修复了登录跳转

This commit is contained in:
luyuan 2020-08-28 15:54:36 +08:00
parent 7c839816d4
commit a6328358e2
Signed by: theluyuan
GPG Key ID: A7972FD973317FF3
2 changed files with 7 additions and 5 deletions

View File

@ -10,9 +10,9 @@ export default {
uni.getStorage({ uni.getStorage({
key: "token", key: "token",
success: (res) => { success: (res) => {
uni.switchTab({ // uni.switchTab({
url: "/pages/index/index" // url: "/pages/index/index"
}) // })
} }
}) })
}, },

View File

@ -147,10 +147,12 @@ export default {
}, },
onLoad() { onLoad() {
let token = uni.getStorageSync('token'); let token = uni.getStorageSync('token');
let user = uni.getStorageSync('userinfo');
console.log( user.role == 2 ? '/pages/index/index' : '/pages/user/myinfo')
if (token != undefined && token) { if (token != undefined && token) {
this.$u.route({ this.$u.route({
url: '/pages/index/index' url: user.role == 2 ? '/pages/index/index' : '/pages/user/myinfo',
type: user.role == 2 ? 'tab' : 'to'
}); });
} }
} }