Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
basic-uniapp-v3
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
1
合并请求
1
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Basic
basic-uniapp-v3
Commits
d51d5b1a
提交
d51d5b1a
authored
11月 28, 2025
作者:
方治民
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: 调整农场详情地图页面细节
上级
8b78dc8e
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
84 行增加
和
33 行删除
+84
-33
ToolBox.vue
src/components/Map/Widgets/ToolBox/src/ToolBox.vue
+3
-1
types.ts
src/components/Map/Widgets/ToolBox/src/types.ts
+5
-2
pages.json
src/pages.json
+2
-2
index.vue
src/pages/nongchang/detail/index.vue
+74
-28
rain.active.png
src/static/images/codefun/rain.active.png
+0
-0
rain.png
src/static/images/codefun/rain.png
+0
-0
没有找到文件。
src/components/Map/Widgets/ToolBox/src/ToolBox.vue
浏览文件 @
d51d5b1a
...
...
@@ -83,7 +83,9 @@
}
if
(
button
.
type
===
'button'
)
{
button
.
handle
?.({
type
:
'click'
,
name
:
button
.
name
})
button
.
handle
?.({
type
:
'click'
,
name
:
button
.
name
,
button
})
}
else
if
(
button
.
type
===
'toggle'
)
{
button
.
handle
?.({
type
:
'toggle'
,
name
:
button
.
name
,
button
})
}
else
if
(
button
.
type
===
'select'
)
{
// 打开 Select 组件
model
.
selectPopup
.
title
=
button
.
name
...
...
src/components/Map/Widgets/ToolBox/src/types.ts
浏览文件 @
d51d5b1a
...
...
@@ -2,16 +2,19 @@ import type { BasicWidgetInstance, BasicWidgetProps } from '../../utils'
export
interface
ToolBoxButtonHandleEvent
{
// 事件类型
type
:
'click'
|
'change'
type
:
'click'
|
'change'
|
'toggle'
// 事件名称
name
:
string
// 事件值
value
?:
string
|
string
[]
|
{
text
:
string
;
value
:
string
}
|
{
text
:
string
;
value
:
string
}[]
// 按钮本身
button
?:
ToolBoxButton
}
export
interface
ToolBoxButton
{
// 按钮类型
type
:
'select'
|
'button'
|
'filter'
type
:
'select'
|
'button'
|
'filter'
|
'toggle'
// 按钮名称
name
:
string
// 按钮图标
...
...
src/pages.json
浏览文件 @
d51d5b1a
...
...
@@ -351,7 +351,7 @@
"titleNView"
:
{
"buttons"
:
[
{
"text"
:
"
\u
e
674 地图模式"
,
"text"
:
"
\u
E
674 地图模式"
,
"fontSrc"
:
"/static/fonts/tihuan.ttf"
,
"color"
:
"#fff"
,
"fontSize"
:
"26rpx"
,
...
...
@@ -567,7 +567,7 @@
{
"path"
:
"pages/nongchang/detail/index"
,
"style"
:
{
"navigationBarTitleText"
:
""
,
"navigationBarTitleText"
:
"
农场
"
,
"enablePullDownRefresh"
:
false
,
"navigationBarBackgroundColor"
:
"#5DB66F"
,
"navigationBarTextStyle"
:
"white"
,
...
...
src/pages/nongchang/detail/index.vue
浏览文件 @
d51d5b1a
...
...
@@ -10,7 +10,9 @@
addDefaultSymbolLayer
,
useMapbox
,
}
from
'@/components/Map/Mapbox/hook'
import
type
{
ToolBoxButtonHandleEvent
}
from
'@/components/Map/Widgets/ToolBox'
import
{
ToolBoxWidget
,
useToolBoxWidget
}
from
'@/components/Map/Widgets/ToolBox'
import
*
as
NongchangAPI
from
'@/api/model/nongchang'
// 页面参数
const
page
=
reactive
<
Page
>
({
...
...
@@ -31,30 +33,58 @@
plots
:
[],
// 设备信息
devices
:
[],
})
onLoad
((
options
)
=>
{
console
.
log
(
'页面参数'
,
options
)
model
.
id
=
options
.
id
model
.
name
=
decodeURIComponent
(
options
.
name
)
uni
.
setNavigationBarTitle
({
title
:
decodeURIComponent
(
options
.
name
),
})
// 天气信息
weather
:
{
live
:
{
tem
:
'12°'
,
phenomena
:
''
,
wind
:
''
,
humidity
:
''
,
},
forecast
:
[
{
phenomena
:
''
,
date
:
''
,
maxTem
:
''
,
minTem
:
''
,
},
],
},
})
// 地图组件
const
center
:
[
number
,
number
]
=
[
111.024108
,
29.554847
]
const
[
registerMap
,
map
]
=
useMapbox
({
style
:
{
center
,
zoom
:
15
},
onLoaded
:
(
data
)
=>
{
style
:
{
zoom
:
15
},
onLoaded
:
async
(
data
)
=>
{
console
.
log
(
'✨✨✨ Map Loaded'
,
data
)
// 模拟数据
model
.
lonlat
=
'111.024108, 29.554847'
model
.
address
=
'湖南省 张家界市 慈利县 三淹桥村 村委会'
model
.
description
=
'详情信息说明'
// 查询农场数据
const
res
=
await
NongchangAPI
.
farmsList
()
console
.
log
(
'农场列表'
,
res
.
records
)
// 获取第一个农场信息
const
item
=
res
.
records
?.[
0
]
model
.
id
=
item
.
id
model
.
name
=
item
.
farmName
model
.
description
=
item
.
description
if
(
item
.
longitude
&&
item
.
latitude
)
{
model
.
lonlat
=
`
${
item
.
longitude
}
,
${
item
.
latitude
}
`
}
else
{
// 模拟位置数据
model
.
lonlat
=
'111.024108, 29.554847'
Message
.
toast
(
'未设置农场坐标位置,已使用模拟位置数据'
)
}
// 设置页面标题
uni
.
setNavigationBarTitle
({
title
:
item
.
farmName
,
})
// 设置地图中心点
map
.
flyTo
({
center
:
model
.
lonlat
.
split
(
','
).
map
(
Number
)
as
[
number
,
number
],
duration
:
0
,
})
// 渲染地块数据
model
.
plots
=
[
...
...
@@ -148,8 +178,8 @@
popup
:
`{{name}}`
,
}),
]
addDefaultGeoJSONSource
(
map
,
`
${
page
.
id
}
-
text
`
,
model
.
devices
)
addDefaultSymbolLayer
(
map
,
`
${
page
.
id
}
-
text
`
,
{
addDefaultGeoJSONSource
(
map
,
`
${
page
.
id
}
-
symbol
`
,
model
.
devices
)
addDefaultSymbolLayer
(
map
,
`
${
page
.
id
}
-
symbol
`
,
{
layout
:
{
'text-field'
:
''
,
'icon-image'
:
[
'get'
,
'icon'
],
...
...
@@ -183,9 +213,19 @@
name
:
'设备'
,
color
:
'#75c849'
,
icon
:
'/static/images/codefun/device.active.png'
,
type
:
'button'
,
handle
:
()
=>
{
Message
.
alert
(
'【设备】功能正在努力开发中...'
,
''
)
type
:
'toggle'
,
handle
:
(
e
:
ToolBoxButtonHandleEvent
)
=>
{
// 切换显示设备数据地图渲染
const
active
=
e
.
button
.
icon
===
'/static/images/codefun/device.active.png'
if
(
active
)
{
e
.
button
.
color
=
'#666666'
e
.
button
.
icon
=
'/static/images/codefun/device.png'
map
.
setLayoutProperty
(
`
${
page
.
id
}
-symbol`
,
'visibility'
,
'none'
)
}
else
{
e
.
button
.
color
=
'#75c849'
e
.
button
.
icon
=
'/static/images/codefun/device.active.png'
map
.
setLayoutProperty
(
`
${
page
.
id
}
-symbol`
,
'visibility'
,
'visible'
)
}
},
},
],
...
...
@@ -196,11 +236,10 @@
buttons
:
[
{
name
:
'降雨'
,
color
:
'#75c849'
,
icon
:
'/static/images/codefun/rain.png'
,
type
:
'button'
,
handle
:
()
=>
{
Message
.
alert
(
'【降雨】功能正在努力开发中...'
,
'
'
)
Message
.
toast
(
'暂无降雨数据
'
)
},
},
{
...
...
@@ -208,7 +247,7 @@
icon
:
'/static/images/codefun/temp.png'
,
type
:
'button'
,
handle
:
()
=>
{
Message
.
alert
(
'【温度】功能正在努力开发中...'
,
'
'
)
Message
.
toast
(
'暂无温度数据
'
)
},
},
{
...
...
@@ -216,7 +255,7 @@
icon
:
'/static/images/codefun/severe.png'
,
type
:
'button'
,
handle
:
()
=>
{
Message
.
alert
(
'【强对流】功能正在努力开发中...'
,
'
'
)
Message
.
toast
(
'暂无强对流数据
'
)
},
},
{
...
...
@@ -224,7 +263,7 @@
icon
:
'/static/images/codefun/wind.png'
,
type
:
'button'
,
handle
:
()
=>
{
Message
.
alert
(
'【大风】功能正在努力开发中...'
,
'
'
)
Message
.
toast
(
'暂无大风数据
'
)
},
},
{
...
...
@@ -232,7 +271,7 @@
icon
:
'/static/images/codefun/other.png'
,
type
:
'button'
,
handle
:
()
=>
{
Message
.
alert
(
'
【其他】功能正在努力开发中...'
,
'
'
)
Message
.
alert
(
'
敬请期待~'
,
'温馨提醒
'
)
},
},
],
...
...
@@ -265,6 +304,13 @@
<view
class=
"play-wrap hidden"
>
<PlayWidget
/>
</view>
<!-- 天气信息 -->
<view
class=
"weather-info"
>
<view>
<view
/>
</view>
</view>
</view>
</view>
</
template
>
...
...
src/static/images/codefun/rain.active.png
0 → 100644
浏览文件 @
d51d5b1a
1.9 KB
src/static/images/codefun/rain.png
查看替换文件 @
8b78dc8e
浏览文件 @
d51d5b1a
1.9 KB
|
W:
|
H:
1.3 KB
|
W:
|
H:
2-up
Swipe
Onion skin
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论