提交 8754aa1b 作者: 方治民

feat: 首页金刚区支持路由跳转

上级 187fc292
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
import * as HomeAPI from '@/api/model/home' import * as HomeAPI from '@/api/model/home'
import * as UserAPI from '@/api/model/userInfo' import * as UserAPI from '@/api/model/userInfo'
import { useDictStore } from '@/store/modules/dict' import { useDictStore } from '@/store/modules/dict'
import Navigate from '@/utils/page/navigate'
const dictStore = useDictStore() const dictStore = useDictStore()
const model = reactive({ const model = reactive({
...@@ -362,7 +363,30 @@ ...@@ -362,7 +363,30 @@
console.log('点击菜单项:', item) console.log('点击菜单项:', item)
// 在这里添加具体的菜单点击逻辑 // 在这里添加具体的菜单点击逻辑
Message.toast(item.name) if (item.jump_target?.startsWith('/')) {
const tabbarKeyWords = [
'/pages/shouye/shouye',
'/pages/nongchang/nongchang',
'/pages/fuwu/fuwu',
'/pages/chanxiao/chanxiao',
]
if (tabbarKeyWords.includes(item.jump_target)) {
uni.switchTab({
url: item.jump_target,
})
} else {
Navigate.to(item.jump_target).catch(() => {
Message.alert(`${item.jump_target} 页面打开失败`, item.name)
})
}
} else if (item.jump_target?.startsWith('http')) {
Navigate.webview(item.jump_target, item.name)
} else {
uni.showModal({
title: item.name,
content: '功能开发中...',
})
}
} }
// 农产品关注点击事件 // 农产品关注点击事件
...@@ -450,6 +474,17 @@ ...@@ -450,6 +474,17 @@
videoContext.play() videoContext.play()
} }
function onClickWarning(item) {
console.log('点击预警信息:', item)
// 在这里添加具体的点击逻辑
uni.showModal({
title: '预警信息',
content: item.title,
showCancel: false,
})
}
onHide(() => { onHide(() => {
// 停止所有其他视频的播放(只暂停,不重置位置) // 停止所有其他视频的播放(只暂停,不重置位置)
pageData.agricultureClass.videoList.forEach((_, index) => { pageData.agricultureClass.videoList.forEach((_, index) => {
...@@ -628,6 +663,7 @@ ...@@ -628,6 +663,7 @@
v-for="item of pageData.newsItems" v-for="item of pageData.newsItems"
:key="item.id" :key="item.id"
class="codefun-flex-col" class="codefun-flex-col"
@click="onClickWarning(item)"
> >
<view class="codefun-flex-row codefun-items-baseline" style="align-items: center"> <view class="codefun-flex-row codefun-items-baseline" style="align-items: center">
<view class="font_5 text_17">最新预警</view> <view class="font_5 text_17">最新预警</view>
...@@ -1387,7 +1423,7 @@ ...@@ -1387,7 +1423,7 @@
} }
.section_8 { .section_8 {
padding: 15.38rpx 0 12rpx; padding: 16rpx 0 16rpx;
background-color: #ffffff; background-color: #ffffff;
border-radius: 16rpx; border-radius: 16rpx;
mix-blend-mode: NOTTHROUGH; mix-blend-mode: NOTTHROUGH;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论