gemercheung 2 yıl önce
ebeveyn
işleme
a0cb086f2c

+ 103 - 98
packages/qjkankan-editor/src/framework/show/index.vue

@@ -1,15 +1,27 @@
 <template>
   <div class="panocon">
     <template v-if="showInfo">
-      <iframe allowfullscreen="true" v-if="activeItem.type=='4dkk'" 
-      :src="`/spc.html?m=${activeItem.sceneCode}&lang=zh`" frameborder="0"></iframe>
-      <div v-show="activeItem.type!='4dkk'" id="pano"></div>
+      <iframe
+        allowfullscreen="true"
+        v-if="activeItem.type == '4dkk'"
+        :src="`/spc.html?m=${activeItem.sceneCode}&lang=zh`"
+        frameborder="0"
+      ></iframe>
+      <div v-show="activeItem.type != '4dkk'" id="pano"></div>
 
-      <div class="pano-logo" v-if="showInfo.isLogo&&activeItem.type!='4dkk'">
-        <img :src="showInfo.logo||require('@/assets/images/default/img_logoshow@2x.png')" alt="" />
+      <div
+        class="pano-logo"
+        v-if="showInfo.isLogo && activeItem.type != '4dkk'"
+      >
+        <img
+          :src="
+            showInfo.logo ||
+            require('@/assets/images/default/img_logoshow@2x.png')
+          "
+          alt=""
+        />
       </div>
 
-
       <div
         class="oper-tips"
         :class="{ hidetips: !showTips }"
@@ -43,7 +55,7 @@
         @close="showPreview = false"
       />
 
-      <ul class="aside" v-if="activeItem.type!='4dkk'">
+      <ul class="aside" v-if="activeItem.type != '4dkk'">
         <li v-for="(item, i) in aside" :key="i">
           <span @click="handleItem(item)">
             <i class="iconfont" :class="item.icon"></i>
@@ -53,23 +65,21 @@
     </template>
     <template v-else>
       <div class="hasDel" v-if="loadFinish">
-      <div>
-        <img :src="$noresult" alt="">
-        <p>作品已被删除</p>
+        <div>
+          <img :src="$noresult" alt="" />
+          <p>作品已被删除</p>
+        </div>
       </div>
-    </div>
-
     </template>
   </div>
 </template>
 
 <script>
 import * as krfn from "@/core/index.js";
-import { getPanoInfo, checkPassword,checkWork } from "@/api";
+import { getPanoInfo, checkPassword, checkWork } from "@/api";
 import password from "./popup/password";
 import preview from "./popup/preview";
-import { $smallWaiting } from '@/components/shared/loading'
-
+import { $smallWaiting } from "@/components/shared/loading";
 
 import popup from "./popup/";
 import { mapGetters } from "vuex";
