bill преди 1 година
родител
ревизия
6a29d390be
променени са 5 файла, в които са добавени 19 реда и са изтрити 186 реда
  1. 0 1
      src/App.vue
  2. 2 4
      src/request/URL.ts
  3. 9 178
      src/request/index.ts
  4. 7 2
      src/store/scene.ts
  5. 1 1
      src/view/map/coord.vue

+ 0 - 1
src/App.vue

@@ -37,7 +37,6 @@ lifeHook.push({
     if (exixts) {
       clearTimeout(timeout);
       timeout = setTimeout(() => {
-        console.log("close");
         loading!.close();
         loading = null;
         exixts = false;

+ 2 - 4
src/request/URL.ts

@@ -43,8 +43,7 @@ export const getUserInfoById = `/relics/user/info/:id`;
 export const userScenepage = `/relics/user/page`;
 
 export const getMsgAuthCode = `/relics/user/getMsgAuthCode`;
-export const changePassword = `/relics/user/changePassword`
-
+export const changePassword = `/relics/user/changePassword`;
 
 ///drawing
 
@@ -54,6 +53,5 @@ export const getDrawingDetail = `/relics/relics/drawing/info/:drawingId`;
 export const getDrawingInfoByRelicsId = `/relics/relics/drawing/infoByRelicsId/:drawingId`;
 export const updateDrawing = `/relics/relics/drawing/update`;
 
-
 //token
-export const getFdTokenByNum = `/relics/scene/getFdTokenByNum?num=`;
+export const getFdTokenByNum = `/relics/scene/getFdTokenByNum?num=`;

+ 9 - 178
src/request/index.ts

@@ -19,10 +19,11 @@ import {
   Device,
   // PolygonsAttrib,
 } from "./type";
+import { getFdTokenByNum } from "./URL";
 
 const error = throttle((msg: string) => ElMessage.error(msg), 2000);
 
-type Other = { params?: Param; paths?: Param, useResult?: boolean };
+type Other = { params?: Param; paths?: Param; useResult?: boolean };
 export const sendFetch = <T>(
   url: string,
   init: RequestInit,
@@ -47,9 +48,9 @@ export const sendFetch = <T>(
     ...init,
     headers: headers
       ? {
-        ...headers,
-        ...gHeaders,
-      }
+          ...headers,
+          ...gHeaders,
+        }
       : gHeaders,
   })
     .then((res) => {
@@ -63,18 +64,17 @@ export const sendFetch = <T>(
     })
     .then((data) => {
       if (data.code !== 0) {
-        error(data.message);
+        !sendUrl.includes(getFdTokenByNum) && error(data.message);
         errorHook.map((err) => {
           err(data.code, data.msg);
         });
         throw data.message;
       } else {
         if (other && other.useResult) {
-          return data
+          return data;
         } else {
           return data.data;
         }
-
       }
     });
 };
@@ -193,173 +193,6 @@ export const relicsScenePosInfoFetch = (posId: number) =>
     { paths: { posId } }
   );
 
-// export const relicsPolyginsFetch = () => {
-//   return new Promise<PolygonsAttrib>((resolve) => {
-//     setTimeout(() => {
-//       resolve({
-//         lines: [
-//           {
-//             id: "1",
-//             pointIds: ["2666", "2667"],
-//           },
-//           {
-//             id: "2",
-//             pointIds: ["2667", "2669"],
-//           },
-//           {
-//             id: "3",
-//             pointIds: ["2669", "2674"],
-//           },
-//           {
-//             id: "4",
-//             pointIds: ["2674", "2675"],
-//           },
-//           {
-//             id: "5",
-//             pointIds: ["2675", "2676"],
-//           },
-//           {
-//             id: "6",
-//             pointIds: ["2676", "2673"],
-//           },
-//           {
-//             id: "7",
-//             pointIds: ["2673", "2672"],
-//           },
-//           {
-//             id: "8",
-//             pointIds: ["2672", "2670"],
-//           },
-//           {
-//             id: "9",
-//             pointIds: ["2677", "2678"],
-//           },
-//           {
-//             id: "10",
-//             pointIds: ["2678", "2679"],
-//           },
-//           {
-//             id: "11",
-//             pointIds: ["2679", "2680"],
-//           },
-//           {
-//             id: "12",
-//             pointIds: ["2680", "2681"],
-//           },
-//         ],
-//         polygons: [
-//           {
-//             id: "1",
-//             lineIds: ["1", "2", "3", "4", "5", "6", "7", "8"],
-//           },
-//           {
-//             id: "2",
-//             lineIds: ["9", "10", "11", "12"],
-//           },
-//         ],
-//         points: [
-//           {
-//             rtk: false,
-//             x: 115.949835199646,
-//             y: 30.0971239995873,
-//             id: "2666",
-//           },
-//           {
-//             rtk: false,
-//             x: 115.949706558269,
-//             y: 30.0975243383135,
-//             id: "2667",
-//           },
-//           {
-//             rtk: false,
-//             x: 115.950002555619,
-//             y: 30.0977552558535,
-//             id: "2668",
-//           },
-//           {
-//             rtk: false,
-//             x: 115.949968744193,
-//             y: 30.097862045865,
-//             id: "2669",
-//           },
-//           {
-//             rtk: true,
-//             x: 115.950063977564,
-//             y: 30.0978879318173,
-//             id: "2670",
-//           },
-//           {
-//             rtk: true,
-//             x: 115.949964417593,
-//             y: 30.0978650571868,
-//             id: "2671",
-//           },
-//           {
-//             rtk: true,
-//             x: 115.950300839723,
-//             y: 30.0976756336231,
-//             id: "2672",
-//           },
-//           {
-//             rtk: true,
-//             x: 115.950437426448,
-//             y: 30.097269657442,
-//             id: "2673",
-//           },
-//           {
-//             rtk: false,
-//             x: 115.95025353664198,
-//             y: 30.097554052476422,
-//             id: "2674",
-//           },
-//           {
-//             rtk: false,
-//             x: 115.95021286828855,
-//             y: 30.09733715459145,
-//             id: "2675",
-//           },
-//           {
-//             rtk: false,
-//             x: 115.95031589478391,
-//             y: 30.097000962869746,
-//             id: "2676",
-//           },
-//           {
-//             rtk: false,
-//             x: 115.95100324233627,
-//             y: 30.09844929254667,
-//             id: "2677",
-//           },
-//           {
-//             rtk: false,
-//             x: 115.95233898242569,
-//             y: 30.098492207890907,
-//             id: "2678",
-//           },
-//           {
-//             rtk: false,
-//             x: 115.95227997382736,
-//             y: 30.097059908276954,
-//             id: "2679",
-//           },
-//           {
-//             rtk: false,
-//             x: 115.95076720794296,
-//             y: 30.0971403745474,
-//             id: "2680",
-//           },
-//           {
-//             rtk: false,
-//             x: 115.95056336005783,
-//             y: 30.098095240956702,
-//             id: "2681",
-//           },
-//         ],
-//       });
-//     }, 500);
-//   });
-// };
-
 export type ScenePageProps = PageProps<{
   sceneCode?: string;
   sceneName?: string;
@@ -423,12 +256,10 @@ export const addDeviceFetch = (sn: string) =>
     body: JSON.stringify({ cameraSn: sn }),
   });
 
-
-
 export const getTokenFetch = (num: string) =>
   sendFetch(URL.getFdTokenByNum + num, {
     method: "get",
   });
 
-export * from './organization'
-export * from './users'
+export * from "./organization";
+export * from "./users";

+ 7 - 2
src/store/scene.ts

@@ -118,8 +118,12 @@ export const gotoScene = async (scene: Scene, edit = false) => {
   const params = new URLSearchParams();
   if (edit) {
     if (scene.sceneCode.startsWith("KJ")) {
-      const res = await getTokenFetch(scene.sceneCode);
-      params.set("token", (res as any).token);
+      try {
+        const res = await getTokenFetch(scene.sceneCode);
+        params.set("token", (res as any).token);
+      } catch {
+        edit = false;
+      }
     } else {
       params.set("token", gHeaders.token);
     }
@@ -127,6 +131,7 @@ export const gotoScene = async (scene: Scene, edit = false) => {
   params.set("lang", "zh");
   if (scene.sceneCode.startsWith("KJ")) {
     const qjURL = import.meta.env.VITE_QJ_URL;
+    params.set("id", scene.sceneCode);
     // console.log('')
     window.open(`${qjURL}/${edit ? "edit" : "show"}.html?` + params.toString());
   } else {

+ 1 - 1
src/view/map/coord.vue

@@ -87,7 +87,7 @@
                       v-if="!data.run"
                       @click.stop="
                         data.type === 'scene'
-                          ? gotoScene(data.raw, false)
+                          ? gotoScene(data.raw, true)
                           : gotoPointPage(data.raw)
                       "
                     />