jinx 1 年之前
父節點
當前提交
b77d6a5f42

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

@@ -182,7 +182,7 @@ const handlerUpload = async data => {
             delete notify.value.__temp
             notify.value.id = response.data.markingId
             notify.value = null
-            emits('action', '提交成功')
+            emits('action', t('common.commitSuccess'))
         } else if (response.code == 4008) {
             showTips.value = t('code.4008')
         } else {

+ 4 - 2
src/components/files/index.vue

@@ -33,7 +33,7 @@
             <button type="submit" @click="onAddConfirm">{{ $t('common.confirm') }}</button>
         </div>
     </transition>
-    <ui-confirm v-if="delComfirm" @ok="handlerDel" @no="handlerDel">
+    <ui-confirm v-if="delComfirm" :title="$t('common.tips')" :okText="$t('common.confirm')" :noText="$t('common.cancel')" @ok="handlerDel" @no="handlerDel">
         <template #content>
             <div>{{ $t('tag.deleteTagText') }}</div>
         </template>
@@ -42,10 +42,12 @@
 </template>
 <script setup>
 import { ref, inject, watchEffect, onMounted, nextTick, watch } from 'vue'
+import i18n, { getLocale, setI18nLanguage, loadLocaleMessages } from '@/i18n'
 import browser from '@/utils/browser'
 import { http } from '@/utils/request'
 import UiConfirm from '@/components/dialog/Confirm.vue'
 import Toast from '@/components/dialog/Toast'
+const { t } = i18n.global
 let editTag = null
 let tempTag = null
 const exit$ = ref(null)
@@ -64,7 +66,7 @@ const handlerDel = status => {
         }).then(response => {
             if (response.success) {
                 toastOps.value.type = 'success'
-                showTips.value = '删除成功'
+                showTips.value = t('common.deleteSuccess')
                 let index = tags.value.findIndex(item => item.sid == delComfirm.value.sid)
                 if (index != -1) {
                     tags.value.splice(index, 1)

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

@@ -112,9 +112,9 @@ const onLogin = () => {
                 emits('close')
             } else {
                 if (response.code == 4002) {
-                    errors.value.message = '该账号下未检测到当前场景,请更换账号重新登录'
+                    errors.value.message = t('code.4002') //'该账号下未检测到当前场景,请更换账号重新登录'
                 } else {
-                    errors.value.message = response.message
+                    errors.value.message = t(`code.${response.code}`) // response.message
                 }
             }
         })

+ 17 - 2
src/locales/en.json

@@ -106,12 +106,27 @@
     "syncSuccess": "Sync Success",
     "endPoint": "EndPoint",
     "startPoint": "StartPoint",
-    "measure": "Measure"
+    "measure": "Measure",
+    "commitSuccess": "提交成功",
+    "about": "约"
   },
   "common.name": "Common",
+  "unit": {
+    "meter": "米"
+  },
+  "unit.name": "单位",
   "code": {
     "4008": "User not logged in",
-    "failed": "Failed to connect to the server"
+    "failed": "Failed to connect to the server",
+    "0": "操作成功",
+    "-1": "操作失败",
+    "2001": "操作过于频繁,请刷新后再试",
+    "4001": "参数缺少",
+    "4002": "没有权限",
+    "4003": "用户不存在",
+    "3014": "账号或密码不正确。",
+    "3015": "用户不存在。",
+    "4013": "该账号下未检测到当前场景,请更换账号重新登录"
   },
   "code.name": "code"
 }

+ 17 - 2
src/locales/ja.json

@@ -106,12 +106,27 @@
     "syncSuccess": "シンクロに成功",
     "endPoint": "終点",
     "startPoint": "起点",
-    "measure": "測量"
+    "measure": "測量",
+    "commitSuccess": "提交成功",
+    "about": "约"
   },
   "common.name": "通用",
