jinx 2 年之前
父节点
当前提交
9b5873a875
共有 4 个文件被更改,包括 31 次插入14 次删除
  1. 3 1
      src/components/files/TagEditor.vue
  2. 9 8
      src/components/files/TagManager.vue
  3. 1 0
      src/components/files/index.vue
  4. 18 5
      src/pages/Viewer.vue

+ 3 - 1
src/components/files/TagEditor.vue

@@ -56,6 +56,8 @@ const projectId = browser.valueFromUrl('projectId') || 1
 const notify = inject('notify')
 const tags = inject('tags')
 const isEdit = inject('isEdit')
+const source = inject('source')
+
 const height = ref(0)
 const form = ref({
     title: '',
@@ -153,7 +155,7 @@ const handlerUpload = async data => {
         markingStatus: form.value.status,
         markingTitle: form.value.title,
         hotData: tag,
-        num: browser.getURLParam('m'),
+        num: source.value.num,
     }
     if (tag.id) {
         params.markingId = tag.id

+ 9 - 8
src/components/files/TagManager.vue

@@ -32,15 +32,16 @@ const onAction = text => {
     showTips.value = text
 }
 const initLaserTag = () => {
+  // consoler.error('******************initLaserTag')
     window.laser.then(sdk => {
-        sdk.scene.on('posChange', cameraPos => {
-            tags.value.forEach(tag => {
-                const info2d = sdk.scene.getScreenByPoint(tag.position)
-                tag.x = info2d.pos.x
-                tag.y = info2d.pos.y
-                tag.visible = info2d.trueSide
-            })
-        })
+        // sdk.scene.on('posChange', cameraPos => {
+        //     tags.value.forEach(tag => {
+        //         const info2d = sdk.scene.getScreenByPoint(tag.position)
+        //         tag.x = info2d.pos.x
+        //         tag.y = info2d.pos.y
+        //         tag.visible = info2d.trueSide
+        //     })
+        // })
     })
 }
 </script>

+ 1 - 0
src/components/files/index.vue

@@ -52,6 +52,7 @@ const exit$ = ref(null)
 const add$ = ref(null)
 const props = defineProps(['show'])
 const emits = defineEmits(['add', 'exit'])
+// const source = inject('source')
 const showTips = ref(null)
 const handlerDel = status => {
     if (status == 'ok') {

+ 18 - 5
src/pages/Viewer.vue

@@ -132,6 +132,8 @@ const isLogin = ref(false)
 const isFlying = ref(false)
 const editTagId = ref(null)
 const isAuth = ref(false)
+const source = ref(null)
+
 provide('tags', tags)
 provide('notify', notify)
 provide('isEdit', isEdit)
@@ -139,6 +141,7 @@ provide('editTagId', editTagId)
 provide('isLogin', isLogin)
 provide('isFlying', isFlying)
 provide('isAuth', isAuth)
+provide('source', source)
 const userId = ref(localStorage.getItem('userId') || null)
 
 const getUserId = id => {
@@ -169,7 +172,6 @@ const targetFrame = ref(null)
 
 const mode = ref(0)
 
-const source = ref(null)
 const target = ref(null)
 const project = ref(null)
 const points = ref({ p1: null, p2: null })
@@ -314,7 +316,9 @@ const onLoadSource = () => {
         // BIM单屏模式
         return
     }
+
     if (source.value.type < 2) {
+        window['laser'] = null
         window['kankan'] = sourceFrame.value.contentWindow.app
         window['kankan'].TagManager.load(tags.value)
 
@@ -325,9 +329,18 @@ const onLoadSource = () => {
             isFlying.value = false
         })
     } else {
+        window['kankan'] = null
         window['laser'] = sourceFrame.value.contentWindow.loaded
         window.laser.then(sdk => {
-            console.error(window[0].viewer)
+            console.error('**************')
+            sdk.scene.on('posChange', cameraPos => {
+                tags.value.forEach(tag => {
+                    const info2d = sdk.scene.getScreenByPoint(tag.position)
+                    tag.x = info2d.pos.x
+                    tag.y = info2d.pos.y
+                    tag.visible = info2d.trueSide
+                })
+            })
 
             window[0].viewer.images360.addEventListener('flyToPano', () => {
                 isFlying.value = true
@@ -585,10 +598,10 @@ const onP2Click = type => {
 
 const onRuleHandler = sdk => {
     let rule = sdk.startMeasure()
-    rule.bus.on('end',()=>{
+    rule.bus.on('end', () => {
         setTimeout(() => {
-            onRuleHandler(sdk)    
-        }, 1);
+            onRuleHandler(sdk)
+        }, 1)
     })
     rules.push(rule)
 }