活动结束弹窗提示
This commit is contained in:
parent
91e59bff21
commit
7268190873
@ -13,7 +13,8 @@ export default {
|
|||||||
props: {
|
props: {
|
||||||
title: String,
|
title: String,
|
||||||
time: String,
|
time: String,
|
||||||
itemData: Object
|
itemData: Object,
|
||||||
|
activityData: Object,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -24,6 +25,8 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async beginAction() {
|
async beginAction() {
|
||||||
|
console.log(this.activityData,'----')
|
||||||
|
return
|
||||||
try {
|
try {
|
||||||
let { errcode, errmsg, data } = await apiCheckActivity(
|
let { errcode, errmsg, data } = await apiCheckActivity(
|
||||||
this.itemData.id
|
this.itemData.id
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="confirm-box">
|
<div class="confirm-box">
|
||||||
<div class="confirm-context">{{message}}</div>
|
<div class="confirm-context" v-html="message">{{}}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="btn" @click="handleClose">Confirm</div>
|
<div class="btn" @click="handleClose">Confirm</div>
|
||||||
<!-- <div slot="footer" class="dialog-footer">
|
<!-- <div slot="footer" class="dialog-footer">
|
||||||
|
@ -90,6 +90,9 @@ let errmsg = err
|
|||||||
errmsg = `Your verification code has expired. Please request a new code.`
|
errmsg = `Your verification code has expired. Please request a new code.`
|
||||||
} else if(errmsg.indexOf('code error') > -1) {
|
} else if(errmsg.indexOf('code error') > -1) {
|
||||||
errmsg = `Verification code is incorrect. Please verify and try again.`
|
errmsg = `Verification code is incorrect. Please verify and try again.`
|
||||||
|
} else if(errmsg.indexOf('activity is end') > -1) {
|
||||||
|
errmsg = `This event has now concluded. Thank you for participating!</br>
|
||||||
|
Thank you for joining us! This event has officially ended.`
|
||||||
} 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 chest’s boost count has reached the upper limit') > -1
|
|| errmsg.indexOf('The chest’s boost count has reached the upper limit') > -1
|
||||||
|| errmsg.indexOf('Today’s boost count has been exhausted') > -1) {
|
|| errmsg.indexOf('Today’s boost count has been exhausted') > -1) {
|
||||||
|
@ -340,3 +340,13 @@ export const apiVerifyClient = async (code) => {
|
|||||||
const url = `${API_BASE}/api/user/verify_client`;
|
const url = `${API_BASE}/api/user/verify_client`;
|
||||||
return httpPost(url, {code})
|
return httpPost(url, {code})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 活动时间结束
|
||||||
|
export const endActivity = async (time) => {
|
||||||
|
var now = new Date().getTime();
|
||||||
|
if(time <= now) {
|
||||||
|
return false
|
||||||
|
} else {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -283,7 +283,7 @@
|
|||||||
import { getToken } from "./../../utils/cookies.js";
|
import { getToken } from "./../../utils/cookies.js";
|
||||||
import Pagination from "./../../components/pagination.vue";
|
import Pagination from "./../../components/pagination.vue";
|
||||||
import { sendOpenChest, sendToChain } from "./../../utils/chainapi.js";
|
import { sendOpenChest, sendToChain } from "./../../utils/chainapi.js";
|
||||||
import { apiBoxOpen } from "@/utils/webapi.js";
|
import { apiBoxOpen, endActivity } from "@/utils/webapi.js";
|
||||||
import PaginationDialog from "@/components/paginationDialog.vue";
|
import PaginationDialog from "@/components/paginationDialog.vue";
|
||||||
import Loading from "@/components/loading.vue";
|
import Loading from "@/components/loading.vue";
|
||||||
import UserImg from "@/components/userImg.vue";
|
import UserImg from "@/components/userImg.vue";
|
||||||
@ -296,6 +296,9 @@ export default {
|
|||||||
Loading,
|
Loading,
|
||||||
UserImg
|
UserImg
|
||||||
},
|
},
|
||||||
|
props: {
|
||||||
|
activityData: Object,
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
token: null,
|
token: null,
|
||||||
@ -434,50 +437,54 @@ export default {
|
|||||||
|
|
||||||
// 开宝箱
|
// 开宝箱
|
||||||
async openBoxToChain(id) {
|
async openBoxToChain(id) {
|
||||||
let address = this.$store.state.user.address;
|
if(endActivity(this.activityData.endTime)) {
|
||||||
if (!this.$store.state.wallet.connected || !address) {
|
this.$showErr('activity is end')
|
||||||
throw new Error("wallet not connected");
|
} else {
|
||||||
}
|
let address = this.$store.state.user.address;
|
||||||
let storeageKey;
|
if (!this.$store.state.wallet.connected || !address) {
|
||||||
this.isLoading = true;
|
throw new Error("wallet not connected");
|
||||||
try {
|
}
|
||||||
storeageKey = await sendToChain("chest_open", address, id);
|
let storeageKey;
|
||||||
} catch (err) {
|
this.isLoading = true;
|
||||||
this.$showErr(err);
|
|
||||||
this.isLoading = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let serTimeId = setInterval(async () => {
|
|
||||||
try {
|
try {
|
||||||
let { errcode, errmsg, data } = await apiBoxOpen(id);
|
storeageKey = await sendToChain("chest_open", address, id);
|
||||||
if (errcode) {
|
} catch (err) {
|
||||||
if (errcode !== 12) {
|
this.$showErr(err);
|
||||||
// 状态不是等待链上确认的, 都提示错误
|
this.isLoading = false;
|
||||||
// this.$message.error(errmsg)'
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let serTimeId = setInterval(async () => {
|
||||||
|
try {
|
||||||
|
let { errcode, errmsg, data } = await apiBoxOpen(id);
|
||||||
|
if (errcode) {
|
||||||
|
if (errcode !== 12) {
|
||||||
|
// 状态不是等待链上确认的, 都提示错误
|
||||||
|
// this.$message.error(errmsg)'
|
||||||
|
this.isLoading = false;
|
||||||
|
clearInterval(serTimeId);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// alert(`领取成功,显示奖励: ${JSON.stringify(data)}`)
|
||||||
|
if(this.currentPageItems.length == 1) {
|
||||||
|
if(this.currentPage > 1) {
|
||||||
|
this.onChangePage(this.currentPage-1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.boostingList = [];
|
||||||
|
this.getMyBoxList()
|
||||||
|
this.openBoxLog();
|
||||||
this.isLoading = false;
|
this.isLoading = false;
|
||||||
|
this.$emit("awardDialog", data);
|
||||||
|
localStorage.removeItem(storeageKey);
|
||||||
clearInterval(serTimeId);
|
clearInterval(serTimeId);
|
||||||
}
|
}
|
||||||
} else {
|
} catch (err) {
|
||||||
// alert(`领取成功,显示奖励: ${JSON.stringify(data)}`)
|
|
||||||
if(this.currentPageItems.length == 1) {
|
|
||||||
if(this.currentPage > 1) {
|
|
||||||
this.onChangePage(this.currentPage-1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.boostingList = [];
|
|
||||||
this.getMyBoxList()
|
|
||||||
this.openBoxLog();
|
|
||||||
this.isLoading = false;
|
this.isLoading = false;
|
||||||
this.$emit("awardDialog", data);
|
// this.$message.error(`claim task reward error: ${err}`)
|
||||||
localStorage.removeItem(storeageKey);
|
|
||||||
clearInterval(serTimeId);
|
|
||||||
}
|
}
|
||||||
} catch (err) {
|
}, 3000);
|
||||||
this.isLoading = false;
|
}
|
||||||
// this.$message.error(`claim task reward error: ${err}`)
|
|
||||||
}
|
|
||||||
}, 3000);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// 开箱子记录
|
// 开箱子记录
|
||||||
@ -532,20 +539,24 @@ export default {
|
|||||||
|
|
||||||
// 复制助力链接
|
// 复制助力链接
|
||||||
copyLink(data) {
|
copyLink(data) {
|
||||||
this.userData = JSON.parse(localStorage.getItem("userData"));
|
if(endActivity(this.activityData.endTime)) {
|
||||||
let url = `${location.protocol}//${location.host}/home/box=${data.shareCode}`;
|
this.$showErr('activity is end')
|
||||||
let oInput = document.createElement("input");
|
} else {
|
||||||
oInput.value = url;
|
this.userData = JSON.parse(localStorage.getItem("userData"));
|
||||||
document.body.appendChild(oInput);
|
let url = `${location.protocol}//${location.host}/home/box=${data.shareCode}`;
|
||||||
oInput.select();
|
let oInput = document.createElement("input");
|
||||||
document.execCommand("Copy");
|
oInput.value = url;
|
||||||
oInput.className = "oInput";
|
document.body.appendChild(oInput);
|
||||||
oInput.style.display = "none";
|
oInput.select();
|
||||||
this.$message.success("Copy succeeded");
|
document.execCommand("Copy");
|
||||||
let address_type = localStorage.getItem("myAddress");
|
oInput.className = "oInput";
|
||||||
this.$gtag.event("invite_new", {
|
oInput.style.display = "none";
|
||||||
address_type: address_type
|
this.$message.success("Copy succeeded");
|
||||||
});
|
let address_type = localStorage.getItem("myAddress");
|
||||||
|
this.$gtag.event("invite_new", {
|
||||||
|
address_type: address_type
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
antiShake: throttle(function(data) {
|
antiShake: throttle(function(data) {
|
||||||
@ -562,7 +573,7 @@ export default {
|
|||||||
|
|
||||||
// 去探索页面
|
// 去探索页面
|
||||||
toExplore() {
|
toExplore() {
|
||||||
this.$emit("toExplore", 1);
|
this.$emit("toExplore", 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getToken } from '@/utils/cookies.js'
|
import { getToken } from '@/utils/cookies.js'
|
||||||
import { apiCheckin, apiCheckinClaimLeak } from '@/utils/webapi.js'
|
import { apiCheckin, apiCheckinClaimLeak, endActivity } from '@/utils/webapi.js'
|
||||||
import { formatDate, getDayBegin } from '@/utils/utcdate.util.js'
|
import { formatDate, getDayBegin } from '@/utils/utcdate.util.js'
|
||||||
const ONE_DAY = 24 * 60 * 60 * 1000;
|
const ONE_DAY = 24 * 60 * 60 * 1000;
|
||||||
|
|
||||||
@ -97,10 +97,14 @@ export default {
|
|||||||
|
|
||||||
// 补领漏签
|
// 补领漏签
|
||||||
async getCheckinClaimLeak(days) {
|
async getCheckinClaimLeak(days) {
|
||||||
let res = await apiCheckinClaimLeak(days)
|
if(endActivity(this.activityData.endTime)) {
|
||||||
// let { errcode,errmsg} = res
|
this.$showErr('activity is end');
|
||||||
this.getCheckInit()
|
} else {
|
||||||
this.$emit('getCheckinLeak')
|
let res = await apiCheckinClaimLeak(days)
|
||||||
|
// let { errcode,errmsg} = res
|
||||||
|
this.getCheckInit()
|
||||||
|
this.$emit('getCheckinLeak')
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 签到后更新签到状态
|
// 签到后更新签到状态
|
||||||
|
@ -16,13 +16,14 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { apiGameClaim } from '@/utils/webapi.js'
|
import { apiGameClaim, endActivity } from '@/utils/webapi.js'
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
title: String,
|
title: String,
|
||||||
time: String,
|
time: String,
|
||||||
itemData: Object,
|
itemData: Object,
|
||||||
clickAmount: Number
|
clickAmount: Number,
|
||||||
|
activityData: Object,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -51,29 +52,33 @@ bonusCount: 2, // 已助力次数
|
|||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
async checkBtn(){
|
async checkBtn(){
|
||||||
this.isShow = false
|
if(endActivity(this.activityData.endTime)) {
|
||||||
let usesEmailId = this.$store.state.user.userData?.gameId || undefined
|
this.$showErr('activity is end')
|
||||||
if(usesEmailId) {
|
|
||||||
try {
|
|
||||||
let { errcode, errmsg, data } = await apiGameClaim(this.itemData.id);
|
|
||||||
if (!errcode) {
|
|
||||||
this.$emit('checkNft', data)
|
|
||||||
let address_type = localStorage.getItem("myAddress");
|
|
||||||
this.$gtag.event("games_event", {
|
|
||||||
address_type: address_type,
|
|
||||||
gems_task: this.itemData.task,
|
|
||||||
});
|
|
||||||
} else if(errcode == 50) {
|
|
||||||
this.$showErr(errmsg)
|
|
||||||
this.beginCountdown()
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
this.beginCountdown()
|
|
||||||
// this.$message.error(`claim partner reward error: ${err}`);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
this.isShow = true
|
this.isShow = false
|
||||||
this.$showErr('need connect game account first')
|
let usesEmailId = this.$store.state.user.userData?.gameId || undefined
|
||||||
|
if(usesEmailId) {
|
||||||
|
try {
|
||||||
|
let { errcode, errmsg, data } = await apiGameClaim(this.itemData.id);
|
||||||
|
if (!errcode) {
|
||||||
|
this.$emit('checkNft', data)
|
||||||
|
let address_type = localStorage.getItem("myAddress");
|
||||||
|
this.$gtag.event("games_event", {
|
||||||
|
address_type: address_type,
|
||||||
|
gems_task: this.itemData.task,
|
||||||
|
});
|
||||||
|
} else if(errcode == 50) {
|
||||||
|
this.$showErr(errmsg)
|
||||||
|
this.beginCountdown()
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
this.beginCountdown()
|
||||||
|
// this.$message.error(`claim partner reward error: ${err}`);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.isShow = true
|
||||||
|
this.$showErr('need connect game account first')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beginCountdown() {
|
beginCountdown() {
|
||||||
|
@ -60,8 +60,8 @@
|
|||||||
<span>Verify</span>
|
<span>Verify</span>
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<GameCheckBtn v-if="item.status == 0 || item.status == 1" title="Verify" time="5" :itemData="item" @checkNft="chickGameClaim" />
|
<GameCheckBtn v-if="item.status == 0 || item.status == 1" title="Verify" time="5" :activityData="activityData" :itemData="item" @checkNft="chickGameClaim" />
|
||||||
<GameCheckBtn class="" v-else-if="item.status == 2" title="Claim" time="5" :itemData="item" @checkNft="chickGameClaim" />
|
<GameCheckBtn class="" v-else-if="item.status == 2" title="Claim" time="5" :activityData="activityData" :itemData="item" @checkNft="chickGameClaim" />
|
||||||
<div v-if="item.status == 3" class="check-yes">
|
<div v-if="item.status == 3" class="check-yes">
|
||||||
+{{ item.score }}
|
+{{ item.score }}
|
||||||
<img src="./../../assets/common/Checkmark (1).png" alt />
|
<img src="./../../assets/common/Checkmark (1).png" alt />
|
||||||
@ -131,8 +131,8 @@
|
|||||||
<span>Verify</span>
|
<span>Verify</span>
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<GameCheckBtn v-if="item.status == 0 || item.status == 1" title="Verify" time="5" :itemData="item" @checkNft="chickGameClaim" />
|
<GameCheckBtn v-if="item.status == 0 || item.status == 1" title="Verify" time="5" :activityData="activityData" :itemData="item" @checkNft="chickGameClaim" />
|
||||||
<GameCheckBtn class="" v-else-if="item.status == 2" title="Claim" time="5" :itemData="item" @checkNft="chickGameClaim" />
|
<GameCheckBtn class="" v-else-if="item.status == 2" title="Claim" time="5" :activityData="activityData" :itemData="item" @checkNft="chickGameClaim" />
|
||||||
<!-- <div class="check-claim" v-if="item.status == 2">Claim</div> -->
|
<!-- <div class="check-claim" v-if="item.status == 2">Claim</div> -->
|
||||||
<div v-if="item.status == 3" class="check-yes">
|
<div v-if="item.status == 3" class="check-yes">
|
||||||
+{{ item.score }}
|
+{{ item.score }}
|
||||||
@ -153,7 +153,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import GameCheckBtn from './gameCheckBtn.vue'
|
import GameCheckBtn from './gameCheckBtn.vue'
|
||||||
import { getToken } from "@/utils/cookies.js";
|
import { getToken } from "@/utils/cookies.js";
|
||||||
import { apiGameTasks, apiGameClaim } from "@/utils/webapi.js"
|
import { apiGameTasks, apiGameClaim, endActivity } from "@/utils/webapi.js"
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
@ -189,6 +189,7 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
console.log(this.activityData)
|
||||||
this.token = getToken();
|
this.token = getToken();
|
||||||
this.getGameList()
|
this.getGameList()
|
||||||
},
|
},
|
||||||
@ -215,7 +216,11 @@ export default {
|
|||||||
this.$emit('awardDialog', data)
|
this.$emit('awardDialog', data)
|
||||||
},
|
},
|
||||||
toBindGoogle() {
|
toBindGoogle() {
|
||||||
this.$showErr('need connect game account first')
|
if(endActivity(this.activityData.endTime)) {
|
||||||
|
this.$showErr('activity is end')
|
||||||
|
} else {
|
||||||
|
this.$showErr('need connect game account first')
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 打开登录弹窗
|
// 打开登录弹窗
|
||||||
|
@ -118,7 +118,8 @@ import { sendToChain } from './../../utils/chainapi.js'
|
|||||||
import {
|
import {
|
||||||
checkReCaptcha,
|
checkReCaptcha,
|
||||||
apiUploadInviteCode,
|
apiUploadInviteCode,
|
||||||
apiEnhanceBox
|
apiEnhanceBox,
|
||||||
|
endActivity
|
||||||
} from "./../../utils/webapi.js";
|
} from "./../../utils/webapi.js";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -133,6 +134,7 @@ export default {
|
|||||||
level3: Array,
|
level3: Array,
|
||||||
level4: Array,
|
level4: Array,
|
||||||
dialogTitle: String,
|
dialogTitle: String,
|
||||||
|
activityData: Object,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -208,32 +210,33 @@ export default {
|
|||||||
// 宝箱助力
|
// 宝箱助力
|
||||||
async helpBtn() {
|
async helpBtn() {
|
||||||
// debugger
|
// debugger
|
||||||
if(this.boxState.isopened){
|
if(endActivity(this.activityData.endTime)) {
|
||||||
//todo:
|
this.$showErr('activity is end')
|
||||||
this.$showErr('chest already opened')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
let address = localStorage.getItem("myAddress")
|
|
||||||
// 3、是否已经助力此宝箱
|
|
||||||
if(this.boxState.enhanced == 0) {
|
|
||||||
// 1、助力次数是否用完
|
|
||||||
if(this.boxState.userCurrent < this.boxState.userMax) {
|
|
||||||
// 2、宝箱助力次数是否上限
|
|
||||||
if(this.boxState.chestCurrent < this.boxState.chestMax) {
|
|
||||||
// 4、开始助力
|
|
||||||
await this.sendEnhanceReq(this.boxCode)
|
|
||||||
} else {
|
|
||||||
this.$showErr('The chest’s boost count has reached the upper limit.')
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.$showErr('Today’s boost count has been exhausted.')
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
this.$showErr('You have already boosted the chest.')
|
if(this.boxState.isopened){
|
||||||
|
//todo:
|
||||||
|
this.$showErr('chest already opened')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let address = localStorage.getItem("myAddress")
|
||||||
|
// 3、是否已经助力此宝箱
|
||||||
|
if(this.boxState.enhanced == 0) {
|
||||||
|
// 1、助力次数是否用完
|
||||||
|
if(this.boxState.userCurrent < this.boxState.userMax) {
|
||||||
|
// 2、宝箱助力次数是否上限
|
||||||
|
if(this.boxState.chestCurrent < this.boxState.chestMax) {
|
||||||
|
// 4、开始助力
|
||||||
|
await this.sendEnhanceReq(this.boxCode)
|
||||||
|
} else {
|
||||||
|
this.$showErr('The chest’s boost count has reached the upper limit.')
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.$showErr('Today’s boost count has been exhausted.')
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.$showErr('You have already boosted the chest.')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// 发送宝箱助力上链请求并领取奖励
|
// 发送宝箱助力上链请求并领取奖励
|
||||||
|
@ -357,6 +357,7 @@
|
|||||||
v-if="item.status == 1"
|
v-if="item.status == 1"
|
||||||
@stateupdate="toCheck"
|
@stateupdate="toCheck"
|
||||||
@reconnection="toReconnection"
|
@reconnection="toReconnection"
|
||||||
|
:activityData="activityData"
|
||||||
:itemData="item"
|
:itemData="item"
|
||||||
time="5"
|
time="5"
|
||||||
title="Verify"
|
title="Verify"
|
||||||
@ -620,6 +621,8 @@
|
|||||||
@awardDialog="exploreAwardDialog"
|
@awardDialog="exploreAwardDialog"
|
||||||
@toNavIndex="nftToNav"
|
@toNavIndex="nftToNav"
|
||||||
@onWalletLogin="onWalletLogin"
|
@onWalletLogin="onWalletLogin"
|
||||||
|
v-show="activityData"
|
||||||
|
:activityData="activityData"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -761,7 +764,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="box-btm">
|
<div class="box-btm">
|
||||||
<BoxBtm ref="boxList" @toExplore="toExplore" @awardDialog="boxAwardDialog" />
|
<BoxBtm ref="boxList" @toExplore="toExplore" :activityData="activityData" @awardDialog="boxAwardDialog" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -921,6 +924,7 @@
|
|||||||
<HelpDialog
|
<HelpDialog
|
||||||
class="help-dialog"
|
class="help-dialog"
|
||||||
:helpDialogVisible="helpDialogVisible"
|
:helpDialogVisible="helpDialogVisible"
|
||||||
|
:activityData="activityData"
|
||||||
@onWalletLogin="onWalletLogin"
|
@onWalletLogin="onWalletLogin"
|
||||||
@handleClose="helpHandleClose"
|
@handleClose="helpHandleClose"
|
||||||
@awardDialog="helpAwardDialog"
|
@awardDialog="helpAwardDialog"
|
||||||
@ -1005,7 +1009,8 @@ import {
|
|||||||
apiMyNftList,
|
apiMyNftList,
|
||||||
apiClaimNft,
|
apiClaimNft,
|
||||||
apiVerifyGoogle,
|
apiVerifyGoogle,
|
||||||
apiDrawHistory
|
apiDrawHistory,
|
||||||
|
endActivity
|
||||||
} from "./../../utils/webapi.js";
|
} from "./../../utils/webapi.js";
|
||||||
import { sendToChain, sendHelp } from "./../../utils/chainapi.js";
|
import { sendToChain, sendHelp } from "./../../utils/chainapi.js";
|
||||||
import { Wallet } from "@/wallet/index.js";
|
import { Wallet } from "@/wallet/index.js";
|
||||||
@ -1344,90 +1349,94 @@ export default {
|
|||||||
// 开始任务
|
// 开始任务
|
||||||
async toPost(data, onlyaction) {
|
async toPost(data, onlyaction) {
|
||||||
if(this.token) {
|
if(this.token) {
|
||||||
// debugger
|
if(endActivity(this.activityData.endTime)) {
|
||||||
let begintask = data.status == 0 && !onlyaction;
|
this.$showErr('activity is end')
|
||||||
if (begintask) {
|
} else {
|
||||||
this.rumGtag(data.task);
|
// debugger
|
||||||
}
|
let begintask = data.status == 0 && !onlyaction;
|
||||||
|
if (begintask) {
|
||||||
let btw = false;
|
this.rumGtag(data.task);
|
||||||
let bdc = false;
|
|
||||||
if (data.task == "TwitterConnect") {
|
|
||||||
btw = true;
|
|
||||||
await this.loginTwitter(data.id);
|
|
||||||
} else if (data.task == "TwitterFollow") {
|
|
||||||
btw = true;
|
|
||||||
// if (!this.usesTwitterId) {
|
|
||||||
// this.$showErr("Please complete the 'Connect Your X' quest first");
|
|
||||||
// } else {
|
|
||||||
followTwitter(data.cfg.account);
|
|
||||||
// }
|
|
||||||
} else if (data.task == "TwitterLike") {
|
|
||||||
btw = true;
|
|
||||||
// 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") {
|
|
||||||
btw = true;
|
|
||||||
// if (!this.usesTwitterId) {
|
|
||||||
// this.$showErr("Please complete the 'Connect Your X' quest first");
|
|
||||||
// } else {
|
|
||||||
followTwitter(data.cfg.content);
|
|
||||||
// }
|
|
||||||
} else if (data.task == "TwitterRetweet") {
|
|
||||||
btw = true;
|
|
||||||
// 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") {
|
|
||||||
bdc = true;
|
|
||||||
// if (!this.usesDiscordId) {
|
|
||||||
// this.$showErr(
|
|
||||||
// "Please complete the 'Connect Your Discord' quest first"
|
|
||||||
// );
|
|
||||||
// } else {
|
|
||||||
joinDiscord(data.cfg.account);
|
|
||||||
// }
|
|
||||||
} else if (data.task == "DiscordConnect") {
|
|
||||||
bdc = true;
|
|
||||||
this.loginDiscord();
|
|
||||||
} else if (data.task == "GoogleConnect") {
|
|
||||||
// bdc = true;
|
|
||||||
if(data.status == 0 || data.status == 1) {
|
|
||||||
await this.loginWithGoogle()
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (begintask) {
|
let btw = false;
|
||||||
let res = await apiBeginActivity(data.id);
|
let bdc = false;
|
||||||
|
if (data.task == "TwitterConnect") {
|
||||||
if (res.errcode == 0) {
|
btw = true;
|
||||||
await this.getProgress();
|
await this.loginTwitter(data.id);
|
||||||
} else if (res.errcode == 14) {
|
} else if (data.task == "TwitterFollow") {
|
||||||
//pretask not complete
|
btw = true;
|
||||||
if (btw) {
|
// if (!this.usesTwitterId) {
|
||||||
this.$showErr("Please complete the 'Connect Your X' quest first");
|
// this.$showErr("Please complete the 'Connect Your X' quest first");
|
||||||
} else if (bdc) {
|
// } else {
|
||||||
this.$showErr(
|
followTwitter(data.cfg.account);
|
||||||
"Please complete the 'Connect Your Discord' quest first"
|
// }
|
||||||
);
|
} else if (data.task == "TwitterLike") {
|
||||||
} else {
|
btw = true;
|
||||||
this.$showErr(
|
// if (!this.usesTwitterId) {
|
||||||
"Please complete the 'Connect Your Google' quest first"
|
// 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") {
|
||||||
|
btw = true;
|
||||||
|
// if (!this.usesTwitterId) {
|
||||||
|
// this.$showErr("Please complete the 'Connect Your X' quest first");
|
||||||
|
// } else {
|
||||||
|
followTwitter(data.cfg.content);
|
||||||
|
// }
|
||||||
|
} else if (data.task == "TwitterRetweet") {
|
||||||
|
btw = true;
|
||||||
|
// 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") {
|
||||||
|
bdc = true;
|
||||||
|
// if (!this.usesDiscordId) {
|
||||||
|
// this.$showErr(
|
||||||
|
// "Please complete the 'Connect Your Discord' quest first"
|
||||||
|
// );
|
||||||
|
// } else {
|
||||||
|
joinDiscord(data.cfg.account);
|
||||||
|
// }
|
||||||
|
} else if (data.task == "DiscordConnect") {
|
||||||
|
bdc = true;
|
||||||
|
this.loginDiscord();
|
||||||
|
} else if (data.task == "GoogleConnect") {
|
||||||
|
// bdc = true;
|
||||||
|
if(data.status == 0 || data.status == 1) {
|
||||||
|
await this.loginWithGoogle()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (begintask) {
|
||||||
|
let res = await apiBeginActivity(data.id);
|
||||||
|
|
||||||
|
if (res.errcode == 0) {
|
||||||
|
await this.getProgress();
|
||||||
|
} else if (res.errcode == 14) {
|
||||||
|
//pretask not complete
|
||||||
|
if (btw) {
|
||||||
|
this.$showErr("Please complete the 'Connect Your X' quest first");
|
||||||
|
} else if (bdc) {
|
||||||
|
this.$showErr(
|
||||||
|
"Please complete the 'Connect Your Discord' quest first"
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
this.$showErr(
|
||||||
|
"Please complete the 'Connect Your Google' quest first"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.$showErr(`Unknown error[${res.errcode}]`);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
this.$showErr(`Unknown error[${res.errcode}]`);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1707,50 +1716,54 @@ export default {
|
|||||||
|
|
||||||
// 签到
|
// 签到
|
||||||
async walletCheck() {
|
async walletCheck() {
|
||||||
let address = this.$store.state.user.address;
|
if(endActivity(this.activityData.endTime)) {
|
||||||
if (!this.$store.state.wallet.connected || !address) {
|
this.$showErr('activity is end');
|
||||||
this.walletDialogVisible = true;
|
} else {
|
||||||
return;
|
let address = this.$store.state.user.address;
|
||||||
}
|
if (!this.$store.state.wallet.connected || !address) {
|
||||||
this.isLoading = true;
|
this.walletDialogVisible = true;
|
||||||
let storeageKey;
|
return;
|
||||||
try {
|
}
|
||||||
// const moment = this.$moment().format()
|
this.isLoading = true;
|
||||||
let today = formatDate(new Date());
|
let storeageKey;
|
||||||
storeageKey = await sendToChain("check", address, today);
|
|
||||||
} catch (err) {
|
|
||||||
this.isLoading = false;
|
|
||||||
this.$showErr(err);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
let serTimeId = setInterval(async () => {
|
|
||||||
try {
|
try {
|
||||||
let { errcode, errmsg, data } = await apiUsercheckin();
|
// const moment = this.$moment().format()
|
||||||
if (errcode) {
|
let today = formatDate(new Date());
|
||||||
if (errcode === 12) {
|
storeageKey = await sendToChain("check", address, today);
|
||||||
// 已领取, 给个提示就可以了
|
|
||||||
// this.$message.error(errmsg)
|
|
||||||
this.isLoading = false;
|
|
||||||
this.getGameStat();
|
|
||||||
clearInterval(serTimeId);
|
|
||||||
} else if (errcode !== 13) {
|
|
||||||
this.isLoading = false;
|
|
||||||
// this.$message.error(errmsg)
|
|
||||||
clearInterval(serTimeId);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.isLoading = false;
|
|
||||||
this.checkAwardDialog(data);
|
|
||||||
this.$refs.renewCheck.renewCheckInit();
|
|
||||||
this.getGameStat();
|
|
||||||
localStorage.removeItem(storeageKey);
|
|
||||||
clearInterval(serTimeId);
|
|
||||||
}
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.isLoading = false;
|
this.isLoading = false;
|
||||||
// this.$message.error(`claim task reward error: ${err}`)
|
this.$showErr(err);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}, 3000);
|
let serTimeId = setInterval(async () => {
|
||||||
|
try {
|
||||||
|
let { errcode, errmsg, data } = await apiUsercheckin();
|
||||||
|
if (errcode) {
|
||||||
|
if (errcode === 12) {
|
||||||
|
// 已领取, 给个提示就可以了
|
||||||
|
// this.$message.error(errmsg)
|
||||||
|
this.isLoading = false;
|
||||||
|
this.getGameStat();
|
||||||
|
clearInterval(serTimeId);
|
||||||
|
} else if (errcode !== 13) {
|
||||||
|
this.isLoading = false;
|
||||||
|
// this.$message.error(errmsg)
|
||||||
|
clearInterval(serTimeId);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.isLoading = false;
|
||||||
|
this.checkAwardDialog(data);
|
||||||
|
this.$refs.renewCheck.renewCheckInit();
|
||||||
|
this.getGameStat();
|
||||||
|
localStorage.removeItem(storeageKey);
|
||||||
|
clearInterval(serTimeId);
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
this.isLoading = false;
|
||||||
|
// this.$message.error(`claim task reward error: ${err}`)
|
||||||
|
}
|
||||||
|
}, 3000);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// 领取补签奖励
|
// 领取补签奖励
|
||||||
getCheckinLeak() {
|
getCheckinLeak() {
|
||||||
@ -1759,18 +1772,26 @@ export default {
|
|||||||
|
|
||||||
// 领取签到奖励
|
// 领取签到奖励
|
||||||
async claimSeqStat(day) {
|
async claimSeqStat(day) {
|
||||||
let res = await apiCheckinClaimSeq(day);
|
if(endActivity(this.activityData.endTime)) {
|
||||||
console.info(res);
|
this.$showErr('activity is end');
|
||||||
this.getGameStat();
|
} else {
|
||||||
|
let res = await apiCheckinClaimSeq(day);
|
||||||
|
console.info(res);
|
||||||
|
this.getGameStat();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 获取累计签到奖励
|
// 获取累计签到奖励
|
||||||
async getCheckClaim(days) {
|
async getCheckClaim(days) {
|
||||||
let res = await apiCheckinClaim(days);
|
if(endActivity(this.activityData.endTime)) {
|
||||||
console.info(res);
|
this.$showErr('activity is end');
|
||||||
this.getGameStat();
|
} else {
|
||||||
// this.$message.success('Received successfully')
|
let res = await apiCheckinClaim(days);
|
||||||
// }
|
console.info(res);
|
||||||
|
this.getGameStat();
|
||||||
|
// this.$message.success('Received successfully')
|
||||||
|
// }
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 获取钱包地址
|
// 获取钱包地址
|
||||||
@ -1833,20 +1854,24 @@ export default {
|
|||||||
// 复制链接
|
// 复制链接
|
||||||
copyLinkCode() {
|
copyLinkCode() {
|
||||||
if (this.token) {
|
if (this.token) {
|
||||||
let text = this.userData.code;
|
if(endActivity(this.activityData.endTime)) {
|
||||||
let url = `${location.protocol}//${location.host}/home/new=${text}`;
|
this.$showErr('activity is end')
|
||||||
let oInput = document.createElement("input");
|
} else {
|
||||||
oInput.value = url;
|
let text = this.userData.code;
|
||||||
document.body.appendChild(oInput);
|
let url = `${location.protocol}//${location.host}/home/new=${text}`;
|
||||||
oInput.select();
|
let oInput = document.createElement("input");
|
||||||
document.execCommand("Copy");
|
oInput.value = url;
|
||||||
oInput.className = "oInput";
|
document.body.appendChild(oInput);
|
||||||
oInput.style.display = "none";
|
oInput.select();
|
||||||
this.$message.success("Copy succeeded");
|
document.execCommand("Copy");
|
||||||
let address_type = localStorage.getItem("myAddress");
|
oInput.className = "oInput";
|
||||||
this.$gtag.event("invite_new", {
|
oInput.style.display = "none";
|
||||||
address_type: address_type
|
this.$message.success("Copy succeeded");
|
||||||
});
|
let address_type = localStorage.getItem("myAddress");
|
||||||
|
this.$gtag.event("invite_new", {
|
||||||
|
address_type: address_type
|
||||||
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.walletDialogVisible = true;
|
this.walletDialogVisible = true;
|
||||||
}
|
}
|
||||||
|
@ -7,13 +7,14 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { apiClaimNft } from '@/utils/webapi.js'
|
import { apiClaimNft, endActivity } from '@/utils/webapi.js'
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
title: String,
|
title: String,
|
||||||
time: String,
|
time: String,
|
||||||
itemData: Object,
|
itemData: Object,
|
||||||
clickAmount: Number
|
clickAmount: Number,
|
||||||
|
activityData: Object,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -41,50 +42,54 @@ bonusCount: 2, // 已助力次数
|
|||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
async checkBtn(){
|
async checkBtn(){
|
||||||
let discordId = this.$store.state.user.userData?.discordId || undefined
|
if(endActivity(this.activityData.endTime)) {
|
||||||
if(discordId) {
|
this.$showErr('activity is end')
|
||||||
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()
|
|
||||||
} else if(errcode == 100) {
|
|
||||||
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 {
|
} else {
|
||||||
this.$emit('toNavIndex')
|
let discordId = this.$store.state.user.userData?.discordId || undefined
|
||||||
this.$showErr('need connect discord first')
|
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()
|
||||||
|
} else if(errcode == 100) {
|
||||||
|
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() {
|
beginCountdown() {
|
||||||
|
@ -60,7 +60,7 @@
|
|||||||
<span>Verify</span>
|
<span>Verify</span>
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<NftCheckBtn v-if="item.status == 0" title="Verify" time="5" :itemData="item" :clickAmount="clickAmount" @checkNft="chickNftClaim" @toNavIndex="toNavIndex">Verify</NftCheckBtn>
|
<NftCheckBtn v-if="item.status == 0" title="Verify" time="5" :itemData="item" :clickAmount="clickAmount" @checkNft="chickNftClaim" :activityData="activityData" @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>
|
||||||
@ -81,7 +81,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getToken } from "@/utils/cookies.js";
|
import { getToken } from "@/utils/cookies.js";
|
||||||
import { apiNftList, apiVoucherClaim, apiClaimNft } from '@/utils/webapi.js'
|
import { apiNftList, apiVoucherClaim, apiClaimNft, endActivity } from '@/utils/webapi.js'
|
||||||
import NftCheckBtn from './nftCheckBtn.vue'
|
import NftCheckBtn from './nftCheckBtn.vue'
|
||||||
const BASE52_ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
const BASE52_ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
||||||
const isValidVoucherCode = (str) => {
|
const isValidVoucherCode = (str) => {
|
||||||
@ -92,6 +92,9 @@ export default {
|
|||||||
components: {
|
components: {
|
||||||
NftCheckBtn,
|
NftCheckBtn,
|
||||||
},
|
},
|
||||||
|
props: {
|
||||||
|
activityData: Object,
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
checkCodeInput: '',
|
checkCodeInput: '',
|
||||||
@ -167,20 +170,24 @@ export default {
|
|||||||
// 提交nft合作邀请码
|
// 提交nft合作邀请码
|
||||||
async submitCode() {
|
async submitCode() {
|
||||||
if (this.token) {
|
if (this.token) {
|
||||||
if (this.checkCodeInput) {
|
if(endActivity(this.activityData.endTime)) {
|
||||||
if(!isValidVoucherCode(this.checkCodeInput)) {
|
this.$showErr('activity is end')
|
||||||
this.$showErr('Invalid Voucher Code')
|
|
||||||
}
|
|
||||||
let { errcode, errmsg, data } = await apiVoucherClaim(this.checkCodeInput)
|
|
||||||
if(!errcode) {
|
|
||||||
this.$emit('awardDialog',data)
|
|
||||||
} else if(errcode == 11) {
|
|
||||||
this.$showErr(errmsg)
|
|
||||||
} else if(errmsg == 'voucher already used') {
|
|
||||||
this.$showErr('voucher already used')
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
this.$showErr(`Can not be empty`)
|
if (this.checkCodeInput) {
|
||||||
|
if(!isValidVoucherCode(this.checkCodeInput)) {
|
||||||
|
this.$showErr('Invalid Voucher Code')
|
||||||
|
}
|
||||||
|
let { errcode, errmsg, data } = await apiVoucherClaim(this.checkCodeInput)
|
||||||
|
if(!errcode) {
|
||||||
|
this.$emit('awardDialog',data)
|
||||||
|
} else if(errcode == 11) {
|
||||||
|
this.$showErr(errmsg)
|
||||||
|
} else if(errmsg == 'voucher already used') {
|
||||||
|
this.$showErr('voucher already used')
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.$showErr(`Can not be empty`)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.onWalletLogin()
|
this.onWalletLogin()
|
||||||
@ -196,13 +203,17 @@ export default {
|
|||||||
this.$emit('toNavIndex')
|
this.$emit('toNavIndex')
|
||||||
},
|
},
|
||||||
chickNftClaimAmount() {
|
chickNftClaimAmount() {
|
||||||
this.clickAmount++
|
if(endActivity(this.activityData.endTime)) {
|
||||||
if(this.clickAmount >= 4) {
|
return
|
||||||
this.$refs.demo.style.display = 'block'
|
|
||||||
this.$showErr('Complete CAPTCHA verification to verify you are not a robot')
|
|
||||||
this.handleLoadGoogleCaptcha()
|
|
||||||
} else {
|
} else {
|
||||||
this.$refs.demo.style.display = 'none'
|
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'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleLoadGoogleCaptcha() {
|
handleLoadGoogleCaptcha() {
|
||||||
|
@ -200,7 +200,12 @@ export default {
|
|||||||
|
|
||||||
// 点击抽奖
|
// 点击抽奖
|
||||||
handleClick(ticket){
|
handleClick(ticket){
|
||||||
this.toTurntable(ticket)
|
var now = new Date().getTime();
|
||||||
|
if(this.activityData.endTime <= now) {
|
||||||
|
this.$showErr('activity is end')
|
||||||
|
} else {
|
||||||
|
this.toTurntable(ticket)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// 打开登录弹窗
|
// 打开登录弹窗
|
||||||
onWalletLogin() {
|
onWalletLogin() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user