chore:VR有返回箭头了
This commit is contained in:
@@ -156,7 +156,7 @@ const localDevConfig = ({
|
||||
// })['2485']; // 验证电子表单前后端数据一致性
|
||||
// })['5g-11']; // 数码
|
||||
// })['5g-213']; // 选择要使用的环境配置
|
||||
})['5g-165']; // 鸡肉调理品, 优惠卷显示不全,及逻辑错误
|
||||
})['2811']; // 鸡肉调理品, 优惠卷显示不全,及逻辑错误
|
||||
// })['2811']; // 选择要使用的环境配置
|
||||
// })['local-11']; // 选择要使用的环境配置
|
||||
// })['local-1']; // 本地
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1097,7 +1097,7 @@
|
||||
{
|
||||
"path": "vr/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": ""
|
||||
"navigationBarTitleText": "工厂展示"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
<template>
|
||||
<view :style="themeColor">
|
||||
<web-view :src="src"></web-view>
|
||||
<!-- 顶部导航覆盖层:使用 cover-view 兼容微信小程序的 web-view 原生组件 -->
|
||||
<cover-view class="vr-nav-back icondiy icon-system-arrow-go-back-line" @click="navigateBack"></cover-view>
|
||||
<cover-view class="vr-nav-home icondiy icon-system-home-2-line" @click="goHome"></cover-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -15,68 +12,19 @@ export default {
|
||||
};
|
||||
},
|
||||
onLoad(option) {
|
||||
// this.src = decodeURIComponent(option.src);
|
||||
this.$api.sendRequest({
|
||||
url: '/api/config/defaultvr',
|
||||
success: res => {
|
||||
if (res.code == 0) {
|
||||
uni.setNavigationBarTitle({
|
||||
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
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.vr-nav-back,
|
||||
.vr-nav-home {
|
||||
position: absolute;
|
||||
top: 34rpx;
|
||||
z-index: 5;
|
||||
width: 72rpx;
|
||||
height: 72rpx;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
color: #fff;
|
||||
border-radius: 50%;
|
||||
text-align: center;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.vr-nav-back {
|
||||
left: 34rpx;
|
||||
line-height: 60rpx;
|
||||
}
|
||||
|
||||
.vr-nav-home {
|
||||
right: 34rpx;
|
||||
font-size: 40rpx;
|
||||
line-height: 72rpx;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user