jinx hace 2 años
padre
commit
c30a9a8c5f

+ 6 - 6
public/smart-kankan.html

@@ -25,12 +25,12 @@
             <strong>We're sorry but doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
         </noscript>
         <div id="app"></div>
-        <script src="<%= BASE_URL %><%= VUE_APP_SDK_DIR %>kankan-sdk-deps.js?v=<%= VUE_APP_VERSION %>"></script>
-        <script src="<%= BASE_URL %><%= VUE_APP_SDK_DIR %>kankan-sdk.js?v=<%= VUE_APP_VERSION %>"></script>
-        <!--
-        <script src="http://192.168.0.80:3099/dist/sdk/kankan-sdk-deps.js?v=<%= VUE_APP_VERSION %>"></script>
-        <script src="http://192.168.0.80:3099/dist/sdk/kankan-sdk.js?v=<%= VUE_APP_VERSION %>"></script>
-        -->
+        <!-- <script src="<%= BASE_URL %><%= VUE_APP_SDK_DIR %>kankan-sdk-deps.js?v=<%= VUE_APP_VERSION %>"></script>
+        <script src="<%= BASE_URL %><%= VUE_APP_SDK_DIR %>kankan-sdk.js?v=<%= VUE_APP_VERSION %>"></script> -->
+        
+        <script src="http://192.168.0.130:3099/dist/sdk/kankan-sdk-deps.js"></script>
+        <script src="http://192.168.0.130:3099/dist/sdk/kankan-sdk.js"></script>
+       
         
     </body>
 </html>

+ 9 - 1
src/locales/zh.json

@@ -77,6 +77,12 @@
   "tag.name": "标注",
   "components.name": "组件",
   "header.name": "头部",
