diff --git a/src/assets/common/chest bg.png b/src/assets/common/chest bg.png new file mode 100644 index 0000000..811d9b7 Binary files /dev/null and b/src/assets/common/chest bg.png differ diff --git a/src/views/home/awardDialog.vue b/src/views/home/awardDialog.vue index 025b117..6f299d8 100644 --- a/src/views/home/awardDialog.vue +++ b/src/views/home/awardDialog.vue @@ -1,28 +1,272 @@ - \ No newline at end of file diff --git a/src/views/home/gameView.vue b/src/views/home/gameView.vue index 24a2901..aea4dc2 100644 --- a/src/views/home/gameView.vue +++ b/src/views/home/gameView.vue @@ -23,6 +23,31 @@ export default { token: getToken(), // currIndex: localStorage.getItem('currIndex') currIndex: 0, + awardData: { + score: 20, //获得积分数量 + chest: [ + // { // 结构同 18.宝箱列表 + // id: 1, // 箱子id + // stat: 0, // 0: 锁定, 1: 正常 + // shareCode: '箱子的分享码', + // level: 1, // 箱子品级 + // maxBonus: 10, // 最大可助力数量 + // scoreInit: 5, // 初始可获得积分 + // scoreBonus: 10, // 助力增加的分数 + // bonusCount: 2, // 已助力次数 + // }, + // { // 结构同 18.宝箱列表 + // id: 1, // 箱子id + // stat: 0, // 0: 锁定, 1: 正常 + // shareCode: '箱子的分享码', + // level: 1, // 箱子品级 + // maxBonus: 10, // 最大可助力数量 + // scoreInit: 5, // 初始可获得积分 + // scoreBonus: 10, // 助力增加的分数 + // bonusCount: 2, // 已助力次数 + // } + ], + }, }; }, created() {}, @@ -49,42 +74,45 @@ export default { // 行动 async stepBtn(getTotalUsed,amount) { - let myAddress = localStorage.getItem("myAddress") - // console.log(myAddress,getTotalUsed,amount,'--------------------------------') - // return - if(await isWalletConnected()) { - if(amount >= 1) { - cc.mainAnim.setCurrPos(getTotalUsed) - cc.mainAnim.setData(amount) - let res = await this.$axios.post('/api/game/pre_step',{step: amount},{headers: { Authorization: `Bearer ${this.token}` }}) - let id = res.data.data.id - if(id){ - try{ - let result = await sendExplore(myAddress, id) - if(result) { - let serTimeId = setInterval(async () => { - let resExplore = await apiGameStep(id); - console.log(resExplore.data) - if(resExplore.data) { - console.log(resExplore.data) - alert(resExplore.data) - clearInterval(serTimeId) - location.reload() - } - }, 2000) - } - } catch(e) { - this.$message.error(e.message) - } + console.log(getTotalUsed,amount) + this.$emit('awardDialog', this.awardData) + + // let myAddress = localStorage.getItem("myAddress") + // // console.log(myAddress,getTotalUsed,amount,'--------------------------------') + // // return + // if(await isWalletConnected()) { + // if(amount >= 1) { + // cc.mainAnim.setCurrPos(getTotalUsed) + // cc.mainAnim.setData(amount) + // let res = await this.$axios.post('/api/game/pre_step',{step: amount},{headers: { Authorization: `Bearer ${this.token}` }}) + // let id = res.data.data.id + // if(id){ + // try{ + // let result = await sendExplore(myAddress, id) + // if(result) { + // let serTimeId = setInterval(async () => { + // let resExplore = await apiGameStep(id); + // console.log(resExplore.data) + // if(resExplore.data) { + // console.log(resExplore.data) + // alert(resExplore.data) + // clearInterval(serTimeId) + // location.reload() + // } + // }, 2000) + // } + // } catch(e) { + // this.$message.error(e.message) + // } - } - } else { - this.$message.error('Get the number of explorations') - } - } else { - this.$message.error('Log in first') - } + // } + // } else { + // this.$message.error('Get the number of explorations') + // } + // } else { + // this.$message.error('Log in first') + // } }, } diff --git a/src/views/home/helpDialog.vue b/src/views/home/helpDialog.vue new file mode 100644 index 0000000..f29ff12 --- /dev/null +++ b/src/views/home/helpDialog.vue @@ -0,0 +1,115 @@ + + + + + \ No newline at end of file diff --git a/src/views/home/index.vue b/src/views/home/index.vue index a490be7..68ac4a1 100644 --- a/src/views/home/index.vue +++ b/src/views/home/index.vue @@ -67,7 +67,7 @@
- +
-
+
宝箱助力 @@ -469,7 +469,11 @@
- + + + + +
@@ -482,6 +486,7 @@ import gameView from "./gameView.vue"; import CheckBtn from "@/components/checkBtn.vue"; import WalletDialog from "@/components/walletDialog/index.vue"; import AwardDialog from './awardDialog.vue' +import HelpDialog from './helpDialog.vue' import { getToken } from '@/utils/cookies.js' import { getWalletAddress, isWalletConnected, linkWallet } from "@/wallet/index.js"; import { @@ -503,7 +508,8 @@ export default { WalletDialog, BoxBtm, CheckBtn, - AwardDialog + AwardDialog, + HelpDialog, // ImgView, }, data() { @@ -557,7 +563,7 @@ export default { nickname: "0000000" } ], - helpDialogVisible: false, + helpDialogVisible: true, isHelpSuccess: false, helpAmount: 0, isHelpBox: false, @@ -568,6 +574,13 @@ export default { stepTicket: 0, // 探索次数 inviteDialogVisible: false, inviteTableData: [], + ExploreDialogVisible: true, + awardData: {}, + level1: [], + level2: [], + level3: [], + level4: [], + dialogTitle: '', }; }, watch: { @@ -787,6 +800,38 @@ export default { this.$refs.stepId.stepBtn(this.getTotalUsed, amount) }, + // 探索奖励 + awardDialog(val) { + this.awardData = val + if(this.awardData.chest.length > 0) { + this.level1 = [] + this.level2 = [] + this.level3 = [] + this.level4 = [] + val.chest.forEach(element => { + if (element.level == "1") { + this.level1.push(element) + } else if (element.level == "2") { + this.level2.push(element) + } else if(element.level == "3"){ + this.level3.unshift(element) + } else if(element.level == "4"){ + this.level4.push(element) + } + }); + this.dialogTitle = 'Explore successfully and get rewards' + } else { + this.dialogTitle = 'Congratulations' + } + + this.ExploreDialogVisible = true + }, + + // 关闭奖励弹窗 + ExploreHandleClose() { + this.ExploreDialogVisible = false; + }, + // 签到 async walletCheck() { let address = localStorage.getItem("myAddress") @@ -979,6 +1024,11 @@ export default { } }, + // 关闭助力弹窗 + helpHandleClose() { + this.helpDialogVisible = false; + }, + // 复制链接 copyLink(text) { let url = `http://192.168.100.216:8030/home/new=${text}/box=undefined/id=undefined`;