bill 2 semanas atrás
pai
commit
d3b3dd6c21

+ 3 - 3
profile/.env.exetest

@@ -5,12 +5,12 @@ VITE_ENTRY_EXAMPLE='./main.ts'
 
 
 # VITE_ORIGIN='params'
-VITE_OSS_ROOT="http://192.168.0.125:1804/"
+VITE_OSS_ROOT="http://192.168.9.165:9008/"
 VITE_OSS='http://192.168.0.125:1804/oss/'
-VITE_MESH_OSS='http://192.168.0.125:1804/oss/'
+VITE_MESH_OSS='http://192.168.9.165:9008/'
 VITE_MESH_API='http://192.168.0.125:1804/'
 VITE_CLOUD_API='http://192.168.0.125:1804/'
-VITE_FUSE_API='http://192.168.0.125:1804/'
+VITE_FUSE_API='http://192.168.9.165:8808/'
 
 VITE_MESH_VIEW='./static/kankan.html?m={m}&lang=zh&env=dev'
 VITE_CLOUD_VIEW='http://192.168.0.125:1804/swss/index.html?m={m}&lang=zh'

+ 14 - 8
src/example/dialog/basemap/leaflet/index.vue

@@ -77,6 +77,7 @@ import {
 import { BasemapInfo, SearchResultItem, SelectMapImageProps } from "../index";
 import html2canvas from "html2canvas";
 import { ElInput, ElSelect, ElOption } from "element-plus";
+import { asyncTimeout } from "@/utils/shared";
 
 const props = defineProps<SelectMapImageProps>();
 
@@ -96,10 +97,10 @@ const tiles = computed(() => props.tileGroups[groupIndex.value].tiles);
 watchEffect(() => setTileLayers(tiles.value));
 
 const searchTypes = [
-  { label: "经纬度", value: "latlng" },
   { label: "地址", value: "name" },
+  { label: "经纬度", value: "latlng" },
 ];
-const searchType = ref(searchTypes[0].value as "latlng" | "name");
+const searchType = ref(searchTypes[1].value as "latlng" | "name");
 const searchName = computed(
   () => searchTypes.find((item) => item.value === searchType.value)!.label
 );
@@ -142,13 +143,18 @@ const searchHandler = async () => {
 };
 
 const initLatlng = async () => {
-  let latlng: LatLng = window.platform.getDefaultAddress() || (await getCurrentLatlng());
-  if (!keyword.value && mark.value === undefined && searchType.value === "latlng") {
-    keyword.value = `${latlng.lat},${latlng.lng}`;
-    searchHandler();
+  try {
+    let latlng: LatLng =
+      window.platform.getDefaultAddress() || (await getCurrentLatlng());
+    if (!keyword.value && mark.value === undefined && searchType.value === "latlng") {
+      keyword.value = `${latlng.lat},${latlng.lng}`;
+      searchHandler();
+    }
+  } finally {
+    await asyncTimeout(160);
+    // await nextTick();
+    searchType.value = "name";
   }
-  await nextTick();
-  searchType.value = "name";
 };
 initLatlng();
 

+ 21 - 14
src/example/fuse/enter-exe.ts

@@ -1,18 +1,25 @@
-
 import { params } from "../env";
-import { resourceURLS, SCENE_TYPE } from "./enter-shared";
+import { postFile, resourceURLS, SCENE_TYPE } from "./enter-shared";
 
-let load: Promise<any>
-if (import.meta.env.VITE_ORIGIN === 'params') {
-  resourceURLS.oss = params.value.app_resource
-  resourceURLS.ossRoot = params.value.app_resource
-  resourceURLS[SCENE_TYPE.cloud] = params.value.laser_server
-  resourceURLS[SCENE_TYPE.mesh] = params.value.mesh_server
-  resourceURLS[SCENE_TYPE.fuse] = params.value.fuse_server
-  load = import('./enter')
+let load: Promise<any>;
+if (import.meta.env.VITE_ORIGIN === "params") {
+  resourceURLS.oss = params.value.app_resource;
+  resourceURLS.ossRoot = params.value.app_resource;
+  resourceURLS[SCENE_TYPE.cloud] = params.value.laser_server;
+  resourceURLS[SCENE_TYPE.mesh] = params.value.mesh_server;
+  resourceURLS[SCENE_TYPE.fuse] = params.value.fuse_server;
+  load = import("./enter");
 } else {
-  load = import('./enter')
+  load = import("./enter");
 }
-load.then(() => {
-  window.platform.preventLogin = true
-})
+load.then((p) => {
+  window.platform.preventLogin = true;
+
+  window.platform.uploadResourse = async (file: File) => {
+    const url = await postFile(`fusion/upload/file`, { file });
+    if (url.includes("//")) {
+      return url;
+    }
+    return `${resourceURLS.oss}${url}`;
+  };
+});