+  "unit": {
+    "meter": "米"
+  },
+  "unit.name": "单位",
   "code": {
     "4008": "ユーザーはログインされていません。",
-    "failed": "サーバ接続に失敗しました"
+    "failed": "サーバ接続に失敗しました",
+    "0": "操作成功",
+    "-1": "操作失败",
+    "2001": "操作过于频繁,请刷新后再试",
+    "4001": "参数缺少",
+    "4002": "没有权限",
+    "4003": "用户不存在",
+    "3014": "账号或密码不正确。",
+    "3015": "用户不存在。",
+    "4013": "该账号下未检测到当前场景,请更换账号重新登录"
   },
   "code.name": "状態コード"
 }

+ 17 - 2
src/locales/zh.json

@@ -106,12 +106,27 @@
     "syncSuccess": "同步成功",
     "endPoint": "终点",
     "startPoint": "起点",
-    "measure": "测量"
+    "measure": "测量",
+    "commitSuccess": "提交成功",
+    "about": "约"
   },
   "common.name": "通用",
+  "unit": {
+    "meter": "米"
+  },
+  "unit.name": "单位",
   "code": {
     "4008": "用户未登录",
-    "failed": "连接服务器失败"
+    "failed": "连接服务器失败",
+    "0": "操作成功",
+    "-1": "操作失败",
+    "2001": "操作过于频繁,请刷新后再试",
+    "4001": "参数缺少",
+    "4002": "没有权限",
+    "4003": "用户不存在",
+    "3014": "账号或密码不正确。",
+    "3015": "用户不存在。",
+    "4013": "该账号下未检测到当前场景,请更换账号重新登录"
   },
   "code.name": "状态码"
 }

+ 3 - 3
src/pages/SViewer.vue

@@ -13,11 +13,11 @@
             <div class="item-date">
                 <Calendar :value="sourceDate" :highlighted="sourceDays" @selected="onSelected" @prev="onPrevDate" @next="onNextDate" />
             </div>
-            <div class="item-mode" v-if="source.type == 2">
+            <div class="item-mode" v-if="source.type == 2 || source.type == 3">
                 <div class="iconfont icon-show_roaming" :class="{ active: mode == 0 }" @click="onModeChange(0)"></div>
                 <div class="iconfont icon-show_plane" :class="{ active: mode == 1 }" @click="onModeChange(1)"></div>
             </div>
-            <div class="item-density" v-if="source.type == 2 && mode == 1" @click="showDensity = true">
+            <div class="item-density" v-if="(source.type == 2 && mode == 1) || (source.type == 3 && mode == 1)" @click="showDensity = true">
                 <span>{{ densityType.text }}</span>
                 <div @click.stop="showDensity = false" v-if="showDensity">
                     <ul>
@@ -163,7 +163,7 @@ const sourceDays = computed(() => {
         }
     })
 
-    outDays.year.sort((a,b)=>b-a)
+    outDays.year.sort((a, b) => b - a)
     outDays.month.sort()
     outDays.day.sort()
 

+ 10 - 10
src/pages/Viewer.vue

@@ -20,11 +20,11 @@
                             @next="onNextDate"
                         ></calendar>
                     </div>
-                    <div class="item-mode" v-if="source.type == 2">
+                    <div class="item-mode" v-if="source.type == 2 || source.type == 3">
                         <div class="iconfont icon-show_roaming" :class="{ active: mode == 0 }" @click="onModeChange(0)"></div>
                         <div class="iconfont icon-show_plane" :class="{ active: mode == 1 }" @click="onModeChange(1)"></div>
                     </div>
-                    <div class="item-density" v-if="source.type == 2 && mode == 1" :class="{ active: showDensity }" @click="showDensity = !showDensity">
+                    <div class="item-density" v-if="(source.type == 2 && mode == 1) || (source.type == 3 && mode == 1)" :class="{ active: showDensity }" @click="showDensity = !showDensity">
                         <span>{{ densityType.text }}</span>
                         <i class="iconfont icon-arrows_down"></i>
                         <ul>
@@ -120,9 +120,9 @@ import Calendar from '@/components/calendar'
 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 i18n, { getLocale, useI18n, useScope, setI18nLanguage, loadLocaleMessages } from '@/i18n'
 import Rules from './Rules'
