update
This commit is contained in:
@@ -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, isAndriod } from "@/plugins";
|
||||
import { createBGM, getQueryString, screenOrientation, isAndriod,fontAdpat } from "@/plugins";
|
||||
import { authorize, getUserInfo } from "@/api";
|
||||
import { Toast } from "vant";
|
||||
import { useMainStore } from "@/store";
|
||||
@@ -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;
|
||||
@@ -113,6 +113,24 @@ onMounted(() => {
|
||||
createBGM();
|
||||
// 开始加载组件
|
||||
showLoad.value = true;
|
||||
|
||||
// ios自动播放音乐
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
function audioAutoPlay() {
|
||||
var audio = document.getElementById("musicBtn");
|
||||
audio.play();
|
||||
document.addEventListener(
|
||||
"WeixinJSBridgeReady",
|
||||
function () {
|
||||
WeixinJSBridge.invoke("getNetworkType", {}, function (e) {
|
||||
audio.play();
|
||||
});
|
||||
},
|
||||
false
|
||||
);
|
||||
}
|
||||
audioAutoPlay();
|
||||
});
|
||||
return;
|
||||
} else {
|
||||
authorize({ scopeType: 1, redirectUri: url }).then((res) => {
|
||||
@@ -184,39 +202,19 @@ onMounted(() => {
|
||||
}
|
||||
} else {
|
||||
showLoad.value = true;
|
||||
createBGM();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
// 字体适配
|
||||
const fontAdpat = () => {
|
||||
if (
|
||||
typeof WeixinJSBridge == "object" &&
|
||||
typeof WeixinJSBridge.invoke == "function"
|
||||
) {
|
||||
handleFontSize();
|
||||
} else {
|
||||
if (document.addEventListener) {
|
||||
document.addEventListener("WeixinJSBridgeReady", handleFontSize, false);
|
||||
} else if (document.attachEvent) {
|
||||
document.attachEvent("onWeixinJSBridgeReady", handleFontSize);
|
||||
}
|
||||
}
|
||||
function handleFontSize() {
|
||||
// 设置网页字体为默认大小
|
||||
WeixinJSBridge.invoke("setFontSizeCallback", { fontSize: 0 });
|
||||
// 重写设置网页字体大小的事件
|
||||
WeixinJSBridge.on("menu:setfont", function () {
|
||||
WeixinJSBridge.invoke("setFontSizeCallback", { fontSize: 0 });
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const playMusic = () => {
|
||||
if (isAndriod) {
|
||||
var audio = document.getElementById("audio");
|
||||
audio.play();
|
||||
}
|
||||
|
||||
if(isAndriod){
|
||||
var audioEle = document.getElementById("audio");
|
||||
audioEle.play();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user