修改nft合作方领取冷却时间

This commit is contained in:
yuyongdong 2024-04-28 13:20:46 +08:00
parent d4d0054289
commit f371007b8b
4 changed files with 129 additions and 48 deletions

View File

@ -1,4 +1,4 @@
// const version = require('./package.json').version
const marketVersion = '1.0.4'
const marketVersion = '1.0.6'
export default marketVersion

View File

@ -1135,14 +1135,21 @@ export default {
},
// Twitter || Discord
toReconnection(val) {
if(val.task == "DiscordConnect" || val.task == "TwitterConnect") {
if(val.task == "DiscordConnect") {
this.activeList.forEach(item => {
if(item.task == "DiscordConnect") {
item.status = 0
} else if(val.task == "TwitterConnect") {
item.status = 0
} else {
if(item.task !== "DiscordConnect") {
return
} else {
item.status = 0
}
});
}
if(val.task == "TwitterConnect") {
this.activeList.forEach(item => {
if(item.task != "TwitterConnect") {
return
} else {
item.status = 0
}
});
}
@ -1150,7 +1157,7 @@ export default {
//
async getActivitrStatue(id) {
await apiCheckActivity(id);
await this.getProgress();
// await this.getProgress();
},
async loginTwitter(id) {
// const _address = "0x8c10Ae04BF525734eaC00d5F7c062567461c207F";

View File

@ -0,0 +1,101 @@
<template>
<el-button class="mybtn"
:loading="timeLeft > 0"
@click.stop="checkBtn">
{{ timeLeft > 0 ? timeLeft + 's' : title }}
</el-button>
</template>
<script>
import { apiClaimNft } from '@/utils/webapi.js'
export default {
props: {
title: String,
time: String,
itemData: Object,
},
data() {
return {
timeLeft: 0,
aaa: {
chests:[{
id: 1, // id
stat: 0, // 0: , 1: , 2: , , 9:
shareCode: '箱子的分享码',
level: 1, //
maxBonus: 10, //
scoreInit: 5, //
scoreBonus: 10, //
bonusCount: 2, //
}]
},
}
},
methods: {
async checkBtn(){
let discordId = this.$store.state.user.userData?.discordId || undefined
if(discordId) {
try {
let { errcode, errmsg, data } = await apiClaimNft(this.itemData.contract);
if (!errcode) {
this.$emit('checkNft', data)
} else if(errcode == 10) {
this.$showErr(errmsg)
this.beginCountdown()
} else if(errcode == 13) {
this.$showErr(`${errmsg}`)
this.beginCountdown()
} else if(errcode == 14) {
if(this.itemData.guild !== '930002266868555827') {
this.$showErr(`You do not hold the required role in the '${this.itemData.projectName}' Discord server`)
} else {
this.$showErr(`You do not hold the required role in the 'Counter Fire' Discord server`)
}
this.beginCountdown()
} else if(errcode == 20) {
this.$showErr(errmsg)
this.beginCountdown()
} else if(errcode == 21) {
if(this.itemData.guild !== '930002266868555827') {
this.$showErr(`You do not hold the required role in the '${this.itemData.projectName}' Discord server`)
} else {
this.$showErr(`You do not hold the required role in the 'Counter Fire' Discord server`)
}
this.beginCountdown()
}
} catch (err) {
this.beginCountdown()
// this.$message.error(`claim partner reward error: ${err}`);
}
} else {
this.$emit('toNavIndex')
this.$showErr('need connect discord first')
}
},
beginCountdown() {
this.timeLeft = parseInt(this.time);
let timer = setInterval(() => {
this.timeLeft--;
if (this.timeLeft <= 0) {
// this.$showErr("Please try again");
clearInterval(timer);
}
}, 1000);
}
},
}
</script>
<style lang="scss" scoped>
.el-button {
border: 0px;
background: #fec25d;
color: #000;
padding: 5px 10px;
font-weight: 400;
border-radius: 20px;
font-size: 12px;
}
</style>

View File

@ -56,9 +56,10 @@
</div>
<div v-if="token != null" class="btn">
<div class="is-btn">
<div v-if="item.status == 0" class="check-no" @click.stop="chickNftClaim(item)">
<NftCheckBtn v-if="item.status == 0" title="Verify" time="5" :itemData="item" @checkNft="chickNftClaim" @toNavIndex="toNavIndex">Verify</NftCheckBtn>
<!-- <div v-if="item.status == 0" class="check-no">
<span>Verify</span>
</div>
</div> -->
<div v-if="item.status == 1" class="check-yes">
<img src="@/assets/home/check-yes.png" alt />
</div>
@ -77,12 +78,16 @@
<script>
import { getToken } from "@/utils/cookies.js";
import { apiNftList, apiVoucherClaim, apiClaimNft } from '@/utils/webapi.js'
import NftCheckBtn from './nftCheckBtn.vue'
const BASE52_ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
const isValidVoucherCode = (str) => {
let reg = new RegExp(`^[${BASE52_ALPHABET}]{12}$`)
return reg.test(str)
}
export default {
components: {
NftCheckBtn,
},
data() {
return {
checkCodeInput: '',
@ -175,44 +180,12 @@ export default {
},
// NFT holder
async chickNftClaim(itemData) {
let discordId = this.$store.state.user.userData?.discordId || undefined
const nextAction = function(){
this.$emit('toNavIndex')
}
if(discordId) {
try {
let { errcode, errmsg, data } = await apiClaimNft(itemData.contract);
if (!errcode) {
this.getNftList()
this.$emit('awardDialog',data)
} else if(errcode == 10) {
this.$showErr(errmsg)
} else if(errcode == 13) {
this.$showErr(`${errmsg}`)
} else if(errcode == 14) {
if(itemData.guild !== '930002266868555827') {
this.$showErr(`You do not hold the required role in the '${itemData.projectName}' Discord server`)
} else {
this.$showErr(`You do not hold the required role in the 'Counter Fire' Discord server`)
}
} else if(errcode == 20) {
this.$showErr(errmsg)
} else if(errcode == 21) {
// this.$showErr(errmsg, nextAction)
if(itemData.guild !== '930002266868555827') {
this.$showErr(`You do not hold the required role in the '${itemData.projectName}' Discord server`)
} else {
this.$showErr(`You do not hold the required role in the 'Counter Fire' Discord server`)
}
}
} catch (err) {
// this.$message.error(`claim partner reward error: ${err}`);
}
} else {
this.$emit('toNavIndex')
this.$showErr('need connect discord first')
}
async chickNftClaim(data) {
this.getNftList()
this.$emit('awardDialog', data)
},
toNavIndex() {
this.$emit('toNavIndex')
},
beginCountdown(step) {
this.timeLeft = parseInt(step);