浏览代码

预改:拼接参数encodeURIComponent编码之后再给后端

lifanagju_citu 4 月之前
父节点
当前提交
a65ad043d7
共有 4 个文件被更改,包括 11 次插入1 次删除
  1. 0 1
      components.d.ts
  2. 8 0
      src/api/position.js
  3. 2 0
      src/config/axios/service.js
  4. 1 0
      src/utils/openEncryption.js

+ 0 - 1
components.d.ts

@@ -29,7 +29,6 @@ declare module 'vue' {
     CtTextField: typeof import('./src/components/CtVuetify/CtTextField/index.vue')['default']
     DatePicker: typeof import('./src/components/DatePicker/index.vue')['default']
     Echarts: typeof import('./src/components/Echarts/index.vue')['default']
-    ElCascader: typeof import('element-plus/es')['ElCascader']
     ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider']
     Empty: typeof import('./src/components/Empty/index.vue')['default']
     File: typeof import('./src/components/Upload/file.vue')['default']

+ 8 - 0
src/api/position.js

@@ -218,6 +218,14 @@ export const refreshJobAdvertised = async (ids) => {
     openEncryption: true
   })
 }
+// // 招聘端-刷新职位
+// export const refreshJobAdvertised = async (ids) => {
+//   return await request.post({
+//     url: `/app-api/menduner/system/recruit/job-advertised/refresh?${encodeURIComponent('ids='+ids)}`,
+//     encodeParams: true,
+//     openEncryption: true
+//   })
+// }
 
 // 招聘端-开启职位
 export const enableJobAdvertised = async (ids) => {

+ 2 - 0
src/config/axios/service.js

@@ -106,6 +106,7 @@ service.interceptors.request.use(
     // 开启参数加密
     if (config.openEncryption) {
       const raw = config.url.split('?')[1]
+      // const raw = config.encodeParams ? config.url.split('?')[1] : config.url.split('?')[1]
       const body = {
         ...config.data,
         ...config.params
@@ -130,6 +131,7 @@ service.interceptors.request.use(
         content
       })
       Object.assign(config.headers, header)
+      // if (config.encodeParams) config.url = config.url.split('?')[0] + '?' + decodeURIComponent(config.url.split('?')[1])
     }
     
     if (isToken) {

+ 1 - 0
src/utils/openEncryption.js

@@ -35,6 +35,7 @@ export const encryptionFun = ({raw, body, appId, AppSecret}) => {
     str += decodeURIComponent(JSON.stringify(body))
   }
   // console.log('str:', str, 'paramsStr:', paramsStr)
+  // console.log(sha256(str + paramsStr))
   return {
     ...initSign,
     sign: sha256(str + paramsStr)