bill hace 3 meses
padre
commit
e6b2eae537
Se han modificado 6 ficheros con 29 adiciones y 20 borrados
  1. 3 2
      src/api/instance.ts
  2. 17 14
      src/api/setup.ts
  3. 1 0
      src/app.vue
  4. 6 3
      src/main.ts
  5. 1 1
      src/sdk/association/animation.ts
  6. 1 0
      vite.config.ts

+ 3 - 2
src/api/instance.ts

@@ -8,6 +8,7 @@ import GAxios from "axios";
 
 const instance = axiosFactory();
 
+
 export const {
   axios, 
   addUnsetTokenURLS,
@@ -27,8 +28,8 @@ export const {
 } = instance;
 
 const gotoLogin = () => {
-  const loginHref = import.meta.env.DEV ? 'http://localhost:5174' : appBackRoot[params.app]
-  location.href = loginHref + '?redirect=' + escape(location.href) + '#/login'
+  // const loginHref = import.meta.env.DEV ? 'http://localhost:5174' : appBackRoot[params.app]
+  // location.href = loginHref + '?redirect=' + escape(location.href) + '#/login'
   // if (import.meta.env.DEV) {
     // GAxios.post("/service/manage/login", {
     //   password: "MRinIEn3ExMjM0NTY=Q5Lm39urQWzN7k4oCG",

+ 17 - 14
src/api/setup.ts

@@ -41,6 +41,7 @@ export const axiosFactory = () => {
     let axiosObj = axiosConfig[key] as any[]
     const apis: any = { 
       set (val: AxiosConfig[K]) {
+        console.error('set', key, val)
         axiosObj = axiosConfig[key] = val as any
       }
     }
@@ -131,20 +132,22 @@ export const axiosFactory = () => {
         hook.before && hook.before(config)
       }
 
-      // if (!matchURL(axiosConfig.unTokenSet, config)) {
-      //   if (!axiosConfig.token) {
-      //     if (!offline && !matchURL(axiosConfig.unReqErrorSet, config)) {
-      //       const error = new Error('缺少token')
-      //       callErrorHandler('req', error, config)
-      //       throw error
-      //     }
-      //   } else {
-      //     config.headers = {
-      //       ...config.headers,
-      //       token: axiosConfig.token
-      //     }
-      //   }
-      // }
+      console.log(axiosConfig.unTokenSet)
+      if (!matchURL(axiosConfig.unTokenSet, config)) {
+        if (!axiosConfig.token) {
+          if (!offline && !matchURL(axiosConfig.unReqErrorSet, config)) {
+            console.log(config)
+            const error = new Error('缺少token')
+            callErrorHandler('req', error, config)
+            throw error
+          }
+        } else {
+          config.headers = {
+            ...config.headers,
+            token: axiosConfig.token
+          }
+        }
+      }
       return config
     }
   )

+ 1 - 0
src/app.vue

@@ -105,6 +105,7 @@ const stopWatch = watch(
       await router.replace({ name: RoutesName.error });
     }
     stopWatch();
+    console.error("加载完成");
     loaded.value = true;
   },
   { immediate: true }

+ 6 - 3
src/main.ts

@@ -40,8 +40,9 @@ addHook({
 
 addHook({
   before(config: any) {
-    if (params.sign) {
-      config.headers["sign"] = params.sign
+    console.error('request hook', params)
+    if (params.share) {
+      config.headers["share"] = 1
     }
   },
 });
@@ -49,7 +50,7 @@ addHook({
 watchEffect(
   (onCleanup) => {
     if (
-      params.sign && [RoutesName.show, RoutesName.signModel].includes(currentLayout.value!)
+       [RoutesName.show, RoutesName.signModel].includes(currentLayout.value!)
     ) {
       const untokenURLS = [
         URL.FUSE_MODEL_LIST,
@@ -71,6 +72,8 @@ watchEffect(
         URL.CASE_INFO,
         URL.PATH_LIST,
         URL.AUTH_PWD,
+        URL.MAP_TILE_LIST,
+        URL.AM_MODEL_LIST,
         '/fusion/caseInquest/info',
         '/fusion/caseExtractDetail/info',
         '/fusion/caseInquest/downDocx',

+ 1 - 1
src/sdk/association/animation.ts

@@ -502,7 +502,7 @@ export const associationAnimation = (sdk: SDK, el: HTMLDivElement) => {
     () => [...ams.value],
     (newv, oldv = []) => {
       const { added, deleted } = diffArrayChange(newv, oldv);
-      console.log("diffam", added, deleted, ams.value);
+      // console.log("diffam", added, deleted, ams.value);
       added.forEach(addAM);
     },
     { immediate: true, deep: true }

+ 1 - 0
vite.config.ts

@@ -65,6 +65,7 @@ const proxy = {
   }
 }
 
+console.log
 let app = "index";
 if (process.argv.length > 3) {
   app = process.argv[process.argv.length - 1].trim();