Переглянути джерело

点击大地图跳转到对应点位的功能

(cherry picked from commit ec37f468a50e5ccba442adec17e78bf4dfc53e0e)
任一存 2 роки тому
батько
коміт
db5a1a1252
4 змінених файлів з 151 додано та 87 видалено
  1. 1 1
      public/static/js/Hot.js
  2. 114 0
      src/areaPosInfo.js
  3. 0 82
      src/test.js
  4. 36 4
      src/views/gui/BigMap.vue

+ 1 - 1
public/static/js/Hot.js

@@ -37,7 +37,7 @@ window.initHot = function (model) {
   var getCommonHotspotUrl = function (link) {
     var querySectionInLink = link.split('?')[1]
     var langParam = "en" == manage.number("lang") ? "&lang=" + manage.number("lang") : ""
-    // return `http://192.168.20.16:8081/#/${browser.isMobile() ? 'mobile' : 'web'}/?${querySectionInLink}&time=${randomTime().getTime()}&id=${window.number}${langParam}`
+    // return `http://192.168.20.16:8080/#/${browser.isMobile() ? 'mobile' : 'web'}/?${querySectionInLink}&time=${randomTime().getTime()}&id=${window.number}${langParam}`
     return `/webMHot/index.html#/${browser.isMobile() ? 'mobile' : 'web'}/?${querySectionInLink}&time=${randomTime().getTime()}&id=${window.number}${langParam}`
   }
   var removeSrcPostMark = function (url) {//去除texture.load时自动加上的'?'

+ 114 - 0
src/areaPosInfo.js

@@ -0,0 +1,114 @@
+export default [
+  {
+    id: "62",
+    x: -0.08218792401479444,
+    y: -0.2998950894210036,
+    z: -0.02594306524235197,
+    w: 0.9500710620779145,
+  },
+  {
+    id: "40",
+    x: -0.07547630469938987,
+    y: 0.8751677284243968,
+    z: 0.14506380732566115,
+    w: 0.4553473946124161,
+  },
+  {
+    id: "106",
+    x: -0.04874378570024711,
+    y: -0.7762938002491228,
+    z: -0.060488393768113165,
+    w: 0.625566261784805,
+  },
+  {
+    id: "80",
+    x: 0.06021515182562042,
+    y: -0.008753546838454425,
+    z: 0.0005280747291852729,
+    w: 0.9981469031446539,
+  },
+  {
+    id: "94",
+    x: 0.00020764321050824265,
+    y: 0.9875568630047246,
+    z: 0.1572567436730408,
+    w: -0.0013039789330159463,
+  },
+  {
+    id: "44",
+    x: -0.09880447414353871,
+    y: 0.5236681908602636,
+    z: 0.06130788908219584,
+    w: 0.8439494312329774,
+  },
+  {
+    id: "18",
+    x: -0.07966023394777529,
+    y: -0.45433393979567677,
+    z: -0.04083428802457088,
+    w: 0.8863224538770456,
+  },
+  {
+    id: "170",
+    x: -0.05451405853957413,
+    y: -0.8482264188916693,
+    z: -0.08905384130029256,
+    w: 0.5192394369219047,
+  },
+  {
+    id: "246",
+    x: -0.10306116864562431,
+    y: 0.6977617884219377,
+    z: 0.1025230490837825,
+    w: 0.7014241943387098,
+  },
+  {
+    id: "136",
+    x: -0.051292961805944844,
+    y: -0.6917283832203684,
+    z: -0.04937215192506026,
+    w: 0.7186398791095168,
+  },
+  {
+    id: "58",
+    x: -0.03029150973450734,
+    y: -0.7087721669897309,
+    z: -0.030491348499773856,
+    w: 0.7041269202236122,
+  },
+  {
+    id: "98",
+    x: -0.00024084483201076916,
+    y: 0.9997575436159882,
+    z: -0.016439951866935757,
+    w: -0.014646419774642365,
+  },
+  {
+    id: "160",
+    x: 0.07744488467251866,
+    y: 0.0006226754085158644,
+    z: -0.00004836830159652476,
+    w: 0.9969964368989918,
+  },
+  {
+    id: "102",
+    x: 0.041928460892960755,
+    y: 0.698007134257237,
+    z: -0.04100739097261852,
+    w: 0.7136851230549477,
+  },
+  {
+    id: "82",
+    x: 0.05271624147051653,
+    y: -0.7223348541048733,
+    z: 0.055403281466788,
+    w: 0.687301843571721,
+  },
+  {
+    id: "152",
+    x: 0.030351074093449584,
+    y: 0.9584813090120319,
+    z: 0.1116118738011681,
+    w: -0.2606437571535123,
+  },
+]

+ 0 - 82
src/test.js

@@ -1,82 +0,0 @@
-[
-  {
-    "children": [
-      {
-        "children": null,
-        "createTime": null,
-        "fileName": "",
-        "filePath": "",
-        "id": 10,
-        "level": 2,
-        "name": "二级类别test3",
-        "parentId": 6,
-        "updateTime": null
-      }
-    ],
-    "createTime": null,
-    "fileName": "",
-    "filePath": "",
-    "id": 6,
-    "level": 1,
-    "name": "一级类别test2",
-    "parentId": null,
-    "updateTime": null
-  },
-  {
-    "children": [
-      {
-        "children": [
-          {
-            "children": null,
-            "createTime": null,
-            "fileName": "",
-            "filePath": "",
-            "id": 3,
-            "level": 0,
-            "name": "设备1-1-1",
-            "parentId": 8,
-            "updateTime": null
-          },
-          {
-            "children": null,
-            "createTime": null,
-            "fileName": "666.pdf",
-            "filePath": "/product/doc/20230410_0943455294.pdf",
-            "id": 4,
-            "level": 0,
-            "name": "设备1-1-2",
-            "parentId": 8,
-            "updateTime": null
-          }
-        ],
-        "createTime": null,
-        "fileName": "",
-        "filePath": "",
-        "id": 8,
-        "level": 2,
-        "name": "二级类别1-1",
-        "parentId": 7,
-        "updateTime": null
-      },
-      {
-        "children": null,
-        "createTime": null,
-        "fileName": "",
-        "filePath": "",
-        "id": 9,
-        "level": 2,
-        "name": "二级类别test1",
-        "parentId": 7,
-        "updateTime": null
-      }
-    ],
-    "createTime": null,
-    "fileName": "",
-    "filePath": "",
-    "id": 7,
-    "level": 1,
-    "name": "一级类别test1",
-    "parentId": null,
-    "updateTime": null
-  }
-]

+ 36 - 4
src/views/gui/BigMap.vue

@@ -48,6 +48,8 @@
 </template>
 
 <script>
+import areaPosInfo from "@/areaPosInfo.js"
+
 export default {
   data() {
     return {
@@ -86,15 +88,45 @@ export default {
         { id: '14', nameCn: '捷拉斯', nameEn: 'Gallus', reportType: 'gallus', },
         { id: '15', nameCn: '海德堡金融服务', nameEn: 'Financial Service', reportType: 'financialService', },
         { id: '16', nameCn: '直播间', nameEn: 'Livestreaming Room', reportType: 'livestreamingRoom', },
-      ]
+      ],
+      isFlying: false,
+      checkingIntervalId: null,
     }
   },
+  beforeDestroy() {
+    clearInterval(this.checkingIntervalId)
+  },
   methods: {
     onClickRegion(regionItem) {
+      if (this.isFlying) {
+        return
+      }
+      this.$router.go(-1)
+      this.isFlying = true
+
       globalApi.reportRegionClick(regionItem.reportType)
-      // window.player.flyToPano({
-      //   pano: window.player.model.panos.index["ce13067e8cc247b983405502dc2577ae"],
-      // })
+
+      const posInfo = areaPosInfo[Number(regionItem.id) - 1]
+      // 判断移动到点位结束之后,才允许再次点击
+      this.checkingIntervalId = window.setInterval(() => {
+        if (window.player.currentPano.id === posInfo.id) {
+          this.isFlying = false
+          clearInterval(this.checkingIntervalId)
+        }
+      }, 300)
+
+      console.assert(posInfo, '没有找到点击的区域所对应的点位数据')
+      window.player.flyToPano({
+        // 移动到点位
+        pano: window.player.model.panos.index[posInfo.id],
+        // 移动视角
+        quaternion: new window.THREE.Quaternion(
+          posInfo.x,
+          posInfo.y,
+          posInfo.z,
+          posInfo.w
+        ),
+      })
     }
   }
 }