同步数据

This commit is contained in:
XGL-THINKPAD-X1\rucky
2024-01-23 16:12:41 +08:00
parent 2ab7f2daab
commit 8db3e50c0f
7 changed files with 134 additions and 69 deletions

View File

@@ -1,5 +1,5 @@
<template>
<div class="home">
<div class="home" @click.once="playMusic">
<Index v-if="showIndex" @IndexPage="indexFn"></Index>
<Question v-if="showQuestion" @QuestionPage="questionFn"></Question>
<Result v-if="showResult" @ResultPage="resultFn"></Result>
@@ -19,7 +19,7 @@ import MyPrize from "@/components/MyPrize";
import Draw from "@/components/Draw";
import Result from "@/components/Result";
import Rule from "@/components/Rule";
import { createBGM, getQueryString, screenOrientation } from "@/plugins";
import { createBGM, getQueryString, screenOrientation, isAndriod } from "@/plugins";
import { authorize, getUserInfo } from "@/api";
import { Toast } from "vant";
import { useMainStore } from "@/store";
@@ -109,7 +109,7 @@ onMounted(() => {
getUserInfo({ code: code }).then((res) => {
if (res.code == 0) {
console.log("我的信息:", res.data);
userStore.updateToken(res.data.authorization);
userStore.updateToken(res.data);
createBGM();
// 开始加载组件
showLoad.value = true;
@@ -119,35 +119,37 @@ onMounted(() => {
if (res.code == 0) {
console.log("重定向地址:", res.data);
location.replace(res.data);
}
} else {
// 活动已结束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,
});
});
}
});
@@ -156,26 +158,28 @@ onMounted(() => {
if (res.code == 0) {
console.log("重定向地址:", res.data);
location.replace(res.data);
} else {
// 活动已结束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,
});
}
}
// 活动已结束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 {
@@ -206,6 +210,16 @@ const fontAdpat = () => {
});
}
};
const playMusic = () => {
if (isAndriod) {
var audio = document.getElementById("audio");
audio.play();
}
}
</script>
<style lang="scss" >
@@ -247,6 +261,7 @@ const fontAdpat = () => {
@include bg_pos("orientation-icon.png");
margin-bottom: 20px;
}
.orientation-text {
color: #fff;
font-size: 30px;