소스 검색

Merge branch 'jobFair' of https://git.citupro.com/zhengnaiwen_citu/menduner into jobFair

Xiao_123 5 일 전
부모
커밋
a2d98c960e
4개의 변경된 파일13개의 추가작업 그리고 13개의 파일을 삭제
  1. 1 1
      src/config/axios/service.js
  2. 1 1
      src/store/system.js
  3. 10 0
      src/utils/index.js
  4. 1 11
      src/utils/openEncryption.js

+ 1 - 1
src/config/axios/service.js

@@ -127,7 +127,7 @@ service.interceptors.request.use(
         appId: 'web_client',
         AppSecret: 'fa0fc0b5098b974b',
         // timestamp: 1735282548997,
-        timestamp: new Date().getTime() + systemInfo.timeDifference,
+        timestamp: new Date().getTime() + (Number(systemInfo?.timeDifference) || 0),
       })
       const content = {
         data: config.data,

+ 1 - 1
src/store/system.js

@@ -11,7 +11,7 @@ export const useSystem = defineStore('system',
     })
 
     const setTimeDifference = (Difference) => {
-      systemInfo.value.timeDifference = Difference
+      systemInfo.value.timeDifference = Number(Difference) || 0
     }
 
     const getTimeDifference = () => {

+ 10 - 0
src/utils/index.js

@@ -140,3 +140,13 @@ export const removeEmptyProperties = (obj) => {
     Object.entries(obj).filter(([key, value]) => value !== null && value !== undefined && value !== '' && (Array.isArray(value) ? value.length > 0 : true))
   )
 }
+
+// 替换无效编码序列(解决 decodeURIComponent 报错 "URI malformed" 的问题)
+export const decodeURIComponentSafe = (str) => {
+  try {
+    return decodeURIComponent(str);
+  } catch (e) {
+    // 替换无效的百分号编码为空字符串
+    return decodeURIComponent(str.replace(/%(?![\da-f]{2})/gi, ''));
+  }
+}

+ 1 - 11
src/utils/openEncryption.js

@@ -12,6 +12,7 @@
 
 import { generateUUID } from "@/utils/index" 
 import { sha256 } from 'js-sha256'
+import { decodeURIComponentSafe } from '@/utils/index'
 
 /**
  * 
@@ -19,17 +20,6 @@ import { sha256 } from 'js-sha256'
  * @param { Object } body
  * @returns 
 */
-
-// 替换无效编码序列(解决 decodeURIComponent 报错 "URI malformed" 的问题)
-export const decodeURIComponentSafe = (str) => {
-  try {
-    return decodeURIComponent(str);
-  } catch (e) {
-    // 替换无效的百分号编码为空字符串
-    return decodeURIComponent(str.replace(/%(?![\da-f]{2})/gi, ''));
-  }
-}
-
 export const encryptionFun = ({raw, body, appId, AppSecret, timestamp}) => {
   const initSign = {
     appId,