|
|
|
@ -9,7 +9,10 @@
|
|
|
|
|
import axios from 'axios';
|
|
|
|
|
import qs from 'qs';
|
|
|
|
|
import router from "@/permission"
|
|
|
|
|
import { message} from 'ant-design-vue'
|
|
|
|
|
import {
|
|
|
|
|
message
|
|
|
|
|
} from 'ant-design-vue'
|
|
|
|
|
|
|
|
|
|
function filterRequestData(obj) {
|
|
|
|
|
let o = {};
|
|
|
|
|
for (let key in obj) {
|
|
|
|
@ -21,7 +24,7 @@ function filterRequestData(obj) {
|
|
|
|
|
}
|
|
|
|
|
return o;
|
|
|
|
|
}
|
|
|
|
|
axios.defaults.withCredentials = true;
|
|
|
|
|
// axios.defaults.withCredentials = true;
|
|
|
|
|
//创建axios的实例
|
|
|
|
|
const httpService = axios.create({
|
|
|
|
|
baseURL: 'http://cloud.sws010.com', // TODO:具体的配置可以根据项目情况而来
|
|
|
|
@ -35,7 +38,7 @@ httpService.interceptors.request.use(config => {
|
|
|
|
|
// if(localStorage.getItem('token')){//判断浏览器中的cookie中是否存在项目的token
|
|
|
|
|
// config.headers.token = localStorage.getItem('token')
|
|
|
|
|
// }\
|
|
|
|
|
// config.withCredentials = true;
|
|
|
|
|
config.withCredentials = true;
|
|
|
|
|
const rqParams = filterRequestData(config.params);
|
|
|
|
|
const rqData = filterRequestData(config.data);
|
|
|
|
|
// post 'Content-Type' === 'application/x-www-form-urlencoded'
|
|
|
|
@ -64,7 +67,12 @@ httpService.interceptors.response.use(response => {
|
|
|
|
|
data1 = res.Data1 || [];
|
|
|
|
|
msg = res.Msg || "";
|
|
|
|
|
totalNum = res.totalNum || 0;
|
|
|
|
|
return {data,data1, msg, totalNum};
|
|
|
|
|
return {
|
|
|
|
|
data,
|
|
|
|
|
data1,
|
|
|
|
|
msg,
|
|
|
|
|
totalNum
|
|
|
|
|
};
|
|
|
|
|
} else {
|
|
|
|
|
msg = res.Msg || "";
|
|
|
|
|
message.error(msg);
|
|
|
|
@ -88,5 +96,3 @@ httpService.interceptors.response.use(response => {
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
export default httpService
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|