瀏覽代碼

正式版tag

TrembleC 3 年之前
父節點
當前提交
a305fe48fc
共有 3 個文件被更改,包括 30 次插入28 次删除
  1. 1 1
      src/clients/index.vue
  2. 29 25
      src/clients/mobile.vue
  3. 0 2
      src/pages/mobilescene/components/qrcode.vue

+ 1 - 1
src/clients/index.vue

@@ -21,7 +21,7 @@ export default {
         );
       } else {
         window.location.href =
-          window.location.origin + window.location.pathname + "testmobile.html";
+          window.location.origin + window.location.pathname + "mobile.html";
       }
     }
 

+ 29 - 25
src/clients/mobile.vue

@@ -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>

+ 0 - 2
src/pages/mobilescene/components/qrcode.vue

@@ -142,8 +142,6 @@ export default {
         .then((dataUrl) => {
           this[imgstr] = dataUrl;
           this.$hideLoading()
-
-          console.log(this[imgstr]);
         })
         .catch((error) => {
           this.$hideLoading()