gemercheung 2 years ago
parent
commit
741d70dc23

+ 99 - 62
packages/qjkankan-kankan-view/src/pages/SMG.vue

@@ -12,24 +12,48 @@
           <ui-icon type="show_map_collect"></ui-icon>
         </span>
 
-        <p class="change" v-if="controls.showDollhouse" @click="changeMode('dollhouse')">
+        <p
+          class="change"
+          v-if="controls.showDollhouse"
+          @click="changeMode('dollhouse')"
+        >
           <ui-icon type="show_3d_normal"></ui-icon>
-          {{$t('mode.dollhouseModel')}}
+          {{ $t("mode.dollhouseModel") }}
         </p>
       </teleport>
       <template v-if="refMiniMap">
-        <div :class="{ disabled: flying }" v-show="mode != 'panorama'"
-          v-if="controls.showFloorplan && controls.showDollhouse" class="tab-layer">
+        <div
+          :class="{ disabled: flying }"
+          v-show="mode != 'panorama'"
+          v-if="controls.showFloorplan && controls.showDollhouse"
+          class="tab-layer"
+        >
           <div class="tabs" v-if="controls.showMap">
-            <span :class="{ active: mode === 'floorplan' }" ref="floorplan_ref"
-              @click="changeMode('floorplan', $event)">
-              <ui-icon :type="mode == 'floorplan' ? 'show_plane_selected' : 'show_plane_normal'"></ui-icon>
-              {{$t('mode.floorplan')}}
+            <span
+              :class="{ active: mode === 'floorplan' }"
+              ref="floorplan_ref"
+              @click="changeMode('floorplan', $event)"
+            >
+              <ui-icon
+                :type="
+                  mode == 'floorplan'
+                    ? 'show_plane_selected'
+                    : 'show_plane_normal'
+                "
+              ></ui-icon>
+              {{ $t("mode.floorplan") }}
             </span>
-            <span :class="{ active: mode === 'dollhouse' }" ref="dollhouse_ref"
-              @click="changeMode('dollhouse', $event)">
-              <ui-icon :type="mode == 'dollhouse' ? 'show_3d_selected' : 'show_3d_normal'"></ui-icon>
-              {{$t('mode.dollhouse')}}
+            <span
+              :class="{ active: mode === 'dollhouse' }"
+              ref="dollhouse_ref"
+              @click="changeMode('dollhouse', $event)"
+            >
+              <ui-icon
+                :type="
+                  mode == 'dollhouse' ? 'show_3d_selected' : 'show_3d_normal'
+                "
+              ></ui-icon>
+              {{ $t("mode.dollhouse") }}
             </span>
             <div class="background" ref="background"></div>
           </div>
@@ -39,13 +63,12 @@
     <UiTags />
   </div>
 </template>
-  
-<script setup>
 
+<script setup>
 import UiTags from "@/components/Tags";
 
-import { listenMessage } from '@/utils/messageHandler'
-import {Dialog} from '@/global_components'
+import { listenMessage } from "@/utils/messageHandler";
+import { Dialog } from "@/global_components";
 
 import Information from "@/components/Information";
 import Control from "@/components/Controls/Control.Mobile.vue";
@@ -59,33 +82,33 @@ import { ref, onMounted, computed, nextTick, watch } from "vue";
 import { useStore } from "vuex";
 import browser from "@/utils/browser";
 import { useApp, getApp } from "@/app";
-import { useI18n, getLocale } from '@/i18n'
+import { useI18n, getLocale } from "@/i18n";
 import { useAppHeight } from "@/utils/globalViewHeight";
-const { t } = useI18n({ useScope: 'global' })
+const { t } = useI18n({ useScope: "global" });
 useAppHeight();
 let app = null;
 