+  "toast": {
+    "clickLeft": "请先在左侧点击",
+    "clickTop": "请先在上方点击",
+    "ruleConfirmTips": "起点确定完毕,请定位终点"
+  },
+  "toast.name": "提示",
   "common": {
     "high": "高",
     "middle": "中",
@@ -94,7 +100,9 @@
     "sync": "同步",
     "deleteSuccess": "删除成功",
     "copySuccess": "复制成功",
-    "syncSuccess": "同步成功"
+    "syncSuccess": "同步成功",
+    "endPoint": "终点",
+    "startPoint": "起点"
   },
   "common.name": "通用",
   "code": {

+ 85 - 0
src/pages/DesignOption/index.vue

@@ -0,0 +1,85 @@
+<!--  -->
+<template>
+    <div class="widgets-design-option">
+        <div class="delete-ruler">
+            <li>{{ $t('common.deleteRuleLine') }}</li>
+        </div>
+    </div>
+</template>
+<style lang="scss">
+.delete-ruler {
+    li {
+        white-space: nowrap;
+    }
+}
+
+.widgets-design-option {
+    width: 100%;
+    height: 100%;
+    z-index: 4;
+    position: absolute;
+    user-select: none;
+    overflow: hidden;
+    pointer-events: none;
+    left: 0;
+    top: 0;
+
+    i {
+        margin: 0 5px;
+        &:before {
+            font-family: 'iconfont' !important;
+            font-size: 32px;
+            line-height: 36px;
+            font-style: normal;
+        }
+    }
+
+    li {
+        cursor: pointer;
+    }
+
+    > div {
+        height: 36px;
+        background: #262729;
+        position: absolute;
+        transform: translate(-100%, -50%) translateX(-15px);
+        border-top-left-radius: 18px;
+        border-bottom-left-radius: 18px;
+        padding-left: 10px;
+        pointer-events: auto;
+        box-shadow: 0px 2px 8px 0px rgba(0, 0, 0, 0.4);
+        &:after {
+            position: absolute;
+            right: -15px;
+            top: 0;
+            content: '';
+            width: 0;
+            height: 0;
+            border-style: solid;
+            border-width: 18px 0 18px 15px;
+            border-color: transparent transparent transparent #262729;
+        }
+    }
+
+    &.right > div {
+        transform: translate(15px, -50%);
+        border-top-left-radius: 0;
+        border-bottom-left-radius: 0;
+        border-top-right-radius: 18px;
+        border-bottom-right-radius: 18px;
+        padding: 0 10px 0 0;
+        &:after {
+            right: auto;
+            left: -15px;
+            border-width: 18px 15px 18px 0;
+            border-color: transparent #262729 transparent transparent;
+        }
+    }
+    .delete-ruler li {
+        line-height: 36px;
+        padding: 0 10px;
+        word-break: keep-all;
+        list-style: none;
+    }
+}
+</style>

+ 75 - 0
src/pages/Rules/index.vue

@@ -0,0 +1,75 @@
+<!--  -->
+<template>
+    <!-- <div class="rules-box">
+        <ui-button :class="{ disabled: !next }" type="primary" @click="confirmRules"
+            >{{ $t('common.confirm') }}{{ rulesIndex >= 2 ? $t('common.endPoint') : $t('common.startPoint') }}({{ rulesIndex }}/2)</ui-button
+        >
+        <ui-button type="cancel" @click="cancelRules">{{ $t('common.cancel') }}</ui-button>
+    </div> -->
+
+    <div class="rules-box">
+        <button class="ui-button primary" @click="confirmRules" :class="{ disabled: !next }">{{ rulesIndex >= 2 ? $t('common.endPoint') : $t('common.startPoint') }}({{ rulesIndex }}/2)</button
+        ><button class="ui-button cancel" @click="cancelRules">{{ $t('common.cancel') }}</button>
+    </div>
+
+    <Toast v-if="showTips" type="warn" :content="showTips" :close="() => (showTips = null)" />
+</template>
+
+<script setup>
+import { reactive, toRefs, onBeforeMount, onMounted, ref, defineEmits } from 'vue'
+import Toast from '@/components/dialog/Toast'
+import i18n from '@/i18n'
+const showTips = ref(null)
+const { t } = i18n.global
+const rulesIndex = ref(1)
+const emits = defineEmits(['close'])
+const confirmRules = () => {
+    next.value = false
+    window.kankan.TagManager.confirmMeasure(rulesIndex.value)
+    if (rulesIndex.value < 2) {
+        showTips.value = t('toast.ruleConfirmTips')
+        rulesIndex.value++
+    } else {
+        cancelRules()
+    }
+}
+const cancelRules = () => {
+    emits('close')
+    rulesIndex.value = 1
+}
+const next = ref(false)
+onMounted(() => {
+    window.kankan.TagManager.on('tagManager.markTagPos', res => {
+        next.value = true
+    })
+})
+</script>
+<style lang="scss" scoped>
+.rules-box {
+    position: fixed;
+    z-index: 1001;
+
+    bottom: 20px;
+    left: 50%;
+    transform: translateX(-50%);
+    min-width: 150px;
+    .ui-button {
+        margin-bottom: 10px;
+        &:last-of-type {
+            margin-bottom: 0;
+        }
+        &.cancel {
+            background: rgba(92, 92, 92, 0.51) !important;
+            color: #fff !important;
+            border: none !important;
+        }
+    }
+}
+
+.ui-button.primary {
+    background-color: var(--colors-primary-base) !important;
+    color: var(--colors-normal-fill-hover);
+    border: none;
+    opacity: 1;
+}
+</style>

+ 27 - 3
src/pages/Viewer.vue

@@ -1,10 +1,13 @@
 <template>
+    <DesignOption />
+    <Rules v-if="showRules" @close="closeRules" />
+
     <AppHeader v-show="!fscChecked" :project="project" @getUserId="getUserId" :show-adjust="showAdjust" @update="onPointsUpdate" />
     <article>
         <main>
             <div class="split">
                 <iframe ref="sourceFrame" v-if="sourceURL" :src="sourceURL" frameborder="0" @load="onLoadSource"></iframe>
-                <div class="tools" v-if="source" v-show="showWidget && !showAdjust && !fscChecked && (dbsChecked || (!target && !bimChecked))">
+                <div class="tools" v-if="source && !showRules" v-show="showWidget && !showAdjust && !fscChecked && (dbsChecked || (!target && !bimChecked))">
                     <div class="item-date">
                         <calendar
                             name="source"
@@ -69,13 +72,19 @@
                     </div>
                 </div>
             </div>
-            <div class="model" v-show="showWidget && !showAdjust">
+            <div class="model" v-show="showWidget && !showAdjust && !showRules">
                 <div v-if="isLogin" class="file" :class="{ active: fileChecked, disable: fileDisable }" v-show="!fscChecked && !showBim && !dbsChecked && !bimChecked">
                     <div @click="onFileChecked">
                         <i class="iconfont icon-note1"></i>
                         <span>{{ $t('home.tag') }}</span>
                     </div>
                 </div>
+                <div class="rule" :class="{ active: fileChecked, disable: fileDisable }" v-show="!fscChecked && !showBim && !dbsChecked && !bimChecked">
+                    <div @click="onRuleChecked">
+                        <i class="iconfont icon-note1"></i>
+                        <span>标尺</span>
+                    </div>
+                </div>
                 <div class="bim" :class="{ active: bimChecked, disable: bimDisable }" v-show="!fscChecked && !showBim">
                     <div @click="onBimChecked">
                         <i class="iconfont icon-BIM"></i>
@@ -112,6 +121,8 @@ import Files from '@/components/files'
 import TagManager from '@/components/files/TagManager'
 import sync, { beforeChangeURL, loadSourceScene, loadTargetScene, setPanoWithBim, flyToP1P2 } from '@/utils/sync'
 import i18n from '@/i18n'
+import DesignOption from './DesignOption'
+import Rules from './Rules'
 const { t } = i18n.global
 const isDev = process.env.VUE_APP_TEST == 1
 
@@ -128,6 +139,11 @@ const userId = ref(localStorage.getItem('userId') || null)
 const getUserId = id => {
     userId.value = id
 }
+const showRules = ref(false)
+const closeRules = () => {
+    showRules.value = false
+    window.kankan.TagManager.cancelMeasure()
+}
 
 // 是否BIM模式
 const showBim = ref(browser.urlHasValue('bim'))
@@ -539,6 +555,15 @@ const onP2Click = type => {
 
     flyToP1P2(points.value.p2)
 }
+const onRuleChecked = () => {
+    
+
+    showRules.value = true
+    window.kankan.TagManager.startMeasure()
+
+    // store.commit('SetPlayerOptions', { showRulesWidgets: true })
+    // emits('close')
+}
 
 onMounted(() => {
     const num = browser.valueFromUrl('m') || ''
@@ -590,7 +615,6 @@ onMounted(() => {
         .catch(() => {
             showTips.value = t('code.failed')
         })
-    console.error(browser.getURLParam('m'))
     http.post(`smart-site/marking/list`, {
         projectId: projectId,
         pageNum: 1,