修改bug

This commit is contained in:
zhouyanli
2026-07-30 18:01:39 +08:00
parent 80ff7588b1
commit 8c0a713512
20 changed files with 223 additions and 134 deletions

View File

@@ -1,5 +1,6 @@
<script setup>
import { onLaunch,onShow,onHide } from '@dcloudio/uni-app'
import { isPublicPath } from '@/common/checkLogin.js'
let cidRetryTimer = null
let cidRetryCount = 0
@@ -29,6 +30,20 @@
// 所有人统一进首页
console.log('进入首页hasToken=' + !!token + '')
// 全局 navigateTo 拦截器:未登录用户访问需登录页面时自动跳转登录页
uni.addInterceptor('navigateTo', {
invoke(args) {
const t = uni.getStorageSync('token')
if (!t && !isPublicPath(args.url)) {
uni.showToast({ title: '请先登录', icon: 'none' })
setTimeout(() => {
uni.navigateTo({ url: '/pageSubPack/loginSub/login?mode=pwd' })
}, 1000)
return false
}
}
})
})
onShow((options) => {
console.log('App Show', options)