diff --git a/package1/components/planet/planet-daily-loop.vue b/package1/components/planet/planet-daily-loop.vue
new file mode 100644
index 0000000..fe160b6
--- /dev/null
+++ b/package1/components/planet/planet-daily-loop.vue
@@ -0,0 +1,108 @@
+
+
+
+
+ 2 MIN DAILY
+ 今天就做这几步
+ 收券、看事件、反搜、投奖池,90秒走人
+
+ {{data.minutesToDraw || 0}}min
+
+
+
+
+ 今晚现金奖池
+ ¥{{poolAmount}}
+
+
+ {{data.myProbability || 0}}%
+ 我的概率
+
+
+
+
+
+ {{data.todayCollectedTickets || 0}}
+ 今日收券
+
+
+ {{data.myPoolTickets || 0}}
+ 已投奖池
+
+
+ {{data.poolJoinCount || 0}}
+ 参与同学
+
+
+
+
+ {{e}}
+
+
+
+
+ 1
+ {{collectText}}
+
+
+ 2
+ {{data.hasRevengeTarget ? '反搜一下' : '随机搜查'}}
+
+
+ 3
+ {{joinText}}
+
+
+
+
+
+
+
+
diff --git a/package1/components/planet/planet-operate.vue b/package1/components/planet/planet-operate.vue
new file mode 100644
index 0000000..4b397db
--- /dev/null
+++ b/package1/components/planet/planet-operate.vue
@@ -0,0 +1,157 @@
+
+
+
+
+ CAMPUS FARM
+ 松鼠星际农场
+ 种券、仓库、防御塔和地标争夺,每天都有一点成长
+
+
+ {{state.stamina || 0}}
+ 体力
+
+
+
+
+
+
+
+
+
+ 券树培育
+ 选择周期投入星球券,成熟后返还本金和收益
+
+
+ {{c.cycleHours}}h
+ 收益 {{rateText(c.rate)}}
+
+
+
+
+
+ SAFE
+ 松鼠仓库 Lv{{state.warehouseLevel || 1}}
+
+ {{state.warehouseTicketCount || 0}} / {{state.warehouseCapacity || 10}} 张安全券
+
+ 存入
+ 取出
+ 升级
+
+
+
+
+ TOWER
+ 防御塔 Lv{{state.towerLevel || 1}}
+ 拦截 {{state.towerInterceptRate || 0}}% · 伤害 {{state.towerDamage || 0}}
+ 升级防御
+
+
+
+ RADAR
+ 星际搜查
+ 今日 {{state.dailySearchCount || 0}} 次 · 获得 {{state.dailySearchGain || 0}} 券
+ 派出松鼠宇航员
+
+
+
+
+ 校园地标
+
+
+ {{l.icon || 'LAND'}}
+ {{l.name}}
+ {{benefitText(l)}}
+
+
+
+
+
+ 成长中的券树
+
+
+ {{o.cycleHours}}h · 投入{{o.investTickets}}券
+ 预计收获 {{o.expectedTotal}} 券
+
+ {{o.status === 2 ? '已收' : '收获'}}
+
+
+
+
+
+
+
+
diff --git a/package1/planet/index.vue b/package1/planet/index.vue
index a224020..32e8c4b 100644
--- a/package1/planet/index.vue
+++ b/package1/planet/index.vue
@@ -38,6 +38,14 @@
@draw="goDrawResult">
+
+
+
+
+
+
@@ -103,6 +123,8 @@
import huntModal from '@/package1/components/planet/hunt-modal.vue'
import buffShop from '@/package1/components/planet/buff-shop.vue'
import planetNews from '@/package1/components/planet/planet-news.vue'
+ import planetOperate from '@/package1/components/planet/planet-operate.vue'
+ import planetDailyLoop from '@/package1/components/planet/planet-daily-loop.vue'
export default {
components: {
@@ -113,7 +135,9 @@
planetRank,
huntModal,
buffShop,
- planetNews
+ planetNews,
+ planetOperate,
+ planetDailyLoop
},
data() {
return {
@@ -134,7 +158,9 @@
rankList: [],
buffShop: [],
newsList: [],
- myBuffs: []
+ myBuffs: [],
+ operate: {},
+ dailyLoop: {}
},
boxOpening: false,
boxResult: {
@@ -313,6 +339,129 @@
})
})
},
+ promptTickets(title, callback) {
+ uni.showModal({
+ title,
+ editable: true,
+ placeholderText: '输入星球券数量',
+ success: (res) => {
+ if (!res.confirm) return
+ const tickets = parseInt(res.content || '0', 10)
+ if (!tickets || tickets <= 0) {
+ this.tui.toast('请输入正确数量')
+ return
+ }
+ callback(tickets)
+ }
+ })
+ },
+ operateRequest(url, data, successText) {
+ this.tui.request(url, 'POST', Object.assign({
+ userId: this.userId,
+ regionId: this.regionId
+ }, data || {})).then((res) => {
+ this.tui.toast(res.code == 200 ? successText : res.message, 1500, res.code == 200)
+ if (res.code == 200) this.loadHome(true)
+ })
+ },
+ onPlantTree(config) {
+ this.promptTickets(`投入 ${config.cycleHours}h 券树`, (tickets) => {
+ this.operateRequest('/app/planet/tree/plant', { configId: config.id, tickets }, '种植成功')
+ })
+ },
+ onHarvestTree(order) {
+ if (order.status === 2) {
+ this.tui.toast('这棵券树已经收获')
+ return
+ }
+ this.operateRequest('/app/planet/tree/harvest', { orderId: order.id }, '收获成功')
+ },
+ onStoreWarehouse() {
+ this.promptTickets('存入松鼠仓库', (tickets) => {
+ this.operateRequest('/app/planet/warehouse/store', { tickets }, '存入成功')
+ })
+ },
+ onTakeWarehouse() {
+ this.promptTickets('从仓库取出', (tickets) => {
+ this.operateRequest('/app/planet/warehouse/take', { tickets }, '取出成功')
+ })
+ },
+ onUpgradeWarehouse() {
+ this.tui.modal('升级仓库', '确认消耗星球券升级松鼠仓库?', true, (ok) => {
+ if (ok) this.operateRequest('/app/planet/warehouse/upgrade', {}, '升级成功')
+ })
+ },
+ onUpgradeTower() {
+ this.tui.modal('升级防御塔', '确认消耗星球券提升拦截能力?', true, (ok) => {
+ if (ok) this.operateRequest('/app/planet/tower/upgrade', {}, '升级成功')
+ })
+ },
+ onRandomSearch() {
+ this.startSearch('/app/planet/search/random', {}, { nickname: '随机同校区玩家' })
+ },
+ onDailyCollect() {
+ if (!this.home.dailyLoop || !this.home.dailyLoop.signedToday) {
+ this.onSign()
+ return
+ }
+ if (this.home.dailyLoop.boxAvailable) {
+ this.openBox()
+ return
+ }
+ this.tui.toast('今天的顺手券已经收完')
+ },
+ onDailyRevenge() {
+ const loop = this.home.dailyLoop || {}
+ if (loop.hasRevengeTarget && loop.revengeTarget && loop.revengeTarget.fromUserId) {
+ this.startSearch('/app/planet/search/target', { toUserId: loop.revengeTarget.fromUserId }, loop.revengeTarget)
+ } else {
+ this.onRandomSearch()
+ }
+ },
+ startSearch(url, data, target) {
+ this.huntModal.show = true
+ this.huntModal.phase = 'searching'
+ this.huntModal.result = null
+ this.huntModal.target = target || { nickname: '同校区玩家' }
+ setTimeout(() => { this.huntModal.phase = 'locking' }, 900)
+ setTimeout(() => { this.huntModal.phase = 'chasing' }, 1800)
+ this.tui.request(url, 'POST', Object.assign({
+ userId: this.userId,
+ regionId: this.regionId
+ }, data || {}), false, false, true).then((res) => {
+ setTimeout(() => {
+ if (res.code == 200 && res.result) {
+ this.huntModal.result = {
+ result: res.result.intercepted ? 'shield' : 'success',
+ message: res.result.message,
+ gainTickets: res.result.gainTickets,
+ totalGain: res.result.gainTickets,
+ remainHunt: res.result.remainSearchCount
+ }
+ this.huntModal.phase = 'result'
+ this.loadHome(true)
+ } else {
+ this.huntModal.show = false
+ this.tui.toast(res.message)
+ }
+ }, 2200)
+ }).catch(() => {
+ this.huntModal.show = false
+ })
+ },
+ onJoinPool() {
+ const loop = this.home.dailyLoop || {}
+ const n = loop.suggestedAddTickets || 1
+ this.tui.modal('投入现金奖池', `建议投入 ${n} 张星球券,预计概率提升到 ${loop.suggestedProbability || 0}%。投入后星球券会被回收,确认上车?`, true, (ok) => {
+ if (!ok) return
+ this.operateRequest('/app/planet/pool/join', { tickets: n }, '投入成功')
+ }, '#22B889', '立即上车')
+ },
+ onBidLandmark(item) {
+ this.promptTickets(`争夺${item.name}`, (tickets) => {
+ this.operateRequest('/app/planet/landmark/bid', { landmarkId: item.id, tickets }, '投入成功')
+ })
+ },
goDrawResult() {
uni.navigateTo({
url: '/package1/planet/drawResult'