取消社媒任务Gas费、新增弹窗

This commit is contained in:
yuyongdong 2024-04-20 02:50:16 +08:00
parent 89b1af7926
commit 25487b41c8
6 changed files with 115 additions and 62 deletions

View File

@ -1,45 +1,47 @@
<template>
<el-button class="mybtn" :loading="timeLeft > 0" @click.stop="beginAction">{{ timeLeft > 0 ? timeLeft + 's' : title }}</el-button>
<el-button
class="mybtn"
:loading="timeLeft > 0"
@click.stop="beginAction"
>{{ timeLeft > 0 ? timeLeft + 's' : title }}</el-button>
</template>
<script>
import {
apiCheckActivity,
} from "@/utils/webapi.js";
import { apiCheckActivity } from "@/utils/webapi.js";
export default {
props: {
title: String,
time: String,
dataid: String
itemData: Object
},
data() {
return {
timeLeft: 0,
}
timeLeft: 0
};
},
computed: {
},
methods: {
async beginAction() {
try {
let { errcode, errmsg, data } = await apiCheckActivity(this.dataid);
let { errcode, errmsg, data } = await apiCheckActivity(
this.itemData.id
);
if (errcode !== 0) {
if(errmsg == 'twitter already binded') {
this.$showErr('twitter already binded')
} else if(errmsg == 'discord already binded to another account') {
this.$showErr('discord already binded to another account')
if (errmsg == "twitter already binded") {
this.$showErr("twitter already binded");
} else if (errmsg == "discord already binded to another account") {
this.$showErr("discord already binded to another account");
} else {
this.beginCountdown();
this.$showErr('Please try again')
}
return;
}
if (data.status === 2) {
this.$emit('stateupdate', data.status);
this.$emit("stateupdate", data.status);
return;
// } else if(data.status === 1) {
// this.$showErr('Please try again')
}
this.beginCountdown();
} catch (err) {
this.beginCountdown();
}
@ -49,42 +51,41 @@ export default {
let timer = setInterval(() => {
this.timeLeft--;
if (this.timeLeft <= 0) {
this.$showErr('Please try again')
this.$showErr("Please try again");
clearInterval(timer);
}
}, 1000);
}
}
}
};
</script>
<style lang="scss" scoped>
.mybtn{
.mybtn {
width: 90px;
height: 30px;
line-height: 0!important;
line-height: 0 !important;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50% , -50%);
transform: translate(-50%, -50%);
background: #fec25d;
background: url('@/assets/home/ButtonFollow.png') no-repeat;
background: url("@/assets/home/ButtonFollow.png") no-repeat;
background-size: 100% 100%;
color: unset;
border: none;
}
.mybtn:disabled{
color:unset;
.mybtn:disabled {
color: unset;
border: none;
line-height: 0!important;
line-height: 0 !important;
}
.mybtn.is-loading:before{
.mybtn.is-loading:before {
background-color: unset;
}
</style>
<style lang="scss">
.mybtn .el-icon-loading{
line-height: 0!important;
.mybtn .el-icon-loading {
line-height: 0 !important;
}
</style>

View File

@ -52,9 +52,19 @@ let errmsg = err
errmsg = 'This X account has already been linked'
} else if(errmsg.indexOf('discord already binded to another account') > -1) {
errmsg = 'This Discord account has already been linked'
} else if(errmsg.indexOf("Please complete the 'Connect Your X' quest first") > -1) {
errmsg = "Please complete the 'Connect Your X' quest first"
} else if(errmsg.indexOf("Please complete the 'Connect Your Discord' quest first") > -1) {
errmsg = "Please complete the 'Connect Your Discord' quest first"
} else if(errmsg.indexOf("maintance now, please try later") > -1) {
errmsg = "maintance now, please try later"
} else if(errmsg.indexOf("Delabs Game") > -1) {
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 click 'Connect' to try verifying again, or attempt later"
} else {
// 请重试
errmsg = 'Please try again'
errmsg = 'Unknown on-chain interaction issue. Please try again'
}
const _confirm = new iErrorMessage({

View File

@ -40,7 +40,7 @@ const actions = {
// mutations
const mutations = {
updateAddress(state, _address) {
console.info('update address: ', _address)
// console.info('update address: ', _address)
state.address = _address
},
updateChain(state, _chainId) {
@ -55,7 +55,7 @@ const mutations = {
state.logined = _status
},
updateUserData(state, _data) {
console.info(_data)
// console.info(_data)
state.userData = { ...state.userData, ..._data }
}
}

View File

@ -79,7 +79,7 @@
<span v-if="boxData.level == 1">COMMON</span>
<span v-else-if="boxData.level == 2">RARE</span>
<span v-else-if="boxData.level == 3">MYTHICAL</span>
<span v-else-if="boxData.level == 4">LEGENDAR</span>
<span v-else-if="boxData.level == 4">LEGENDAY</span>
</div>
</div>
<div class="box-btm-con-img">

View File

@ -222,7 +222,7 @@
<CheckBtn
v-if="item.status == 1"
@stateupdate="toCheck"
:dataid="item.id"
:itemData="item"
time="5"
title="Verify"
class="started"
@ -795,6 +795,12 @@ export default {
usesInviteCount() {
return this.$store.state.user.userData?.inviteCount || 0
},
usesDiscordId() {
return this.$store.state.user.userData?.discordId || undefined;
},
usesTwitterId() {
return this.$store.state.user.userData?.twitterId || undefined;
},
},
created() {
this.userData = JSON.parse(localStorage.getItem("userData"));
@ -892,15 +898,42 @@ export default {
if (data.task == "TwitterConnect") {
await this.loginTwitter(data.id);
} else if(data.task == "TwitterFollow") {
followTwitter(data.cfg.account)
//todo: panduan twitter id
if (!this.usesTwitterId) {
this.$showErr("Please complete the 'Connect Your X' quest first");
} else {
followTwitter(data.cfg.account)
}
} else if(data.task == "TwitterLike") {
window.open(`https://twitter.com/intent/like?tweet_id=${data.cfg.content}`, '_blank');
//todo: panduan twitter id
if (!this.usesTwitterId) {
this.$showErr("Please complete the 'Connect Your X' quest first");
} else {
window.open(`https://twitter.com/intent/like?tweet_id=${data.cfg.content}`, '_blank');
}
} else if(data.task == "TwitterTweet") {
followTwitter(data.cfg.content)
//todo: panduan twitter id
if (!this.usesTwitterId) {
this.$showErr("Please complete the 'Connect Your X' quest first");
} else {
followTwitter(data.cfg.content)
}
} else if(data.task == "TwitterRetweet") {
window.open(`https://twitter.com/intent/retweet?tweet_id=${data.cfg.content}`, '_blank');
//todo: panduan twitter id
if (!this.usesTwitterId) {
this.$showErr("Please complete the 'Connect Your X' quest first");
} else {
window.open(`https://twitter.com/intent/retweet?tweet_id=${data.cfg.content}`, '_blank');
}
} else if(data.task == "DiscordJoin") {
joinDiscord(data.cfg.account)
//todo: panduan dc id
if (!this.usesDiscordId) {
this.$showErr(
"Please complete the 'Connect Your Discord' quest first"
);
} else {
joinDiscord(data.cfg.account)
}
} else if (data.task == "DiscordConnect") {
this.loginDiscord()
}
@ -955,21 +988,21 @@ export default {
},
//
async getTaskClaim(id) {
let address = this.$store.state.user.address;
if (!this.$store.state.wallet.connected || !address) {
this.walletDialogVisible = true;
return;
}
this.isLoading = true;
let storeageKey;
try {
storeageKey = await sendToChain("task_claim", address, id);
} catch (err) {
this.isLoading = false;
this.$showErr(err);
return;
}
let serTimeId = setInterval(async () => {
// let address = this.$store.state.user.address;
// if (!this.$store.state.wallet.connected || !address) {
// this.walletDialogVisible = true;
// return;
// }
// this.isLoading = true;
// let storeageKey;
// try {
// storeageKey = await sendToChain("task_claim", address, id);
// } catch (err) {
// this.isLoading = false;
// this.$showErr(err);
// return;
// }
// let serTimeId = setInterval(async () => {
try {
let { errcode, errmsg, data } = await apiTaskClaim(id);
if (errcode) {
@ -978,30 +1011,29 @@ export default {
this.isLoading = false
// this.$message.error(errmsg)
this.getActivitrStatue(id)
clearInterval(serTimeId)
// clearInterval(serTimeId)
} else if (errcode !== 14) {
// ,
this.isLoading = false
// this.$message.error(errmsg)
clearInterval(serTimeId)
// clearInterval(serTimeId)
}
} else {
if (data?.status == 3) {
console.log(data ,'这里')
// alert(`, : ${data.score}`)
this.isLoading = false;
this.activityDialog(data);
this.getActivitrStatue(id);
this.getUserState();
localStorage.removeItem(storeageKey);
clearInterval(serTimeId);
// localStorage.removeItem(storeageKey);
// clearInterval(serTimeId);
}
}
} catch (err) {
this.isLoading = false
// this.$message.error(`claim task reward error: ${err}`)
}
}, 3000);
// }, 3000);
},
//

View File

@ -156,16 +156,26 @@ export default {
if (!errcode) {
this.getNftList()
this.$emit('awardDialog',data)
} else if(errcode == 10 || errcode == 20) {
} else if(errcode == 10) {
this.$showErr(errmsg)
} else if(errcode == 13) {
this.$showErr(`${errmsg}`)
} else if(errcode == 14) {
if(itemData.contract == 'INK') {
this.$showErr("You do not hold the required role in the 'Ink' Discord server")
} else if(itemData.projectName == "Delabs Games") {
this.$showErr(`${itemData.projectName}`)
} else {
this.$showErr("had no role")
}
} else if(errcode == 20) {
this.$showErr(errmsg)
} else if(errcode == 21) {
// this.$showErr(errmsg, nextAction)
if(itemData.contract == 'INK') {
this.$showErr("You do not hold the required role in the 'Ink' Discord server")
} else if(itemData.projectName == "Delabs Games") {
this.$showErr(`${itemData.projectName}`)
} else {
this.$showErr("You do not hold the required role in the 'Counter Fire' Discord server")
this.$emit('toNavIndex')