diff --git a/.local.config.js b/.local.config.js index 4272c7f..f272cd9 100644 --- a/.local.config.js +++ b/.local.config.js @@ -156,7 +156,7 @@ const localDevConfig = ({ // })['2485']; // 验证电子表单前后端数据一致性 // })['5g-11']; // 数码 // })['5g-213']; // 选择要使用的环境配置 -})['5g-165']; // 鸡肉调理品, 优惠卷显示不全,及逻辑错误 +})['2811']; // 鸡肉调理品, 优惠卷显示不全,及逻辑错误 // })['2811']; // 选择要使用的环境配置 // })['local-11']; // 选择要使用的环境配置 // })['local-1']; // 本地 diff --git a/common/js/util.js b/common/js/util.js index d611c56..0aa8c30 100644 --- a/common/js/util.js +++ b/common/js/util.js @@ -636,30 +636,35 @@ export default { const diyTabBar = store.state.tabBarList; if (diyTabBar && diyTabBar.list && Array.isArray(diyTabBar.list)) { const cleanUrl = url.split('?')[0]; - const isDiyTabRoot = diyTabBar.list.some(item => { - if (!item || !item.link || !item.link.wap_url) return false; - const normalizedTab = adaptSubpackageUrl(item.link.wap_url.startsWith('/') ? item.link.wap_url : '/' + item.link.wap_url).split('?')[0]; - const normalizedUrl = adaptSubpackageUrl(cleanUrl.startsWith('/') ? cleanUrl : '/' + cleanUrl).split('?')[0]; - return normalizedTab === normalizedUrl; - }); - if (isDiyTabRoot) { - const adaptedUrl = adaptSubpackageUrl(cleanUrl); - const inSystemTabBar = systemTabBarList.some(sysUrl => adaptedUrl === sysUrl || cleanUrl === sysUrl); - // 首页用switchTab,其他DIY tab根页用reLaunch确保页面栈干净 - let navApi = inSystemTabBar ? (adaptedUrl === INDEX_PAGE_URL ? uni.switchTab : uni.reLaunch) : uni.reLaunch; - - // 鸿蒙元服务环境下 uni.switchTab 有兼容性问题, 全部使用 reLaunch - // #ifdef MP-HARMONY - navApi = uni.reLaunch; - // #endif - - navApi({ - url, - fail: (err) => { - console.error('[navigate] tabBar 跳转失败:', cleanUrl, err); - } + // 检查目标页面是否在排除列表中(如 VR、webview 等特殊页面) + // 如果在排除列表中,不应该被当作 DIY tabBar 根页处理 + const isExcludedPage = NO_TAB_PAGES.has(cleanUrl); + if (!isExcludedPage) { + const isDiyTabRoot = diyTabBar.list.some(item => { + if (!item || !item.link || !item.link.wap_url) return false; + const normalizedTab = adaptSubpackageUrl(item.link.wap_url.startsWith('/') ? item.link.wap_url : '/' + item.link.wap_url).split('?')[0]; + const normalizedUrl = adaptSubpackageUrl(cleanUrl.startsWith('/') ? cleanUrl : '/' + cleanUrl).split('?')[0]; + return normalizedTab === normalizedUrl; }); - return; + if (isDiyTabRoot) { + const adaptedUrl = adaptSubpackageUrl(cleanUrl); + const inSystemTabBar = systemTabBarList.some(sysUrl => adaptedUrl === sysUrl || cleanUrl === sysUrl); + // 首页用switchTab,其他DIY tab根页用reLaunch确保页面栈干净 + let navApi = inSystemTabBar ? (adaptedUrl === INDEX_PAGE_URL ? uni.switchTab : uni.reLaunch) : uni.reLaunch; + + // 鸿蒙元服务环境下 uni.switchTab 有兼容性问题, 全部使用 reLaunch + // #ifdef MP-HARMONY + navApi = uni.reLaunch; + // #endif + + navApi({ + url, + fail: (err) => { + console.error('[navigate] tabBar 跳转失败:', cleanUrl, err); + } + }); + return; + } } } diff --git a/pages.json b/pages.json index 2a33b8f..eb7826a 100644 --- a/pages.json +++ b/pages.json @@ -1097,7 +1097,7 @@ { "path": "vr/index", "style": { - "navigationBarTitleText": "" + "navigationBarTitleText": "工厂展示" } }, { diff --git a/pages_tool/vr/index.vue b/pages_tool/vr/index.vue index 4ba9169..87404cb 100644 --- a/pages_tool/vr/index.vue +++ b/pages_tool/vr/index.vue @@ -1,9 +1,6 @@ @@ -15,68 +12,37 @@ export default { }; }, onLoad(option) { - // this.src = decodeURIComponent(option.src); + // 确保导航栏标题显示 + uni.setNavigationBarTitle({ + title: '工厂展示' + }); + this.$api.sendRequest({ url: '/api/config/defaultvr', success: res => { if (res.code == 0) { uni.setNavigationBarTitle({ - title:res.data.title - }) + title: res.data.title || '工厂展示' + }); this.src = res.data.url } }, fail: res => { } }); - }, - methods: { - navigateBack() { - const pages = getCurrentPages(); - if (pages.length > 1) { - uni.navigateBack({ - delta: 1 - }); - } else { - // 直接进入的场景(分享链接 / 外部链接 / 扫码等),页面栈只有当前页, - // navigateBack 会失败。重定向到首页,保证用户能离开 VR 页面。 - uni.reLaunch({ - url: this.$util.PAGE_KEY_MAP.PAGE_INDEX - }); - } - }, - goHome() { - uni.reLaunch({ - url: this.$util.PAGE_KEY_MAP.PAGE_INDEX - }); - } } };