提交 79398c8f 作者: test

feat: 新增水情模块的 Webview 页面配置测试,并支持 2 级页面

上级 4aed7419
...@@ -5,19 +5,21 @@ ...@@ -5,19 +5,21 @@
}) })
onLoad(({ title, link }) => { onLoad(({ title, link }) => {
page.title = decodeURI(title) page.title = title ? decodeURI(title) : ''
page.link = decodeURIComponent(link) page.link = decodeURIComponent(link)
if (!title || !link) { if (!link) {
Message.toast('页面打开失败,参数错误') Message.toast('页面打开失败,参数错误')
uni.navigateBack() uni.navigateBack()
return return
} }
// 设置标题栏为文件名 // 设置标题栏为文件名
if (page.title && page.title !== 'undefined') {
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: page.title, title: page.title,
}) })
}
// #ifdef APP-PLUS // #ifdef APP-PLUS
const webview = plus.webview.currentWebview() const webview = plus.webview.currentWebview()
...@@ -28,6 +30,6 @@ ...@@ -28,6 +30,6 @@
<template> <template>
<view class="wrap" v-if="page.link"> <view class="wrap" v-if="page.link">
<web-view :src="page.link" :update-title="false" /> <web-view :src="page.link" :update-title="!page.title" />
</view> </view>
</template> </template>
...@@ -47,6 +47,12 @@ export const liveModules: NavItemType[] = [ ...@@ -47,6 +47,12 @@ export const liveModules: NavItemType[] = [
value: 'light-m', value: 'light-m',
type: 'webview', type: 'webview',
navigate: { navigate: {
/**
* 支持链接中配置三个参数
* app: 5 代表从 APP V5 进入,必传
* token: 后端生成的一个长期有效 Token,固定值,必传
* open: true 代表可以从嵌入的页面打开新页面,默认为 false,非必传(注意:打开的子页面也进行了重写适配,一般来说不用担心出现意外情况,但注意进行简单测试)
*/
// url: `https://hntq.zhijietianqi.com/h5/web/monitoringOfLive/new-severe-weather.v3.html?app=5&token=${AppV4Token}`, // url: `https://hntq.zhijietianqi.com/h5/web/monitoringOfLive/new-severe-weather.v3.html?app=5&token=${AppV4Token}`,
url: `http://127.0.0.1:8080/web/monitoringOfLive/new-severe-weather.v3.html?app=5&token=${AppV4Token}`, url: `http://127.0.0.1:8080/web/monitoringOfLive/new-severe-weather.v3.html?app=5&token=${AppV4Token}`,
}, },
...@@ -74,6 +80,11 @@ export const liveModules: NavItemType[] = [ ...@@ -74,6 +80,11 @@ export const liveModules: NavItemType[] = [
{ {
label: '水情监测', label: '水情监测',
value: 'water-m', value: 'water-m',
type: 'webview',
navigate: {
// url: `https://hntq.zhijietianqi.com/h5/web/monitoringOfLive/new-severe-weather.v3.html?app=5&token=${AppV4Token}`,
url: `http://127.0.0.1:8080/web/monitoringOfLive/waterRegimenMap.v3.html?app=5&open=true&token=${AppV4Token}`,
},
}, },
{ {
label: '山洪风险', label: '山洪风险',
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论