|
|
|
@ -67,7 +67,7 @@ |
|
|
|
<view class="planet-map-plays"> |
|
|
|
<text>下单得券</text> |
|
|
|
<text>种树得券</text> |
|
|
|
<text>防御塔升级</text> |
|
|
|
<text>升防御塔</text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<planet-me |
|
|
|
@ -143,7 +143,7 @@ |
|
|
|
</view> |
|
|
|
<view class="pool-detail-item"> |
|
|
|
<text>{{(home.dailyLoop && home.dailyLoop.myWeightTickets) || 0}}</text> |
|
|
|
<text>我的概率</text> |
|
|
|
<text>我投入券</text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="reward-list" v-if="home.rewardList && home.rewardList.length"> |
|
|
|
@ -208,6 +208,7 @@ |
|
|
|
loading: true, |
|
|
|
userId: '', |
|
|
|
regionId: '', |
|
|
|
regionName: '', |
|
|
|
nickname: '', |
|
|
|
avatar: '', |
|
|
|
college: '', |
|
|
|
@ -278,9 +279,12 @@ |
|
|
|
try { |
|
|
|
const area = uni.getStorageSync('area') |
|
|
|
if (area) { |
|
|
|
this.regionId = JSON.parse(area).id || '' |
|
|
|
const areaInfo = JSON.parse(area) |
|
|
|
this.regionId = areaInfo.id || '' |
|
|
|
this.regionName = areaInfo.title || '' |
|
|
|
} |
|
|
|
} catch (e) {} |
|
|
|
if (!this.checkPoolJoinRegion()) return |
|
|
|
this.loadHome() |
|
|
|
}, |
|
|
|
onShow() { |
|
|
|
@ -302,6 +306,46 @@ |
|
|
|
showPoolRuleModal() { |
|
|
|
this.poolRuleVisible = true |
|
|
|
}, |
|
|
|
poolJoinRegionKey() { |
|
|
|
return 'planetPoolJoinRegion_' + this.userId |
|
|
|
}, |
|
|
|
checkPoolJoinRegion() { |
|
|
|
if (!this.userId || !this.regionId) return true |
|
|
|
const record = uni.getStorageSync(this.poolJoinRegionKey()) |
|
|
|
if (!record) return true |
|
|
|
let joinRegion = record |
|
|
|
if (typeof record === 'string') { |
|
|
|
try { |
|
|
|
joinRegion = JSON.parse(record) |
|
|
|
} catch (e) { |
|
|
|
return true |
|
|
|
} |
|
|
|
} |
|
|
|
const joinRegionId = joinRegion && joinRegion.regionId |
|
|
|
if (!joinRegionId) return true |
|
|
|
if (String(joinRegionId) === String(this.regionId)) { |
|
|
|
if (!joinRegion.regionName && this.regionName) this.savePoolJoinRegion() |
|
|
|
return true |
|
|
|
} |
|
|
|
const joinRegionName = joinRegion.regionName || '其他' |
|
|
|
uni.showModal({ |
|
|
|
title: '提示', |
|
|
|
content: `您已在“${joinRegionName}”区域参与抽奖`, |
|
|
|
showCancel: false, |
|
|
|
success() { |
|
|
|
uni.reLaunch({ url: '/pages/index/index' }) |
|
|
|
} |
|
|
|
}) |
|
|
|
return false |
|
|
|
}, |
|
|
|
savePoolJoinRegion() { |
|
|
|
if (!this.userId || !this.regionId) return |
|
|
|
uni.setStorageSync(this.poolJoinRegionKey(), { |
|
|
|
userId: this.userId, |
|
|
|
regionId: this.regionId, |
|
|
|
regionName: this.regionName |
|
|
|
}) |
|
|
|
}, |
|
|
|
loadHome(silent) { |
|
|
|
if (!this.userId) { |
|
|
|
this.tui.toast('请先登录') |
|
|
|
@ -511,6 +555,7 @@ |
|
|
|
}) |
|
|
|
}, |
|
|
|
onJoinPool() { |
|
|
|
if (!this.checkPoolJoinRegion()) return |
|
|
|
const loop = this.home.dailyLoop || {} |
|
|
|
if ((this.home.myTicketCount || 0) <= 0) { |
|
|
|
this.tui.toast('星球券不足') |
|
|
|
@ -525,6 +570,7 @@ |
|
|
|
tickets: 1 |
|
|
|
}).then((res) => { |
|
|
|
if (res.code == 200) { |
|
|
|
this.savePoolJoinRegion() |
|
|
|
this.loadHome(true) |
|
|
|
} else { |
|
|
|
this.home.myTicketCount = (this.home.myTicketCount || 0) + 1 |
|
|
|
|