瀏覽代碼

fix: test

jinx 9 月之前
父節點
當前提交
3541f5ce1c
共有 1 個文件被更改,包括 28 次插入10 次删除
  1. 28 10
      src/framework/show/pano.vue

+ 28 - 10
src/framework/show/pano.vue

@@ -28,7 +28,7 @@
       </div>
       <div class="txt_ul clip-scroller" slot="txtList" v-if="!exhibition">
         <ul>
-          <li v-for="(item, i) in list" @click="selectExh = item" :key="i" :class="{ active: selectExh.id == item.id }">
+          <li v-for="(item, i) in list" @click="handleMenu(item)" :key="i" :class="{ active: selectExh.id == item.id }">
             <span>{{ item.title }}</span>
           </li>
         </ul>
@@ -65,6 +65,8 @@ export default {
       list: [],
       isFirst: true,
       loadFinish: false,
+      krPano: null,
+      krPanos: ["scene_fd720_3G82mgyyb", "scene_fd720_BhcHtmvNw", "scene_fd720_d3fFXszk3"],
     };
   },
   watch: {
@@ -124,18 +126,18 @@ export default {
           "view.hlookat": newVal.initVisual ? newVal.initVisual.hlookat : 0,
         };
 
-        window.$("#pano").empty();
-        window.removepano("#pano");
+        // window.$("#pano").empty();
+        // window.removepano("#pano");
 
-        if (this.selectExh.type != "4dkk") {
-          window.embedpano({
+        if (this.selectExh.type != "4dkk" && !this.krPano) {
+          this.krPano = window.embedpano({
             // https://4dkk.4dage.com/720yun_fd_manage/fd720_FC5BmPHcV/vtour/tour.xml
             // xml: "%HTMLPATH%/static/template/tour.xml",
             // xml: `https://airshow.4dkankan.com/pano/${this.selectExh.id}/${newVal.sceneCode}/vtour/tour.xml`,
             // swf: `${this.g_CDN}resource/tour.swf`,
 
             swf: "https://test.4dkankan.com/panorama/showviewer/lib/krpano/tour.swf",
-            xml: "https://4dkk.4dage.com/720yun_fd_manage/WK1856238346562650112/tour.xml",
+            xml: `https://4dkk.4dage.com/720yun_fd_manage/WK1856238346562650112/tour.xml`,
             target: "pano",
             html5: "auto",
             mobilescale: 1,
@@ -147,10 +149,26 @@ export default {
     },
   },
   methods: {
-    handleItem(item) {
-      if (this.loadFinish) {
-        this.selected = item;
-      }
+    handleMenu(item) {
+      this.selectExh = item;
+    },
+    handleItem() {
+      // if (this.loadFinish) {
+      //   this.selected = item;
+      // }
+      let random = this.getRandomInt(0, 2);
+      console.error(random);
+      this.changeKrpanoScene(this.krPanos[random]);
+    },
+    changeKrpanoScene(scene) {
+      var krpano = document.getElementById("krpanoSWFObject");
+      console.error(scene);
+      krpano.call("loadscene('" + scene + "', null,null, BLEND(1.0, easeInCubic) )");
+    },
+    getRandomInt(min, max) {
+      min = Math.ceil(min); // 确保min是整数
+      max = Math.floor(max); // 确保max是整数
+      return Math.floor(Math.random() * (max - min + 1)) + min; // 返回介于min和max之间的整数
     },
     getList() {
       // window.$.ajax({url:`code/pano/data.json`,success:(data)=>{