lxl
2022-11-07 c6a9b11ff0783bcd81a043a179fbc27f685eee70
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
 * @Description:
 * @Author: 王旭
 * @Date: 2021-11-09 15:41:39
 * @LastEditTime: 2022-05-17 09:48:18
 * @LastEditors: 王旭
 */
// 引入axios并配置
import axios from "axios";
 
// import store from "./store/index.js";
 
// 请求超时时间
// axios.defaults.timeout = 3000;
// 请求拦截器
// axios.interceptors.request.use(
//   function (config) {
//     store.commit("showLoading");
//     var token = window.sessionStorage.getItem("token");
//     config.headers["X-Access-Token"] = token;
//     return config;
//   },
//   function (error) {
//     store.commit("hideLoading");
//     return Promise.reject(error);
//   }
// );
 
//响应拦截器
// axios.interceptors.response.use(
//   (response) => {
//     store.commit("hideLoading");
//     return response;
//   },
//   (error) => {
//     store.commit("hideLoading");
//     return Promise.reject(error);
//   }
// );
// 给axios配置请求拦截器
// axios.interceptors.request.use(
//   function(config) {
//     var token = window.sessionStorage.getItem("userId");
//     config.headers.userId = token;
//     return config;
//   },
//   function(ereor) {
//     return Promise.reject(ereor);
//   }
// );
// 基准路径
// axios.defaults.withCredentials = true;
// axios.defaults.baseURL = "http://103.135.160.14:8932/jeecg-boot/";
 
// axios.defaults.baseURL = "http://103.85.165.98:10800/wh/jeecg-boot/";
// axios.defaults.baseURL = "http://192.168.20.53:8062/jeecg-boot/";
// axios.defaults.baseURL = `${baseUrl}/jeecg-boot/`;
// axios.defaults.baseURL = "http://192.168.11.116:8062/jeecg-boot/";
// axios.defaults.baseURL = "http://103.135.160.14:8062/jeecg-boot/";
export default axios;