simple inviter code
This commit is contained in:
parent
78ba497647
commit
b673d2f90b
@ -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 {
|
||||||
|
@ -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
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user