Sfoglia il codice sorgente

Merge branch 'v1.2.0-ga' of http://192.168.0.115:3000/bill/fuse-code into v1.2.0-ga

xzw 4 mesi fa
parent
commit
4ce4718dc5

+ 1 - 1
.env

@@ -2,4 +2,4 @@ VITE_LASER_HOST=
 VITE_LASER_OSS=/laser-data
 VITE_OSS=/oss
 VITE_PANO_OSS=/oss
-
+VITE_MAP_PLATFORM=jm

+ 5 - 0
.env.development

@@ -0,0 +1,5 @@
+VITE_LASER_HOST=
+VITE_LASER_OSS=/laser-data
+VITE_OSS=/oss
+VITE_PANO_OSS=/oss
+VITE_MAP_PLATFORM=gaode

+ 26 - 15
src/components/bill-ui/components/input/checkbox.vue

@@ -1,20 +1,31 @@
 <template>
-    <div class="input checkbox" :style="{ width, height }">
-        <input :id="id" type="checkbox" class="replace-input" :checked="props.modelValue" @input="ev => emit('update:modelValue', ev.target.checked)" />
-        <span class="replace">
-            <icon type="checkbox" :size="width > height ? height : width" />
-        </span>
-    </div>
-    <label class="label" v-if="props.label" :for="id">
-        {{ props.label }}
-    </label>
+  <div class="input checkbox" :style="{ width, height }">
+    <input
+      :id="id"
+      type="checkbox"
+      class="replace-input"
+      :checked="props.modelValue"
+      @input="updateInput"
+    />
+    <span class="replace">
+      <icon type="checkbox" :size="width > height ? height : width" />
+    </span>
+  </div>
+  <label class="label" v-if="props.label" :for="id">
+    {{ props.label }}
+  </label>
 </template>
 
 <script setup>
-import icon from '../icon'
-import { checkboxPropsDesc } from './state'
-import { randomId } from '../../utils'
-const props = defineProps(checkboxPropsDesc)
-const emit = defineEmits(['update:modelValue'])
-const id = randomId(4)
+import icon from "../icon";
+import { checkboxPropsDesc } from "./state";
+import { randomId } from "../../utils";
+const props = defineProps(checkboxPropsDesc);
+const emit = defineEmits(["update:modelValue"]);
+const id = randomId(4);
+
+const updateInput = (ev) => {
+  console.error("ev.target.checked", ev.target.checked);
+  emit("update:modelValue", ev.target.checked);
+};
 </script>

+ 7 - 2
src/components/global-search/map.vue

@@ -1,10 +1,15 @@
 <template>
-  <p @click="flyLatLng(data.latlng)">{{ data.address }}</p>
+  <p @click="fly">{{ data.address }}</p>
 </template>
 
 <script lang="ts" setup>
 import { flyLatLng } from "@/hook/use-fly";
 import { Address } from "@/store/map";
 
-defineProps<{ data: Address }>();
+const props = defineProps<{ data: Address }>();
+
+const fly = () => {
+  console.log("fly", props.data.latlng);
+  flyLatLng(props.data.latlng);
+};
 </script>

+ 17 - 9
src/components/view-setting/index.vue

@@ -31,7 +31,7 @@ import {
   showTaggingsStack,
 } from "@/env";
 import { DownOutlined } from "@ant-design/icons-vue";
-import { computed, watchEffect } from "vue";
+import { computed, watch, watchEffect } from "vue";
 import { selectPaths } from "@/store";
 
 const props = defineProps<{ value?: Record<string, boolean> }>();
@@ -44,17 +44,25 @@ const showOptions = [
     key: "showPath",
     text: "路径",
     stack: computed({
-      get: () => selectPaths.all.value || selectPaths.selects.value.length > 0,
-      set: (val: boolean) => (selectPaths.all.value = val),
+      get: () => {
+        return selectPaths.all.value || selectPaths.selects.value.length > 0;
+      },
+      set: (val: boolean) => {
+        selectPaths.all.value = val;
+        console.log(selectPaths.selects.value);
+      },
     }),
   },
 ];
