diff --git a/package1/planet/index.vue b/package1/planet/index.vue index e29530e..4c180d3 100644 --- a/package1/planet/index.vue +++ b/package1/planet/index.vue @@ -67,7 +67,7 @@ 下单得券 种树得券 - 防御塔升级 + 升防御塔 {{(home.dailyLoop && home.dailyLoop.myWeightTickets) || 0}} - 我的概率 + 我投入券 @@ -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 diff --git a/package1/planet/more.vue b/package1/planet/more.vue index 5455ede..a381fa6 100644 --- a/package1/planet/more.vue +++ b/package1/planet/more.vue @@ -281,12 +281,26 @@ }) }, onPlantTree(config) { + if (this.hasPlantingTree(config)) { + this.tui.toast('此培育时间有正在培育中的券树') + return + } this.treeInput = { show: true, config: config || {}, tickets: '' } }, + hasPlantingTree(config) { + const cycleHours = Number((config && config.cycleHours) || 0) + if (!cycleHours) return false + const operate = (this.home && this.home.operate) || {} + const orders = operate.treeOrders || [] + return orders.some((order) => { + if (Number(order.cycleHours || 0) !== cycleHours) return false + return order.status !== 2 && order.status !== '2' + }) + }, closeTreeInput() { this.treeInput.show = false }, diff --git a/package1/planet/rank.vue b/package1/planet/rank.vue index acbbc74..9868638 100644 --- a/package1/planet/rank.vue +++ b/package1/planet/rank.vue @@ -442,7 +442,7 @@ .podium-head { position: relative; z-index: 1; display: flex; justify-content: space-between; gap: 16rpx; align-items: flex-start; } .podium-kicker { color: rgba(255,214,92,0.86); font-size: 17rpx; font-weight: 900; letter-spacing: 2rpx; } .podium-title { margin-top: 6rpx; color: #FFFFFF; font-size: 40rpx; font-weight: 900; text-shadow: 0 8rpx 20rpx rgba(0,0,0,0.18); } - .podium-prize { max-width: 230rpx; padding: 10rpx 16rpx; border-radius: 999rpx; background: rgba(255,255,255,0.12); color: #FFE08A; font-size: 19rpx; font-weight: 900; line-height: 1.25; text-align: center; border: 1rpx solid rgba(255,255,255,0.18); } + .podium-prize { max-width: 250rpx; padding: 10rpx 16rpx; border-radius: 999rpx; background: rgba(255,255,255,0.12); color: #FFE08A; font-size: 19rpx; font-weight: 900; line-height: 1.25; text-align: center; border: 1rpx solid rgba(255,255,255,0.18); } .reward-rule { position: relative; z-index: 1; margin-top: 20rpx; padding: 18rpx; border-radius: 28rpx; background: linear-gradient(135deg, rgba(255,224,138,0.18), rgba(255,255,255,0.1)); border: 1rpx solid rgba(255,255,255,0.18); box-shadow: inset 0 1rpx 0 rgba(255,255,255,0.18); } .reward-main { color: #FFF4B8; font-size: 23rpx; font-weight: 900; line-height: 1.35; } .reward-chips { margin-top: 12rpx; display: flex; flex-wrap: wrap; gap: 10rpx; }