完成部分接口联调
This commit is contained in:
@@ -17,9 +17,14 @@ import Question from "@/components/Question";
|
||||
import MyPrize from "@/components/MyPrize";
|
||||
import Draw from "@/components/Draw";
|
||||
import Result from "@/components/Result";
|
||||
import { createBGM } from "@/plugins";
|
||||
import { createBGM, getQueryString } from "@/plugins";
|
||||
import { authorize, getUserInfo } from '@/api'
|
||||
import { Toast } from "vant";
|
||||
import { useMainStore } from "@/store"
|
||||
|
||||
const showLoad = ref(true);
|
||||
const userStore = useMainStore()
|
||||
|
||||
const showLoad = ref(false);
|
||||
const loadFn = (item) => {
|
||||
if (item.action == "hide") {
|
||||
showLoad.value = false;
|
||||
@@ -66,7 +71,7 @@ const drawFn = (item) => {
|
||||
}
|
||||
};
|
||||
|
||||
const showResult = ref(true);
|
||||
const showResult = ref(false);
|
||||
const resultFn = (item) => {
|
||||
if (item.action == "hide") {
|
||||
showResult.value = false;
|
||||
@@ -74,14 +79,102 @@ const resultFn = (item) => {
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
createBGM();
|
||||
|
||||
let code = getQueryString('code')
|
||||
console.log('code:', code);
|
||||
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 {
|
||||
console.log('hhhh');
|
||||
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: res.msg,
|
||||
duration: 0,
|
||||
forbidClick: true
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// 活动未开启:6002
|
||||
if (res.code == '6002') {
|
||||
Toast({
|
||||
message: res.msg,
|
||||
duration: 0,
|
||||
icon: 'flag-o',
|
||||
forbidClick: true
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// 其余情况
|
||||
Toast.fail({
|
||||
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: '活动未开始',
|
||||
duration: 0,
|
||||
icon: 'flag-o',
|
||||
forbidClick: true
|
||||
})
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" >
|
||||
#app {
|
||||
overflow: hidden;
|
||||
background-color: rgb(255, 255, 255);
|
||||
background: linear-gradient(135deg, #f6d365, #fda085);
|
||||
}
|
||||
|
||||
#musicBtn {
|
||||
|
||||
@@ -26,10 +26,12 @@ wxShare({
|
||||
|
||||
// 测试环境开vconsole
|
||||
if (isMobile()) {
|
||||
// const vConsole = new VConsole();
|
||||
|
||||
}
|
||||
|
||||
const vConsole = new VConsole();
|
||||
|
||||
|
||||
app.use(createPinia())
|
||||
app.mount('#app')
|
||||
console.log('Mode:', import.meta.env.VITE_MODE);
|
||||
|
||||
Reference in New Issue
Block a user