@@ -93,10 +103,10 @@ export default {
   data() {
     return {
       showPreview: false,
-      isFullscreen:false,
+      isFullscreen: false,
       showTips: false,
       canLoad: false,
-      loadFinish:false,
+      loadFinish: false,
       showPassword: false,
       showIntro: false,
       localRemind: false,
@@ -123,37 +133,37 @@ export default {
   },
   methods: {
     onFullScreen() {
-        let element = document.documentElement;
-        if (this.isFullscreen) {
-            if (document.exitFullscreen) {
-                document.exitFullscreen();
-            } else if (document.webkitCancelFullScreen) {
-                document.webkitCancelFullScreen();
-            } else if (document.mozCancelFullScreen) {
-                document.mozCancelFullScreen();
-            } else if (document.msExitFullscreen) {
-                document.msExitFullscreen();
-            }
-        } else {
-            if (element.requestFullscreen) {
-                element.requestFullscreen();
-            } else if (element.webkitRequestFullScreen) {
-                element.webkitRequestFullScreen();
-            } else if (element.mozRequestFullScreen) {
-                element.mozRequestFullScreen();
-            } else if (element.msRequestFullscreen) {
-                element.msRequestFullscreen();
-            }
+      let element = document.documentElement;
+      if (this.isFullscreen) {
+        if (document.exitFullscreen) {
+          document.exitFullscreen();
+        } else if (document.webkitCancelFullScreen) {
+          document.webkitCancelFullScreen();
+        } else if (document.mozCancelFullScreen) {
+          document.mozCancelFullScreen();
+        } else if (document.msExitFullscreen) {
+          document.msExitFullscreen();
         }
-          // 改变当前全屏状态
-        this.isFullscreen = !this.isFullscreen;
-      },
+      } else {
+        if (element.requestFullscreen) {
+          element.requestFullscreen();
+        } else if (element.webkitRequestFullScreen) {
+          element.webkitRequestFullScreen();
+        } else if (element.mozRequestFullScreen) {
+          element.mozRequestFullScreen();
+        } else if (element.msRequestFullscreen) {
+          element.msRequestFullscreen();
+        }
+      }
+      // 改变当前全屏状态
+      this.isFullscreen = !this.isFullscreen;
+    },
     handleItem(data) {
       if (data.id == "about") {
         this.showIntro = true;
       }
       if (data.id == "full") {
-        this.onFullScreen()
+        this.onFullScreen();
       }
       if (data.id == "vr") {
         var krpano = document.getElementById("krpanoSWFObject");
@@ -171,7 +181,7 @@ export default {
           if (res.code == 0) {
             this.showPassword = false;
             this.canLoad = true;
-          } 
+          }
         }
       );
     },
@@ -193,14 +203,13 @@ export default {
           }
         });
       });
