修改nft合作方领取冷却时间
This commit is contained in:
parent
d4d0054289
commit
f371007b8b
@ -1,4 +1,4 @@
|
||||
// const version = require('./package.json').version
|
||||
|
||||
const marketVersion = '1.0.4'
|
||||
const marketVersion = '1.0.6'
|
||||
export default marketVersion
|
@ -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";
|
||||
|
101
src/views/home/nftCheckBtn.vue
Normal file
101
src/views/home/nftCheckBtn.vue
Normal 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>
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user