|
|
|
@ -1,15 +1,15 @@
|
|
|
|
|
import axios from "axios";
|
|
|
|
|
import { Notification, MessageBox, Message, Loading } from "element-ui";
|
|
|
|
|
import {Notification, MessageBox, Message, Loading} from "element-ui";
|
|
|
|
|
import store from "@/store";
|
|
|
|
|
import { getAdminId, getToken } from "@/utils/auth";
|
|
|
|
|
import {getAdminId, getToken} from "@/utils/auth";
|
|
|
|
|
import errorCode from "@/utils/errorCode";
|
|
|
|
|
import { tansParams, blobValidate } from "@/utils/ruoyi";
|
|
|
|
|
import {tansParams, blobValidate} from "@/utils/ruoyi";
|
|
|
|
|
import cache from "@/plugins/cache";
|
|
|
|
|
import { saveAs } from "file-saver";
|
|
|
|
|
import {saveAs} from "file-saver";
|
|
|
|
|
|
|
|
|
|
let downloadLoadingInstance;
|
|
|
|
|
// 是否显示重新登录
|
|
|
|
|
export let isRelogin = { show: false };
|
|
|
|
|
export let isRelogin = {show: false};
|
|
|
|
|
|
|
|
|
|
axios.defaults.headers["Content-Type"] = "application/json;charset=utf-8";
|
|
|
|
|
// 对应国际化资源文件后缀
|
|
|
|
@ -32,6 +32,7 @@ service.interceptors.request.use(
|
|
|
|
|
if (getToken() && !isToken) {
|
|
|
|
|
// config.headers['ADMIN_TOKEN'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
|
|
|
|
|
config.headers = {
|
|
|
|
|
CLIENT_TYPE: "locWeb",
|
|
|
|
|
ADMIN_ID: getAdminId(),
|
|
|
|
|
ADMIN_TOKEN: getToken(),
|
|
|
|
|
};
|
|
|
|
@ -148,7 +149,7 @@ service.interceptors.response.use(
|
|
|
|
|
*/
|
|
|
|
|
(error) => {
|
|
|
|
|
console.log("err" + error);
|
|
|
|
|
let { message } = error;
|
|
|
|
|
let {message} = error;
|
|
|
|
|
if (message == "Network Error") {
|
|
|
|
|
message = "后端接口连接异常";
|
|
|
|
|
} else if (message.includes("timeout")) {
|
|
|
|
@ -179,7 +180,7 @@ export function download(url, params, filename) {
|
|
|
|
|
return tansParams(params);
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
|
|
|
headers: {"Content-Type": "application/x-www-form-urlencoded"},
|
|
|
|
|
responseType: "blob",
|
|
|
|
|
})
|
|
|
|
|
.then(async (data) => {
|
|
|
|
|