新增nft合作人机验证

This commit is contained in:
yuyongdong 2024-04-29 19:39:47 +08:00
parent 780384d0d5
commit d4f136c1ac
6 changed files with 95 additions and 20 deletions

7
package-lock.json generated
View File

@ -19,7 +19,6 @@
"js-cookie": "^3.0.5", "js-cookie": "^3.0.5",
"moment": "^2.30.1", "moment": "^2.30.1",
"postcss-px-to-viewport": "^1.1.1", "postcss-px-to-viewport": "^1.1.1",
"source-map-loader": "^5.0.0",
"swiper": "^5.4.5", "swiper": "^5.4.5",
"vue": "^2.6.14", "vue": "^2.6.14",
"vue-gtag": "^1.16.1", "vue-gtag": "^1.16.1",
@ -41,6 +40,7 @@
"eslint-plugin-vue": "^8.0.3", "eslint-plugin-vue": "^8.0.3",
"sass": "^1.32.7", "sass": "^1.32.7",
"sass-loader": "^12.0.0", "sass-loader": "^12.0.0",
"source-map-loader": "^5.0.0",
"vue-template-compiler": "^2.6.14" "vue-template-compiler": "^2.6.14"
} }
}, },
@ -11449,7 +11449,8 @@
"node_modules/safer-buffer": { "node_modules/safer-buffer": {
"version": "2.1.2", "version": "2.1.2",
"resolved": "https://registry.npmmirror.com/safer-buffer/-/safer-buffer-2.1.2.tgz", "resolved": "https://registry.npmmirror.com/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
"dev": true
}, },
"node_modules/sass": { "node_modules/sass": {
"version": "1.74.1", "version": "1.74.1",
@ -11932,6 +11933,7 @@
"version": "5.0.0", "version": "5.0.0",
"resolved": "https://registry.npmjs.org/source-map-loader/-/source-map-loader-5.0.0.tgz", "resolved": "https://registry.npmjs.org/source-map-loader/-/source-map-loader-5.0.0.tgz",
"integrity": "sha512-k2Dur7CbSLcAH73sBcIkV5xjPV4SzqO1NJ7+XaQl8if3VODDUj3FNchNGpqgJSKbvUfJuhVdv8K2Eu8/TNl2eA==", "integrity": "sha512-k2Dur7CbSLcAH73sBcIkV5xjPV4SzqO1NJ7+XaQl8if3VODDUj3FNchNGpqgJSKbvUfJuhVdv8K2Eu8/TNl2eA==",
"dev": true,
"dependencies": { "dependencies": {
"iconv-lite": "^0.6.3", "iconv-lite": "^0.6.3",
"source-map-js": "^1.0.2" "source-map-js": "^1.0.2"
@ -11951,6 +11953,7 @@
"version": "0.6.3", "version": "0.6.3",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
"integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
"dev": true,
"dependencies": { "dependencies": {
"safer-buffer": ">= 2.1.2 < 3.0.0" "safer-buffer": ">= 2.1.2 < 3.0.0"
}, },

View File

@ -26,6 +26,7 @@
property="twitter:image" property="twitter:image"
content="https://pbs.twimg.com/media/GLITHinbUAA1N8p?format=jpg&name=large" 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> </head>
<body> <body>
<noscript> <noscript>
@ -41,7 +42,6 @@
gtag('config', 'G-4KSHDJ3MGL'); gtag('config', 'G-4KSHDJ3MGL');
</script> </script>
<!-- built files will be auto injected --> <!-- built files will be auto injected -->
<!-- <script src="https://www.google.com/recaptcha/api.js?render=6Ld3xoIpAAAAABW7f5ImgAC6GcWLeDCbt5HPXqe2"></script> -->
<script th:inline="javascript"> <script th:inline="javascript">
/** /**
* 加载外部js * 加载外部js

View File

@ -60,6 +60,14 @@ let errmsg = err
errmsg = "Verification failed due to high traffic. Please attempt to verify again or try later" errmsg = "Verification failed due to high traffic. Please attempt to verify again or try later"
} else if(errmsg.indexOf('already claimed') > -1) { } else if(errmsg.indexOf('already claimed') > -1) {
errmsg = "Already received" 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 } else if(errmsg.indexOf('You have already boosted the chest') > -1
|| errmsg.indexOf('The chests boost count has reached the upper limit') > -1 || errmsg.indexOf('The chests boost count has reached the upper limit') > -1
|| errmsg.indexOf('Todays boost count has been exhausted') > -1) { || errmsg.indexOf('Todays boost count has been exhausted') > -1) {

View File

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

View File

@ -1,7 +1,7 @@
<template> <template>
<el-button class="mybtn" <el-button class="mybtn"
:loading="timeLeft > 0" :loading="timeLeft > 0"
@click.stop="checkBtn"> @click="checkBtn">
{{ timeLeft > 0 ? timeLeft + 's' : title }} {{ timeLeft > 0 ? timeLeft + 's' : title }}
</el-button> </el-button>
</template> </template>
@ -13,6 +13,7 @@ export default {
title: String, title: String,
time: String, time: String,
itemData: Object, itemData: Object,
clickAmount: Number
}, },
data() { data() {
return { return {
@ -29,19 +30,25 @@ scoreBonus: 10, // 助力增加的分数
bonusCount: 2, // bonusCount: 2, //
}] }]
}, },
nftCliLength: [],
} }
}, },
complete: {
},
mounted() {
},
methods: { methods: {
async checkBtn(){ async checkBtn(){
let discordId = this.$store.state.user.userData?.discordId || undefined let discordId = this.$store.state.user.userData?.discordId || undefined
if(discordId) { if(discordId) {
try { try {
let { errcode, errmsg, data } = await apiClaimNft(this.itemData.contract); let { errcode, errmsg, data } = await apiClaimNft(this.itemData.contract);
if (!errcode) { if (!errcode) {
this.$emit('checkNft', data) this.$emit('checkNft', data)
} else if(errcode == 10) { } else
if(errcode == 10) {
this.$showErr(errmsg) this.$showErr(errmsg)
this.beginCountdown() this.beginCountdown()
} else if(errcode == 13) { } else if(errcode == 13) {

View File

@ -25,7 +25,7 @@
<div>Rewards</div> <div>Rewards</div>
</div> </div>
<div class="nft-list"> <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="quest-item">
<div class="content-rewards-left"> <div class="content-rewards-left">
<div class="img-logo"> <div class="img-logo">
@ -56,14 +56,17 @@
</div> </div>
<div v-if="token != null" class="btn"> <div v-if="token != null" class="btn">
<div class="is-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="idRecaptchaId" class="check-no">
<!-- <div v-if="item.status == 0" class="check-no">
<span>Verify</span> <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"> <div v-if="item.status == 1" class="check-yes">
<img src="@/assets/home/check-yes.png" alt /> <img src="@/assets/home/check-yes.png" alt />
</div> </div>
</div> </div>
</div>
</div> </div>
<div class="light-btn" v-else @click="onWalletLogin">Connect Wallet</div> <div class="light-btn" v-else @click="onWalletLogin">Connect Wallet</div>
</div> </div>
@ -72,6 +75,7 @@
</div> </div>
</div> </div>
</div> </div>
<div ref="demo" id="iframe" class="verification_box"></div>
</div> </div>
</template> </template>
@ -95,6 +99,9 @@ export default {
token: '', token: '',
time: 10, time: 10,
timeLeft: 0, timeLeft: 0,
clickAmount: 0,
idRecaptchaId: false,
recaptchaId: null,
} }
}, },
computed: { computed: {
@ -104,6 +111,7 @@ export default {
this.getNftList() this.getNftList()
}, },
methods() { methods() {
this.handleLoadGoogleCaptcha();
}, },
methods: { methods: {
onWalletLogin() { onWalletLogin() {
@ -187,14 +195,63 @@ export default {
toNavIndex() { toNavIndex() {
this.$emit('toNavIndex') this.$emit('toNavIndex')
}, },
beginCountdown(step) { chickNftClaimAmount() {
this.timeLeft = parseInt(step); this.clickAmount++
let timer = setInterval(() => { if(this.clickAmount == 4) {
this.timeLeft--; this.$refs.demo.style.display = 'block'
if (this.timeLeft <= 0) { this.$showErr('Complete CAPTCHA verification to verify you are not a robot')
clearInterval(timer); 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 greCaptchaSite 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')
}, },
}, },
}; };