活动结束弹窗提示
This commit is contained in:
parent
91e59bff21
commit
7268190873
@ -13,7 +13,8 @@ export default {
|
||||
props: {
|
||||
title: String,
|
||||
time: String,
|
||||
itemData: Object
|
||||
itemData: Object,
|
||||
activityData: Object,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@ -24,6 +25,8 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
async beginAction() {
|
||||
console.log(this.activityData,'----')
|
||||
return
|
||||
try {
|
||||
let { errcode, errmsg, data } = await apiCheckActivity(
|
||||
this.itemData.id
|
||||
|
@ -13,7 +13,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="confirm-box">
|
||||
<div class="confirm-context">{{message}}</div>
|
||||
<div class="confirm-context" v-html="message">{{}}</div>
|
||||
</div>
|
||||
<div class="btn" @click="handleClose">Confirm</div>
|
||||
<!-- <div slot="footer" class="dialog-footer">
|
||||
|
@ -90,6 +90,9 @@ let errmsg = err
|
||||
errmsg = `Your verification code has expired. Please request a new code.`
|
||||
} else if(errmsg.indexOf('code error') > -1) {
|
||||
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
|
||||
|| errmsg.indexOf('The chest’s boost count has reached the upper limit') > -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`;
|
||||
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 Pagination from "./../../components/pagination.vue";
|
||||
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 Loading from "@/components/loading.vue";
|
||||
import UserImg from "@/components/userImg.vue";
|
||||
@ -296,6 +296,9 @@ export default {
|
||||
Loading,
|
||||
UserImg
|
||||
},
|
||||
props: {
|
||||
activityData: Object,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
token: null,
|
||||
@ -434,50 +437,54 @@ export default {
|
||||
|
||||
// 开宝箱
|
||||
async openBoxToChain(id) {
|
||||
let address = this.$store.state.user.address;
|
||||
if (!this.$store.state.wallet.connected || !address) {
|
||||
throw new Error("wallet not connected");
|
||||
}
|
||||
let storeageKey;
|
||||
this.isLoading = true;
|
||||
try {
|
||||
storeageKey = await sendToChain("chest_open", address, id);
|
||||
} catch (err) {
|
||||
this.$showErr(err);
|
||||
this.isLoading = false;
|
||||
return;
|
||||
}
|
||||
|
||||
let serTimeId = setInterval(async () => {
|
||||
if(endActivity(this.activityData.endTime)) {
|
||||
this.$showErr('activity is end')
|
||||
} else {
|
||||
let address = this.$store.state.user.address;
|
||||
if (!this.$store.state.wallet.connected || !address) {
|
||||
throw new Error("wallet not connected");
|
||||
}
|
||||
let storeageKey;
|
||||
this.isLoading = true;
|
||||
try {
|
||||
let { errcode, errmsg, data } = await apiBoxOpen(id);
|
||||
if (errcode) {
|
||||
if (errcode !== 12) {
|
||||
// 状态不是等待链上确认的, 都提示错误
|
||||
// this.$message.error(errmsg)'
|
||||
storeageKey = await sendToChain("chest_open", address, id);
|
||||
} catch (err) {
|
||||
this.$showErr(err);
|
||||
this.isLoading = false;
|
||||
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.$emit("awardDialog", data);
|
||||
localStorage.removeItem(storeageKey);
|
||||
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();
|
||||
} catch (err) {
|
||||
this.isLoading = false;
|
||||
this.$emit("awardDialog", data);
|
||||
localStorage.removeItem(storeageKey);
|
||||
clearInterval(serTimeId);
|
||||
// this.$message.error(`claim task reward error: ${err}`)
|
||||
}
|
||||
} catch (err) {
|
||||
this.isLoading = false;
|
||||
// this.$message.error(`claim task reward error: ${err}`)
|
||||
}
|
||||
}, 3000);
|
||||
}, 3000);
|
||||
}
|
||||
},
|
||||
|
||||
// 开箱子记录
|
||||
@ -532,20 +539,24 @@ export default {
|
||||
|
||||
// 复制助力链接
|
||||
copyLink(data) {
|
||||
this.userData = JSON.parse(localStorage.getItem("userData"));
|
||||
let url = `${location.protocol}//${location.host}/home/box=${data.shareCode}`;
|
||||
let oInput = document.createElement("input");
|
||||
oInput.value = url;
|
||||
document.body.appendChild(oInput);
|
||||
oInput.select();
|
||||
document.execCommand("Copy");
|
||||
oInput.className = "oInput";
|
||||
oInput.style.display = "none";
|
||||
this.$message.success("Copy succeeded");
|
||||
let address_type = localStorage.getItem("myAddress");
|
||||
this.$gtag.event("invite_new", {
|
||||
address_type: address_type
|
||||
});
|
||||
if(endActivity(this.activityData.endTime)) {
|
||||
this.$showErr('activity is end')
|
||||
} else {
|
||||
this.userData = JSON.parse(localStorage.getItem("userData"));
|
||||
let url = `${location.protocol}//${location.host}/home/box=${data.shareCode}`;
|
||||
let oInput = document.createElement("input");
|
||||
oInput.value = url;
|
||||
document.body.appendChild(oInput);
|
||||
oInput.select();
|
||||
document.execCommand("Copy");
|
||||
oInput.className = "oInput";
|
||||
oInput.style.display = "none";
|
||||
this.$message.success("Copy succeeded");
|
||||
let address_type = localStorage.getItem("myAddress");
|
||||
this.$gtag.event("invite_new", {
|
||||
address_type: address_type
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
antiShake: throttle(function(data) {
|
||||
@ -562,7 +573,7 @@ export default {
|
||||
|
||||
// 去探索页面
|
||||
toExplore() {
|
||||
this.$emit("toExplore", 1);
|
||||
this.$emit("toExplore", 2);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
<script>
|
||||
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'
|
||||
const ONE_DAY = 24 * 60 * 60 * 1000;
|
||||
|
||||
@ -97,10 +97,14 @@ export default {
|
||||
|
||||
// 补领漏签
|
||||
async getCheckinClaimLeak(days) {
|
||||
let res = await apiCheckinClaimLeak(days)
|
||||
// let { errcode,errmsg} = res
|
||||
this.getCheckInit()
|
||||
this.$emit('getCheckinLeak')
|
||||
if(endActivity(this.activityData.endTime)) {
|
||||
this.$showErr('activity is end');
|
||||
} else {
|
||||
let res = await apiCheckinClaimLeak(days)
|
||||
// let { errcode,errmsg} = res
|
||||
this.getCheckInit()
|
||||
this.$emit('getCheckinLeak')
|
||||
}
|
||||
},
|
||||
|
||||
// 签到后更新签到状态
|
||||
|
@ -16,13 +16,14 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { apiGameClaim } from '@/utils/webapi.js'
|
||||
import { apiGameClaim, endActivity } from '@/utils/webapi.js'
|
||||
export default {
|
||||
props: {
|
||||
title: String,
|
||||
time: String,
|
||||
itemData: Object,
|
||||
clickAmount: Number
|
||||
clickAmount: Number,
|
||||
activityData: Object,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@ -51,29 +52,33 @@ bonusCount: 2, // 已助力次数
|
||||
|
||||
methods: {
|
||||
async checkBtn(){
|
||||
this.isShow = false
|
||||
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}`);
|
||||
}
|
||||
if(endActivity(this.activityData.endTime)) {
|
||||
this.$showErr('activity is end')
|
||||
} else {
|
||||
this.isShow = true
|
||||
this.$showErr('need connect game account first')
|
||||
this.isShow = false
|
||||
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() {
|
||||
|
@ -60,8 +60,8 @@
|
||||
<span>Verify</span>
|
||||
</div>
|
||||
<div v-else>
|
||||
<GameCheckBtn v-if="item.status == 0 || item.status == 1" title="Verify" time="5" :itemData="item" @checkNft="chickGameClaim" />
|
||||
<GameCheckBtn class="" v-else-if="item.status == 2" title="Claim" 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" :activityData="activityData" :itemData="item" @checkNft="chickGameClaim" />
|
||||
<div v-if="item.status == 3" class="check-yes">
|
||||
+{{ item.score }}
|
||||
<img src="./../../assets/common/Checkmark (1).png" alt />
|
||||
@ -131,8 +131,8 @@
|
||||
<span>Verify</span>
|
||||
</div>
|
||||
<div v-else>
|
||||
<GameCheckBtn v-if="item.status == 0 || item.status == 1" title="Verify" time="5" :itemData="item" @checkNft="chickGameClaim" />
|
||||
<GameCheckBtn class="" v-else-if="item.status == 2" title="Claim" 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" :activityData="activityData" :itemData="item" @checkNft="chickGameClaim" />
|
||||
<!-- <div class="check-claim" v-if="item.status == 2">Claim</div> -->
|
||||
<div v-if="item.status == 3" class="check-yes">
|
||||
+{{ item.score }}
|
||||
@ -153,7 +153,7 @@
|
||||
<script>
|
||||
import GameCheckBtn from './gameCheckBtn.vue'
|
||||
import { getToken } from "@/utils/cookies.js";
|
||||
import { apiGameTasks, apiGameClaim } from "@/utils/webapi.js"
|
||||
import { apiGameTasks, apiGameClaim, endActivity } from "@/utils/webapi.js"
|
||||
|
||||
export default {
|
||||
props: {
|
||||
@ -189,6 +189,7 @@ export default {
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
console.log(this.activityData)
|
||||
this.token = getToken();
|
||||
this.getGameList()
|
||||
},
|
||||
@ -215,7 +216,11 @@ export default {
|
||||
this.$emit('awardDialog', data)
|
||||
},
|
||||
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 {
|
||||
checkReCaptcha,
|
||||
apiUploadInviteCode,
|
||||
apiEnhanceBox
|
||||
apiEnhanceBox,
|
||||
endActivity
|
||||
} from "./../../utils/webapi.js";
|
||||
|
||||
export default {
|
||||
@ -133,6 +134,7 @@ export default {
|
||||
level3: Array,
|
||||
level4: Array,
|
||||
dialogTitle: String,
|
||||
activityData: Object,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@ -208,32 +210,33 @@ export default {
|
||||
// 宝箱助力
|
||||
async helpBtn() {
|
||||
// debugger
|
||||
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.')
|
||||
}
|
||||
if(endActivity(this.activityData.endTime)) {
|
||||
this.$showErr('activity is end')
|
||||
} 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"
|
||||
@stateupdate="toCheck"
|
||||
@reconnection="toReconnection"
|
||||
:activityData="activityData"
|
||||
:itemData="item"
|
||||
time="5"
|
||||
title="Verify"
|
||||
@ -620,6 +621,8 @@
|
||||
@awardDialog="exploreAwardDialog"
|
||||
@toNavIndex="nftToNav"
|
||||
@onWalletLogin="onWalletLogin"
|
||||
v-show="activityData"
|
||||
:activityData="activityData"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@ -761,7 +764,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-btm">
|
||||
<BoxBtm ref="boxList" @toExplore="toExplore" @awardDialog="boxAwardDialog" />
|
||||
<BoxBtm ref="boxList" @toExplore="toExplore" :activityData="activityData" @awardDialog="boxAwardDialog" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -921,6 +924,7 @@
|
||||
<HelpDialog
|
||||
class="help-dialog"
|
||||
:helpDialogVisible="helpDialogVisible"
|
||||
:activityData="activityData"
|
||||
@onWalletLogin="onWalletLogin"
|
||||
@handleClose="helpHandleClose"
|
||||
@awardDialog="helpAwardDialog"
|
||||
@ -1005,7 +1009,8 @@ import {
|
||||
apiMyNftList,
|
||||
apiClaimNft,
|
||||
apiVerifyGoogle,
|
||||
apiDrawHistory
|
||||
apiDrawHistory,
|
||||
endActivity
|
||||
} from "./../../utils/webapi.js";
|
||||
import { sendToChain, sendHelp } from "./../../utils/chainapi.js";
|
||||
import { Wallet } from "@/wallet/index.js";
|
||||
@ -1344,90 +1349,94 @@ export default {
|
||||
// 开始任务
|
||||
async toPost(data, onlyaction) {
|
||||
if(this.token) {
|
||||
// debugger
|
||||
let begintask = data.status == 0 && !onlyaction;
|
||||
if (begintask) {
|
||||
this.rumGtag(data.task);
|
||||
}
|
||||
|
||||
let btw = false;
|
||||
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(endActivity(this.activityData.endTime)) {
|
||||
this.$showErr('activity is end')
|
||||
} else {
|
||||
// debugger
|
||||
let begintask = data.status == 0 && !onlyaction;
|
||||
if (begintask) {
|
||||
this.rumGtag(data.task);
|
||||
}
|
||||
}
|
||||
|
||||
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"
|
||||
);
|
||||
let btw = false;
|
||||
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 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 {
|
||||
@ -1707,50 +1716,54 @@ export default {
|
||||
|
||||
// 签到
|
||||
async walletCheck() {
|
||||
let address = this.$store.state.user.address;
|
||||
if (!this.$store.state.wallet.connected || !address) {
|
||||
this.walletDialogVisible = true;
|
||||
return;
|
||||
}
|
||||
this.isLoading = true;
|
||||
let storeageKey;
|
||||
try {
|
||||
// const moment = this.$moment().format()
|
||||
let today = formatDate(new Date());
|
||||
storeageKey = await sendToChain("check", address, today);
|
||||
} catch (err) {
|
||||
this.isLoading = false;
|
||||
this.$showErr(err);
|
||||
return;
|
||||
}
|
||||
let serTimeId = setInterval(async () => {
|
||||
if(endActivity(this.activityData.endTime)) {
|
||||
this.$showErr('activity is end');
|
||||
} else {
|
||||
let address = this.$store.state.user.address;
|
||||
if (!this.$store.state.wallet.connected || !address) {
|
||||
this.walletDialogVisible = true;
|
||||
return;
|
||||
}
|
||||
this.isLoading = true;
|
||||
let storeageKey;
|
||||
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);
|
||||
}
|
||||
// const moment = this.$moment().format()
|
||||
let today = formatDate(new Date());
|
||||
storeageKey = await sendToChain("check", address, today);
|
||||
} catch (err) {
|
||||
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() {
|
||||
@ -1759,18 +1772,26 @@ export default {
|
||||
|
||||
// 领取签到奖励
|
||||
async claimSeqStat(day) {
|
||||
let res = await apiCheckinClaimSeq(day);
|
||||
console.info(res);
|
||||
this.getGameStat();
|
||||
if(endActivity(this.activityData.endTime)) {
|
||||
this.$showErr('activity is end');
|
||||
} else {
|
||||
let res = await apiCheckinClaimSeq(day);
|
||||
console.info(res);
|
||||
this.getGameStat();
|
||||
}
|
||||
},
|
||||
|
||||
// 获取累计签到奖励
|
||||
async getCheckClaim(days) {
|
||||
let res = await apiCheckinClaim(days);
|
||||
console.info(res);
|
||||
this.getGameStat();
|
||||
// this.$message.success('Received successfully')
|
||||
// }
|
||||
if(endActivity(this.activityData.endTime)) {
|
||||
this.$showErr('activity is end');
|
||||
} else {
|
||||
let res = await apiCheckinClaim(days);
|
||||
console.info(res);
|
||||
this.getGameStat();
|
||||
// this.$message.success('Received successfully')
|
||||
// }
|
||||
}
|
||||
},
|
||||
|
||||
// 获取钱包地址
|
||||
@ -1833,20 +1854,24 @@ export default {
|
||||
// 复制链接
|
||||
copyLinkCode() {
|
||||
if (this.token) {
|
||||
let text = this.userData.code;
|
||||
let url = `${location.protocol}//${location.host}/home/new=${text}`;
|
||||
let oInput = document.createElement("input");
|
||||
oInput.value = url;
|
||||
document.body.appendChild(oInput);
|
||||
oInput.select();
|
||||
document.execCommand("Copy");
|
||||
oInput.className = "oInput";
|
||||
oInput.style.display = "none";
|
||||
this.$message.success("Copy succeeded");
|
||||
let address_type = localStorage.getItem("myAddress");
|
||||
this.$gtag.event("invite_new", {
|
||||
address_type: address_type
|
||||
});
|
||||
if(endActivity(this.activityData.endTime)) {
|
||||
this.$showErr('activity is end')
|
||||
} else {
|
||||
let text = this.userData.code;
|
||||
let url = `${location.protocol}//${location.host}/home/new=${text}`;
|
||||
let oInput = document.createElement("input");
|
||||
oInput.value = url;
|
||||
document.body.appendChild(oInput);
|
||||
oInput.select();
|
||||
document.execCommand("Copy");
|
||||
oInput.className = "oInput";
|
||||
oInput.style.display = "none";
|
||||
this.$message.success("Copy succeeded");
|
||||
let address_type = localStorage.getItem("myAddress");
|
||||
this.$gtag.event("invite_new", {
|
||||
address_type: address_type
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.walletDialogVisible = true;
|
||||
}
|
||||
|
@ -7,13 +7,14 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { apiClaimNft } from '@/utils/webapi.js'
|
||||
import { apiClaimNft, endActivity } from '@/utils/webapi.js'
|
||||
export default {
|
||||
props: {
|
||||
title: String,
|
||||
time: String,
|
||||
itemData: Object,
|
||||
clickAmount: Number
|
||||
clickAmount: Number,
|
||||
activityData: Object,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@ -41,50 +42,54 @@ 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()
|
||||
} 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}`);
|
||||
}
|
||||
if(endActivity(this.activityData.endTime)) {
|
||||
this.$showErr('activity is end')
|
||||
} else {
|
||||
this.$emit('toNavIndex')
|
||||
this.$showErr('need connect discord first')
|
||||
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()
|
||||
} 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() {
|
||||
|
@ -60,7 +60,7 @@
|
||||
<span>Verify</span>
|
||||
</div>
|
||||
<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">
|
||||
<img src="@/assets/home/check-yes.png" alt />
|
||||
</div>
|
||||
@ -81,7 +81,7 @@
|
||||
|
||||
<script>
|
||||
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'
|
||||
const BASE52_ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
||||
const isValidVoucherCode = (str) => {
|
||||
@ -92,6 +92,9 @@ export default {
|
||||
components: {
|
||||
NftCheckBtn,
|
||||
},
|
||||
props: {
|
||||
activityData: Object,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
checkCodeInput: '',
|
||||
@ -167,20 +170,24 @@ export default {
|
||||
// 提交nft合作邀请码
|
||||
async submitCode() {
|
||||
if (this.token) {
|
||||
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')
|
||||
}
|
||||
if(endActivity(this.activityData.endTime)) {
|
||||
this.$showErr('activity is end')
|
||||
} 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 {
|
||||
this.onWalletLogin()
|
||||
@ -196,13 +203,17 @@ export default {
|
||||
this.$emit('toNavIndex')
|
||||
},
|
||||
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()
|
||||
if(endActivity(this.activityData.endTime)) {
|
||||
return
|
||||
} 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() {
|
||||
|
@ -200,7 +200,12 @@ export default {
|
||||
|
||||
// 点击抽奖
|
||||
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() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user