更新
This commit is contained in:
@@ -20,11 +20,11 @@ import Draw from "@/components/Draw";
|
||||
import Result from "@/components/Result";
|
||||
import Rule from "@/components/Rule";
|
||||
import { createBGM, getQueryString } from "@/plugins";
|
||||
import { authorize, getUserInfo } from '@/api'
|
||||
import { authorize, getUserInfo } from "@/api";
|
||||
import { Toast } from "vant";
|
||||
import { useMainStore } from "@/store"
|
||||
import { useMainStore } from "@/store";
|
||||
|
||||
const userStore = useMainStore()
|
||||
const userStore = useMainStore();
|
||||
|
||||
const showLoad = ref(false);
|
||||
const loadFn = (item) => {
|
||||
@@ -77,7 +77,7 @@ const drawFn = (item) => {
|
||||
}
|
||||
};
|
||||
|
||||
const showResult = ref(false);
|
||||
const showResult = ref(true);
|
||||
const resultFn = (item) => {
|
||||
if (item.action == "hide") {
|
||||
showResult.value = false;
|
||||
@@ -87,114 +87,99 @@ const resultFn = (item) => {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const showRule = ref(false);
|
||||
const ruleFn = (item) => {
|
||||
if (item.action == "hide") {
|
||||
showRule.value = false;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
let code = getQueryString("code");
|
||||
console.log("code:", code);
|
||||
|
||||
let code = getQueryString('code')
|
||||
console.log('code:', code);
|
||||
|
||||
let dev = import.meta.env.VITE_MODE
|
||||
if (dev != 'dev') {
|
||||
let dev = import.meta.env.VITE_MODE;
|
||||
if (dev != "dev") {
|
||||
if (code) {
|
||||
getUserInfo({ code: code }).then(
|
||||
res => {
|
||||
if (res.code == 0) {
|
||||
console.log('我的信息:', res.data);
|
||||
userStore.updateToken(res.data.authorization)
|
||||
createBGM();
|
||||
// 开始加载组件
|
||||
showLoad.value = true
|
||||
return
|
||||
} else {
|
||||
authorize({ scopeType: 1 }).then(
|
||||
res => {
|
||||
getUserInfo({ code: code }).then((res) => {
|
||||
if (res.code == 0) {
|
||||
console.log("我的信息:", res.data);
|
||||
userStore.updateToken(res.data.authorization);
|
||||
createBGM();
|
||||
// 开始加载组件
|
||||
showLoad.value = true;
|
||||
return;
|
||||
} else {
|
||||
authorize({ scopeType: 1 }).then((res) => {
|
||||
if (res.code == 0) {
|
||||
console.log("重定向地址:", res.data);
|
||||
location.replace(res.data);
|
||||
}
|
||||
|
||||
if (res.code == 0) {
|
||||
console.log('重定向地址:', res.data);
|
||||
location.replace(res.data)
|
||||
}
|
||||
// 活动已结束:6001
|
||||
if (res.code == "6001") {
|
||||
Toast.fail({
|
||||
message: res.msg,
|
||||
duration: 0,
|
||||
forbidClick: true,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// 活动已结束:6001
|
||||
if (res.code == '6001') {
|
||||
Toast.fail({
|
||||
message: res.msg,
|
||||
duration: 0,
|
||||
forbidClick: true
|
||||
})
|
||||
return
|
||||
}
|
||||
// 活动未开启:6002
|
||||
if (res.code == "6002") {
|
||||
Toast({
|
||||
message: res.msg,
|
||||
duration: 0,
|
||||
icon: "flag-o",
|
||||
forbidClick: true,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// 活动未开启:6002
|
||||
if (res.code == '6002') {
|
||||
Toast({
|
||||
message: res.msg,
|
||||
duration: 0,
|
||||
icon: 'flag-o',
|
||||
forbidClick: true
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// 其余情况
|
||||
Toast({
|
||||
message: res.msg,
|
||||
duration: 0,
|
||||
forbidClick: true
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
)
|
||||
} else {
|
||||
authorize({ scopeType: 1 }).then(
|
||||
res => {
|
||||
|
||||
if (res.code == 0) {
|
||||
console.log('重定向地址:', res.data);
|
||||
location.replace(res.data)
|
||||
}
|
||||
|
||||
// 活动已结束:6001
|
||||
if (res.code == '6001') {
|
||||
Toast.fail({
|
||||
message: '活动已结束',
|
||||
duration: 0,
|
||||
forbidClick: true
|
||||
})
|
||||
}
|
||||
|
||||
// 活动未开启:6002
|
||||
if (res.code == '6002') {
|
||||
// 其余情况
|
||||
Toast({
|
||||
message: '活动未开始',
|
||||
message: res.msg,
|
||||
duration: 0,
|
||||
icon: 'flag-o',
|
||||
forbidClick: true
|
||||
})
|
||||
}
|
||||
forbidClick: true,
|
||||
});
|
||||
});
|
||||
}
|
||||
)
|
||||
});
|
||||
} else {
|
||||
authorize({ scopeType: 1 }).then((res) => {
|
||||
if (res.code == 0) {
|
||||
console.log("重定向地址:", res.data);
|
||||
location.replace(res.data);
|
||||
}
|
||||
|
||||
// 活动已结束:6001
|
||||
if (res.code == "6001") {
|
||||
Toast.fail({
|
||||
message: "活动已结束",
|
||||
duration: 0,
|
||||
forbidClick: true,
|
||||
});
|
||||
}
|
||||
|
||||
// 活动未开启:6002
|
||||
if (res.code == "6002") {
|
||||
Toast({
|
||||
message: "活动未开始",
|
||||
duration: 0,
|
||||
icon: "flag-o",
|
||||
forbidClick: true,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
showLoad.value = true
|
||||
showLoad.value = true;
|
||||
}
|
||||
|
||||
fontAdpat()
|
||||
|
||||
fontAdpat();
|
||||
});
|
||||
|
||||
|
||||
// 字体适配
|
||||
const fontAdpat = () => {
|
||||
if (
|
||||
@@ -218,7 +203,6 @@ const fontAdpat = () => {
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" >
|
||||
|
||||
Reference in New Issue
Block a user