-watchEffect(() => {
-  if (!props.value) return;
-  showOptions.forEach((item) => {
-    item.stack.value = props.value![item.key];
-  });
-});
+watch(
+  () => props.value,
+  () => {
+    if (!props.value) return;
+    showOptions.forEach((item) => {
+      item.stack.value = props.value![item.key];
+    });
+  }
+);
 
 watchEffect(() => {
   emit(

+ 49 - 16
src/store/map.ts

@@ -1,38 +1,71 @@
 import { params } from "@/env";
 
-export type Address = { address: string; latlng: number[], id: string };
+export type Address = { address: string; latlng: number[]; id: string };
 const platform = {
   gaode(val: string) {
     const key = params.mapKey || "3bddec1685d461c2271a6099cde02fd2";
-    return fetch(
-      `https://restapi.amap.com/v3/geocode/geo?address=${encodeURIComponent(
-        val
-      )}&key=${key}`
-    )
+    const url = `https://restapi.amap.com/v3/geocode/geo?address=${encodeURIComponent(
+      val
+    )}&key=${key}`;
+    return fetch(url)
       .then((res) => res.json())
       .then((res) => {
         if (res.info !== "OK") {
           throw res.info;
         }
-        console.log(res)
-        const items = res.geocodes.map((item: any) => ({
-          id: item.location,
-          address: item.formatted_address,
-          latlng: item.location
-            .split(",")
-            .map((item: string) => Number(item.trim())),
-        })).slice(0, 10);
+        console.log(res);
+        const items = res.geocodes
+          .map((item: any) => ({
+            id: item.location,
+            address: item.formatted_address,
+            latlng: item.location
+              .split(",")
+              .map((item: string) => Number(item.trim())),
+          }))
+          .slice(0, 10);
         return items;
       });
   },
+  async jm(val: string) {
+    const tipParams = new URLSearchParams();
+    tipParams.set("basic", "y");
+    tipParams.set("key", val);
+    tipParams.set("location", "113.05,22.61");
+
+    const keyList = (await fetch(`/s/api/gettips?${tipParams.toString()}`)
+      .then((res) => res.json())
+      .then((res) => res.data)) as { name: string }[];
+
+    // const keyList = [{name: '港湾一号'},{name: '港湾二号'},]
+
+    const items: Address[] = [];
+    const reqs = keyList.map(({ name }) => {
+      const params = new URLSearchParams();
+      params.set("name", name);
+      return fetch(`/s/api/gettips_name?${params.toString()}`)
+        .then((res) => res.json())
+        .then((res) => res.data)
+        .then((data) => {
+          items.push({
+            latlng: [Number(data.lat), Number(data.lng)],
+            address: name,
+            id: data.lat.toString() + "," + data.lng.toString(),
+          });
+        });
+    });
+
+    await Promise.all(reqs)
+    return items
+  },
 };
 
 export const searchAddress = (val: string): Promise<Address[]> => {
-  if (!val) return Promise.resolve([])
+  if (!val) return Promise.resolve([]);
+  console.log(import.meta.env.VITE_MAP_PLATFORM)
   const p = (
     params.mapPlatform && params.mapPlatform in platform
       ? params.mapPlatform
-      : "gaode"
+      : import.meta.env.VITE_MAP_PLATFORM
   ) as keyof typeof platform;
 
   return platform[p](val);

+ 1 - 1
src/views/guide/guide/attach-animation-sam.vue

@@ -5,7 +5,7 @@
     @click="attachAnimation"
   >
     <ui-icon type="a-animation_s" />
-    <span>激活动画</span>
+    <span>{{ isPlayIng ? "关闭" : "激活" }}动画</span>
   </div>
 </template>
 

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

@@ -11,6 +11,7 @@ interface ImportMetaEnv {
   readonly VITE_LASER_OSS: string
   readonly VITE_PANO_OSS: string
   readonly VITE_OSS: string
+  readonly VITE_MAP_PLATFORM: string
   
 }