-const { t } = i18n.global
+const { t } = useI18n({ useScope: 'global' })
 const isDev = process.env.VUE_APP_TEST == 1
 const rules = []
 const tags = ref([])
@@ -217,7 +217,7 @@ const sourceURL = computed(() => {
     beforeChangeURL('source')
 
     if (bimChecked.value && !dbsChecked.value) {
-        return `smart-bim.html?m=${project.value.bimData.bimOssFilePath}`
+        return `smart-bim.html?m=${project.value.bimData.bimOssFilePath}&lang=${getLocale()}`
     }
 
     if (!source.value) {
@@ -226,23 +226,23 @@ const sourceURL = computed(() => {
     getTagList(source.value.num)
     if (source.value.type < 2) {
         // 看看、看见场景
-        return `smart-kankan.html?m=${source.value.num}${isDev ? '&dev' : ''}`
+        return `smart-kankan.html?m=${source.value.num}${isDev ? '&dev' : ''}&lang=${getLocale()}`
     } else {
         // 深时场景
-        return `smart-laser.html?m=${source.value.num}${isDev ? '&dev' : ''}`
+        return `smart-laser.html?m=${source.value.num}${isDev ? '&dev' : ''}&lang=${getLocale()}`
     }
 })
 const targetURL = computed(() => {
     if (bimChecked.value) {
-        return `smart-bim.html?m=${project.value.bimData.bimOssFilePath}`
+        return `smart-bim.html?m=${project.value.bimData.bimOssFilePath}&lang=${getLocale()}`
     }
     // getTagList(target.value.num)
     if (target.value.type < 2) {
         // 看看、看见场景
-        return `smart-kankan.html?m=${target.value.num}${isDev ? '&dev' : ''}`
+        return `smart-kankan.html?m=${target.value.num}${isDev ? '&dev' : ''}&lang=${getLocale()}`
     } else {
         // 深时场景
-        return `smart-laser.html?m=${target.value.num}${isDev ? '&dev' : ''}`
+        return `smart-laser.html?m=${target.value.num}${isDev ? '&dev' : ''}&lang=${getLocale()}`
     }
 })
 const sourceDate = computed(() => {

+ 24 - 8
src/pages/kankan.js

@@ -1,13 +1,29 @@
 import './DesignOption/measure.scss'
 import browser from '../utils/browser'
+import i18n, { getLocale, setI18nLanguage, loadLocaleMessages } from '@/i18n'
+const { t } = i18n.global
 
-window.app = new KanKan({
-    dom: '#app',
-    num: browser.valueFromUrl('m'),
-    isLoadTags:false,
-    tag:{
-        showIn:'all'
+const local = getLocale()
+loadLocaleMessages(i18n, local).then(() => {
+    setI18nLanguage(i18n, local)
+    const lan = {
+        'common.about': t('common.about'),
+        'common.meter': t('unit.meter'),
     }
+    window.app = new KanKan({
+        dom: '#app',
+        num: browser.valueFromUrl('m'),
+        isLoadTags: false,
+        tag: {
+            showIn: 'all',
+        },
+        lang: getLocale(),
+        langs: {
+            en: lan,
+            ja: lan,
+        },
+    })
+
+    app.use('TagEditor')
+    app.render()
 })
-app.use('TagEditor')
-app.render()

+ 0 - 1
src/pages/sviewer.js

@@ -42,7 +42,6 @@ String.prototype.toDate = function() {
 setup()
 // createApp(App).use(DatetimePicker).mount('#app')
 
-
 const app = createApp(App)
 loadLocaleMessages(i18n, local).then(() => {
   setI18nLanguage(i18n, local)

+ 1 - 1
vue.config.js

@@ -24,7 +24,7 @@ const devServer = {
             }
         },
         '/smart-site': {
-            target: 'https://test.4dkankan.com/',//'http://192.168.0.152:8111', //
+            target: 'https://test.4dkankan.com/',//'http://192.168.0.11:8111', //
             changeOrigin: true,
             headers: {
                 Connection: 'keep-alive',