Merge branch 'login-gtag-RBI' of http://git.kingsome.cn/yuyongdong/UAW into login-gtag-RBI

This commit is contained in:
yuyongdong 2024-04-22 20:37:12 +08:00
commit dd84bf9d67

View File

@ -895,55 +895,74 @@ export default {
//
async toPost(data, onlyaction) {
// debugger
if (data.status == 0 || !onlyaction) {
let res = await apiBeginActivity(data.id);
if (res.errcode == 0) {
await this.getProgress();
}
}
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") {
//todo: panduan twitter id
if (!this.usesTwitterId) {
this.$showErr("Please complete the 'Connect Your X' quest first");
} else {
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") {
//todo: panduan twitter id
if (!this.usesTwitterId) {
this.$showErr("Please complete the 'Connect Your X' quest first");
} else {
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") {
//todo: panduan twitter id
if (!this.usesTwitterId) {
this.$showErr("Please complete the 'Connect Your X' quest first");
} else {
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") {
//todo: panduan twitter id
if (!this.usesTwitterId) {
this.$showErr("Please complete the 'Connect Your X' quest first");
} else {
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") {
//todo: panduan dc id
if (!this.usesDiscordId) {
this.$showErr(
"Please complete the 'Connect Your Discord' quest first"
);
} else {
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()
}
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(`Unknown error[${res.errcode}]`);
}
}
},
//
async toCheck() {