Browse Source

fix: 当前场景无Mesh场景,无法切换。

jinx 1 year ago
parent
commit
94ef0af81c
7 changed files with 47 additions and 5 deletions
  1. 2 0
      .env
  2. 2 0
      .env.test
  3. 2 1
      src/locales/en.json
  4. 2 1
      src/locales/ja.json
  5. 2 1
      src/locales/zh.json
  6. 5 0
      src/pages/SViewer.vue
  7. 32 2
      src/pages/Viewer.vue

+ 2 - 0
.env

@@ -2,6 +2,8 @@
 VUE_APP_CDN_URL=https://4dkk.4dage.com/v4/www/
 # sdk文件地址
 VUE_APP_SDK_DIR=https://4dkk.4dage.com/v4-test/www/sdk/
+# 激光接口地址
+VUE_APP_LASER_URL=https:uat-laser.4dkankan.com/
 # 静态资源目录
 VUE_APP_STATIC_DIR=static
 VUE_APP_TEST=0

+ 2 - 0
.env.test

@@ -3,6 +3,8 @@ NODE_ENV=production
 VUE_APP_CDN_URL=https://4dkk.4dage.com/v4/www/
 # sdk文件地址
 VUE_APP_SDK_DIR=https://4dkk.4dage.com/v4-test/www/sdk/
+# 激光接口地址
+VUE_APP_LASER_URL=https:uat-laser.4dkankan.com/
 # 静态资源目录
 VUE_APP_STATIC_DIR=static
 VUE_APP_TEST=1

+ 2 - 1
src/locales/en.json

@@ -8,7 +8,8 @@
     "sceneDelete": "The current scene has been deleted and cannot be viewed",
     "tag": "Tag",
     "splitScreen": "Split-screen",
-    "fullScreen": "Full screen"
+    "fullScreen": "Full screen",
+    "noPanorama": "The current scene has no Mesh scene and cannot be switched"
   },
   "home.name": "Home page",
   "header": {

+ 2 - 1
src/locales/ja.json

@@ -8,7 +8,8 @@
     "sceneDelete": "このシーンはすでに削除され、確認できません。",
     "tag": "ホットスポット",
     "splitScreen": "対照",
-    "fullScreen": "全画面表示"
+    "fullScreen": "全画面表示",
+    "noPanorama": "現在のシーンはパノラマ画像がないため、切り替えることはできません"
   },
   "home.name": "トップページ",
   "header": {

+ 2 - 1
src/locales/zh.json

@@ -8,7 +8,8 @@
     "sceneDelete": "当前场景已被删除,无法进行查看",
     "tag": "标注",
     "splitScreen": "分屏",
-    "fullScreen": "全屏"
+    "fullScreen": "全屏",
+    "noPanorama": "当前场景无Mesh场景,无法切换。"
   },
   "home.name": "首页",
   "header": {

+ 5 - 0
src/pages/SViewer.vue

@@ -171,6 +171,10 @@ const sourceDays = computed(() => {
 })
 
 const onModeChange = targetMode => {
+    if (source.value?.location == 6 && targetMode == 0) {
+        showTips.value = t('home.noPanorama')
+        return
+    }
     if (sourceFrame.value && sourceFrame.value.contentWindow.loaded) {
         sourceFrame.value.contentWindow.loaded.then(sdk => sdk.scene.changeMode(targetMode))
         mode.value = targetMode
@@ -268,6 +272,7 @@ onMounted(() => {
                     if (!source.value) {
                         return (showTips.value = t('home.sceneDelete'))
                     }
+                    mode.value = source.value?.location == 6 ? 1 : 0
                 } else {
                     return (showTips.value = t('home.sceneDelete'))
                 }

+ 32 - 2
src/pages/Viewer.vue

@@ -22,7 +22,7 @@
                     </div>
                     <div class="item-mode" v-if="source.type == 2 || source.type == 3">
                         <div class="iconfont icon-show_roaming" :class="{ active: mode == 0 }" @click="onModeChange(0)"></div>
-                        <div class="iconfont icon-show_plane" :class="{ active: mode == 1 }" @click="onModeChange(1)"></div>
+                        <div class="iconfont icon-show_plane" :class="{ active: mode == 1 }" @click="noPanorama"></div>
                     </div>
                     <div class="item-density" v-if="(source.type == 2 && mode == 1) || (source.type == 3 && mode == 1)" :class="{ active: showDensity }" @click="showDensity = !showDensity">
                         <span>{{ densityType.text }}</span>
@@ -112,7 +112,7 @@
 <script setup>
 import { ref, onMounted, computed, nextTick, provide, watch } from 'vue'
 import { http } from '@/utils/request'
-
+import axios from 'axios'
 import browser from '@/utils/browser'
 import Toast from '@/components/dialog/Toast'
 import AppHeader from '@/components/header'
@@ -228,10 +228,35 @@ const sourceURL = computed(() => {
         // 看看、看见场景
         return `smart-kankan.html?m=${source.value.num}${isDev ? '&dev' : ''}&lang=${getLocale()}`
     } else {
+        getLaserInfo(source.value.num)
         // 深时场景
         return `smart-laser.html?m=${source.value.num}${isDev ? '&dev' : ''}&lang=${getLocale()}`
     }
 })
+const noPanorama = ref(true)
+const getLaserInfo = num => {
+    axios
+        .get(process.env.VUE_APP_LASER_URL + `laser/dataset/${num}/getDataSet`)
+        .then(res => {
+            if (res.data.code == 200) {
+                let list = res.data.data
+                list.forEach(item => {
+                    if (item.pointCount) {
+                        noPanorama.value = false
+                    } else {
+                        noPanorama.value = true
+                    }
+                })
+                if (noPanorama.value) {
+                    onModeChange(1)
+                }
+            } else {
+            }
+        })
+        .catch(() => {
+            // showTips.value = t('code.failed')
+        })
+}
 const targetURL = computed(() => {
     if (bimChecked.value) {
         return `smart-bim.html?m=${project.value.bimData.bimOssFilePath}&lang=${getLocale()}`
@@ -359,6 +384,10 @@ const onLoadTarget = () => {
 }
 
 const onModeChange = targetMode => {
+    if (targetMode == 0 && noPanorama.value) {
+        showTips.value = t('home.noPanorama')
+        return
+    }
     window.Log('changeMode:' + targetMode, '#3cffff')
     if (sync.sourceInst) {
         sync.sourceInst.loaded.then(sdk => sdk.scene.changeMode(targetMode))
@@ -668,6 +697,7 @@ const getInfo = () => {
                         if (!source.value) {
                             return (showTips.value = t('home.sceneDelete'))
                         }
+                        mode.value = source.value?.location == 6 ? 1 : 0
                         if (showAdjust.value || showSplit.value) {
                             onBimChecked()
                             nextTick(() => onDbsChecked())