Browse Source

制作1.7.0需求

bill 1 năm trước cách đây
mục cha
commit
1781c9ad42

+ 0 - 3
src/api/setting.ts

@@ -6,7 +6,6 @@ import axios from "./instance";
 type ServeSetting = {
   settingsId?: string;
   pose?: string;
-  lonlat?: number[];
   cover?: string;
   back?: string;
 };
@@ -25,7 +24,6 @@ export type Setting = {
   };
   cover: string;
   back: string;
-  lonlat: number[];
   fov?: number;
   openCompass?: boolean;
 };
@@ -34,7 +32,6 @@ const toLocal = (serviceSetting: ServeSetting): Setting => ({
   id: serviceSetting.settingsId,
   pose: serviceSetting.pose && JSON.parse(serviceSetting.pose),
   cover: serviceSetting.cover || defaultCover,
-  lonlat: serviceSetting.lonlat || [113.600356, 22.364093],
   back: serviceSetting.back || "none",
 });
 

+ 3 - 0
src/api/sys.ts

@@ -50,6 +50,7 @@ export type FireProject = {
   projectSite: string;
   projectSiteCode: string;
   projectSn: string;
+  
   status: FireStatus;
   statusDesc: string;
   updateTime: string;
@@ -58,6 +59,8 @@ export type FireProject = {
 
 export interface Case {
   caseTitle: string;
+  latAndLong: string,
+  mapUrl: string
   tmProject?: FireProject;
 }
 

+ 1 - 0
src/layout/model-list/sign.vue

@@ -12,6 +12,7 @@
           type="show_roaming_n"
           @click.stop="$emit('click', 'pano')"
           class="icon"
+          :class="{ active: custom.showMode === 'pano' && active }"
           v-if="getSceneModel(props.model)?.supportPano()"
         />
         <ui-input

+ 4 - 0
src/layout/model-list/style.scss

@@ -25,6 +25,10 @@
   align-items: center;
   flex       : none;
 
+  .active {
+    color: var(--colors-primary-base) !important;
+  }
+
   >* {
     margin-left: 20px;
   }

+ 7 - 7
src/model/platform.ts

@@ -1,5 +1,5 @@
 import { watchEffect, nextTick } from 'vue'
-import { fuseModelsLoaded, scenes, SceneType, setting } from '@/store'
+import { fuseModelsLoaded, scenes, SceneType, setting, caseProject } from '@/store'
 import { fuseModel } from './'
 import { initialSDK, initialed as fuseInitialed, sdk as fuseSDK } from '@/sdk'
 import { asyncTimeout } from '@/utils'
@@ -12,15 +12,15 @@ export async function modelSDKFactory (
   type: ModelType, 
   dom: HTMLDivElement | HTMLIFrameElement
 ): Promise<ModelExpose> {
-  console.log(type, dom)
-
+  const lonlatStr = caseProject.value?.latAndLong || '22.364093,113.600356'
+  const lonlat = lonlatStr.split(',').map(Number)
   const center = aMapToWgs84({
-    x: setting.value!.lonlat![0],
-    y: setting.value!.lonlat![1],
+    x: lonlat[1],
+    y: lonlat[0],
   });
   if (type === fuseModel) {
     if (!fuseInitialed) {
-      await initialSDK({ layout: dom, scenes: scenes.value, lonlat: [center.y, center.y] })
+      await initialSDK({ layout: dom, scenes: scenes.value, lonlat: [center.x, center.y] })
     }
     return exposeFactory(fuseModel)
   } else {
@@ -50,7 +50,7 @@ export async function modelSDKFactory (
 }
 
 
-const findObjectAttr = <T, K extends keyof T>(data: T, key: K): Promise<T[K]> => {
+const findObjectAttr = <T extends {}, K extends keyof T>(data: T, key: K): Promise<T[K]> => {
   return new Promise<T[K]>(resolve => {
     const query = () => {
       if (key in data) {

+ 86 - 68
src/views/merge/index.vue

@@ -1,24 +1,29 @@
 <template>
-  <RightPano v-if="custom.currentModel && active" class="merge-layout">
+  <RightPano
+    v-if="custom.currentModel && active && custom.showMode === 'fuse'"
+    class="merge-layout"
+  >
     <ui-group>
       <template #header>
         <Actions class="edit-header" :items="actionItems" v-model:current="currentItem" />
       </template>
       <ui-group-option label="等比缩放">
         <template #icon>
-          <a class="set-prop" 
-            :class="{disabled: isOld || currentItem}"
+          <a
+            class="set-prop"
+            :class="{ disabled: isOld || currentItem }"
             @click="router.push({ 
               name: RoutesName.proportion, 
               params: { id: custom.currentModel!.id, save: '1' },
             })"
-          >设置比例</a>
+            >设置比例</a
+          >
         </template>
-        <ui-input 
-          type="range" 
-          v-model="custom.currentModel.scale" 
-          v-bind="modelRange.scaleRange" 
-          :ctrl="false" 
+        <ui-input
+          type="range"
+          v-model="custom.currentModel.scale"
+          v-bind="modelRange.scaleRange"
+          :ctrl="false"
           width="100%"
         >
           <template #icon>%</template>
@@ -36,25 +41,26 @@
         </ui-input>
       </ui-group-option> -->
       <ui-group-option label="模型不透明度">
-        <ui-input 
-          type="range" 
-          v-model="custom.currentModel.opacity" 
-          v-bind="modelRange.opacityRange" 
-          :ctrl="false" 
+        <ui-input
+          type="range"
+          v-model="custom.currentModel.opacity"
+          v-bind="modelRange.opacityRange"
+          :ctrl="false"
           width="100%"
         >
           <template #icon>%</template>
         </ui-input>
       </ui-group-option>
       <ui-group-option>
-          <!-- :disabled="currentItem"  -->
-        <ui-button 
-          :class="{disabled: isOld}"
+        <!-- :disabled="currentItem"  -->
+        <ui-button
+          :class="{ disabled: isOld }"
           @click="router.push({ 
             name: RoutesName.registration, 
             params: {id: custom.currentModel!.id, save: '1' } 
           })"
-        >配准</ui-button>
+          >配准</ui-button
+        >
       </ui-group-option>
       <ui-group-option>
         <ui-button @click="reset">恢复默认</ui-button>
@@ -64,79 +70,92 @@
 </template>
 
 <script lang="ts" setup>
-import { RoutesName, router } from '@/router'
-import { RightPano } from '@/layout'
-import { autoSaveFuseModels, defaultFuseModelAttrs, isOld } from '@/store'
-import { togetherCallback } from '@/utils'
-import { sdk, getSceneModel, modelRange } from '@/sdk'
-import { useViewStack, useActive } from '@/hook'
-import { showLeftPanoStack, custom, modelsChangeStoreStack, showRightPanoStack } from '@/env'
-import { ref, nextTick, watchEffect, computed, watch } from 'vue'
-import { Dialog } from 'bill/expose-common'
+import { RoutesName, router } from "@/router";
+import { RightPano } from "@/layout";
+import { autoSaveFuseModels, defaultFuseModelAttrs, isOld } from "@/store";
+import { togetherCallback } from "@/utils";
+import { sdk, getSceneModel, modelRange } from "@/sdk";
+import { useViewStack, useActive } from "@/hook";
+import {
+  showLeftPanoStack,
+  custom,
+  modelsChangeStoreStack,
+  showRightPanoStack,
+} from "@/env";
+import { ref, nextTick, watchEffect, computed, watch } from "vue";
+import { Dialog } from "bill/expose-common";
 
-import Actions from '@/components/actions/index.vue'
+import Actions from "@/components/actions/index.vue";
 
-import type { ActionsProps, ActionsItem } from '@/components/actions/index.vue'
+import type { ActionsProps, ActionsItem } from "@/components/actions/index.vue";
 
-const active = useActive()
-const actionItems: ActionsProps['items'] = [
+const active = useActive();
+const actionItems: ActionsProps["items"] = [
   {
-    icon: 'move',
-    text: '移动',
+    icon: "move",
+    text: "移动",
     action: () => {
-      getSceneModel(custom.currentModel)?.enterMoveMode()
-      return () => getSceneModel(custom.currentModel)?.leaveTransform()
-    }
+      getSceneModel(custom.currentModel)?.enterMoveMode();
+      return () => getSceneModel(custom.currentModel)?.leaveTransform();
+    },
   },
   {
-    icon: 'flip',
-    text: '旋转',
+    icon: "flip",
+    text: "旋转",
     action: () => {
-      getSceneModel(custom.currentModel)?.enterRotateMode()
+      getSceneModel(custom.currentModel)?.enterRotateMode();
       return () => {
-        getSceneModel(custom.currentModel)?.leaveTransform()
-      }
-    }
+        getSceneModel(custom.currentModel)?.leaveTransform();
+      };
+    },
   },
-]
-
+];
 
-const currentItem = ref<ActionsItem | null>(null)
+const currentItem = ref<ActionsItem | null>(null);
 watchEffect(() => {
   if (!custom.currentModel) {
-    currentItem.value = null
+    currentItem.value = null;
   }
-})
+});
 
 watch(
-  () => custom.currentModel, 
+  () => custom.currentModel,
   () => {
-    console.log('???')
+    console.log("???");
     currentItem.value = null;
   }
-)
+);
 
 const reset = async () => {
-  if (custom.currentModel && await Dialog.confirm('确定恢复默认?此操作无法撤销')) {
-    Object.assign(custom.currentModel, defaultFuseModelAttrs)
-    await nextTick()
-    custom.currentModel && (custom.currentModel.bottom = 0)
+  if (custom.currentModel && (await Dialog.confirm("确定恢复默认?此操作无法撤销"))) {
+    Object.assign(custom.currentModel, defaultFuseModelAttrs);
+    await nextTick();
+    custom.currentModel && (custom.currentModel.bottom = 0);
   }
-}
-useViewStack(() => togetherCallback([
-  showLeftPanoStack.push(ref(true)),
-  showRightPanoStack.push(computed(() => !!custom.currentModel)),
-  modelsChangeStoreStack.push(ref(true)),
-  () => currentItem.value = null
-]))
-useViewStack(autoSaveFuseModels)
+};
+useViewStack(() =>
+  togetherCallback([
+    showLeftPanoStack.push(ref(true)),
+    showRightPanoStack.push(computed(() => !!custom.currentModel)),
+    modelsChangeStoreStack.push(ref(true)),
+    () => (currentItem.value = null),
+  ])
+);
+useViewStack(autoSaveFuseModels);
 
 useViewStack(() => {
-  sdk.showGrid()
+  const stopWatch = watchEffect(() => {
+    if (custom.showMode === "fuse") {
+      sdk.showGrid();
+    } else {
+      sdk.hideGrid();
+    }
+  });
   return () => {
-    sdk.hideGrid()
-  }
-})
+    sdk.hideGrid();
+    stopWatch();
+  };
+});
 </script>
 
 <style lang="scss">
@@ -150,8 +169,7 @@ useViewStack(() => {
   }
 }
 
-
 .set-prop {
   cursor: pointer;
 }
-</style>
+</style>