From 967babba886d8455c1fa1229a090b5ef1305767f Mon Sep 17 00:00:00 2001 From: yuexin Date: Tue, 23 Apr 2024 16:21:06 +0800 Subject: [PATCH] fix the chest boost record --- src/components/errorDialog/index.js | 4 +++ src/views/home/helpDialog.vue | 39 +++++++++++++++++++---------- 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/src/components/errorDialog/index.js b/src/components/errorDialog/index.js index 473c485..ea4ae28 100644 --- a/src/components/errorDialog/index.js +++ b/src/components/errorDialog/index.js @@ -62,6 +62,10 @@ let errmsg = err errmsg = "You do not hold the required role in the 'Delabs Game' Discord server" } else if(errmsg.indexOf('Please try again') > -1) { errmsg = "Verification failed due to high traffic. Please attempt to verify again or try later" + } else if(errmsg.indexOf('You have already boosted the chest') > -1 + || errmsg.indexOf('The chest’s boost count has reached the upper limit') > -1 + || errmsg.indexOf('Today’s boost count has been exhausted') > -1) { + // keep the errmsg } else { // 请重试 errmsg = 'An unknown on-chain interaction error has occurred. Our technical team cannot resolve this issue directly. Please use a blockchain explorer to check your wallet address and determine if the transaction was recorded or if another issue exists.' diff --git a/src/views/home/helpDialog.vue b/src/views/home/helpDialog.vue index ad1da5e..ed88739 100644 --- a/src/views/home/helpDialog.vue +++ b/src/views/home/helpDialog.vue @@ -27,7 +27,7 @@
- Boost Records + Chest Boost Points
@@ -130,10 +130,13 @@ export default { // 获取帮助的宝箱助力记录 async getHelpBoxLog() { if (this.$route.params.code != undefined) { - let rtoken = await checkReCaptcha("chest_share"); + // let rtoken = await checkReCaptcha("chest_share"); let res = await this.$axios.post( process.env.VUE_APP_API_URL+"/api/chest/enhance/list", - { code: this.boxCode, rtoken: rtoken }, + { + code: this.boxCode + // , rtoken: rtoken + }, { headers: { Authorization: `Bearer ${this.token}` } } @@ -146,23 +149,29 @@ export default { // 宝箱助力 async helpBtn() { + // debugger + if(this.boxState.isopened){ + //todo: + this.$showErr('chest already opened') + return + } let address = localStorage.getItem("myAddress") // 3、是否已经助力此宝箱 if(this.boxState.enhanced == 0) { // 1、助力次数是否用完 if(this.boxState.userCurrent < this.boxState.userMax) { - // 2、宝箱助力次数是否上限 - if(this.boxState.chestCurrent < this.boxState.chestMax) { - // 4、开始助力 - await this.sendEnhanceReq(this.boxCode) + // 2、宝箱助力次数是否上限 + if(this.boxState.chestCurrent < this.boxState.chestMax) { + // 4、开始助力 + await this.sendEnhanceReq(this.boxCode) + } else { + this.$showErr('The chest’s boost count has reached the upper limit.') + } } else { - this.$showErr('Boost limit reached.') + this.$showErr('Today’s boost count has been exhausted.') } } else { - this.$showErr('Not enough boosts available.') - } - } else { - this.$showErr('You have already boosted the chest once.') + this.$showErr('You have already boosted the chest.') } @@ -228,7 +237,11 @@ export default { // 助力状态查询 async initBoxState(boxCode) { let res = await this.$axios.post(process.env.VUE_APP_API_URL+'/api/chest/enhance/state',{code: boxCode, },{headers: { Authorization: `Bearer ${this.token}` }}) - this.boxState = res.data.data + if(res.data.errcode == 0){ + this.boxState = res.data.data + }else if(res.data.errcode == 14){ + this.boxState.isopened = true + } }, // 关闭弹窗