-      tmp = this.$unique(tmp)
+      tmp = this.$unique(tmp);
 
       this.showInfo.catalogs = tmp;
       let rootmp = [];
       tmp.forEach((item) => {
         this.showInfo.catalogRoot.forEach((sub) => {
-
-          sub.children = this.$unique(sub.children)
+          sub.children = this.$unique(sub.children);
 
           if (sub.children.indexOf(item.id) > -1) {
             rootmp.push(sub);
@@ -208,18 +217,16 @@ export default {
         });
       });
 
+      rootmp = this.$unique(rootmp);
 
-      rootmp = this.$unique(rootmp)
-
-      let sortArr = this.showInfo.catalogRoot.map(item=>item.name)
-      rootmp.sort((a,b)=>{
-        return sortArr.indexOf(a.name) - sortArr.indexOf(b.name)
-      })
-
+      let sortArr = this.showInfo.catalogRoot.map((item) => item.name);
+      rootmp.sort((a, b) => {
+        return sortArr.indexOf(a.name) - sortArr.indexOf(b.name);
+      });
 
       this.showInfo.catalogRoot = rootmp.map((item) => {
         let temp = [];
-        item.children = this.$unique(item.children)
+        item.children = this.$unique(item.children);
         item.children.forEach((sub) => {
           tmp.forEach((jj) => {
             if (jj.id == sub) {
@@ -233,15 +240,15 @@ export default {
         };
       });
 
-      this.showInfo.catalogs = tmp
+      this.showInfo.catalogs = tmp;
 
-      let cid = 'c_'+this.$randomWord(true,8,8)
+      let cid = "c_" + this.$randomWord(true, 8, 8);
 
       if (this.showInfo.catalogRoot.length <= 0) {
         this.showInfo.catalogRoot.push({
-          id: 'r_'+this.$randomWord(true,8,8),
+          id: "r_" + this.$randomWord(true, 8, 8),
           name: "全部场景",
-          children:[cid]
+          children: [cid],
         });
       }
 
@@ -253,28 +260,27 @@ export default {
       }
 
       if (this.showInfo.firstScene) {
-        this.showInfo.firstScene = this.showInfo.scenes.find(item=>item.sceneCode==this.showInfo.firstScene.sceneCode)
+        this.showInfo.firstScene = this.showInfo.scenes.find(
+          (item) => item.sceneCode == this.showInfo.firstScene.sceneCode
+        );
       }
 
       this.$store.commit("SetShowInfo", this.showInfo);
     },
 
     getSceneInfo() {
-      checkWork("",data=>{
+      checkWork("", (data) => {
         if (data.data) {
-          getPanoInfo(
-            "",
-            (res) => {
-              this.$store.commit("SetShowInfo", res);
-              this.fixData()
-              this.loadFinish = true
-            }
-          );
-        } else{
-          this.loadFinish = true
+          getPanoInfo("", (res) => {
+            this.$store.commit("SetShowInfo", res);
+            this.fixData();
+            this.loadFinish = true;
+          });
+        } else {
+          this.loadFinish = true;
         }
-      })
-    }
+      });
+    },
   },
   watch: {
     currentHotspot: {
@@ -296,7 +302,7 @@ export default {
     canLoad(newVal) {
       if (newVal) {
         setTimeout(() => {
-          this.showTips = this.localRemind
+          this.showTips = this.localRemind;
           setTimeout(() => {
             this.showTips = false;
           }, this.showInfo.remindTime * 1000);
@@ -308,21 +314,20 @@ export default {
       immediate: true,
       handler: function (newVal) {
         if (newVal) {
-          document.title = newVal.name || '无标题'
-          let locoR = "localRemind"+newVal.id
+          document.title = newVal.name || "无标题";
+          let locoR = "localRemind" + newVal.id;
           if (!newVal.description) {
-            this.aside.shift()
+            this.aside.shift();
           }
-          if (newVal.isRemind==1) {
-            this.localRemind = localStorage.getItem(locoR) == 1 ? false : true
+          if (newVal.isRemind == 1) {
+            this.localRemind = localStorage.getItem(locoR) == 1 ? false : true;
             localStorage.setItem(locoR, 1);
-          }
-          else{
+          } else {
             this.localRemind = true;
             localStorage.setItem(locoR, 0);
           }
           if (this.showInfo.firstScene) {
-            if (this.showInfo.firstScene.type == '4dkk') {
+            if (this.showInfo.firstScene.type == "4dkk") {
               this.localRemind = false;
             }
           }
@@ -332,19 +337,19 @@ export default {
     },
     activeItem: {
       handler(newVal) {
-        this.currentHotspot = ''
+        this.currentHotspot = "";
         $("#pano").empty();
         window.vrInitFn = () => {
-          $smallWaiting.hide()
+          $smallWaiting.hide();
           var krpano = document.getElementById("krpanoSWFObject");
           __krfn.utils.initHotspot(krpano, newVal && newVal.someData, false);
         };
         window.vrViewFn = () => {
           try {
-            let tmp = newVal.initVisual||{};
+            let tmp = newVal.initVisual || {};
             var krpano = document.getElementById("krpanoSWFObject");
-            krpano.set("view.vlookat", tmp.vlookat||0);
-            krpano.set("view.hlookat", tmp.hlookat||0);
+            krpano.set("view.vlookat", tmp.vlookat || 0);
+            krpano.set("view.hlookat", tmp.hlookat || 0);
             krpano.set("autorotate.enabled", Boolean(this.showInfo.isAuto));
           } catch (error) {
             error;
@@ -355,13 +360,13 @@ export default {
           "events[skin_events].onloadcomplete": "js(window.vrInitFn());",
         };
         if (newVal) {
-          if (newVal.type=='4dkk') {
-              removepano("#pano");
-              $("#pano").empty();
-              return
+          if (newVal.type == "4dkk") {
+            removepano("#pano");
+            $("#pano").empty();
+            return;
           }
           removepano("#pano");
-          $smallWaiting.show()
+          $smallWaiting.show();
 
           embedpano({
             // xml: "%HTMLPATH%/static/template/tour.xml",
@@ -381,8 +386,8 @@ export default {
     window.__krfn = __krfn;
 
     this.$bus.on("clickHotspot", (data) => {
-      let someData = this.activeItem.someData
-      if (typeof someData == 'string') {
+      let someData = this.activeItem.someData;
+      if (typeof someData == "string") {
         someData = JSON.parse(this.activeItem.someData);
       }
       let idx = someData.hotspots.findIndex((item) => item.name == data);
@@ -398,20 +403,20 @@ export default {
 .panocon {
   width: 100%;
   height: 100%;
-  .hasDel{
+  .hasDel {
     background: #fff;
     width: 100%;
     height: 100%;
     position: relative;
-    >div{
+    > div {
       position: absolute;
       top: 50%;
       left: 50%;
-      transform: translate(-50%,-50%);
+      transform: translate(-50%, -50%);
       color: #909090;
       text-align: center;
       font-size: 18px;
-      >p{
+      > p {
         margin-top: 20px;
       }
     }
@@ -420,7 +425,7 @@ export default {
     width: 100%;
     height: 100%;
   }
-  >iframe{
+  > iframe {
     width: 100%;
     height: 100%;
   }

+ 82 - 20
packages/qjkankan-editor/src/framework/showMobile/index.vue

@@ -8,17 +8,38 @@
         :bgmUrl="bgmUrl"
         :somedatainfo="somedatainfo"
         :key="embeM || activeItem.sceneCode"
-        :url="otherLink ? otherLink : `/embed.html?from=mingyuan&m=${embeM || activeItem.sceneCode}&lang=zh&scene-link=1&rnd=${rnd}`"
+        :url="
+          otherLink
+            ? otherLink
+            : `/embed.html?from=mingyuan&m=${
+                embeM || activeItem.sceneCode
+              }&lang=zh&scene-link=1&rnd=${rnd}`
+        "
       />
       <!-- -->
 
       <div v-show="activeItem.type != '4dkk'" id="pano"></div>
 
-      <div class="pano-logo" v-if="showInfo.isLogo && activeItem.type != '4dkk'">
-        <img :src="showInfo.logo || require('@/assets/images/default/img_logoshow@2x.png')" alt="" />
+      <div
+        class="pano-logo"
+        v-if="showInfo.isLogo && activeItem.type != '4dkk'"
+      >
+        <img
+          :src="
+            showInfo.logo ||
+            require('@/assets/images/default/img_logoshow@2x.png')
+          "
+          alt=""
+        />
       </div>
 
-      <list v-if="canLoad && !isVR" @select="handleSelect" :firstScene="firstScene" :select="activeItem" :mapvisit="mapvisit"></list>
+      <list
+        v-if="canLoad && !isVR"
+        @select="handleSelect"
+        :firstScene="firstScene"
+        :select="activeItem"
+        :mapvisit="mapvisit"
+      ></list>
 
       <ul class="aside" v-show="activeItem.type != '4dkk'">
         <li v-for="(item, i) in aside" :key="i">
@@ -27,20 +48,47 @@
           </span>
         </li>
       </ul>
-      <div class="oper-tips" :class="{ hidetips: !showTips }" v-if="localRemind">
-        <img :src="showInfo.appIcon || require('@/assets/images/default/show/img_tipsmb_default.png')" alt="" />
+      <div
+        class="oper-tips"
+        :class="{ hidetips: !showTips }"
+        v-if="localRemind"
+      >
+        <img
+          :src="
+            showInfo.appIcon ||
+            require('@/assets/images/default/show/img_tipsmb_default.png')
+          "
+          alt=""
+        />
       </div>
-      <password :bg="showInfo.icon" :show="showPassword" @submit="handlePassword" @close="showPassword = false" />
+      <password
+        :bg="showInfo.icon"
+        :show="showPassword"
+        @submit="handlePassword"
+        @close="showPassword = false"
+      />
       <popup :title="'简介'" :show="showIntro" @close="showIntro = false">
         <div slot="content" class="introcon">
           <span>{{ showInfo.description || "暂无简介" }}</span>
         </div>
       </popup>
-      <imgview @close="showImage = false" v-if="showImage" :image="currentHotspot.image" />
+      <imgview
+        @close="showImage = false"
+        v-if="showImage"
+        :image="currentHotspot.image"
+      />
 
-      <preview :item="currentHotspot" :show="showPreview" @close="showPreview = false" />
+      <preview
+        :item="currentHotspot"
+        :show="showPreview"
+        @close="showPreview = false"
+      />
 
-      <popup :title="currentHotspot.hotspotTitle" :show="showTextarea" @close="showTextarea = false">
+      <popup
+        :title="currentHotspot.hotspotTitle"
+        :show="showTextarea"
+        @close="showTextarea = false"
+      >
         <div slot="content" class="introcon">
           <span>{{ currentHotspot.textarea }}</span>
         </div>
@@ -75,7 +123,12 @@
 
 <script>
 import * as krfn from "@/core/index.js";
-import { getPanoInfo, checkPassword, checkWork, getSceneInfomation } from "@/api";
+import {
+  getPanoInfo,
+  checkPassword,
+  checkWork,
+  getSceneInfomation,
+} from "@/api";
 import password from "./popup/password";
 import preview from "./popup/preview";
 import { $smallWaiting } from "@/components/shared/loading";
@@ -122,7 +175,7 @@ export default {
     return {
       mapvisit: 0,
       bgmUrl: "",
-      somedatainfo:'',
+      somedatainfo: "",
       isVR: false,
       localRemind: false,
       showPreview: false,
@@ -168,17 +221,21 @@ export default {
     getSceneInfomation() {
       getSceneInfomation({ id: this.activeItem.sceneCode }, (data) => {
         this.mapvisit = data.data.mapVisi;
-        this.somedatainfo = data.data
+        this.somedatainfo = data.data;
         if (data.data.bgMusic) {
           if (bgmMap[data.data.bgMusic]) {
             this.bgmUrl =
               window.location.href.indexOf("www.4dkankan.com") > -1
                 ? `https://4dkk.4dage.com/v3/audio/${bgmMap[data.data.bgMusic]}`
-                : `https://4dkk.4dage.com/v3-test/audio/${bgmMap[data.data.bgMusic]}`;
+                : `https://4dkk.4dage.com/v3-test/audio/${
+                    bgmMap[data.data.bgMusic]
+                  }`;
           }
 
-          if (data.data.bgMusic == 'user') {
-            this.bgmUrl = data.data.bgMusic ? `https://4dkk.4dage.com/images/images${data.data.num}/${data.data.bgMusicName}` : "";
+          if (data.data.bgMusic == "user") {
+            this.bgmUrl = data.data.bgMusic
+              ? `https://4dkk.4dage.com/images/images${data.data.num}/${data.data.bgMusicName}`
+              : "";
           }
         }
       });
@@ -197,7 +254,10 @@ export default {
             var webvr = krpano.get("webvr");
             webvr.entervr();
           } else {
-            this.$alert({ content: "运动和方向访问失败,您需要完全关闭此应用,然后再次打开,并允许访问运动与方向" });
+            this.$alert({
+              content:
+                "运动和方向访问失败,您需要完全关闭此应用,然后再次打开,并允许访问运动与方向",
+            });
           }
         });
       }
@@ -285,7 +345,9 @@ export default {
       }
 
       if (this.showInfo.firstScene) {
-        this.showInfo.firstScene = this.showInfo.scenes.find((item) => item.sceneCode == this.showInfo.firstScene.sceneCode);
+        this.showInfo.firstScene = this.showInfo.scenes.find(
+          (item) => item.sceneCode == this.showInfo.firstScene.sceneCode
+        );
       }
 
       this.$store.commit("SetShowInfo", this.showInfo);
@@ -308,7 +370,7 @@ export default {
   watch: {
     currentHotspot: {
       deep: true,
-      handler: function(newVal) {
+      handler: function (newVal) {
         if (newVal) {
           this.audioUrl = "";
           if (newVal.hotspotType == "link") {
@@ -349,7 +411,7 @@ export default {
     showInfo: {
       deep: true,
       immediate: true,
-      handler: function(newVal) {
+      handler: function (newVal) {
         if (newVal) {
           document.title = newVal.name || "无标题";
           let locoR = "localRemind" + newVal.id;

+ 1 - 1
packages/qjkankan-view/.env.testprod

@@ -7,5 +7,5 @@ VUE_APP_PROXY_URL='https://test.4dkankan.com/qjkankan/'
 VUE_APP_URL_FILL=/qjkankan
 # 接口请求地址
 VUE_APP_APIS_URL=https://test.4dkankan.com/
-VUE_APP_DEBBUG_FLAG=0614-01
+VUE_APP_DEBBUG_FLAG=0614-04
 VUE_APP_DEBBUG_NOTIFY=0

+ 18 - 2
packages/qjkankan-view/src/components/assembly/MobileTags/metas/metas-image.vue

@@ -67,10 +67,23 @@ const hasImages = computed(
     currentTag.value.imageTextInfo.imageList.length > 0
 );
 // debugger
+const appHeight = () => {
+  const doc = document.documentElement;
+  var windowVH = window.innerHeight / 100;
+  doc.style.setProperty("--vh", windowVH + "px");
+  doc.style.setProperty("--imageHeight", `${window.innerHeight}px`);
+};
 
-onMounted(() => {});
+onMounted(() => {
+  appHeight();
+  window.addEventListener("resize", appHeight);
+  window.addEventListener("orientationchange", appHeight);
+});
 
-onUnmounted(() => {});
+onUnmounted(() => {
+  window.removeEventListener("resize", appHeight);
+  window.removeEventListener("orientationchange", appHeight);
+});
 const zoomChange = (swiper, scale, imageEl, slideEl) => {
   console.log("zoomChange", scale, imageEl, slideEl);
   if (browser.detectIOS()) {
@@ -86,8 +99,11 @@ const zoomChange = (swiper, scale, imageEl, slideEl) => {
 <style lang="scss">
 .image-container {
   height: calc(100vh - 50px);
+  height: calc(var(--imageHeight) - 50px);
+  // height: calc(var(--vh) * 100 - 50px);+
   width: 100%;
   overflow: hidden;
+  // background-color: red;
 }
 .metas-image {
   width: 100%;

+ 23 - 8
packages/qjkankan-view/src/components/assembly/OpeningMobile.vue

@@ -94,6 +94,7 @@
   </div>
 </template>
 <script setup>
+import { toConfigure } from "@/utils/wxshare";
 import {
   ref,
   watch,
@@ -357,8 +358,18 @@ onUnmounted(() => {
     openvideo$.value.addEventListener("ended", handleVideoEnded, false);
   }
 });
-onMounted(() => {
+function WeixinPlay(){
+  WeixinJSBridge.invoke('getNetworkType', {}, function (e) {
+    openvideo$.value.play();
+  })
+}
+
+
+onMounted(async () => {
   console.log("coverData", unref(props.coverData));
+  if (typeof wx != "undefined") {
+    await toConfigure();
+  }
 
   if (openvideo$.value) {
     openvideo$.value.addEventListener("ended", handleVideoEnded, false);
@@ -375,13 +386,17 @@ onMounted(() => {
       }
     });
 
-    // document.addEventListener(
-    //   "WeixinJSBridgeReady",
-    //   () => {
-    //     openvideo$.value.play();
-    //   },
-    //   false
-    // );
+    if (window.WeixinJSBridge) {
+      WeixinPlay();
+    } else {
+      document.addEventListener(
+        "WeixinJSBridgeReady",
+        function () {
+          WeixinPlay();
+        },
+        false
+      );
+    }
   }
 }),
   useApp().then((app) => {

+ 10 - 5
packages/qjkankan-view/src/hooks/useAudio.js

@@ -2,7 +2,7 @@
  * 利用
  */
 import store from "@/store";
-import { computed, onMounted, watch, ref, unref } from "vue";
+import { computed, onMounted, watch, ref, unref, reactive } from "vue";
 import debounce from "lodash-es/debounce";
 import mitt from "mitt";
 let CLICKFIRST = false;
@@ -10,8 +10,10 @@ let CLICKFIRST = false;
 const currentPlayer = ref(null);
 const isInit = ref(false);
 const currentAudio = computed(() => store.getters["audio/currentAudio"]);
+const currentAudioTemp = ref("");
 const isDoneforCover = computed(() => store.getters["scene/isDoneforCover"]);
 const currentScene = computed(() => store.getters["scene/currentScene"]);
+
 const isShowCover = computed(
   () => store.getters["scene/metadata"].coverInfo.isShowCover === 1 || false
 );
@@ -42,10 +44,12 @@ async function initDefaultAudio() {
 
   watch(
     currentAudio,
-    (val, old) => {
-      const isSame = unref(old) && unref(val).url === unref(old).url;
-      console.log("isSame", isSame);
-      if (unref(val) && unref(val).url.length > 0) {
+    (val) => {
+      const oldValue = currentAudioTemp.value;
+      const newValue = unref(val).url;
+      const isSame = newValue === oldValue;
+      console.log("audio-isSame", isSame);
+      if (newValue && newValue.length > 0) {
         if (unref(currentPlayer)) {
           const url = unref(val).url;
           const autoplay = unref(val).isAuto;
@@ -53,6 +57,7 @@ async function initDefaultAudio() {
           console.log("currentAudio", unref(val).url, autoplay, loop);
           if (!isSame) {
             unref(currentPlayer).switchUrl(url, autoplay, loop);
+            currentAudioTemp.value = newValue;
           } else {
             //相同URL的再次播放
             unref(currentPlayer).resume();

+ 54 - 50
packages/qjkankan-view/src/store/modules/scene.js

@@ -1,23 +1,20 @@
-
 /**
  * 兼容自定主义按键为中文的处理器
  */
 const covertCustomButton = (data) => {
-  return data.map(item => {
-    if ('type' in item) {
-      if (item.type == '链接') item.type = 'link'
-      if (item.type == '电话') item.type = 'phone'
-
+  return data.map((item) => {
+    if ("type" in item) {
+      if (item.type == "链接") item.type = "link";
+      if (item.type == "电话") item.type = "phone";
     }
-    if ('openMethod' in item) {
-      if (item.openMethod == '弹出层打开') item.openMethod = '_self'
-      if (item.openMethod == '新窗口打开') item.openMethod = '_target'
+    if ("openMethod" in item) {
+      if (item.openMethod == "弹出层打开") item.openMethod = "_self";
+      if (item.openMethod == "新窗口打开") item.openMethod = "_target";
     }
     // console.log('当前转换数据!', item);
-    return item
-  })
-
-}
+    return item;
+  });
+};
 
 export default {
   namespaced: true,
@@ -40,12 +37,10 @@ export default {
       //当前场景分组
       currentScenesList: {},
       //当时场景的版本
-      fdkkCurrentVersion: 'v4',
+      fdkkCurrentVersion: "v4",
       // 存在开场动作并动作完成的flag
 
-      isDoneforCover: false
-
-
+      isDoneforCover: false,
     };
   },
   getters: {
@@ -62,49 +57,48 @@ export default {
     isDoneforCover: (state) => state.isDoneforCover,
 
     customLink: (state, getters, rootState, rootGetters) => {
-      let metadata = getters.metadata
+      let metadata = getters.metadata;
       if (metadata.customButton) {
-        let temp = JSON.parse(JSON.stringify(metadata.customButton))
+        let temp = JSON.parse(JSON.stringify(metadata.customButton));
         const res = covertCustomButton(temp);
-        return res.find(item => item.type == 'link')
+        return res.find((item) => item.type == "link");
       }
-      return {}
+      return {};
     },
 
-
     customTelephone: (state, getters, rootState, rootGetters) => {
-      let metadata = getters.metadata
+      let metadata = getters.metadata;
       if (metadata.customButton) {
         console.log(metadata.customButton);
-        let temp = JSON.parse(JSON.stringify(metadata.customButton))
+        let temp = JSON.parse(JSON.stringify(metadata.customButton));
         const res = covertCustomButton(temp);
-        return temp.find(item => item.type == 'phone')
+        return temp.find((item) => item.type == "phone");
       }
 
-      return {}
+      return {};
     },
     musicURL: (state, getters, rootState, rootGetters) => {
-      let metadata = getters.metadata
+      let metadata = getters.metadata;
       if (metadata.backgroundMusic && metadata.backgroundMusic.id) {
-        return metadata.backgroundMusic.ossPath
+        return metadata.backgroundMusic.ossPath;
       }
-      return null
+      return null;
     },
 
     earthMask: (state, getters) => {
-      let metadata = getters.metadata
+      let metadata = getters.metadata;
       if (metadata.customMask && metadata.customMask.earth) {
-        return metadata.customMask.earth
+        return metadata.customMask.earth;
       }
-      return null
+      return null;
     },
 
     skyMask: (state, getters) => {
-      let metadata = getters.metadata
+      let metadata = getters.metadata;
       if (metadata.customMask && metadata.customMask.sky) {
-        return metadata.customMask.sky
+        return metadata.customMask.sky;
       }
-      return null
+      return null;
     },
   },
   mutations: {
@@ -118,18 +112,19 @@ export default {
       state.fdkkCurrentVersion = payload;
     },
 
-
     // 设置当前场景
     setCurrentScene(state, payload) {
       if (payload.someData) {
         try {
           // someData旧数据有可能是字符串,要parse一下
-          payload.someData = typeof payload.someData == 'string' ? JSON.parse(payload.someData) : payload.someData
-        } catch (error) {
-        }
+          payload.someData =
+            typeof payload.someData == "string"
+              ? JSON.parse(payload.someData)
+              : payload.someData;
+        } catch (error) {}
       }
       state.currentScene = payload;
-      this.commit('fdkk/setReset')
+      this.commit("fdkk/setReset");
     },
     // 设置当前二级分组
     setCurrentSecondary(state, payload) {
@@ -138,7 +133,10 @@ export default {
         return state.currentSecondary.id == item.category;
       });
 
-      this.commit('scene/setCurrentScenesList', arr.sort((a, b) => a.weight - b.weight))
+      this.commit(
+        "scene/setCurrentScenesList",
+        arr.sort((a, b) => a.weight - b.weight)
+      );
     },
 
     // 设置当前场景列表
@@ -154,34 +152,40 @@ export default {
         payload.children.forEach((item) => {
           state.metadata.catalogs.forEach((sub) => {
             if (item == sub.id) {
-              if (state.list.some(iii => iii.category == sub.id)) {
+              if (state.list.some((iii) => iii.category == sub.id)) {
                 temp.push(sub);
               }
             }
           });
         });
 
-      this.commit('scene/setSecondaryList', temp)
+      this.commit("scene/setSecondaryList", temp);
     },
 
     // 设置当前二级分组列表
     setSecondaryList(state, payload) {
-      state.secondaryList = payload
+      state.secondaryList = payload;
       if (payload.length > 0) {
-        this.commit('scene/setCurrentSecondary', payload[0])
+        this.commit("scene/setCurrentSecondary", payload[0]);
       }
     },
     setMetaData(state, payload) {
       state.metadata = payload;
-      document.title = payload.name || '无标题'
+      document.title = payload.name || "无标题";
       // debugger
-      document.querySelector('meta[name="description"]').setAttribute("content", payload.description.replace(/<\/?[^>]+(>|$)/g, ""));
-      document.querySelector('meta[name="cover"]').setAttribute("content", payload.icon);
+      document
+        .querySelector('meta[name="description"]')
+        .setAttribute(
+          "content",
+          payload.description.replace(/<\/?[^>]+(>|$)/g, "")
+        );
+      document
+        .querySelector('meta[name="cover"]')
+        .setAttribute("content", payload.icon);
     },
 
     setDoneforCover(state, payload) {
       state.isDoneforCover = payload;
-    }
-
+    },
   },
 };

+ 3 - 1
packages/qjkankan-view/src/utils/wxshare.js

@@ -1,4 +1,4 @@
-function toConfigure() {
+export function toConfigure() {
   return new Promise((resolve, reject) => {
     $.ajax({
       url: "//www.4dage.com/wechat/jssdk/share",
@@ -154,6 +154,8 @@ export default async (args) => {
   if (typeof wx != "undefined") {
     //需要引入 https://res.wx.qq.com/open/js/jweixin-1.2.0.js
     await toConfigure();
+    const event = new Event("weixinInit");
+    document.dispatchEvent(event);
     setup(args);
   }
 };