修改bug
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user