新增nft合作人机验证
This commit is contained in:
parent
780384d0d5
commit
d4f136c1ac
7
package-lock.json
generated
7
package-lock.json
generated
@ -19,7 +19,6 @@
|
||||
"js-cookie": "^3.0.5",
|
||||
"moment": "^2.30.1",
|
||||
"postcss-px-to-viewport": "^1.1.1",
|
||||
"source-map-loader": "^5.0.0",
|
||||
"swiper": "^5.4.5",
|
||||
"vue": "^2.6.14",
|
||||
"vue-gtag": "^1.16.1",
|
||||
@ -41,6 +40,7 @@
|
||||
"eslint-plugin-vue": "^8.0.3",
|
||||
"sass": "^1.32.7",
|
||||
"sass-loader": "^12.0.0",
|
||||
"source-map-loader": "^5.0.0",
|
||||
"vue-template-compiler": "^2.6.14"
|
||||
}
|
||||
},
|
||||
@ -11449,7 +11449,8 @@
|
||||
"node_modules/safer-buffer": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmmirror.com/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/sass": {
|
||||
"version": "1.74.1",
|
||||
@ -11932,6 +11933,7 @@
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/source-map-loader/-/source-map-loader-5.0.0.tgz",
|
||||
"integrity": "sha512-k2Dur7CbSLcAH73sBcIkV5xjPV4SzqO1NJ7+XaQl8if3VODDUj3FNchNGpqgJSKbvUfJuhVdv8K2Eu8/TNl2eA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"iconv-lite": "^0.6.3",
|
||||
"source-map-js": "^1.0.2"
|
||||
@ -11951,6 +11953,7 @@
|
||||
"version": "0.6.3",
|
||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
|
||||
"integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"safer-buffer": ">= 2.1.2 < 3.0.0"
|
||||
},
|
||||
|
@ -26,6 +26,7 @@
|
||||
property="twitter:image"
|
||||
content="https://pbs.twimg.com/media/GLITHinbUAA1N8p?format=jpg&name=large"
|
||||
/>
|
||||
<script src="https://www.google.com/recaptcha/enterprise.js?render=explicit" async defer></script>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>
|
||||
@ -41,7 +42,6 @@
|
||||
gtag('config', 'G-4KSHDJ3MGL');
|
||||
</script>
|
||||
<!-- built files will be auto injected -->
|
||||
<!-- <script src="https://www.google.com/recaptcha/api.js?render=6Ld3xoIpAAAAABW7f5ImgAC6GcWLeDCbt5HPXqe2"></script> -->
|
||||
<script th:inline="javascript">
|
||||
/**
|
||||
* 加载外部js
|
||||
|
@ -60,6 +60,14 @@ let errmsg = err
|
||||
errmsg = "Verification failed due to high traffic. Please attempt to verify again or try later"
|
||||
} else if(errmsg.indexOf('already claimed') > -1) {
|
||||
errmsg = "Already received"
|
||||
} else if(errmsg.indexOf('Complete CAPTCHA verification to verify you are not a robot') > -1) {
|
||||
errmsg = "Complete CAPTCHA verification to verify you are not a robot"
|
||||
} else if(errmsg.indexOf('Verification Successful') > -1) {
|
||||
errmsg = "Verification Successful"
|
||||
} else if(errmsg.indexOf('Verification Timeout') > -1) {
|
||||
errmsg = "Verification Timeout"
|
||||
} else if(errmsg.indexOf('Verification Error') > -1) {
|
||||
errmsg = "Verification Error"
|
||||
} else if(errmsg.indexOf('You have already boosted the chest') > -1
|
||||
|| errmsg.indexOf('The chest’s boost count has reached the upper limit') > -1
|
||||
|| errmsg.indexOf('Today’s boost count has been exhausted') > -1) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
// const version = require('./package.json').version
|
||||
|
||||
const marketVersion = '1.0.6'
|
||||
const marketVersion = '1.0.7'
|
||||
export default marketVersion
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<el-button class="mybtn"
|
||||
:loading="timeLeft > 0"
|
||||
@click.stop="checkBtn">
|
||||
@click="checkBtn">
|
||||
{{ timeLeft > 0 ? timeLeft + 's' : title }}
|
||||
</el-button>
|
||||
</template>
|
||||
@ -13,6 +13,7 @@ export default {
|
||||
title: String,
|
||||
time: String,
|
||||
itemData: Object,
|
||||
clickAmount: Number
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@ -29,19 +30,25 @@ scoreBonus: 10, // 助力增加的分数
|
||||
bonusCount: 2, // 已助力次数
|
||||
}]
|
||||
},
|
||||
|
||||
nftCliLength: [],
|
||||
}
|
||||
},
|
||||
|
||||
complete: {
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
|
||||
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) {
|
||||
} else
|
||||
if(errcode == 10) {
|
||||
this.$showErr(errmsg)
|
||||
this.beginCountdown()
|
||||
} else if(errcode == 13) {
|
||||
|
@ -25,7 +25,7 @@
|
||||
<div>Rewards</div>
|
||||
</div>
|
||||
<div class="nft-list">
|
||||
<li v-for="(item, index) in nftsList" :key="index">
|
||||
<li v-for="(item, index) in nftsList" :key="index" @click="chickNftClaimAmount">
|
||||
<div class="quest-item">
|
||||
<div class="content-rewards-left">
|
||||
<div class="img-logo">
|
||||
@ -56,14 +56,17 @@
|
||||
</div>
|
||||
<div v-if="token != null" class="btn">
|
||||
<div class="is-btn">
|
||||
<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">
|
||||
<div v-if="idRecaptchaId" class="check-no">
|
||||
<span>Verify</span>
|
||||
</div> -->
|
||||
</div>
|
||||
<div v-else>
|
||||
<NftCheckBtn v-if="item.status == 0" title="Verify" time="5" :itemData="item" :clickAmount="clickAmount" @checkNft="chickNftClaim" @toNavIndex="toNavIndex">Verify</NftCheckBtn>
|
||||
<div v-if="item.status == 1" class="check-yes">
|
||||
<img src="@/assets/home/check-yes.png" alt />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="light-btn" v-else @click="onWalletLogin">Connect Wallet</div>
|
||||
</div>
|
||||
@ -72,6 +75,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div ref="demo" id="iframe" class="verification_box"></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -95,6 +99,9 @@ export default {
|
||||
token: '',
|
||||
time: 10,
|
||||
timeLeft: 0,
|
||||
clickAmount: 0,
|
||||
idRecaptchaId: false,
|
||||
recaptchaId: null,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@ -104,6 +111,7 @@ export default {
|
||||
this.getNftList()
|
||||
},
|
||||
methods() {
|
||||
this.handleLoadGoogleCaptcha();
|
||||
},
|
||||
methods: {
|
||||
onWalletLogin() {
|
||||
@ -187,14 +195,63 @@ export default {
|
||||
toNavIndex() {
|
||||
this.$emit('toNavIndex')
|
||||
},
|
||||
beginCountdown(step) {
|
||||
this.timeLeft = parseInt(step);
|
||||
let timer = setInterval(() => {
|
||||
this.timeLeft--;
|
||||
if (this.timeLeft <= 0) {
|
||||
clearInterval(timer);
|
||||
chickNftClaimAmount() {
|
||||
this.clickAmount++
|
||||
if(this.clickAmount == 4) {
|
||||
this.$refs.demo.style.display = 'block'
|
||||
this.$showErr('Complete CAPTCHA verification to verify you are not a robot')
|
||||
this.handleLoadGoogleCaptcha()
|
||||
} else {
|
||||
this.$refs.demo.style.display = 'none'
|
||||
}
|
||||
}, 1000);
|
||||
},
|
||||
handleLoadGoogleCaptcha() {
|
||||
if(this.recaptchaId) {
|
||||
grecaptcha.enterprise.reset(this.recaptchaId)
|
||||
} else {
|
||||
// /* eslint-disable */
|
||||
this.idRecaptchaId = true
|
||||
this.recaptchaId = grecaptcha.enterprise.render(this.$refs.demo, {
|
||||
//在Google greCaptcha网站获取的Site Key
|
||||
"sitekey": "6LchWcopAAAAAGLVh8COKPY4TktIIyXuRiNZEMvw",
|
||||
//主题
|
||||
"theme": "light",
|
||||
// 设置尺寸
|
||||
'size': 'normal',
|
||||
//验证成功后的回调函数
|
||||
"callback": this.handleCaptchaCallback,
|
||||
//验证码超时后的回调函数
|
||||
"expired-callback": this.handleCaptchaExpired,
|
||||
//验证失败时的回调函数
|
||||
"error-callback": this.handleCaptchaError,
|
||||
//默认语言 默认是英语,简体中文写zh-CN 如果有其他需要请自行搜索
|
||||
// "hl": this.$i18n.locale
|
||||
// "Preference": '1212'
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 验证成功
|
||||
handleCaptchaCallback(val) {
|
||||
if(val) {
|
||||
this.clickAmount = 0
|
||||
this.idRecaptchaId = false
|
||||
this.$showErr('Verification Successful')
|
||||
this.$refs.demo.style.display = 'none'
|
||||
grecaptcha.enterprise.reset(this.recaptchaId)
|
||||
}
|
||||
},
|
||||
|
||||
// 验证超时
|
||||
handleCaptchaExpired() {
|
||||
grecaptcha.enterprise.reset(this.recaptchaId)
|
||||
this.$showErr('Verification Timeout')
|
||||
},
|
||||
|
||||
// 验证错误
|
||||
handleCaptchaError() {
|
||||
grecaptcha.enterprise.reset(this.recaptchaId)
|
||||
this.$showErr('Verification Error')
|
||||
},
|
||||
},
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user