simple inviter code

This commit is contained in:
yuexin 2024-04-13 23:17:23 +08:00
parent 78ba497647
commit b673d2f90b
2 changed files with 15 additions and 37 deletions

View File

@ -70,6 +70,7 @@ import { getToken } from './../../utils/cookies.js'
import { sendHelp } from './../../utils/chainapi.js' import { sendHelp } from './../../utils/chainapi.js'
import { import {
checkReCaptcha, checkReCaptcha,
apiUploadInviteCode
} from "./../../utils/webapi.js"; } from "./../../utils/webapi.js";
export default { export default {
@ -133,11 +134,12 @@ export default {
async helpConfirm() { async helpConfirm() {
if(this.$route.params.name != undefined) { if(this.$route.params.name != undefined) {
let newInvite = this.$route.params.name.split("new=")[1]; let newInvite = this.$route.params.name.split("new=")[1];
let rtoken = await checkReCaptcha("invite_user"); // let rtoken = await checkReCaptcha("invite_user");
let res = await this.$axios.get(process.env.VUE_APP_API_URL+"/api/activity/upload_invite_code", { // let res = await this.$axios.get(process.env.VUE_APP_API_URL+"/api/activity/upload_invite_code", {
params: { code: newInvite, rtoken: rtoken }, // params: { code: newInvite, rtoken: rtoken },
headers: { Authorization: `Bearer ${this.token}` } // headers: { Authorization: `Bearer ${this.token}` }
}); // });
let res = await apiUploadInviteCode(newInvite)
if (res.data.errcode == 0) { if (res.data.errcode == 0) {
this.isNewUser = 0 this.isNewUser = 0
} else { } else {

View File

@ -1163,44 +1163,20 @@ export default {
}, },
//
async getUploadInviteCode(code) {
await apiUploadInviteCode(code)
return
try {
let { errcode, errmsg, data } = apiUploadInviteCode(code)
if (errcode) {
if (errcode === 12) {
// ,
this.$message.error(errmsg)
} else if (errcode !== 14) {
// ,
this.$message.error(errmsg)
}
} else {
if(data?.status == 3) {
// alert(`, : ${data.score}`)
// this.activityDialog({data, isNewUser: this.isNewUser})
localStorage.removeItem(storeageKey)
}
}
} catch (err) {
this.$message.error(`claim task reward error: ${err}`)
}
},
// || // ||
async helpConfirm() { async helpConfirm() {
debugger
if(this.$route.params.name != undefined) { if(this.$route.params.name != undefined) {
let newInvite = this.$route.params.name.split("new=")[1]; let newInvite = this.$route.params.name.split("new=")[1];
let rtoken = await checkReCaptcha("invite_user"); // let rtoken = await checkReCaptcha("invite_user");
let res = await this.$axios.get(process.env.VUE_APP_API_URL+"/api/activity/upload_invite_code", { // let res = await this.$axios.get(process.env.VUE_APP_API_URL+"/api/activity/upload_invite_code", {
params: { code: newInvite, rtoken: rtoken }, // params: { code: newInvite, rtoken: rtoken },
headers: { Authorization: `Bearer ${this.token}` } // headers: { Authorization: `Bearer ${this.token}` }
}); // });
let res = await apiUploadInviteCode(newInvite)
if (res.data.errcode == 0) { if (res.data.errcode == 0) {
this.isNewUser = 0 this.isNewUser = 0
this.getUploadInviteCode(newInvite) // this.getUploadInviteCode(newInvite)
} else { } else {
this.isNewUser = 1 this.isNewUser = 1
} }