Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
basic-uniapp-v3
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
1
合并请求
1
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Basic
basic-uniapp-v3
Commits
50ba3d74
提交
50ba3d74
authored
11月 10, 2025
作者:
方治民
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dev' of
https://gitlab.yiring.com/digital-agri/agri-app
上级
baeb2a89
78020c8b
显示空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
177 行增加
和
70 行删除
+177
-70
home.ts
src/api/model/home.ts
+12
-0
nongjifuwu.ts
src/api/model/nongjifuwu.ts
+12
-0
pages.json
src/pages.json
+10
-0
nongchang.vue
src/pages/nongchang/nongchang.vue
+3
-0
nongjifuwu.vue
src/pages/nongjifuwu/nongjifuwu.vue
+43
-4
nongmaojiaoyi.vue
src/pages/nongmaojiaoyi/nongmaojiaoyi.vue
+3
-1
shouye.vue
src/pages/shouye/shouye.vue
+67
-65
webview.vue
src/pages/webview/webview.vue
+27
-0
没有找到文件。
src/api/model/home.ts
浏览文件 @
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
,
})
}
src/api/model/nongjifuwu.ts
浏览文件 @
50ba3d74
...
...
@@ -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
src/pages.json
浏览文件 @
50ba3d74
...
...
@@ -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"
...
...
src/pages/nongchang/nongchang.vue
浏览文件 @
50ba3d74
...
...
@@ -347,6 +347,9 @@
function
onClickTool
(
tool
:
any
)
{
console
.
log
(
'点击常用工具:'
,
tool
)
// 在这里添加具体的常用工具点击逻辑
uni
.
navigateTo
({
url
:
`/pages/webview/webview?url=
${
encodeURIComponent
(
tool
.
addr
)}
`
,
})
}
// 轮播视频切换的时候触发
...
...
src/pages/nongjifuwu/nongjifuwu.vue
浏览文件 @
50ba3d74
<
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%"
>
...
...
src/pages/nongmaojiaoyi/nongmaojiaoyi.vue
浏览文件 @
50ba3d74
...
...
@@ -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
2
rpx
#eeeeee
;
.section_3
{
padding
:
12
rpx
0
116
rpx
;
background-image
:
url('/static/images/codefun/00db5a56fec86b1852516ae34b6d443a.png')
;
background-size
:
100%
100%
;
background-repeat
:
no-repeat
;
width
:
160
rpx
;
...
...
src/pages/shouye/shouye.vue
浏览文件 @
50ba3d74
...
...
@@ -129,7 +129,6 @@
// 查询金刚区数据
getServiceItems
()
getMenuItems
()
// 查询天气信息
getWarningInfo
()
// 查询热门产地行情
...
...
@@ -138,6 +137,8 @@
getServiceStatsList
()
// 农技课堂
getAgricultureClassList
()
// 预警信息
getWarning
()
})
// 下拉刷新
...
...
@@ -184,15 +185,6 @@
}
})
})
WeatherAPI
.
alarm
(
`
${
pageData
.
weather
.
lat
}
,
${
pageData
.
weather
.
lon
}
`
).
then
((
res
)
=>
{
console
.
log
(
'WeatherAPI.alarm'
,
res
)
// pageData.weather.warning = res.data.alerts?.[0]?.description || ''
// TODO: 测试数据
pageData
.
weather
.
warning
=
'雨花区气象台24日11时19分继续发布大风蓝色预警信号:预计未来24小时内临桂将出现6级(或阵风7级)以上大风,请做好防范。'
})
}
// 页面数据
...
...
@@ -228,14 +220,7 @@
serviceItems
:
[],
// 新闻资讯
newsItems
:
[
{
id
:
1
,
type
:
'最新预警'
,
title
:
'积极防范持续高温对农作物的影响'
,
date
:
dayjs
().
format
(
'YYYY-MM-DD'
),
},
],
newsItems
:
[],
// 农产品行情
productMarket
:
{
...
...
@@ -307,7 +292,7 @@
function
getServiceItems
()
{
HomeAPI
.
zoneList
({
pageNo
:
1
,
pageSize
:
4
,
pageSize
:
8
,
status
:
1
,
type
:
1
,
}).
then
((
res
)
=>
{
...
...
@@ -316,18 +301,6 @@
pageData
.
serviceItems
=
records
})
}
function
getMenuItems
()
{
HomeAPI
.
zoneList
({
pageNo
:
1
,
pageSize
:
4
,
status
:
1
,
type
:
2
,
}).
then
((
res
)
=>
{
const
{
records
}
=
res
pageData
.
menuItems
=
[]
pageData
.
menuItems
=
records
})
}
function
getWarningInfo
()
{
if
(
!
pageData
.
weather
.
lon
||
!
pageData
.
weather
.
lat
)
{
return
...
...
@@ -377,6 +350,13 @@
})
}
function
getWarning
()
{
HomeAPI
.
warning
().
then
((
res
)
=>
{
const
{
records
}
=
res
pageData
.
newsItems
=
records
})
}
// 菜单点击事件
function
onMenuItemClick
(
item
:
any
)
{
console
.
log
(
'点击菜单项:'
,
item
)
...
...
@@ -384,13 +364,13 @@
}
// 农产品关注点击事件
function
_
onProductFollowClick
(
product
:
any
)
{
function
onProductFollowClick
(
product
:
any
)
{
console
.
log
(
'点击关注农产品:'
,
product
)
// 在这里添加具体的关注逻辑
}
// 查看更多农技课堂
function
_
onViewMoreClass
()
{
function
onViewMoreClass
()
{
console
.
log
(
'查看全部农技课堂'
)
// 在这里添加具体的查看逻辑
}
...
...
@@ -495,7 +475,7 @@
<view
class=
"codefun-flex-col codefun-relative group_3"
>
<view
class=
"codefun-flex-col"
>
<view
class=
"codefun-flex-col codefun-self-stretch group_4"
>
<view
class=
"codefun-flex-col section_3"
:class=
"
{ '!pb-6': !pageData.weather.warning }"
>
<view
class=
"codefun-flex-col section_3"
>
<view
class=
"codefun-flex-row codefun-justify-between"
style=
"align-items: center"
>
<view
class=
"codefun-flex-row codefun-items-center codefun-relative codefun-overflow-hidden"
...
...
@@ -511,7 +491,7 @@
style=
"width: 400rpx"
>
<up-notice-bar
v-if=
"pageData.weather.detailedLocation !=
=
'获取中'"
v-if=
"pageData.weather.detailedLocation != '获取中'"
icon=
""
bgColor=
"#FFFFFF00"
color=
"#5db66f"
...
...
@@ -617,13 +597,13 @@
>
<text
class=
"text_12"
>
{{
pageData
.
weather
.
warning
}}
</text>
</view>
</view>
</view>
-->
</view>
<view
class=
"codefun-flex-col codefun-relative section_5"
>
<view
class=
"codefun-flex-row"
>
<view
class=
"codefun-flex-row section_5"
>
<view
v-show=
"item.status"
v-for=
"item in pageData.menu
Items"
v-for=
"item in pageData.service
Items"
:key=
"item.id"
class=
"codefun-flex-col codefun-items-center group_10"
@
click=
"onMenuItemClick(item)"
...
...
@@ -632,36 +612,46 @@
<text
class=
"font_2 mt-11"
>
{{
item
.
name
}}
</text>
</view>
</view>
<view
class=
"codefun-flex-row codefun-mt-20"
>
<view
v-show=
"item.status"
v-for=
"item in pageData.serviceItems"
<swiper
:autoplay=
"true"
:interval=
"5000"
:duration=
"500"
:circular=
"true"
:vertical=
"true"
:indicator-dots=
"false"
class=
"codefun-flex-row codefun-justify-between codefun-items-center section_6 warn-scroll"
>
<swiper-item
id=
"scroll-view-content"
v-for=
"item of pageData.newsItems"
:key=
"item.id"
class=
"codefun-flex-col codefun-items-center group_10"
@
click=
"onMenuItemClick(item)"
class=
"codefun-flex-col"
>
<image
class=
"image_11"
:src=
"item.icon_url"
/>
<text
class=
"font_2 mt-11"
>
{{
item
.
name
}}
</text>
</view>
</view>
</view>
<view
class=
"codefun-flex-row codefun-justify-between codefun-items-center section_6"
>
<view
class=
"codefun-flex-col"
>
<view
class=
"codefun-flex-row codefun-items-baseline"
style=
"align-items: center"
>
<view
class=
"font_5 text_17"
>
{{
pageData
.
newsItems
[
0
].
type
}}
</view>
<view
class=
"font_5 text_17"
>
最新预警
</view>
<view
class=
"codefun-flex-row"
style=
"flex-flow: column; justify-content: space-around; height: 90rpx"
style=
"
flex-flow: column;
justify-content: space-around;
height: 90rpx;
width: calc(100% - 110rpx);
"
>
<view
class=
"font_2 text_18 ml-11"
>
{{
pageData
.
newsItems
[
0
].
title
}}
</view>
<text
class=
"text-26 text_20 text_21 ml-11"
>
{{
pageData
.
newsItems
[
0
].
date
}}
</text>
</view
>
</view
>
<view
class=
"font_2 text_18 ml-11"
style=
"white-space: nowrap; overflow: hidden; text-overflow: ellipsis"
>
{{
item
.
title
}}
</view
>
<text
class=
"text-26 text_20 text_21 ml-11"
>
{{
item
.
warningDate
}}
</text
>
</view>
<image
class=
"image_13"
src=
"/static/images/codefun/64d85a99ca3de5fab9ce0e8dc71aa791.png"
/>
<image
class=
"warn-image"
src=
"/static/images/codefun/64d85a99ca3de5fab9ce0e8dc71aa791.png"
/>
</view>
</swiper-item>
</swiper>
</view>
<view
class=
"codefun-self-end section_7"
/>
</view>
...
...
@@ -711,7 +701,7 @@
text_26: !product.isUp,
}"
>
{{
`${product.
isUp ? '' : '-'
}
${product.
percent
}
%`
}}
{{
`${product.percent
}
%`
}}
<
/text
>
<
/view
>
<!--
<
view
...
...
@@ -939,7 +929,7 @@
.
section_3
{
width
:
694
rpx
;
// margin-right: 28rpx;
padding
:
28
rpx
;
padding
:
2
0
rpx
28
rpx
5
8
rpx
;
background
-
image
:
linear
-
gradient
(
180
deg
,
#
dcfce7
0
%
,
#
f8fef9
100
%
);
border
-
radius
:
16
rpx
;
mix
-
blend
-
mode
:
NOTTHROUGH
;
...
...
@@ -1116,12 +1106,12 @@
}
.
section_5
{
flex
-
wrap
:
wrap
;
margin
-
right
:
28
rpx
;
margin
-
top
:
-
34
rpx
;
padding
:
30
rpx
0
40.76
rpx
;
padding
:
30
rpx
0
30
rpx
;
background
-
color
:
#
ffffff
;
border
-
radius
:
16
rpx
;
mix
-
blend
-
mode
:
NOTTHROUGH
;
.
image_11
{
border
-
radius
:
88
rpx
;
...
...
@@ -1130,6 +1120,7 @@
}
.
group_10
{
margin
-
bottom
:
15
rpx
;
flex
:
1
1
173.5
rpx
;
.
text_50
{
...
...
@@ -1235,11 +1226,22 @@
line
-
height
:
17.18
rpx
;
}
}
.
warn
-
scroll
{
width
:
655
rpx
;
height
:
90
rpx
;
.
warn
-
image
{
border
-
radius
:
16
rpx
;
mix
-
blend
-
mode
:
NOTTHROUGH
;
width
:
32
rpx
;
height
:
32
rpx
;
}
}
.
image_13
{
border
-
radius
:
16
rpx
;
mix
-
blend
-
mode
:
NOTTHROUGH
;
width
:
32
rpx
;
height
:
40
rpx
;
height
:
32
rpx
;
}
.
codefun
-
mr
-
4
{
margin
-
right
:
10
rpx
;
...
...
src/pages/webview/webview.vue
0 → 100644
浏览文件 @
50ba3d74
<
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
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论