bill 1 anno fa
parent
commit
0f56ce1f87
2 ha cambiato i file con 6 aggiunte e 4 eliminazioni
  1. 4 2
      src/request/index.ts
  2. 2 2
      src/view/pano/pano.vue

+ 4 - 2
src/request/index.ts

@@ -1,4 +1,4 @@
-import { dateFormat, gendUrl } from "@/util";
+import { dateFormat, gendUrl, throttle } from "@/util";
 import * as URL from "./URL";
 import {
   basePath,
@@ -12,6 +12,8 @@ import {
 import { ElMessage } from "element-plus";
 import { Relics, Scene, ScenePoint, ResPage, UserInfo, Device } from "./type";
 
+const error = throttle((msg: string) => ElMessage.error(msg), 2000);
+
 type Other = { params?: Param; paths?: Param };
 export const sendFetch = <T>(
   url: string,
@@ -53,7 +55,7 @@ export const sendFetch = <T>(
     })
     .then((data) => {
       if (data.code !== 0) {
-        ElMessage.error(data.message);
+        error(data.message);
         errorHook.map((err) => {
           err(data.code, data.msg);
         });

+ 2 - 2
src/view/pano/pano.vue

@@ -55,7 +55,7 @@ import { copyText, toDegrees } from "@/util";
 import { ElMessage } from "element-plus";
 import saveAs from "@/util/file-serve";
 import { DeviceType } from "@/store/device";
-import { initRelics } from "@/store/relics";
+import { initRelics, relics } from "@/store/relics";
 
 type Params = { pid?: string; relicsId?: string } | null;
 const params = computed(() => router.currentRoute.value.params as Params);
@@ -99,7 +99,7 @@ const photo = () => {
   setSize(3, 1920, 1080);
   panoDomRef.value!.toBlob(async (blob) => {
     if (blob) {
-      await saveAs(blob, "pano.jpg");
+      await saveAs(blob, `${relics.value?.name}.jpg`);
       ElMessage.success("图片导出成功");
     }