|
@@ -1,5 +1,5 @@
|
|
|
<template>
|
|
|
- <div class="bbbb" @touchstart.once="playaudio">
|
|
|
+ <div class="bbbb">
|
|
|
<router-view />
|
|
|
</div>
|
|
|
</template>
|
|
@@ -13,8 +13,18 @@ import wxShare from "@/utils/wxshare";
|
|
|
let gdBgm = new Audio();
|
|
|
gdBgm.src = require("@/assets/audio/bgm.mp3");
|
|
|
gdBgm.loop = true;
|
|
|
+gdBgm.load();
|
|
|
|
|
|
-
|
|
|
+let playaudio = () => {
|
|
|
+ if (!window.notfirstPlayAudio) {
|
|
|
+ window.notfirstPlayAudio = true;
|
|
|
+ gdBgm.play();
|
|
|
+ setTimeout(() => {
|
|
|
+ gdBgm.pause();
|
|
|
+ });
|
|
|
+ document.removeEventListener("touchstart", playaudio);
|
|
|
+ }
|
|
|
+};
|
|
|
export default {
|
|
|
watch: {
|
|
|
"$route.name": function(newVal) {
|
|
@@ -22,37 +32,32 @@ export default {
|
|
|
// newVal !='scene' ? this.$refs.vgbgm.pause() : this.$refs.vgbgm.play();
|
|
|
},
|
|
|
},
|
|
|
- methods: {
|
|
|
- playaudio(){
|
|
|
- if (window.firstPlayAudio) {
|
|
|
- window.firstPlayAudio = false
|
|
|
- gdBgm.play();
|
|
|
- setTimeout(() => {
|
|
|
- gdBgm.pause();
|
|
|
- },);
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
+
|
|
|
mounted() {
|
|
|
if (!this.isMobile) {
|
|
|
// window.location.href = window.location.href.replace("mobile.html", "index.html");
|
|
|
- window.location.href = window.location.href.replace("testmobile.html", "testindex.html");
|
|
|
+ window.location.href = window.location.href.replace(
|
|
|
+ "mobile.html",
|
|
|
+ "index.html"
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
+ document.addEventListener(
|
|
|
+ "WeixinJSBridgeReady",
|
|
|
+ () => {
|
|
|
+ gdBgm.play();
|
|
|
+ setTimeout(() => {
|
|
|
+ gdBgm.pause();
|
|
|
+ });
|
|
|
+ },
|
|
|
+ false
|
|
|
+ );
|
|
|
|
|
|
-
|
|
|
- document.addEventListener("WeixinJSBridgeReady", ()=>{
|
|
|
- gdBgm.play();
|
|
|
- setTimeout(() => {
|
|
|
- gdBgm.pause();
|
|
|
- },);
|
|
|
- }, false);
|
|
|
-
|
|
|
-
|
|
|
+ document.addEventListener("touchstart", playaudio);
|
|
|
|
|
|
this.$bus.$on("toggleGdBgm", (data) => {
|
|
|
- data == 'play' ? gdBgm.play() : gdBgm.pause();
|
|
|
+ data == "play" ? gdBgm.play() : gdBgm.pause();
|
|
|
});
|
|
|
wxShare({
|
|
|
title: `新时代中国网络文明建设成果展云展示`,
|
|
@@ -94,5 +99,4 @@ body,
|
|
|
// display: none;
|
|
|
// }
|
|
|
// }
|
|
|
-
|
|
|
</style>
|