修改
This commit is contained in:
parent
8ea206dacb
commit
a66e7a218f
@ -40,6 +40,7 @@
|
||||
"axios": "0.24.0",
|
||||
"clipboard": "2.0.8",
|
||||
"core-js": "3.19.1",
|
||||
"crypto-js": "^4.2.0",
|
||||
"echarts": "4.9.0",
|
||||
"element-ui": "2.15.8",
|
||||
"file-saver": "2.0.5",
|
||||
|
||||
29
src/api/crypto.js
Normal file
29
src/api/crypto.js
Normal file
@ -0,0 +1,29 @@
|
||||
import CryptoJS from "crypto-js";
|
||||
const CRYPTOJSKEY = "60afL1G1b39c5Z27";
|
||||
function encrypt(plaintText) {
|
||||
var options = {
|
||||
mode: CryptoJS.mode.ECB,
|
||||
padding: CryptoJS.pad.Pkcs7
|
||||
};
|
||||
var key = CryptoJS.enc.Utf8.parse(CRYPTOJSKEY);
|
||||
var encryptedData = CryptoJS.AES.encrypt(plaintText, key, options);
|
||||
var encryptedBase64Str = encryptedData.toString().replace(/\//g, "_");
|
||||
encryptedBase64Str = encryptedBase64Str.replace(/\+/g, "-");
|
||||
return encryptedBase64Str;
|
||||
}
|
||||
|
||||
//解密
|
||||
function decrypt(encryptedBase64Str) {
|
||||
var vals = encryptedBase64Str.replace(/_/g, '/');
|
||||
var options = {
|
||||
mode: CryptoJS.mode.ECB,
|
||||
padding: CryptoJS.pad.Pkcs7
|
||||
};
|
||||
var key = CryptoJS.enc.Utf8.parse(CRYPTOJSKEY);
|
||||
var decryptedData = CryptoJS.AES.decrypt(vals, key, options);
|
||||
var decryptedStr = CryptoJS.enc.Utf8.stringify(decryptedData);
|
||||
return decryptedStr
|
||||
|
||||
}
|
||||
|
||||
export { encrypt, decrypt }
|
||||
@ -53,7 +53,7 @@ export function goodsCategory(query) {
|
||||
export function updateGoodsInfo(data) {
|
||||
return request({
|
||||
url: '/system/operateGoodInfo/edit',
|
||||
method: 'POST',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ export function addArea(data) {
|
||||
export function updateArea(data) {
|
||||
return request({
|
||||
url: '/system/area/edit',
|
||||
method: 'POST',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
@ -66,7 +66,7 @@ export function updateArea(data) {
|
||||
export function delArea(id) {
|
||||
return request({
|
||||
url: '/system/area/' + id,
|
||||
method: 'POST'
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
|
||||
@ -74,6 +74,6 @@ export function delArea(id) {
|
||||
export function updateRemoteSigns(id, remoteSigns) {
|
||||
return request({
|
||||
url: `/system/area/updateRemoteSigns?id=${id}&remoteSigns=${remoteSigns}`,
|
||||
method: 'POST'
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
@ -38,7 +38,7 @@ export function addGoodsCategory(data) {
|
||||
export function updateGoodsCategory(data) {
|
||||
return request({
|
||||
url: '/system/goodsCategory/edit',
|
||||
method: 'POST',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
@ -47,7 +47,7 @@ export function updateGoodsCategory(data) {
|
||||
export function delGoodsCategory(id) {
|
||||
return request({
|
||||
url: '/system/goodsCategory/' + id,
|
||||
method: 'POST'
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ export function addPoser(data) {
|
||||
export function getListByUser(query) {
|
||||
return request({
|
||||
url: '/system/station/list',
|
||||
method: 'GET',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
@ -71,6 +71,6 @@ export function delPoser(nurseStationId, moduleType, nurseItemId) {
|
||||
export function selectPosterImageJump() {
|
||||
return request({
|
||||
url: '/system/poser/selectPosterImageJump',
|
||||
method: 'GET',
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
@ -12,7 +12,7 @@ export function listTrainingCategory(query) {
|
||||
export function getCounty(data) {
|
||||
return request({
|
||||
url: '/applet/signinfo/getCounty',
|
||||
method: 'POST',
|
||||
method: 'post',
|
||||
data: data,
|
||||
headers: {
|
||||
region: 2,
|
||||
|
||||
@ -3,7 +3,7 @@ import request from '@/utils/request'
|
||||
export function getListByUser(query) {
|
||||
return request({
|
||||
url: '/system/station/list',
|
||||
method: 'GET',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
import axios from 'axios'
|
||||
import { Notification, MessageBox, Message, Loading } from 'element-ui'
|
||||
import { encrypt, decrypt } from "@/api/crypto";
|
||||
import store from '@/store'
|
||||
import { getToken } from '@/utils/auth'
|
||||
import errorCode from '@/utils/errorCode'
|
||||
@ -7,6 +8,8 @@ import { tansParams, blobValidate } from "@/utils/xinyilu";
|
||||
import cache from '@/plugins/cache'
|
||||
import { saveAs } from 'file-saver'
|
||||
|
||||
var witch = '1' //1加密 2不加密
|
||||
|
||||
let downloadLoadingInstance;
|
||||
// 是否显示重新登录
|
||||
export let isRelogin = { show: false };
|
||||
@ -22,6 +25,7 @@ const service = axios.create({
|
||||
|
||||
// request拦截器
|
||||
service.interceptors.request.use(config => {
|
||||
let configtwo = JSON.parse(JSON.stringify(config))
|
||||
// 是否需要设置 token
|
||||
const isToken = (config.headers || {}).isToken === false
|
||||
// 是否需要防止数据重复提交
|
||||
@ -59,14 +63,22 @@ service.interceptors.request.use(config => {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (witch == '1' && config.method == 'post' && config.url != "/logout" && config.url != '/system/station/updateNurseStationHeads') {
|
||||
config.data = encrypt(JSON.stringify(config.data))
|
||||
}
|
||||
console.log(configtwo)
|
||||
return config
|
||||
}, error => {
|
||||
console.log(error)
|
||||
Promise.reject(error)
|
||||
})
|
||||
|
||||
// 响应拦截器
|
||||
service.interceptors.response.use(res => {
|
||||
if (witch == '1' && res.config.url != "/logout" && res.config.url != "/getInfo" && res.config.url != '/system/station/updateNurseStationHeads') {
|
||||
res.data = decrypt(res.data)
|
||||
res.data = JSON.parse(res.data)
|
||||
}
|
||||
console.log(res.data)
|
||||
// 未设置状态码则默认成功状态
|
||||
const code = res.data.code || 200;
|
||||
// 获取错误信息
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -339,6 +339,7 @@ export default {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.log(formData)
|
||||
updateNurseStationHeads(formData).then(response => {
|
||||
if (response.code == 200) {
|
||||
this.options.img = process.env.VUE_APP_BASE_API + response.imgUrl;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user