|
|
@@ -228,12 +228,15 @@ export default {
|
|
|
if (_token) {
|
|
|
_currentRole = uni.getStorageSync('currentRole') || uni.getStorageSync('role') || ''
|
|
|
}
|
|
|
+ // 首次启动标记(由 splash.vue 设置,表示需要展示 splash overlay)
|
|
|
+ var _isFirstLaunch = (uni.getStorageSync('_showSplashOverlay') === '1')
|
|
|
return {
|
|
|
currentRole: _currentRole,
|
|
|
- showTabTransition: false,
|
|
|
+ // TabTransition 始终默认 true,确保首次渲染即出现;首次启动时被 splash overlay 覆盖不可见
|
|
|
+ showTabTransition: true,
|
|
|
|
|
|
- // splash loading ovarlay(首次进入时展示,数据加载完关闭)
|
|
|
- splashOverlay: false,
|
|
|
+ // splash loading overlay(首次进入时展示,数据加载完关闭)
|
|
|
+ splashOverlay: _isFirstLaunch,
|
|
|
splashOverlayFading: false,
|
|
|
_splashReady: false,
|
|
|
|
|
|
@@ -257,44 +260,33 @@ export default {
|
|
|
this._doInit(options)
|
|
|
},
|
|
|
onShow() {
|
|
|
- // 从 splash 首次进入:展示 splash overlay,数据加载完后自动关闭
|
|
|
- var showOverlay = uni.getStorageSync('_showSplashOverlay')
|
|
|
- var isFirstLaunch = (showOverlay === '1')
|
|
|
- if (isFirstLaunch) {
|
|
|
+ // splash overlay 已在 data() 中根据 storage 标记初始化,此处只需配置关闭条件
|
|
|
+ if (this.splashOverlay) {
|
|
|
uni.removeStorageSync('_showSplashOverlay')
|
|
|
- this._showSplashOverlayMask()
|
|
|
- }
|
|
|
-
|
|
|
- // 首次启动由 flash 覆盖加载过程,跳过 TabTransition;后续 tab 切换才显示
|
|
|
- if (!isFirstLaunch) {
|
|
|
- this.showTabTransition = true
|
|
|
- this._watchPageReady()
|
|
|
- }
|
|
|
-
|
|
|
- // 始终执行初始化,确保登录态变更后及时切换视图
|
|
|
- this._doInit()
|
|
|
- },
|
|
|
- methods: {
|
|
|
- // ===== Splash overlay (首次进入蒙板) =====
|
|
|
- _showSplashOverlayMask() {
|
|
|
- this.splashOverlay = true
|
|
|
this._splashLoadCount = 0
|
|
|
this._splashMinPassed = false
|
|
|
|
|
|
- // 最小展示 800ms,让 overlay 有足够时间呈现
|
|
|
var self = this
|
|
|
+ // 最低展示 800ms
|
|
|
setTimeout(function() {
|
|
|
self._splashMinPassed = true
|
|
|
self._tryHideSplash()
|
|
|
}, 800)
|
|
|
-
|
|
|
- // 最长 5 秒强制关闭,防止 API 卡死导致蒙板不消失
|
|
|
+ // 最多展示 5s
|
|
|
setTimeout(function() {
|
|
|
- if (self.splashOverlay) {
|
|
|
- self._hideSplashOverlay()
|
|
|
- }
|
|
|
+ if (self.splashOverlay) self._hideSplashOverlay()
|
|
|
}, 5000)
|
|
|
- },
|
|
|
+ } else {
|
|
|
+ // 非首次:TabTransition 已在 data() 中为 true,确保首次渲染即出现
|
|
|
+ // 但组件缓存后再次切回时可能已被 _watchPageReady 置为 false,需要重置
|
|
|
+ this.showTabTransition = true
|
|
|
+ this._watchPageReady()
|
|
|
+ }
|
|
|
+
|
|
|
+ // 始终执行初始化,确保登录态变更后及时切换视图
|
|
|
+ this._doInit()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
_checkSplashReady() {
|
|
|
this._splashLoadCount++
|
|
|
this._tryHideSplash()
|
|
|
@@ -313,6 +305,8 @@ export default {
|
|
|
_hideSplashOverlay() {
|
|
|
if (this.splashOverlayFading) return
|
|
|
this.splashOverlayFading = true
|
|
|
+ // splash 关闭时同时隐藏 TabTransition(防止 splash 结束后闪现过渡页)
|
|
|
+ this.showTabTransition = false
|
|
|
var self = this
|
|
|
setTimeout(function() {
|
|
|
self.splashOverlay = false
|