Преглед изворни кода

登入跳转调整,通用接口取消鉴权

wy пре 11 месеци
родитељ
комит
4f9134d5bf

+ 13 - 7
src/business/platform/form/utils/custom/joinCURD.js

@@ -2,6 +2,8 @@ import request from '@/utils/request'
 import md5 from 'js-md5'
 import { requestType, requestPath } from './requestType'
 import { mapValues } from 'lodash'
+import { encryptByAes } from '@/utils/encrypt'
+import { SHOW_PLAINTEXT } from '@/constant'
 
 // 请求方式默认POST
 const post = (method, data, type = 'post', loading = false) => {
@@ -59,19 +61,23 @@ const dealData = (method, data) => {
     const strType = ['sql']
     // 查询方法直接拼接字符串
     if (strType.includes(method)) {
-        data = `{"${method}":"${data}"}`
+        data = {
+            sql: data.replace(/\n/g, ' ')
+        }
     } else {
         // 其余方法先处理数据
         if (typeof data === 'object') {
-            data = JSON.stringify(replaceNullWithEmpty(data))
+            data = replaceNullWithEmpty(data)
         } else {
-            data = JSON.stringify(replaceNullWithEmpty(JSON.parse(data)))
+            data = replaceNullWithEmpty(JSON.parse(data))
         }
     }
-    // 加密,获取md5密文
-    const md5 = sig(data)
-    // 结果拼接
-    return `${data.slice(0, 1)}"sig":"${md5}",${data.slice(1)}`
+    const plaintext = SHOW_PLAINTEXT ? { plaintext: data } : {}
+    const res = {
+        ciphertext: encryptByAes(data),
+        ...plaintext
+    }
+    return JSON.stringify(res)
 }
 
 export default post

+ 2 - 0
src/constant.js

@@ -82,3 +82,5 @@ export const ELEMENT_COLOR = __IBPS_CONFIG__.ELEMENT_COLOR || '#409EFF'
 export const SYSTEM_NAME =
     __IBPS_CONFIG__.SYSTEM_NAME || '金通检测/校准实验室质量管理系统(LQMS)'
 export const REPORT_PATH = __IBPS_CONFIG__.REPORT_PATH || ''
+// 是否显示明文SQL,开发环境默认显示
+export const SHOW_PLAINTEXT = __IBPS_CONFIG__.SHOW_PLAINTEXT || env.NODE_ENV === 'development'

+ 1 - 1
src/views/system/login/user-login.vue

@@ -399,7 +399,7 @@ export default {
                             loading.close();
                         });
                     } else {
-                        this.$router.replace('/dashboard');
+                        this.$router.replace('/');
                         setTimeout(() => {
                             this.loading = false;
                             loading.close();