1
0

2 Ревизии 7cfb1d0a56 ... 1a39530977

Автор SHA1 Съобщение Дата
  lifanagju_citu 1a39530977 Merge branch 'jobFair' of https://git.citupro.com/zhengnaiwen_citu/menduner into jobFair преди 5 дни
  lifanagju_citu 199d3e3b7b decodeURIComponentSafe使用utils中的方法 преди 5 дни
променени са 2 файла, в които са добавени 11 реда и са изтрити 11 реда
  1. 10 0
      src/utils/index.js
  2. 1 11
      src/utils/openEncryption.js

+ 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,