|
|
@ -550,6 +550,10 @@ |
|
|
this.userId = uni.getStorageSync('id') || '' |
|
|
this.userId = uni.getStorageSync('id') || '' |
|
|
this.nickname = uni.getStorageSync('nickName') || uni.getStorageSync('nickname') || '' |
|
|
this.nickname = uni.getStorageSync('nickName') || uni.getStorageSync('nickname') || '' |
|
|
this.avatar = uni.getStorageSync('avatarUrl') || uni.getStorageSync('avatar') || '' |
|
|
this.avatar = uni.getStorageSync('avatarUrl') || uni.getStorageSync('avatar') || '' |
|
|
|
|
|
if (!this.hasLogin()) { |
|
|
|
|
|
this.goLogin() |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
try { |
|
|
try { |
|
|
const area = uni.getStorageSync('area') |
|
|
const area = uni.getStorageSync('area') |
|
|
if (area) { |
|
|
if (area) { |
|
|
@ -562,11 +566,23 @@ |
|
|
this.loadHome() |
|
|
this.loadHome() |
|
|
}, |
|
|
}, |
|
|
onShow() { |
|
|
onShow() { |
|
|
|
|
|
if (!this.hasLogin()) return |
|
|
if (this.loadedOnce) { |
|
|
if (this.loadedOnce) { |
|
|
this.loadHome(true) |
|
|
this.loadHome(true) |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
|
|
|
hasLogin() { |
|
|
|
|
|
const token = uni.getStorageSync('hiver_token') |
|
|
|
|
|
return !!(token && typeof token === 'string' && token.trim() && token !== 'null' && token !== 'undefined') |
|
|
|
|
|
}, |
|
|
|
|
|
goLogin() { |
|
|
|
|
|
const redirectKey = 'login_redirect_' + Date.now() |
|
|
|
|
|
uni.setStorageSync(redirectKey, '/package5/planet/index') |
|
|
|
|
|
uni.navigateTo({ |
|
|
|
|
|
url: '/package2/login/login?redirect=' + redirectKey |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
initNavHeight() { |
|
|
initNavHeight() { |
|
|
try { |
|
|
try { |
|
|
const menu = uni.getMenuButtonBoundingClientRect && uni.getMenuButtonBoundingClientRect() |
|
|
const menu = uni.getMenuButtonBoundingClientRect && uni.getMenuButtonBoundingClientRect() |
|
|
@ -622,7 +638,7 @@ |
|
|
}, |
|
|
}, |
|
|
loadHome(silent) { |
|
|
loadHome(silent) { |
|
|
if (!this.userId) { |
|
|
if (!this.userId) { |
|
|
this.tui.toast('请先登录') |
|
|
this.goLogin() |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
if (!this.regionId) { |
|
|
if (!this.regionId) { |
|
|
|