提交 50ba3d74 作者: 方治民
......@@ -6,6 +6,7 @@ enum Api {
productMarketList = '/online/cgform/api/getData/5b71e11020d44366b2d130e200c7a640', // 热门产地行情
serviceStatsList = '/online/cgform/api/getData/491863dde351404da63a1a6e8c699c4c', // 服务展示窗
agricultureClassList = '/online/cgform/api/getData/311c300e05694ba69a063d04c8572e9e', // 农技课堂
warning = '/warningInfo/list'
}
/**
......@@ -65,3 +66,14 @@ export function agricultureClassList(params = {}) {
params,
})
}
/**
* @param params 请求参数
* @returns 获取预警数据
*/
export function warning(params = {}) {
return otherHttp.get({
url: Api.warning,
params,
})
}
......@@ -8,6 +8,7 @@ enum Api {
farmMachineAddFarm = '/farmMachine/machineWork/app/addFarm', // 发布农活服务
farmMachineEdit = '/farmMachine/machineWork/edit', // 编辑农机服务
farmMachineRegister = '/farmMachine/machineWork/app/register', // 参与服务
cascaderHn = '/region/cascader/hn',
}
/**
......@@ -80,3 +81,13 @@ export function farmMachineRegister(params = {}) {
params,
})
}
/**
* 查询湖南省 市/区县/乡镇
* @returns 市/区县/乡镇
*/
export function cascaderHn() {
return otherHttp.get({
url: Api.cascaderHn,
})
}
\ No newline at end of file
......@@ -295,6 +295,16 @@
}
},
{
"path": "pages/webview/webview",
"style": {
"navigationBarTitleText": "常用工具",
"enablePullDownRefresh": false,
"navigationBarBackgroundColor": "#5DB66F",
"navigationBarTextStyle": "white",
"backgroundColorBottom": "#F2F2F2"
}
},
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "Basic APP"
......
......@@ -347,6 +347,9 @@
function onClickTool(tool: any) {
console.log('点击常用工具:', tool)
// 在这里添加具体的常用工具点击逻辑
uni.navigateTo({
url: `/pages/webview/webview?url=${encodeURIComponent(tool.addr)}`,
})
}
// 轮播视频切换的时候触发
......
<script setup lang="ts">
import { reactive } from 'vue'
import { reactive, ref } from 'vue'
import { onLoad, onReachBottom, onShow } from '@dcloudio/uni-app'
import ApplyDialog from './components/apply-dialog.vue'
......@@ -14,8 +14,10 @@
pageData.search.pageNo = 1
pageData.farmMachineList = []
getFarmMachineList()
getCascader()
})
const options = ref([])
const pageData = reactive({
loading: false,
// 分类标签
......@@ -45,6 +47,12 @@
})
}
function getCascader() {
NongjifuwuAPI.cascaderHn().then((res) => {
options.value = res[0].children;
})
}
// 分类标签点击事件
function onCategoryTabClick(tab: any) {
console.log('点击分类标签:', tab)
......@@ -78,10 +86,41 @@
applyDialogRef.value.open(item)
}
function getScope(scope: any) {
if (!scope || !options.value || options.value.length === 0) {
return []
}
const values = scope.split(',')
const labels = []
// 递归查找label
const findLabel = (nodes, value) => {
for (const node of nodes) {
if (node.value === value) {
return node.label
}
if (node.children && node.children.length > 0) {
const found = findLabel(node.children, value)
if (found) {
return found
}
}
}
return null // 如果没找到,返回原始value
}
for (const value of values) {
const label = findLabel(options.value, value.trim())
labels.push(label)
}
return labels.join(' / ')
}
onReachBottom(() => {
console.log('触底了')
if (pageData.total <= pageData.farmMachineList.length)
return
if (pageData.total <= pageData.farmMachineList.length) return
pageData.search.pageNo++
getFarmMachineList()
})
......@@ -134,7 +173,7 @@ return
>
<text class="font text_6">{{ item.name }}</text>
<text class="font_3 text_7 ellipsis" style="width: 100%; margin: 26rpx 0"
>服务范围:{{ item.scope }}</text
>服务范围:{{ getScope(item.scope) }}</text
>
</view>
<view class="flex justify-between" style="width: 100%">
......
......@@ -251,6 +251,9 @@ return
>
<view
class="codefun-flex-col codefun-justify-start codefun-items-start codefun-self-center section_3"
:style="{
'background-image': `url(${product.image})`,
}"
>
<view
v-if="product.labels_dictText.split(',').length > 0"
......@@ -418,7 +421,6 @@ return
border-bottom: solid 2rpx #eeeeee;
.section_3 {
padding: 12rpx 0 116rpx;
background-image: url('/static/images/codefun/00db5a56fec86b1852516ae34b6d443a.png');
background-size: 100% 100%;
background-repeat: no-repeat;
width: 160rpx;
......
<template>
<view class="webview-container">
<web-view :src="url"></web-view>
</view>
</template>
<script>
export default {
data() {
return {
url: ''
}
},
onLoad(options) {
if (options.url) {
this.url = decodeURIComponent(options.url)
} else {
uni.showToast({
title: '网址不存在',
icon: 'none'
})
uni.navigateBack()
}
}
}
</script>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论