bill 8 months ago
parent
commit
82396f1b9c
6 changed files with 17 additions and 5 deletions
  1. 1 0
      .env
  2. 1 0
      src/model/platform.ts
  3. 9 5
      src/router/index.ts
  4. 1 0
      src/sdk/sdk.ts
  5. 1 0
      src/views/tagging/index.vue
  6. 4 0
      src/vite-env.d.ts

+ 1 - 0
.env

@@ -0,0 +1 @@
+VITE_LASER_HOST=/

+ 1 - 0
src/model/platform.ts

@@ -38,6 +38,7 @@ export async function modelSDKFactory(
   if (type === fuseModel) {
     if (!fuseInitialed) {
       await initialSDK({
+        laserRoot: import.meta.env.VITE_LASER_HOST,
         layout: dom,
         scenes: scenes.value,
         lonlat: center,

+ 9 - 5
src/router/index.ts

@@ -1,6 +1,6 @@
 import { createRouter, createWebHashHistory } from 'vue-router'
 import { routes } from './config'
-import { computed, watchEffect } from 'vue'
+import { computed, watch, watchEffect } from 'vue'
 import { RoutesName } from './constant'
 import { metas } from './constant'
 
@@ -55,10 +55,14 @@ export const currentMeta = computed(() => {
   }
 })
 
-watchEffect(() => {
-  if (!currentLayout.value) {
-    router.replace({ name: RoutesName.fireInfo })
-  }
+let timeout: any
+watch(currentLayout, () => {
+  clearTimeout(timeout)
+  timeout = setTimeout(() => {
+    if (!currentLayout.value) {
+      router.replace({ name: RoutesName.fireInfo })
+    }
+  }, 100)
 })
 
 export * from './config'

+ 1 - 0
src/sdk/sdk.ts

@@ -336,6 +336,7 @@ export type Tagging3D = {
 
 export let sdk: SDK;
 export type InialSDKProps = {
+  laserRoot?: string
   layout: HTMLDivElement;
   scenes: Scene[];
   lonlat?: number[];

+ 1 - 0
src/views/tagging/index.vue

@@ -128,6 +128,7 @@ const selectTagging = ref<Tagging | null>(null);
 useViewStack(() => {
   const stopAuth = autoSaveTaggings();
   const stop = watchEffect((onCleanup) => {
+    console.log(taggingsGroup, taggingsGroup.changeCanMove);
     taggingsGroup.changeCanMove(true);
     taggingsGroup.showDelete(true);
     onCleanup(() => {

+ 4 - 0
src/vite-env.d.ts

@@ -6,6 +6,10 @@ declare module '*.vue' {
   export default component
 }
 
+interface ImportMetaEnv {
+  readonly VITE_LASER_HOST: string
+}
+
 declare const offline: boolean
 
 type ToChangeAPI<T extends Record<string, any>> = {