修改链交互报错提示

This commit is contained in:
yuyongdong 2024-04-11 10:24:58 +08:00
parent 44739ec674
commit a145be86c1
3 changed files with 166 additions and 50 deletions

View File

@ -110,11 +110,34 @@
</div>
</div>
<div class="records-dialog">
<div>
<li></li>
<el-dialog class="records-dialog" :visible="recordsDialogVisible" :modal="false" :before-close="recordsHandleClose">
<div class="top">
<div class="top-title">My inviation</div>
<div class="top-close">图片</div>
</div>
</div>
<div class="content">
<el-table :data="recordsList">
<template slot="empty">
<div>No Data</div>
</template>
<el-table-column prop="rank" label="Action" :width="80">Open the Treasure</el-table-column>
<el-table-column label="Time" :width="180">
<template
slot-scope="scope"
>{{ scope.row.address.time }}</template>
</el-table-column>
<el-table-column label="Username" :width="180">
<template
slot-scope="scope"
>{{ scope.row.address.slice(0,4) }}{{ '……'+scope.row.username }}</template>
</el-table-column>
<el-table-column prop="score" label="Points"></el-table-column>
</el-table>
</div>
<div class="btm">
122112
</div>
</el-dialog>
</div>
</template>
@ -184,6 +207,16 @@ export default {
],
pageSize: 6,
currentPage: 1,
recordsDialogVisible: true,
recordsList: [
{
username: 'username',
name: 'username',
points: '12',
address: 'addressaddress',
post: '0000',
}
],
}
},
computed: {
@ -200,6 +233,7 @@ export default {
this.token = getToken()
this.$nextTick(() => {
this.getMyBoxList()
this.openBox()
})
},
methods: {
@ -210,10 +244,8 @@ export default {
params: "",
headers: { Authorization: `Bearer ${this.token}` }
})
console.log('boxList', res.data.data)
this.boxList = res.data.data
this.boxData = res.data.data[0]
console.log('boxData', this.boxData)
if(this.boxData.bounsCount == 0) {
this.$refs.pendingBg.style.width = '0%'
} else {
@ -257,34 +289,36 @@ export default {
async turnBox(id) {
let address = localStorage.getItem("myAddress")
if(this.token) {
let resOpen = await sendOpenChest(address, id)
console.log(id)
if(resOpen) {
let serTimeId = setInterval(async () => {
let res = await this.$axios.post(
"/api/chest/open",
{ chestId: id },
{ headers: { Authorization: `Bearer ${this.token}` } }
);
if (res.data.errcode == 0) {
this.getMyBoxList()
this.openBox()
clearInterval(serTimeId)
}
}, 2000)
try {
let resOpen = await sendOpenChest(address, id)
if(resOpen) {
let serTimeId = setInterval(async () => {
let res = await this.$axios.post(
"/api/chest/open",
{ chestId: id },
{ headers: { Authorization: `Bearer ${this.token}` } }
);
if (res.data.errcode == 0) {
this.getMyBoxList()
this.openBox()
clearInterval(serTimeId)
}
}, 2000)
}
} catch (e) {
this.$message.error(e.message)
}
}
},
//
async openBox() {
let res = this.$axios.get('/api/chest/open/history', {
let res = await this.$axios.get('/api/chest/open/history', {
params: { },
headers: { Authorization: `Bearer ${this.token}` }
})
console.log(res.data.data)
this.recordsList = res.data.data
console.log('开箱子记录', res.data.data)
},
//
@ -302,7 +336,11 @@ export default {
oInput.style.display = "none";
this.$message.success("Copy succeeded");
},
//
recordsHandleClose() {
this.recordsDialogVisible = false
},
},
};
</script>
@ -677,5 +715,76 @@ export default {
margin-top: 20px;
}
}
.records-dialog {
::v-deep .el-dialog {
border: 1px solid #924df2;
box-shadow: 0px 0px 20px #924df2;
background: #1a1821;
border-radius: 50px;
padding: 30px 50px;
.el-dialog__header {
padding: 0;
}
.el-dialog__body {
.top {
display: flex;
position: relative;
.top-title {
color: #fff;
font-size: 28px;
font-family: "Anton-Regular";
}
.top-close {
position: absolute;
top: -30px;
right: -20px;
width: 60px;
height: 60px;
background: #f6f6f6;
}
}
.content {
margin: 20px 0;
.el-table {
background: #1a1821;
.el-table__header-wrapper {
border-radius: 20px;
.el-table__header {
tr {
background: #1a1821;
overflow: hidden;
.el-table__cell {
border: 0px;
background: #2d2738;
color: #fff;
}
.el-table__cell:last-child {
border-radius: 0 20px 20px 0 !important;
}
}
}
}
.el-table__body-wrapper {
.el-table__body {
.el-table__row {
background: #1a1821;
.el-table__cell {
color: #fff;
}
}
}
}
&::before {
background: #1a1821;
}
}
}
.btm {
color: #fff;
}
}
}
}
}
</style>

View File

@ -64,21 +64,25 @@ export default {
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){
console.log(id)
let result = await sendExplore(myAddress, id)
if(result) {
console.log(id)
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()
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)
}
}, 2000)
}
} catch(e) {
this.$message.error(e.message)
}
}
} else {
this.$message.error('Get the number of explorations')

View File

@ -730,7 +730,6 @@ export default {
if (!localStorage.getItem(storeageKey)) {
try {
const chainRes = await sendClaimTask(address, id)
console.log(chainRes)
if (chainRes && chainRes.transactionHash) {
localStorage.setItem(storeageKey, chainRes.transactionHash)
}
@ -789,17 +788,21 @@ export default {
//
async walletCheck() {
let address = localStorage.getItem("myAddress")
console.log(await isWalletConnected())
if(await isWalletConnected()) {
if(address) {
let resChain = await sendDailyCheckIn(address);
if (resChain) {
let serTimeId = setInterval(async () => {
if(await this.getUsercheckin()) {
this.getGameStat();
clearInterval(serTimeId)
}
}, 2000)
try{
let resChain = await sendDailyCheckIn(address);
if (resChain) {
let serTimeId = setInterval(async () => {
if(await this.getUsercheckin()) {
this.getGameStat();
clearInterval(serTimeId)
}
}, 2000)
}
} catch(e) {
console.log(e)
this.$message.error(e.message)
}
} else {
this.walletDialogVisible = true