-const autoPlayMedia = player => {
-    function onclick() {
-        window.parent.postMessage(
-            {
-                source: "qjkankan",
-                event: "autoPlayBgm",
-                params: {
-                    status: true,
-                },
-            },
-            "*"
-        );
-        $player.removeEventListener('click', onclick)
-        $player.removeEventListener('touchstart', onclick)
-    }
-    const $player = document.querySelector('.player')
-    $player.addEventListener('click', onclick)
-    $player.addEventListener('touchstart', onclick)
-}
+const autoPlayMedia = (player) => {
+  function onclick() {
+    window.parent.postMessage(
+      {
+        source: "qjkankan",
+        event: "autoPlayBgm",
+        params: {
+          status: true,
+        },
+      },
+      "*"
+    );
+    $player.removeEventListener("click", onclick);
+    $player.removeEventListener("touchstart", onclick);
+  }
+  const $player = document.querySelector(".player");
+  $player.addEventListener("click", onclick);
+  $player.addEventListener("touchstart", onclick);
+};
 
-listenMessage()
+listenMessage();
 
 const closetagtype = () => {
   store.commit("tag/setTagClickType", {
@@ -113,10 +136,14 @@ const refMiniMap = ref(null);
 const isCollapse = ref(false);
 const background = ref(null);
 const resize = () => {
-  if (this.$refs.background && (this.mode == "floorplan" || this.mode == "dollhouse")) {
+  if (
+    this.$refs.background &&
+    (this.mode == "floorplan" || this.mode == "dollhouse")
+  ) {
     this.$nextTick(() => {
       let $active = $(this.$el).find(".tabs .active");
-      background.value.style.width = $active[0].getBoundingClientRect().width + "px";
+      background.value.style.width =
+        $active[0].getBoundingClientRect().width + "px";
       background.value.style.left = $active.position().left + "px";
     });
   }
@@ -165,12 +192,14 @@ watch(
       clearTimeout(timer);
       if (val == "floorplan") {
         if (floorplan_ref.value && floorplan_ref.value) {
-          background.value.style.width = floorplan_ref.value.getBoundingClientRect().width + "px";
+          background.value.style.width =
+            floorplan_ref.value.getBoundingClientRect().width + "px";
           background.value.style.left = floorplan_ref.value.offsetLeft + "px";
         }
       } else if (val == "dollhouse") {
         if (dollhouse_ref.value && dollhouse_ref.value) {
-          background.value.style.width = dollhouse_ref.value.getBoundingClientRect().width + "px";
+          background.value.style.width =
+            dollhouse_ref.value.getBoundingClientRect().width + "px";
           background.value.style.left = dollhouse_ref.value.offsetLeft + "px";
         }
       }
@@ -247,16 +276,17 @@ onMounted(() => {
         window.location.replace(`/5034.html?m=` + browser.getURLParam("m"));
         break;
       case 5005:
-        Dialog.toast({
-            content: t('guide.no_scene'),
-            type: 'error',
-        })
+        // Dialog.toast({
+        //     content: t('guide.no_scene'),
+        //     type: 'error',
+        // })
+        window.location.replace(`/5033.html?m=` + browser.getURLParam("m"));
         break;
     }
   });
   app.Scene.on("loaded", (pano) => {
     refMiniMap.value = "[xui_min_map]";
-    let music = store.getters['scene/musicURL']
+    let music = store.getters["scene/musicURL"];
 
     window.parent.postMessage(
       {
@@ -268,7 +298,7 @@ onMounted(() => {
       },
       "*"
     );
-    autoPlayMedia()
+    autoPlayMedia();
   });
   app.Scene.on("panorama.videorenderer.resumerender", () => {
     window.parent.postMessage(
@@ -346,19 +376,19 @@ onMounted(() => {
     store.commit("setFlying", false);
     store.commit("setPanoId", targetPano.id);
   });
-  app.TourManager.on('loaded', async (tour) => {
+  app.TourManager.on("loaded", async (tour) => {
     let tours = JSON.parse(
       JSON.stringify(app.TourManager.tours, (key, val) => {
-        if (key === 'audio') {
-          return null
+        if (key === "audio") {
+          return null;
         } else {
-          return val
+          return val;
         }
       })
-    )
-    store.commit('tour/setData', {
+    );
+    store.commit("tour/setData", {
       tours: tours,
-    })
+    });
 
     window.parent.postMessage(
       {
@@ -383,12 +413,16 @@ onMounted(() => {
       ),
     });
   });
-  app.store.on("floorcad", (floor) => store.commit("scene/loadFloorData", floor));
-  app.store.on('flooruser', floor => store.commit('scene/loadFloorData', floor)) //4.7以后新楼层方式
+  app.store.on("floorcad", (floor) =>
+    store.commit("scene/loadFloorData", floor)
+  );
+  app.store.on("flooruser", (floor) =>
+    store.commit("scene/loadFloorData", floor)
+  ); //4.7以后新楼层方式
   app.render();
 });
 </script>
-  
+
 <style lang="scss">
 .tab-layer {
   width: 100%;
@@ -485,7 +519,11 @@ onMounted(() => {
         width: 2px;
         height: 28px;
         bottom: -30px;
-        background: linear-gradient(145deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0));
+        background: linear-gradient(
+          145deg,
+          rgba(255, 255, 255, 0.8),
+          rgba(255, 255, 255, 0)
+        );
         position: absolute;
       }
 
@@ -503,7 +541,7 @@ onMounted(() => {
         pointer-events: none;
       }
 
-      >p {
+      > p {
         color: #131d34;
         font-size: 16px;
         pointer-events: none;
@@ -582,7 +620,7 @@ onMounted(() => {
     .tabs {
       height: 0.7rem;
 
-      >span {
+      > span {
         height: 0.7rem;
         font-size: 0.25rem;
       }
@@ -590,4 +628,3 @@ onMounted(() => {
   }
 }
 </style>
-  

+ 5 - 6
packages/qjkankan-kankan-view/src/pages/SPG.vue

@@ -33,8 +33,6 @@ import browser from "@/utils/browser";
 import { useI18n, getLocale } from "@/i18n";
 const { t } = useI18n({ useScope: "global" });
 
-
-
 const autoPlayMedia = (player) => {
   function onclick() {
     window.parent.postMessage(
@@ -95,10 +93,11 @@ onMounted(() => {
         window.location.replace(`/5034.html?m=` + browser.getURLParam("m"));
         break;
       case 5005:
-        Dialog.toast({
-          content: t("guide.no_scene"),
-          type: "error",
-        });
+        window.location.replace(`/5033.html?m=` + browser.getURLParam("m"));
+        // Dialog.toast({
+        //   content: t("guide.no_scene"),
+        //   type: "error",
+        // });
         break;
     }
   });

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

@@ -7,7 +7,7 @@ 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=0728-01
+VUE_APP_DEBBUG_FLAG=0728-02
 VUE_APP_DEBBUG_NOTIFY=0
 VUE_APP_DEBBUG_V4=0
 VUE_APP_DEBBUG_V4_URL="http://192.168.0.186:8081"

+ 20 - 13
packages/qjkankan-view/src/components/UIGather/list.vue

@@ -189,7 +189,9 @@ const tabCurrentScene = (data) => {
   console.log("tabCurrentScene", data.id, currentScene.value.id);
   if (data.id !== currentScene.value.id) {
     store.commit("scene/setCurrentScene", data);
-    scenesSwiperFocus();
+    setTimeout(() => {
+      scenesSwiperFocus();
+    }, 300);
   } else {
     console.log("重复点击当前导航");
     // window.alert("alert-test-->重复点击当前导航");
@@ -198,9 +200,6 @@ const tabCurrentScene = (data) => {
 
 const tabSecondary = (data, index) => {
   store.commit("scene/setCurrentSecondary", data);
-  // if (window.sencordNatSwiper) {
-  //   window.sencordNatSwiper.slideTo(index);
-  // }
 };
 
 const tabRoot = (data) => {
@@ -234,7 +233,9 @@ const swiperOptions = {
 const initMainSwiper = () => {
   nextTick(() => {
     if (window.mainNatSwiper) {
-      window.mainNatSwiper = null;
+      // window.mainNatSwiper = null;
+      window.mainNatSwiper.update();
+      window.sencordNatSwiper.slideReset();
     }
     window.mainNatSwiper = new Swiper("#swcatalogRoot", swiperOptions);
   });
@@ -242,19 +243,25 @@ const initMainSwiper = () => {
 const initsencordNatSwiper = () => {
   nextTick(() => {
     if (window.sencordNatSwiper) {
-      window.sencordNatSwiper = null;
+      // window.sencordNatSwiper = null;
+      window.sencordNatSwiper.update();
+      window.sencordNatSwiper.slideReset();
     }
     window.sencordNatSwiper = new Swiper("#swSecondary", swiperOptions);
   });
 };
 const initScenesSwiper = () => {
+  console.warn("initScenesSwiper");
   nextTick(() => {
     if (window.scenesNatSwiper) {
-      window.scenesNatSwiper = null;
+      window.scenesNatSwiper.update();
+      window.scenesNatSwiper.slideReset();
+      // window.scenesNatSwiper = null;
+    } else {
+      window.scenesNatSwiper = new Swiper("#swScenes", {
+        ...swiperOptions,
+      });
     }
-    window.scenesNatSwiper = new Swiper("#swScenes", {
-      ...swiperOptions,
-    });
     scenesSwiperFocus();
   });
 };
@@ -263,7 +270,7 @@ const scenesSwiperFocus = () => {
   const sceneIndex = Array.from(currentScenesList.value).findIndex(
     (item) => item.id === currentScene.value.id
   );
-  if (window.scenesNatSwiper) {
+  if (window.scenesNatSwiper && window.scenesNatSwiper.slides.length > 0) {
     const index = sceneIndex < 0 ? 0 : sceneIndex;
     console.warn("scenesSwiperFocus", index);
     window.scenesNatSwiper.slideTo(index);
@@ -302,8 +309,8 @@ onMounted(() => {
     } else {
       if (window.sencordNatSwiper) {
         console.warn("destroy-sencordNatSwiper");
-        window.sencordNatSwiper.destroy(true);
-        window.sencordNatSwiper = null;
+        window.sencordNatSwiper.update();
+        window.sencordNatSwiper.slideReset();
       }
     }
   });

+ 17 - 7
packages/qjkankan-view/src/components/UIGather/mobile/list.vue

@@ -187,7 +187,9 @@ const tabCurrentScene = (data) => {
   console.log("tabCurrentScene", data.id, currentScene.value.id);
   if (data.id !== currentScene.value.id) {
     store.commit("scene/setCurrentScene", data);
-    scenesSwiperFocus();
+    setTimeout(() => {
+      scenesSwiperFocus();
+    }, 300);
   } else {
     console.log("重复点击当前导航");
     // window.alert("alert-test-->重复点击当前导航");
@@ -230,7 +232,8 @@ const swiperOptions = {
 const initMainSwiper = () => {
   nextTick(() => {
     if (window.mainNatSwiper) {
-      window.mainNatSwiper = null;
+      window.mainNatSwiper.update();
+      window.sencordNatSwiper.slideReset();
     }
     window.mainNatSwiper = new Swiper("#swcatalogRoot", swiperOptions);
   });
@@ -238,17 +241,24 @@ const initMainSwiper = () => {
 const initsencordNatSwiper = () => {
   nextTick(() => {
     if (window.sencordNatSwiper) {
-      window.sencordNatSwiper = null;
+      window.sencordNatSwiper.update();
+      window.sencordNatSwiper.slideReset();
     }
     window.sencordNatSwiper = new Swiper("#swSecondary", swiperOptions);
   });
 };
 const initScenesSwiper = () => {
+  console.warn("initScenesSwiper");
   nextTick(() => {
     if (window.scenesNatSwiper) {
-      window.scenesNatSwiper = null;
+      window.scenesNatSwiper.update();
+      window.scenesNatSwiper.slideReset();
+      // window.scenesNatSwiper = null;
+    } else {
+      window.scenesNatSwiper = new Swiper("#swScenes", {
+        ...swiperOptions,
+      });
     }
-    window.scenesNatSwiper = new Swiper("#swScenes", swiperOptions);
     scenesSwiperFocus();
   });
 };
@@ -257,7 +267,7 @@ const scenesSwiperFocus = () => {
   const sceneIndex = Array.from(currentScenesList.value).findIndex(
     (item) => item.id === currentScene.value.id
   );
-  if (window.scenesNatSwiper) {
+  if (window.scenesNatSwiper && window.scenesNatSwiper.slides.length > 0) {
     const index = sceneIndex < 0 ? 0 : sceneIndex;
     console.warn("scenesSwiperFocus", index);
     window.scenesNatSwiper.slideTo(index);
@@ -269,7 +279,7 @@ const sencordNatSwiperFocus = () => {
     const current = Array.from(secondaryList.value).findIndex(
       (item) => item.id === currentSecondary.value.id
     );
-    if (window.sencordNatSwiper) {
+    if (window.sencordNatSwiper && window.sencordNatSwiper.slides.length > 0) {
       console.warn("current-sencordNatSwiper-index", current);
       window.sencordNatSwiper.slideTo(current);
     }

+ 4 - 4
packages/qjkankan-view/src/components/UIGather/mobile/tips.vue

@@ -15,20 +15,20 @@ import { useApp } from "@/app";
 import { useStore } from "vuex";
 const store = useStore();
 const metadata = computed(() => store.getters["scene/metadata"]);
-
+const currentScene = computed(() => store.getters["scene/currentScene"]);
 const show = ref(false);
+const isPano = computed(() => currentScene.value.type === "pano");
 
 useApp().then((app) => {
   app.Scene.on("sceneReady", () => {
     console.log(metadata.value.isRemind);
     let locoR = "localRemind" + metadata.value.id;
-    if (metadata.value.isRemind) {
+    if (metadata.value.isRemind && isPano.value) {
       show.value =
         localStorage.getItem(locoR) == 1 ? false : !!metadata.value.remindTime;
       localStorage.setItem(locoR, 1);
     } else {
-      console.log(metadata.value.remindTime);
-      if (metadata.value.remindTime) {
+      if (metadata.value.remindTime && isPano.value) {
         show.value = true;
       }
       localStorage.setItem(locoR, 0);

+ 17 - 8
packages/qjkankan-view/src/components/UIGather/tips.vue

@@ -1,27 +1,36 @@
 <template>
   <div v-if="show" class="user-tips-overlay">
-    <img :src="metadata.pcIcon || require('@/assets/images/default/show/img_tipspc_default.png')" alt="" />
+    <img
+      :src="
+        metadata.pcIcon ||
+        require('@/assets/images/default/show/img_tipspc_default.png')
+      "
+      alt=""
+    />
   </div>
 </template>
 <script setup>
-import { onMounted, watch, computed, ref, nextTick } from "vue";
+import { onMounted, watch, computed, ref, nextTick, unref } from "vue";
 import { useApp } from "@/app";
 import { useStore } from "vuex";
 const store = useStore();
 const metadata = computed(() => store.getters["scene/metadata"]);
-
+const currentScene = computed(() => store.getters["scene/currentScene"]);
 const show = ref(false);
+const isPano = computed(() => currentScene.value.type === "pano");
 
 useApp().then((app) => {
   app.Scene.on("sceneReady", () => {
-    console.log(metadata.value.isRemind);
     let locoR = "localRemind" + metadata.value.id;
-    if (metadata.value.isRemind) {
-      show.value = localStorage.getItem(locoR) == 1 ? false : !!metadata.value.remindTime;
+    console.error("localRemind状态", metadata.value.isRemind && isPano.value);
+
+    if (metadata.value.isRemind && isPano.value) {
+      show.value =
+        localStorage.getItem(locoR) == 1 ? false : !!metadata.value.remindTime;
       localStorage.setItem(locoR, 1);
     } else {
-      console.log(metadata.value.remindTime);
-      if (metadata.value.remindTime) {
+      console.error("remindTime", metadata.value.remindTime);
+      if (metadata.value.remindTime && isPano.value) {
         show.value = true;
       }
       localStorage.setItem(locoR, 0);

+ 1 - 1
packages/qjkankan-view/src/components/assembly/Share.vue

@@ -3,7 +3,7 @@
     <div>
       <div class="tips">
         <h4>{{ $t("share.shareLink") }}</h4>
-        <i class="iconfont icon-bs_close" @click="onNo"></i>
+        <i class="iconfont icon-close" @click="onNo"></i>
       </div>
       <div class="url">{{ copyLink }}</div>
       <div class="btns">