diff --git a/xuan-deduct-uniapp/src/App.vue b/xuan-deduct-uniapp/src/App.vue index cebac7b..44ecb1f 100644 --- a/xuan-deduct-uniapp/src/App.vue +++ b/xuan-deduct-uniapp/src/App.vue @@ -15,17 +15,31 @@ export default { const userInfo = uni.getStorageSync('userInfo') const hasShownAuth = uni.getStorageSync('hasShownAuth') + console.log('检查用户授权状态:', { + hasUserInfo: !!userInfo, + hasShownAuth: hasShownAuth + }) + if (!userInfo && !hasShownAuth) { console.log('首次使用,跳转到授权页面') uni.setStorageSync('hasShownAuth', true) setTimeout(() => { - uni.redirectTo({ + uni.navigateTo({ url: '/pages/auth/auth', success: () => { console.log('跳转授权页面成功') }, fail: (err) => { console.error('跳转授权页面失败:', err) + uni.redirectTo({ + url: '/pages/auth/auth', + success: () => { + console.log('redirectTo跳转授权页面成功') + }, + fail: (err2) => { + console.error('redirectTo跳转授权页面也失败:', err2) + } + }) } }) }, 500) diff --git a/xuan-deduct-uniapp/src/pages.json b/xuan-deduct-uniapp/src/pages.json index f5e2a8a..4e49eab 100644 --- a/xuan-deduct-uniapp/src/pages.json +++ b/xuan-deduct-uniapp/src/pages.json @@ -1,5 +1,13 @@ { "pages": [ + { + "path": "pages/auth/auth", + "style": { + "navigationBarTitleText": "授权登录", + "navigationBarBackgroundColor": "#10B981", + "navigationBarTextStyle": "white" + } + }, { "path": "pages/index/index", "style": {