diff --git a/src/components/top-nav.vue b/src/components/top-nav.vue
index 582998c..02b590a 100644
--- a/src/components/top-nav.vue
+++ b/src/components/top-nav.vue
@@ -40,7 +40,7 @@
-
+
@@ -75,8 +75,10 @@ export default {
lastMenuClickAt: 0,
routeSyncTimer: null,
lastRoutePath: '',
- showSwitchMask: false,
+ switchMaskVisible: false,
+ switchMaskActive: false,
switchMaskTimer: null,
+ switchMaskFadeTimer: null,
switchMaskStartedAt: 0,
currentUser: null,
defaultMenus: [
@@ -148,6 +150,10 @@ export default {
clearTimeout(this.switchMaskTimer)
this.switchMaskTimer = null
}
+ if (this.switchMaskFadeTimer) {
+ clearTimeout(this.switchMaskFadeTimer)
+ this.switchMaskFadeTimer = null
+ }
},
methods: {
normalizePath(path) {
@@ -183,22 +189,42 @@ export default {
return currentPage?.route ? `/${currentPage.route}` : ''
},
showNavigationMask() {
- this.showSwitchMask = true
this.switchMaskStartedAt = Date.now()
if (this.switchMaskTimer) {
clearTimeout(this.switchMaskTimer)
this.switchMaskTimer = null
}
+ if (this.switchMaskFadeTimer) {
+ clearTimeout(this.switchMaskFadeTimer)
+ this.switchMaskFadeTimer = null
+ }
+ // 先把遮罩放回 DOM(透明状态),下一帧再激活透明度触发淡入
+ this.switchMaskActive = false
+ this.switchMaskVisible = true
+ this.$nextTick(() => {
+ this.switchMaskActive = true
+ })
},
hideNavigationMask() {
const elapsed = Date.now() - this.switchMaskStartedAt
- const delay = elapsed >= 100 ? 0 : 100 - elapsed
+ // 至少保持可见一段时间,给新页面留出首帧渲染时间,避免刚出现就消失造成闪烁
+ const minVisible = 180
+ const delay = elapsed >= minVisible ? 0 : minVisible - elapsed
if (this.switchMaskTimer) {
clearTimeout(this.switchMaskTimer)
}
this.switchMaskTimer = setTimeout(() => {
- this.showSwitchMask = false
this.switchMaskTimer = null
+ // 触发淡出过渡
+ this.switchMaskActive = false
+ if (this.switchMaskFadeTimer) {
+ clearTimeout(this.switchMaskFadeTimer)
+ }
+ // 淡出动画结束后再移除 DOM,保证过渡完整执行
+ this.switchMaskFadeTimer = setTimeout(() => {
+ this.switchMaskFadeTimer = null
+ this.switchMaskVisible = false
+ }, 200)
}, delay)
},
navigateToMenu(targetPath) {
@@ -322,6 +348,7 @@ export default {
}
this.loadCurrentUserInfo()
+ this.closeMinePopup()
uni.showToast({
title: '角色切换成功',
icon: 'success',
@@ -402,7 +429,7 @@ export default {
}
.top-nav-menu-text {
- font-size: 28rpx;
+ font-size: 32rpx;
color: #fff;
font-weight: 500;
}
@@ -478,7 +505,7 @@ export default {
}
.popup-user-text {
- font-size: 24rpx;
+ font-size: 28rpx;
color: #333;
}
@@ -490,14 +517,14 @@ export default {
margin-top: 16rpx;
height: 60rpx;
line-height: 60rpx;
- font-size: 24rpx;
+ font-size: 28rpx;
}
.close-btn {
margin-top: 10rpx;
height: 60rpx;
line-height: 60rpx;
- font-size: 24rpx;
+ font-size: 28rpx;
background-color: #f5f7fb;
color: #333;
}
@@ -508,8 +535,16 @@ export default {
top: 0;
right: 0;
bottom: 0;
- background-color: rgba(248, 248, 248, 0.96);
+ background-color: #f8f8f8;
z-index: 9999;
pointer-events: none;
+ opacity: 0;
+ visibility: hidden;
+ transition: opacity 0.2s ease, visibility 0.2s ease;
+}
+
+.switch-mask--active {
+ opacity: 1;
+ visibility: visible;
}
diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue
index 58bd67e..6eeba0e 100644
--- a/src/pages/index/index.vue
+++ b/src/pages/index/index.vue
@@ -8,12 +8,9 @@
/>
-
+
+
+
{{ getActiveMenuTitle() || '请选择功能菜单' }}
该菜单页面尚未配置({{ activeMenuPath }})
diff --git a/src/pages/login/login.vue b/src/pages/login/login.vue
index 2f3e10c..8535984 100644
--- a/src/pages/login/login.vue
+++ b/src/pages/login/login.vue
@@ -917,7 +917,7 @@ export default {
return
}
uni.reLaunch({
- url: '/pages/order/index',
+ url: '/pages/index/index',
})
}, 300)
return
@@ -986,7 +986,7 @@ export default {
return
}
uni.reLaunch({
- url: '/pages/order/index',
+ url: '/pages/index/index',
})
}, 300)
return
diff --git a/src/pages/order/index.vue b/src/pages/order/index.vue
index 2b34cd6..a284ce0 100644
--- a/src/pages/order/index.vue
+++ b/src/pages/order/index.vue
@@ -1,6 +1,6 @@
-
+
@@ -215,6 +215,13 @@ export default {
components: {
TopNav,
},
+ props: {
+ // 在布局壳内渲染时为 true,隐藏内嵌顶栏;独立访问时不传,显示顶栏
+ embedded: {
+ type: Boolean,
+ default: false,
+ },
+ },
data() {
return {
pendingCount: 134,
@@ -280,24 +287,18 @@ export default {
this.requestCameraPreview()
this.bindFullscreenEvents()
},
- onReady() {
+ activated() {
+ // keep-alive 从缓存恢复时重新初始化摄像头
this.requestCameraPreview()
},
- onShow() {
- this.requestCameraPreview()
+ deactivated() {
+ // 切走时释放摄像头,避免设备被持续占用
+ this.stopCameraPreview()
},
beforeUnmount() {
this.unbindFullscreenEvents()
this.stopCameraPreview()
},
- beforeDestroy() {
- this.unbindFullscreenEvents()
- this.stopCameraPreview()
- },
- onUnload() {
- this.unbindFullscreenEvents()
- this.stopCameraPreview()
- },
methods: {
requestCameraPreview() {
if (this.cameraInitializing || this.cameraLoading || this.cameraReady) {
@@ -898,8 +899,8 @@ export default {