Procházet zdrojové kódy

Merge branch 'dev' of http://192.168.0.115:3000/4dkankan/4dkankan_bim into dev

rindy před 2 roky
rodič
revize
636f5e2669

+ 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

+ 14 - 10
src/components/files/TagManager.vue

@@ -4,10 +4,10 @@
         <TagEditor v-if="notify && isEdit" :notify="notify" @action="onAction" />
         <TagView v-if="notify && !isEdit" :notify="notify" />
     </div>
-    <Toast v-if="showTips" type="warn" :content="showTips" :close="() => (showTips = null)" />
+    <Toast v-if="showTips" v-bind="toastOps" :content="showTips" :close="() => (showTips = null)" />
 </template>
 <script setup>
-import { inject, watch, computed ,ref} from 'vue'
+import { inject, watch, computed, ref } from 'vue'
 import TagItem from './TagItem.vue'
 import TagEditor from './TagEditor.vue'
 import TagView from './TagView.vue'
@@ -28,19 +28,23 @@ const isEdit = inject('isEdit')
 const init = sdk => {
     // sdk.TagManager.load(tags)
 }
+const toastOps = ref({
+    type: 'success',
+})
 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>

+ 3 - 3
src/components/files/TagView.vue

@@ -1,7 +1,7 @@
 <template>
     <div class="tag-view" v-show="canShow">
         <!-- <div class="tag-view-content" :style="{ height: height + 'px' }"> -->
-        <div class="tag-view-content" :class="!isLogin ? 'no-comment' : ''">
+        <div class="tag-view-content" :class="!isLogin || !isAuth ? 'no-comment' : ''">
             <header>
                 <span>{{ notify.title }}</span>
                 <!-- <i class="iconfont icon-close" @click="emits('action', null)"></i> -->
@@ -9,7 +9,7 @@
             </header>
             <article>
                 <TagMsg @setShow="setShow"></TagMsg>
-                <Comment v-if="isLogin" :slideHeigt="slideHeigt"></Comment>
+                <Comment v-if="isLogin && isAuth" :slideHeigt="slideHeigt"></Comment>
             </article>
             <!-- <footer></footer> -->
         </div>
@@ -21,7 +21,7 @@ import { ref, onMounted, onBeforeUnmount, computed, inject, watch } from 'vue'
 import TagMsg from './content/TagMsg.vue'
 import Comment from './content/Comment.vue'
 import { nextTick } from 'process'
-
+const isAuth = inject('isAuth')
 const isLogin = inject('isLogin')
 const notify = inject('notify')
 const emits = defineEmits(['action'])

+ 4 - 3
src/components/files/content/Comment.vue

@@ -81,6 +81,7 @@ import { http } from '@/utils/request'
 import avatar from '@/assets/img/avatar@2x.png'
 import UiConfirm from '@/components/dialog/Confirm.vue'
 import i18n from '@/i18n'
