jinx 2 lat temu
rodzic
commit
fe5a3e1109

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

@@ -88,7 +88,7 @@ const onClose = () => {
 }
 let pushData = null
 const onSubmit = async () => {
-    if (!form.value.title) {
+    if (!form.value.title.trim()) {
         return (showTips.value = t('tag.inputTagName'))
     }
     if (!form.value.status) {

+ 6 - 1
src/components/files/TagItem.vue

@@ -7,7 +7,7 @@
         class="tag-item"
     >
         <div class="tag-icon">
-            <span>{{ props.index }}</span>
+            <span>{{ props.index }}{{ notify}} </span>
         </div>
     </div>
 </template>
@@ -25,7 +25,12 @@ const props = defineProps({
 })
 
 const notify = inject('notify')
+const isEdit = inject('isEdit')
 const onClick = () => {
+  console.log(isEdit.value)
+    if (isEdit.value) {
+        return
+    }
     notify.value = props.tag //{ event: 'focus', sid: props.tag.sid, tag: props.tag }
 }
 </script>

+ 8 - 3
src/components/files/index.vue

@@ -1,6 +1,6 @@
 <template>
     <transition name="slide-right" mode="in-out">
-        <div class="files" v-if="showFiles && !isEdit" >
+        <div class="files" v-if="showFiles && !isEdit">
             <div class="info" ref="add$">
                 <button @click="onAdd">{{ $t('tag.addTag') }}</button>
                 <div>
@@ -92,6 +92,9 @@ const onClick = tag => {
 }
 let isAdd = false
 const onAdd = () => {
+    if (notify.value) {
+        notify.value = null
+    }
     isEdit.value = true
     isAdd = true
     if (window.kankan) {
@@ -106,8 +109,10 @@ const onAdd = () => {
         showToolbar.value = true
     }
 }
-const laserPosition = () => {
+const laserPosition = (tag) => {
     window.laser.then(sdk => {
+        let pos = tag.position
+        sdk.scene.comeToTag(new THREE.Vector3(pos.x, pos.y, pos.z))
         sdk.addMouseDownEvent(e => {
             if (showToolbar.value == false) {
                 return
@@ -244,7 +249,7 @@ const onMoreHandler = (type, tag) => {
                 editor.enter(editTag)
             })
         } else {
-            laserPosition()
+            laserPosition(editTag)
         }
         // window.kankan.TagManager.focusBeforeModify(editTag.sid)
     } else if (type == 'delete') {

+ 33 - 41
src/pages/Viewer.vue

@@ -216,7 +216,8 @@ const sourceURL = computed(() => {
     if (!source.value) {
         return
     }
-
+    // console.log(1111)
+    getTagList(source.value.num)
     if (source.value.type < 2) {
         // 看看、看见场景
         return `smart-kankan.html?m=${source.value.num}${isDev ? '&dev' : ''}`
@@ -229,6 +230,7 @@ const targetURL = computed(() => {
     if (bimChecked.value) {
         return `smart-bim.html?m=${project.value.bimData.bimOssFilePath}`
     }
+    getTagList(target.value.num)
     if (target.value.type < 2) {
         // 看看、看见场景
         return `smart-kankan.html?m=${target.value.num}${isDev ? '&dev' : ''}`
@@ -322,11 +324,11 @@ const onLoadSource = () => {
         window.laser.then(sdk => {
             console.error(window[0].viewer)
 
-            window[0].viewer.images360.addEventListener('flyToPano',()=>{
-              isFlying.value = true
+            window[0].viewer.images360.addEventListener('flyToPano', () => {
+                isFlying.value = true
             })
-            window[0].viewer.images360.addEventListener('flyToPanoDone',()=>{
-              isFlying.value = false
+            window[0].viewer.images360.addEventListener('flyToPanoDone', () => {
+                isFlying.value = false
             })
         })
     }
@@ -592,26 +594,25 @@ const onRuleChecked = () => {
         ruleChecked.value = true
     }
 }
-
-onMounted(() => {
-    // document.addEventListener('fullscreenchange', () => {
-    //     if (document.fullscreenElement) {
-    //         if (!fscChecked.value) {
-    //             fscChecked.value = true
-    //         }
-    //     } else {
-    //         if (fscChecked.value) {
-    //             fscChecked.value = false
-    //         }
-    //     }
-    // });
-
-    // window.addEventListener('keydown',(e)=>{
-    //     console.log(e.which)
-    // },false)
-
-    const num = browser.valueFromUrl('m') || ''
-    const projectId = browser.valueFromUrl('projectId') || 1
+const getTagList = num => {
+    http.post(`smart-site/marking/list`, {
+        projectId: projectId,
+        pageNum: 1,
+        pageSize: 200,
+        num: num ? num : browser.getURLParam('m'),
+    }).then(response => {
+        if (response.data && response.data.list) {
+            tags.value = response.data.list.map(item => {
+                item.hotData.visible = false
+                item.hotData.id = item.markingId
+                item.hotData.createTime = item.createTime
+                item.hotData.lastCreateBy = item.lastCreateBy
+                return item.hotData
+            })
+        }
+    })
+}
+const getInfo = () => {
     http.get(`smart-site/project/info?projectId=${projectId}&sceneOrder=asc`)
         .then(response => {
             if (response.success) {
@@ -659,22 +660,13 @@ onMounted(() => {
         .catch(() => {
             showTips.value = t('code.failed')
         })
-    http.post(`smart-site/marking/list`, {
-        projectId: projectId,
-        pageNum: 1,
-        pageSize: 200,
-        num: browser.getURLParam('m'),
-    }).then(response => {
-        if (response.data && response.data.list) {
-            tags.value = response.data.list.map(item => {
-                item.hotData.visible = false
-                item.hotData.id = item.markingId
-                item.hotData.createTime = item.createTime
-                item.hotData.lastCreateBy = item.lastCreateBy
-                return item.hotData
-            })
-        }
-    })
+}
+const num = browser.valueFromUrl('m') || ''
+const projectId = browser.valueFromUrl('projectId') || 1
+
+onMounted(() => {
+    getInfo()
+    getTagList()
 })
 </script>