From 8055d7d80f8c282f23e3c85cb084cb58e49776bc Mon Sep 17 00:00:00 2001 From: wangfukang <15630117759@163.com> Date: Thu, 10 Sep 2026 08:43:16 +0800 Subject: [PATCH] 1 --- package5/planet/index.vue | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/package5/planet/index.vue b/package5/planet/index.vue index 81f305b..f3c1014 100644 --- a/package5/planet/index.vue +++ b/package5/planet/index.vue @@ -315,6 +315,7 @@ import planetDailyLoop from '@/package5/components/planet/planet-daily-loop.vue' import planetAdventureEntry from '@/package5/components/planet/planet-adventure-entry.vue' import { buildHomeSharePath } from '@/utils/sharePath.js' + import { requireLoginToCurrentPage } from '@/utils/authRedirect.js' const SHARE_TARGET_PATH = '/package5/planet/index' @@ -554,10 +555,6 @@ this.userId = uni.getStorageSync('id') || '' this.nickname = uni.getStorageSync('nickName') || uni.getStorageSync('nickname') || '' this.avatar = uni.getStorageSync('avatarUrl') || uni.getStorageSync('avatar') || '' - if (!this.hasLogin()) { - this.goLogin() - return - } try { const area = uni.getStorageSync('area') if (area) { @@ -566,6 +563,10 @@ this.regionName = areaInfo.title || '' } } catch (e) {} + if (!this.hasLogin()) { + this.loading = false + return + } if (!this.checkPoolJoinRegion()) return this.loadHome() }, @@ -615,11 +616,7 @@ 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 - }) + return requireLoginToCurrentPage() }, initNavHeight() { try { @@ -634,6 +631,9 @@ showPoolRuleModal() { this.poolRuleVisible = true }, + requirePageLogin() { + return requireLoginToCurrentPage() + }, poolJoinRegionKey() { return 'planetPoolJoinRegion_' + this.userId }, @@ -676,7 +676,7 @@ }, loadHome(silent) { if (!this.userId) { - this.goLogin() + this.loading = false return } if (!this.regionId) { @@ -709,6 +709,7 @@ }) }, onSign() { + if (!this.requirePageLogin()) return const pausedStep = this.pauseGuideForAction('sign') this.tui.request('/app/planet/sign', 'POST', { userId: this.userId, @@ -720,6 +721,7 @@ }) }, openBox() { + if (!this.requirePageLogin()) return if (!this.home.boxAvailable || this.boxOpening) return this.pauseGuideForAction('box') this.boxOpening = true @@ -837,6 +839,7 @@ return win.id || win.winnerId || win._id || '' }, receiveWinning() { + if (!this.requirePageLogin()) return const win = this.winningModal.data || {} const winnerId = this.getWinnerId(win) if (this.winningModal.receiving) return @@ -1247,6 +1250,7 @@ }) }, onJoinPool() { + if (!this.requirePageLogin()) return if (!this.checkPoolJoinRegion()) return const loop = this.home.dailyLoop || {} if ((this.home.myTicketCount || 0) <= 0) { @@ -1281,31 +1285,37 @@ }) }, goDrawResult() { + if (!this.requirePageLogin()) return uni.navigateTo({ url: '/package5/planet/drawResult' }) }, goTicketLog() { + if (!this.requirePageLogin()) return uni.navigateTo({ url: '/package5/planet/ticketLog' }) }, goAdventure() { + if (!this.requirePageLogin()) return uni.navigateTo({ url: '/package5/planet/adventure' }) }, goArena() { + if (!this.requirePageLogin()) return uni.navigateTo({ url: '/package5/planet/pkHall' }) }, goRank() { + if (!this.requirePageLogin()) return uni.navigateTo({ url: '/package5/planet/rank' }) }, goMore() { + if (!this.requirePageLogin()) return uni.navigateTo({ url: '/package5/planet/more' })