+import browser from '@/utils/browser'
 import UiInput from '../../form/Input.vue'
 const { t } = i18n.global
 const props = defineProps({
@@ -99,7 +100,7 @@ const replyInfo = ref(null)
 const tipsType = ref('warn')
 const showTips = ref(null)
 const slider = ref(null)
-
+const projectId = browser.valueFromUrl('projectId') || 1
 const handlerReply = (data, index) => {
     inputText.value = ''
     let name = data.nickName ? data.nickName : t('tag.unkownUser')
@@ -142,7 +143,7 @@ const hanlderSubmit = () => {
 
     if (canPut) {
         canPut = false
-        http.post(`smart-site/comment/reply`, params)
+        http.post(`smart-site/comment/reply/${projectId}`, params)
             .then(response => {
                 if (response.success) {
                     getAllComments()
@@ -189,7 +190,7 @@ const getAllComments = () => {
 }
 const handlerDel = status => {
     if (status == 'ok') {
-        http.post(`smart-site/comment/del`, { commentId: delComfirm.value.commentId }).then(response => {
+        http.post(`smart-site/comment/del${projectId}`, { commentId: delComfirm.value.commentId }).then(response => {
             if (response.success) {
                 // if (!delComfirm.value.parentIndex) {
                 //     commentList.value.splice(delComfirm.value.index, 1)

+ 1 - 1
src/components/files/content/TagMsg.vue

@@ -9,7 +9,7 @@
         </div>
         <div class="content-item">
             <div class="item-title">{{ $t('tag.creater') }}</div>
-            <span class="content-desc">{{ notify.lastCreateBy || $t('tag.unkownUser') }}</span>
+            <span class="content-desc">{{ notify.createBy || $t('tag.unkownUser') }}</span>
         </div>
         <div class="content-item">
             <div class="item-title">{{ $t('tag.status') }}</div>

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

@@ -38,7 +38,7 @@
             <div>{{ $t('tag.deleteTagText') }}</div>
         </template>
     </ui-confirm>
-    <Toast v-if="showTips" type="warn" :content="showTips" :close="() => (showTips = null)" />
+    <Toast v-if="showTips" :type="toastOps" :content="showTips" :close="() => (showTips = null)" />
 </template>
 <script setup>
 import { ref, inject, watchEffect, onMounted, nextTick, watch } from 'vue'
@@ -52,13 +52,19 @@ 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 toastOps = ref({
+    type: 'success',
+})
 const handlerDel = status => {
     if (status == 'ok') {
         http.post(`smart-site/marking/del`, {
             markingId: delComfirm.value.id,
         }).then(response => {
             if (response.success) {
+                toastOps.value.type = 'success'
+                showTips.value = '删除成功'
                 let index = tags.value.findIndex(item => item.sid == delComfirm.value.sid)
                 if (index != -1) {
                     tags.value.splice(index, 1)
@@ -67,6 +73,7 @@ const handlerDel = status => {
                     notify.value = null
                 }
             } else {
+                toastOps.value.type = 'warm'
                 showTips.value = response.message
             }
             delComfirm.value = null

+ 11 - 2
src/components/form/SelectList.vue

@@ -16,7 +16,9 @@
             <div class="panel" v-show="selecterShow">
                 <ul>
                     <li v-for="item in data" @click.stop="onselecterChange(item)">
-                        <div><span class="checkbox" :class="{ checked: modelValue.includes(item) }"></span>{{ item.text || $t('tag.unkownUser') }}</div>
+                        <div>
+                            <span class="checkbox" :class="{ checked: modelValue.includes(item) }"></span><span class="name">{{ item.text || $t('tag.unkownUser') }}</span>
+                        </div>
                     </li>
                 </ul>
             </div>
@@ -134,7 +136,14 @@ li {
                 > div {
                     display: flex;
                     align-items: center;
-                    color:rgba(255, 255, 255, 0.6)
+                    color: rgba(255, 255, 255, 0.6);
+                    width: 100%;
+                    .name {
+                        width: 80%;
+                        overflow: hidden;
+                        text-overflow: ellipsis;
+                        white-space: nowrap;
+                    }
                 }
             }
         }

+ 16 - 2
src/components/header/Login.vue

@@ -42,7 +42,7 @@
     </Teleport>
 </template>
 <script setup>
-import { ref, onMounted } from 'vue'
+import { ref, onMounted, inject } from 'vue'
 import { http } from '@/utils/request'
 import common from '@/utils/common'
 import browser from '@/utils/browser'
@@ -50,11 +50,24 @@ import { useI18n, getLocale } from '@/i18n'
 const projectId = browser.valueFromUrl('projectId') || ''
 const { t } = useI18n({ useScope: 'global' })
 const emits = defineEmits(['close', 'user'])
+const isAuth = inject('isAuth')
 const showpass = ref(false)
 const remember = ref(false)
 const username = ref('')
 const password = ref('')
 const errors = ref({})
+const getAuth = () => {
+    http.post(`smart-site/validatedProject/${projectId}`)
+        .then(res => {
+            if (res.code == 0) {
+                isAuth.value = true
+            } else if (res.code == 4002) {
+                //没有权限
+                isAuth.value = false
+            }
+        })
+        .catch(() => {})
+}
 const onLogin = () => {
     errors.value = {}
     if (!username.value) {
@@ -75,10 +88,11 @@ const onLogin = () => {
         phoneNum: username.value,
         rememberMe: remember.value,
         randomcode: '1234',
-        projectId
+        projectId,
     })
         .then(response => {
             if (response.success) {
+                getAuth()
                 if (remember.value) {
                     localStorage.setItem('remember', true)
                     localStorage.setItem('username', username.value)

+ 2 - 1
src/components/header/index.vue

@@ -63,6 +63,7 @@ const props = defineProps({
     project: Object,
     showAdjust: Boolean,
 })
+const projectId = browser.valueFromUrl('projectId') || ''
 const emits = defineEmits(['update', 'getUserId'])
 const isLogin = inject('isLogin')
 const isAuth = inject('isAuth')
@@ -132,7 +133,7 @@ const onSetP2 = () => {
     emits('update', 'p2', points.value.p2)
 }
 const getAuth = () => {
-    http.post(`smart-site/validatedProject/${props.project.projectId}`)
+    http.post(`smart-site/validatedProject/${projectId}`)
         .then(res => {
             if (res.code == 0) {
                 isAuth.value = true

+ 1 - 0
src/pages/SViewer.vue

@@ -203,6 +203,7 @@ const onSelected = data => {
         }
     } else {
         showTips.value = t('home.dateScene')
+        return
     }
 }
 

+ 17 - 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,17 @@ const onLoadSource = () => {
             isFlying.value = false
         })
     } else {
+        window['kankan'] = null
         window['laser'] = sourceFrame.value.contentWindow.loaded
         window.laser.then(sdk => {
-            console.error(window[0].viewer)
+            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 +597,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)
 }