提交 9fd89fae 作者: guolinhua

feat:更新

上级 c7c8d68a
// 上传请求
import { otherHttp } from '/@/utils/http/axios'
enum Api {
farmMachineList = '/farmMachine/machineWork/app/list', // 农机服务列表列表
farmMachineDetails = '/farmMachine/machineWork/queryById', // 农机服务详情
farmMachineAdd = '/farmMachine/machineWork/app/register', // 发布农机服务
farmMachineEdit = '/farmMachine/machineWork/edit', // 编辑农机服务
}
/**
* @param params 请求参数
* @description: 农机服务列表列表
*/
export function farmMachineList(params = {}) {
return otherHttp.get({
url: Api.farmMachineList,
params,
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
})
}
/**
* @param params 请求参数
* @description: 农机服务详情
*/
export function farmMachineDetails(params = {}) {
return otherHttp.get({
url: Api.farmMachineDetails,
params,
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
})
}
/**
* @param params 请求参数
* @description: 发布农机服务
*/
export function farmMachineAdd(params = {}) {
return otherHttp.post({
url: Api.farmMachineAdd,
params,
})
}
/**
* @param params 请求参数
* @description: 编辑农机服务
*/
export function farmMachineEdit(params = {}) {
return otherHttp.post({
url: Api.farmMachineEdit,
params,
})
}
...@@ -161,6 +161,7 @@ ...@@ -161,6 +161,7 @@
"navigationBarBackgroundColor": "#5DB66F", "navigationBarBackgroundColor": "#5DB66F",
"navigationBarTextStyle": "white", "navigationBarTextStyle": "white",
"backgroundColorBottom": "#F2F2F2", "backgroundColorBottom": "#F2F2F2",
"onReachBottomDistance": 50,
"app-plus": { "app-plus": {
"titleNView": {} "titleNView": {}
} }
......
<script setup lang="ts"> <script setup lang="ts">
import { reactive } from 'vue' import { reactive } from 'vue'
import { onPullDownRefresh, onLoad, onShow, onReachBottom } from '@dcloudio/uni-app'
import * as NongjifuwuAPI from '@/api/model/nongjifuwu'
import Navigate from '@/utils/page/navigate'
onLoad((option) => {
pageData.search.serviceType = Number(option.type) || 1
})
onShow(() => {
pageData.search.pageNo = 1
pageData.farmMachineList = []
getFarmMachineList()
})
const pageData = reactive({ const pageData = reactive({
// 分类标签 // 分类标签
...@@ -7,15 +20,39 @@ ...@@ -7,15 +20,39 @@
{ id: 1, name: '找农机' }, { id: 1, name: '找农机' },
{ id: 2, name: '干农活' }, { id: 2, name: '干农活' },
], ],
currentCategoryId: 1, search: {
pageNo: 1,
pageSize: 10,
serviceType: 1,
},
farmMachineList: [],
total: 0,
}) })
function getFarmMachineList() {
NongjifuwuAPI.farmMachineList(pageData.search).then((res) => {
const { records, total } = res
pageData.farmMachineList = [...pageData.farmMachineList, ...records]
pageData.total = total
})
}
// 分类标签点击事件 // 分类标签点击事件
function onCategoryTabClick(tab: any) { function onCategoryTabClick(tab: any) {
console.log('点击分类标签:', tab) console.log('点击分类标签:', tab)
pageData.currentCategoryId = tab.id pageData.search.serviceType = tab.id
// 在这里添加具体的分类标签点击逻辑 // 在这里添加具体的分类标签点击逻辑
pageData.search.pageNo = 1
pageData.farmMachineList = []
getFarmMachineList()
} }
onReachBottom(() => {
console.log('触底了')
if (pageData.total <= pageData.farmMachineList.length) return
pageData.search.pageNo++
getFarmMachineList()
})
</script> </script>
<template> <template>
...@@ -36,36 +73,40 @@ ...@@ -36,36 +73,40 @@
v-for="item in pageData.categoryTabs" v-for="item in pageData.categoryTabs"
:key="item.id" :key="item.id"
class="codefun-flex-col codefun-justify-start codefun-items-center text-50p" class="codefun-flex-col codefun-justify-start codefun-items-center text-50p"
:class="item.id === pageData.currentCategoryId ? 'text-wrapper' : ''" :class="item.id === pageData.search.serviceType ? 'text-wrapper' : ''"
@click="onCategoryTabClick(item)" @click="onCategoryTabClick(item)"
> >
<text class="font_2" :class="item.id === pageData.currentCategoryId ? 'text_4' : 'text_5'">{{ <text class="font_2" :class="item.id === pageData.search.serviceType ? 'text_4' : 'text_5'">{{
item.name item.name
}}</text> }}</text>
</view> </view>
</view> </view>
<view class="codefun-flex-col codefun-relative section_4"> <view class="codefun-flex-col codefun-relative section_4">
<view class="codefun-flex-row group_6"> <view class="codefun-flex-row group_6" v-for="item in pageData.farmMachineList" :key="item.id">
<image <image class="codefun-shrink-0 codefun-self-center image_8" :src="item.picture" />
class="codefun-shrink-0 codefun-self-center image_8" <view style="width: 75%">
src="https://ide.code.fun/api/image?token=6902c43a9520a30011f4e723&name=1f4e4111336d0f182201176d8c761a37.png" <view class="codefun-flex-col codefun-items-start codefun-flex-1 codefun-self-center">
/> <text class="font text_6">{{ item.name }}</text>
<view class="codefun-flex-col codefun-items-start codefun-flex-1 codefun-self-center group_4"> <text class="font_3 text_7 ellipsis" style="width: 100%; margin: 26rpx 0"
<text class="font text_6">大联合收割机</text> >服务范围:{{ item.scope }}{{ item.scope }}{{ item.scope }}{{ item.scope
<text class="font_3 text_7">服务范围:市区及周边20公里</text> }}{{ item.scope }}</text
<view class="group_5"> >
<text class="font_6">¥</text> </view>
<text class="font_4 text_8">60</text> <view class="flex justify-between" style="width: 100%">
<text class="font_7">/亩</text> <view class="group_5">
<text class="font_6">¥</text>
<text class="font_4 text_8">{{ item.price }}</text>
<text class="font_7">/亩</text>
</view>
<view
class="codefun-flex-col codefun-justify-start codefun-items-center codefun-shrink-0 codefun-self-start text-wrapper_2"
>
<text class="font_5">我有需要</text>
</view>
</view> </view>
</view>
<view
class="codefun-flex-col codefun-justify-start codefun-items-center codefun-shrink-0 codefun-self-start text-wrapper_2 view"
>
<text class="font_5">我有需要</text>
</view> </view>
</view> </view>
<view class="codefun-flex-row group_6"> <!-- <view class="codefun-flex-row group_6">
<view class="codefun-flex-row codefun-items-center codefun-flex-1 codefun-self-center"> <view class="codefun-flex-row codefun-items-center codefun-flex-1 codefun-self-center">
<image <image
class="codefun-shrink-0 image_8" class="codefun-shrink-0 image_8"
...@@ -108,15 +149,15 @@ ...@@ -108,15 +149,15 @@
> >
<text class="font_5">我有需要</text> <text class="font_5">我有需要</text>
</view> </view>
</view> </view> -->
<view class="codefun-flex-col codefun-justify-start codefun-relative section_5"> <!-- <view class="codefun-flex-col codefun-justify-start codefun-relative section_5">
<view class="codefun-shrink-0 section_6" /> <view class="codefun-shrink-0 section_6" />
<text class="font_8 text_15 pos_4">夏收专享:收割机服务8折优惠</text> <text class="font_8 text_15 pos_4">夏收专享:收割机服务8折优惠</text>
<view class="codefun-flex-col codefun-justify-start codefun-items-center text-wrapper_3 pos_3"> <view class="codefun-flex-col codefun-justify-start codefun-items-center text-wrapper_3 pos_3">
<text class="font_2 text_16">立即预约</text> <text class="font_2 text_16">立即预约</text>
</view> </view>
</view> </view> -->
<view class="codefun-flex-row group_10"> <!-- <view class="codefun-flex-row group_10">
<view class="codefun-flex-row codefun-items-center codefun-flex-1 codefun-self-center"> <view class="codefun-flex-row codefun-items-center codefun-flex-1 codefun-self-center">
<image <image
class="codefun-shrink-0 image_8" class="codefun-shrink-0 image_8"
...@@ -137,9 +178,9 @@ ...@@ -137,9 +178,9 @@
> >
<text class="font_5">我有需要</text> <text class="font_5">我有需要</text>
</view> </view>
</view> </view> -->
</view> </view>
<view class="codefun-flex-col section_7"> <!-- <view class="codefun-flex-col section_7">
<view class="grid"> <view class="grid">
<view class="codefun-flex-row codefun-justify-between codefun-items-center grid-item"> <view class="codefun-flex-row codefun-justify-between codefun-items-center grid-item">
<text class="font_3 text_19">农机类型</text> <text class="font_3 text_19">农机类型</text>
...@@ -196,7 +237,7 @@ ...@@ -196,7 +237,7 @@
<text class="font_8 text_24">发布需求</text> <text class="font_8 text_24">发布需求</text>
</view> </view>
</view> </view>
</view> </view> -->
</view> </view>
</view> </view>
</template> </template>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论