wangfukang 2 weeks ago
parent
commit
8055d7d80f
  1. 30
      package5/planet/index.vue

30
package5/planet/index.vue

@ -315,6 +315,7 @@
import planetDailyLoop from '@/package5/components/planet/planet-daily-loop.vue' import planetDailyLoop from '@/package5/components/planet/planet-daily-loop.vue'
import planetAdventureEntry from '@/package5/components/planet/planet-adventure-entry.vue' import planetAdventureEntry from '@/package5/components/planet/planet-adventure-entry.vue'
import { buildHomeSharePath } from '@/utils/sharePath.js' import { buildHomeSharePath } from '@/utils/sharePath.js'
import { requireLoginToCurrentPage } from '@/utils/authRedirect.js'
const SHARE_TARGET_PATH = '/package5/planet/index' const SHARE_TARGET_PATH = '/package5/planet/index'
@ -554,10 +555,6 @@
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) {
@ -566,6 +563,10 @@
this.regionName = areaInfo.title || '' this.regionName = areaInfo.title || ''
} }
} catch (e) {} } catch (e) {}
if (!this.hasLogin()) {
this.loading = false
return
}
if (!this.checkPoolJoinRegion()) return if (!this.checkPoolJoinRegion()) return
this.loadHome() this.loadHome()
}, },
@ -615,11 +616,7 @@
return !!(token && typeof token === 'string' && token.trim() && token !== 'null' && token !== 'undefined') return !!(token && typeof token === 'string' && token.trim() && token !== 'null' && token !== 'undefined')
}, },
goLogin() { goLogin() {
const redirectKey = 'login_redirect_' + Date.now() return requireLoginToCurrentPage()
uni.setStorageSync(redirectKey, '/package5/planet/index')
uni.navigateTo({
url: '/package2/login/login?redirect=' + redirectKey
})
}, },
initNavHeight() { initNavHeight() {
try { try {
@ -634,6 +631,9 @@
showPoolRuleModal() { showPoolRuleModal() {
this.poolRuleVisible = true this.poolRuleVisible = true
}, },
requirePageLogin() {
return requireLoginToCurrentPage()
},
poolJoinRegionKey() { poolJoinRegionKey() {
return 'planetPoolJoinRegion_' + this.userId return 'planetPoolJoinRegion_' + this.userId
}, },
@ -676,7 +676,7 @@
}, },
loadHome(silent) { loadHome(silent) {
if (!this.userId) { if (!this.userId) {
this.goLogin() this.loading = false
return return
} }
if (!this.regionId) { if (!this.regionId) {
@ -709,6 +709,7 @@
}) })
}, },
onSign() { onSign() {
if (!this.requirePageLogin()) return
const pausedStep = this.pauseGuideForAction('sign') const pausedStep = this.pauseGuideForAction('sign')
this.tui.request('/app/planet/sign', 'POST', { this.tui.request('/app/planet/sign', 'POST', {
userId: this.userId, userId: this.userId,
@ -720,6 +721,7 @@
}) })
}, },
openBox() { openBox() {
if (!this.requirePageLogin()) return
if (!this.home.boxAvailable || this.boxOpening) return if (!this.home.boxAvailable || this.boxOpening) return
this.pauseGuideForAction('box') this.pauseGuideForAction('box')
this.boxOpening = true this.boxOpening = true
@ -837,6 +839,7 @@
return win.id || win.winnerId || win._id || '' return win.id || win.winnerId || win._id || ''
}, },
receiveWinning() { receiveWinning() {
if (!this.requirePageLogin()) return
const win = this.winningModal.data || {} const win = this.winningModal.data || {}
const winnerId = this.getWinnerId(win) const winnerId = this.getWinnerId(win)
if (this.winningModal.receiving) return if (this.winningModal.receiving) return
@ -1247,6 +1250,7 @@
}) })
}, },
onJoinPool() { onJoinPool() {
if (!this.requirePageLogin()) return
if (!this.checkPoolJoinRegion()) return if (!this.checkPoolJoinRegion()) return
const loop = this.home.dailyLoop || {} const loop = this.home.dailyLoop || {}
if ((this.home.myTicketCount || 0) <= 0) { if ((this.home.myTicketCount || 0) <= 0) {
@ -1281,31 +1285,37 @@
}) })
}, },
goDrawResult() { goDrawResult() {
if (!this.requirePageLogin()) return
uni.navigateTo({ uni.navigateTo({
url: '/package5/planet/drawResult' url: '/package5/planet/drawResult'
}) })
}, },
goTicketLog() { goTicketLog() {
if (!this.requirePageLogin()) return
uni.navigateTo({ uni.navigateTo({
url: '/package5/planet/ticketLog' url: '/package5/planet/ticketLog'
}) })
}, },
goAdventure() { goAdventure() {
if (!this.requirePageLogin()) return
uni.navigateTo({ uni.navigateTo({
url: '/package5/planet/adventure' url: '/package5/planet/adventure'
}) })
}, },
goArena() { goArena() {
if (!this.requirePageLogin()) return
uni.navigateTo({ uni.navigateTo({
url: '/package5/planet/pkHall' url: '/package5/planet/pkHall'
}) })
}, },
goRank() { goRank() {
if (!this.requirePageLogin()) return
uni.navigateTo({ uni.navigateTo({
url: '/package5/planet/rank' url: '/package5/planet/rank'
}) })
}, },
goMore() { goMore() {
if (!this.requirePageLogin()) return
uni.navigateTo({ uni.navigateTo({
url: '/package5/planet/more' url: '/package5/planet/more'
}) })

Loading…
Cancel
Save