diff --git a/src/assets/common/Checkmark (1).png b/src/assets/common/Checkmark (1).png new file mode 100644 index 0000000..dcb50fc Binary files /dev/null and b/src/assets/common/Checkmark (1).png differ diff --git a/src/assets/common/bg button.png b/src/assets/common/bg button.png new file mode 100644 index 0000000..8d9f403 Binary files /dev/null and b/src/assets/common/bg button.png differ diff --git a/src/assets/common/loding .png b/src/assets/common/loding .png new file mode 100644 index 0000000..a5a6465 Binary files /dev/null and b/src/assets/common/loding .png differ diff --git a/src/assets/home/Checkmark.png b/src/assets/home/Checkmark.png index dcb50fc..153da96 100644 Binary files a/src/assets/home/Checkmark.png and b/src/assets/home/Checkmark.png differ diff --git a/src/assets/home/ICON03.png b/src/assets/home/ICON03.png new file mode 100644 index 0000000..6263fd8 Binary files /dev/null and b/src/assets/home/ICON03.png differ diff --git a/src/components/errorDialog/errorDialog.vue b/src/components/errorDialog/errorDialog.vue index 9181b0d..1dc1f3c 100644 --- a/src/components/errorDialog/errorDialog.vue +++ b/src/components/errorDialog/errorDialog.vue @@ -1,47 +1,94 @@ \ No newline at end of file diff --git a/src/components/loading.vue b/src/components/loading.vue new file mode 100644 index 0000000..842468b --- /dev/null +++ b/src/components/loading.vue @@ -0,0 +1,83 @@ + + + + + \ No newline at end of file diff --git a/src/components/walletDialog/index.vue b/src/components/walletDialog/index.vue index 73b0b9a..f1b1b98 100644 --- a/src/components/walletDialog/index.vue +++ b/src/components/walletDialog/index.vue @@ -9,7 +9,6 @@

Connect your wallet to start your Counter Fire journey

-
  • - - {{ scope.row.username }} + + + {{ scope.row.nickname }}
    @@ -225,6 +226,8 @@
  • + +
    @@ -234,11 +237,13 @@ import Pagination from './../../components/pagination.vue' import { sendOpenChest, sendToChain } from './../../utils/chainapi.js' import { apiBoxOpen } from '@/utils/webapi.js' import PaginationDialog from './../../components/paginationDialog.vue' +import Loading from '@/components/loading.vue' export default { components: { Pagination, PaginationDialog, + Loading, }, data() { return { @@ -341,6 +346,7 @@ export default { myRecordsList: [], boostingPageSize: 6, boostingCurrentPage: 1, + isLoading: false } }, computed: { @@ -433,19 +439,22 @@ export default { } }, + // 开宝箱 async openBoxToChain(id) { let address = this.$store.state.user.address; if (!this.$store.state.wallet.connected || !address) { throw new Error('wallet not connected') } - + this.isLoading = true let storeageKey try { storeageKey = await sendToChain('chest_open', address, id) } catch (err) { + this.isLoading = false this.$message.error(`error send chain request`) return } + let serTimeId = setInterval(async () => { try { let { errcode, errmsg, data } = await apiBoxOpen(id) @@ -453,22 +462,25 @@ export default { if (errcode !== 12) { // 状态不是等待链上确认的, 都提示错误 this.$message.error(errmsg) + this.isLoading = false clearInterval(serTimeId) } } else { // alert(`领取成功,显示奖励: ${JSON.stringify(data)}`) this.getMyBoxList() this.openBoxLog() + this.isLoading = false this.$emit('awardDialog', data) localStorage.removeItem(storeageKey) clearInterval(serTimeId) } } catch (err) { + this.isLoading = false this.$message.error(`claim task reward error: ${err}`) } }, 3000) }, - // 开宝箱 + async turnBox(id) { let address = localStorage.getItem("myAddress") if(this.token) { diff --git a/src/views/home/gameView.vue b/src/views/home/gameView.vue index c6e3390..3cfcade 100644 --- a/src/views/home/gameView.vue +++ b/src/views/home/gameView.vue @@ -3,6 +3,7 @@ + @@ -10,12 +11,16 @@ import { sendToChain } from "./../../utils/chainapi.js"; import { getToken } from './../../utils/cookies.js' import { isWalletConnected } from './../../wallet/index.js' +import loading from "@/components/loading.vue"; import { apiGameStep, apiPreStep, } from "./../../utils/webapi.js"; export default { + components: { + loading, + }, props: { getTotalUsed: Number, }, @@ -49,6 +54,7 @@ export default { // } ], }, + isLoading: false, }; }, created() {}, @@ -61,11 +67,6 @@ export default { window.boot() }) }, - // 扔骰子 - randomdice() { - //与后端交互的话在这一步进行扔骰子操作的请求,后端返回点数以及奖励,先拿点数进行走步操作,走步结束后,显示奖励详情 - return Math.round(Math.random() * 5 + 1); //随机生成1-6的整数 - }, stepState(data) { console.log(data,'---------------------------------') setTimeout( @@ -83,13 +84,15 @@ export default { this.$message.error(preRes.errmsg) return } + this.isLoading = true let storeageKey try { storeageKey = await sendToChain('explore', address, preRes.data.id) } catch (err) { + this.isLoading = false this.$message.error(`error send chain request`) return - } + } let serTimeId = setInterval(async () => { try { let { errcode, errmsg, data } = await apiGameStep(preRes.data.id) @@ -97,17 +100,23 @@ export default { if (errcode !== 13) { // 状态不是等待链上确认的, 都提示错误 this.$message.error(errmsg) + this.isLoading = false clearInterval(serTimeId) } } else { // alert(`领取成功, 播放动画, 并显示奖励: ${JSON.stringify(data)}`) + this.isLoading = false cc.mainAnim.setCurrPos(getTotalUsed) cc.mainAnim.setData(step) + setTimeout( + this.$emit('awardDialog', data), + step*2000) this.$emit('awardDialog', data) localStorage.removeItem(storeageKey) clearInterval(serTimeId) } } catch (err) { + this.isLoading = false this.$message.error(`claim task reward error: ${err}`) } }, 3000) diff --git a/src/views/home/helpDialog.vue b/src/views/home/helpDialog.vue index a7a9e9b..4159f92 100644 --- a/src/views/home/helpDialog.vue +++ b/src/views/home/helpDialog.vue @@ -62,10 +62,12 @@ +