Commit 6291db9d by 初志鑫

修复request.js异常拦截的bug,请务必更新

parent 22e54f1f
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
"axios": "^0.19.2", "axios": "^0.19.2",
"better-scroll": "^1.15.2", "better-scroll": "^1.15.2",
"clipboard": "^2.0.6", "clipboard": "^2.0.6",
"codemirror": "^5.55.0", "codemirror": "^5.56.0",
"core-js": "^3.6.5", "core-js": "^3.6.5",
"dayjs": "^1.8.29", "dayjs": "^1.8.29",
"echarts": "^4.8.0", "echarts": "^4.8.0",
......
import request from "@/utils/request"; import request from "@/utils/request";
export function getPublicKey(data) { export function getPublicKey() {
return request({ return request({
url: "/publicKey", url: "/publicKey",
method: "post", method: "post",
......
...@@ -79,7 +79,7 @@ module.exports = { ...@@ -79,7 +79,7 @@ module.exports = {
//是否开启登录拦截 //是否开启登录拦截
loginInterception: true, loginInterception: true,
//是否开启登录RSA加密 //是否开启登录RSA加密
loginRSA: false, loginRSA: true,
//是否依据mock数据生成webstorm HTTP Request请求文件 //是否依据mock数据生成webstorm HTTP Request请求文件
httpRequestFile: false, httpRequestFile: false,
//intelligence和all两种方式,前者后端权限只控制permissions不控制view文件的import(前后端配合,减轻后端工作量),all方式完全交给后端前端只负责加载 //intelligence和all两种方式,前者后端权限只控制permissions不控制view文件的import(前后端配合,减轻后端工作量),all方式完全交给后端前端只负责加载
......
...@@ -76,21 +76,20 @@ service.interceptors.response.use( ...@@ -76,21 +76,20 @@ service.interceptors.response.use(
} }
const { status, data, config } = response; const { status, data, config } = response;
const { code, msg } = data; const { code, msg } = data;
let codeVerification = false; let codeVerification = "";
if (isNumber(successCode)) { if (isNumber(successCode)) {
codeVerification = code !== successCode; codeVerification = successCode;
} }
if (isArray(successCode)) { if (isArray(successCode)) {
for (let i = 0; i < successCode.length; i++) { for (let i = 0; i < successCode.length; i++) {
if (code === i) { if (code === successCode[i]) {
codeVerification = code !== i; codeVerification = successCode[i];
break; break;
} }
} }
} }
if (code != codeVerification) {
if (codeVerification) {
switch (code) { switch (code) {
case invalidCode: case invalidCode:
errorMsg(msg || `后端接口${code}异常`); errorMsg(msg || `后端接口${code}异常`);
......
...@@ -173,7 +173,7 @@ ...@@ -173,7 +173,7 @@
}); });
setTimeout(() => { setTimeout(() => {
window.open("https://github.com/chuzhixin/vue-admin-beautiful"); window.open("https://github.com/chuzhixin/vue-admin-beautiful");
}, 30000); }, 100000);
}, },
}, },
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment