SM2接口传输加密

dengbao
anthonywj 1 year ago
parent 403782abf4
commit 4387ff34c7

@ -22,7 +22,8 @@ ENV = 'production'
# 刘恩典
# VUE_APP_BASE_API = 'http://192.168.0.117:9150/UDI_SPMS_SERVER/'
# VUE_APP_BASE_API = 'http://192.168.0.117:9160/UDI_SPMS_SERVER/'
# VUE_APP_BASE_API = 'http://192.168.0.188:9150/UDI_SPMS_SERVER/'
# VUE_APP_BASE_API = 'http://192.168.0.127:9170/UDI_SPMS_SERVER/'
# 漳州中医院
@ -32,7 +33,7 @@ ENV = 'production'
# VUE_APP_BASE_API = 'http://121.36.152.129:9150/UDI_SPMS_SERVER/'
# 长泰医院
VUE_APP_BASE_API = 'http://139.159.247.26:9150/UDI_SPMS_SERVER/'
# VUE_APP_BASE_API = 'http://139.159.247.26:9150/UDI_SPMS_SERVER/'
# VUE_APP_BASE_API = 'http://192.168.0.139:9150/UDI_SPMS_SERVER/'
# VUE_APP_BASE_API = 'http://dm.xmglxp.com:8081/UDI_SPMS_SERVER/'
@ -55,10 +56,10 @@ VUE_APP_BASE_API = 'http://139.159.247.26:9150/UDI_SPMS_SERVER/'
# 应用访问路径 例如使用前缀 /admin/
# 域名
VUE_APP_CONTEXT_PATH = '/'
# VUE_APP_CONTEXT_PATH = '/'
# 其他
# VUE_APP_CONTEXT_PATH = '/UDI_SPMS_CLIENT/'
VUE_APP_CONTEXT_PATH = '/UDI_SPMS_CLIENT/'
# 监控地址
VUE_APP_MONITRO_ADMIN = '/admin/login'

@ -56,6 +56,7 @@
"qrcodejs2": "^0.0.2",
"quill": "1.3.7",
"screenfull": "5.0.2",
"sm-crypto": "^0.3.13",
"sortablejs": "1.10.2",
"tinymce": "^6.6.2",
"vue": "2.6.12",

@ -7,6 +7,7 @@ import {tansParams, blobValidate} from "@/utils/ruoyi";
import cache from '@/plugins/cache'
import {saveAs} from 'file-saver'
import Cookies from 'js-cookie'
import {sm2} from 'sm-crypto';
let downloadLoadingInstance;
// 是否显示重新登录
@ -48,9 +49,17 @@ service.interceptors.request.use(config => {
config.url = url;
}
if (!isRepeatSubmit && (config.method === 'post' || config.method === 'put')) {
let postDatas = typeof config.data === 'object' ? JSON.stringify(config.data) : config.data;
let encryptData = sm2.doEncrypt(postDatas, '04d29a3c33b87e3c919958679dfc2b086bd65dede3ecceaca1f8d98644efc89afb2e419120b791acfaeba8ab0549aee03e57755d784a56d4c5ebaabe25298423fd');
if (encryptData != null) {
postDatas = encryptData
config.data = {
data: encryptData
}
}
const requestObj = {
url: config.url,
data: typeof config.data === 'object' ? JSON.stringify(config.data) : config.data,
data: encryptData,
time: new Date().getTime()
}
const sessionObj = cache.session.getJSON('sessionObj')
@ -105,7 +114,7 @@ service.interceptors.response.use(res => {
});
}
return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
}else {
} else {
return res.data
}
},

Loading…
Cancel
Save