From 4b5f6e6cfcc81e58b28420d266c10e14e34bce59 Mon Sep 17 00:00:00 2001 From: zhangqun <179111901@qq.com> Date: Thu, 21 Sep 2023 17:49:10 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E5=BD=95ui=E5=92=8C=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 2 +- pages/home/home.vue | 5 +++++ pages/login/login.vue | 20 ++++++++++++++++++-- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/App.vue b/App.vue index caffd0a..cf13387 100644 --- a/App.vue +++ b/App.vue @@ -45,7 +45,7 @@ onShow: function() { console.log('App Show') if(!uni.getStorageSync('satoken')) { - uni.navigateTo({ + uni.redirectTo({ url: '/pages/login/login' }) } diff --git a/pages/home/home.vue b/pages/home/home.vue index 644530c..ce17bc5 100644 --- a/pages/home/home.vue +++ b/pages/home/home.vue @@ -20,6 +20,11 @@ onShow() { if (uni.getStorageSync('satoken') && this.routeData.length == 0) { this.getRouters(); + }else if (!uni.getStorageSync('satoken')){ + console.log('未登录') + uni.redirectTo({ + url: '/pages/login/login' + }) } }, methods: { diff --git a/pages/login/login.vue b/pages/login/login.vue index f7fb4dd..19c518c 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -1,5 +1,8 @@