浏览代码

feat: 完善

rindy 2 年之前
父节点
当前提交
503253baf7
共有 1 个文件被更改,包括 17 次插入10 次删除
  1. 17 10
      src/pages/LaserBim.vue

+ 17 - 10
src/pages/LaserBim.vue

@@ -8,8 +8,8 @@
                 <iframe ref="sourceFrame" :src="`smart-laser.html?m=${source.num}&dev`" frameborder="0" @load="onLoadSource"></iframe>
                 <div class="tools">
                     <div class="item-mode">
-                        <div class="iconfont icon-show_roaming_normal" @click="onModeChange('panorama')"></div>
-                        <div class="iconfont icon-show_more" @click="onModeChange('cloud')"></div>
+                        <div class="iconfont icon-show_roaming_normal" :class="{ active: mode == 0 }" @click="onModeChange(0)"></div>
+                        <div class="iconfont icon-show_more" :class="{ active: mode == 1 }" @click="onModeChange(1)"></div>
                     </div>
                     <div class="item-date" v-if="target">
                         <span class="prev" @click="onPrevDate('source')"><i class="iconfont icon-show_back"></i></span>
@@ -52,6 +52,7 @@ const datepickName = ref(null)
 const datepickValue = ref(null)
 const sourceFrame = ref(null)
 const targetFrame = ref(null)
+const mode = ref(0)
 const source = ref(null)
 const target = ref(null)
 const project = ref(null)
@@ -60,7 +61,7 @@ const scenes = reactive([
     { pid: '001', num: 'SS-t-bFMqa1dqUU', date: '2022-09-01' },
     { pid: '001', num: 'SS-t-xp9BDKfzhR', date: '2022-09-03' },
     { pid: '001', num: 'SS-t-lc5OWhZPaC', date: '2022-09-05' },
-    { pid: '001', num: 'SS-t-Y6gLRFwxE5', date: '2022-09-10' }
+    { pid: '001', num: 'SS-t-Y6gLRFwxE5', date: '2022-09-10' },
 ])
 const highlighted = computed(() => {
     let dates = []
@@ -68,12 +69,17 @@ const highlighted = computed(() => {
         dates = scenes.map(item => item.date.toDate())
     }
     return {
-        dates: dates
+        dates: dates,
     }
 })
 
 const onLoadSource = () => {
-    sourceApp = sourceFrame.value.contentWindow.app
+    sourceApp = sourceFrame.value.contentWindow
+    sourceApp.loaded.then(sdk => {
+        if (mode.value != 0) {
+            sdk.scene.changeMode(mode.value)
+        }
+    })
     // sourceApp.Scene.on('loaded', () => {
     //     sourceApp.Camera.setCompassDisplay(false)
     //     sourceApp.Connect.sync.start()
@@ -109,9 +115,10 @@ const onLoadTarget = () => {
     //     }
     // })
 }
-const onModeChange = mode => {
+const onModeChange = targetMode => {
     if (sourceApp) {
-        
+        sourceApp.loaded.then(sdk => sdk.scene.changeMode(targetMode))
+        mode.value = targetMode
     }
 }
 const onPickDate = name => {
@@ -174,9 +181,6 @@ const onCompare = () => {
 }
 
 const onPrevDate = name => {
-    if (!scene) {
-        scene = source
-    }
     let scene = null
     if (!name || name == 'source') {
         scene = source
@@ -327,6 +331,9 @@ main {
                     margin-left: 20px;
                     margin-right: 20px;
                     cursor: pointer;
+                    &.active {
+                        color: #00c8af;
+                    }
                 }
                 i {
                     font-size: 18px;