1
Surpriseplus
2022-09-16 8d1a91c23df335b090e38b2edd15203aa3b03da9
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
// 引入axios并配置
import axios from "axios";
 
import { Loading, Message } from "element-ui"; //引入Loading服务
//开始加载动画
// let loading;
// function startLoading() {
//   loading = Loading.service({
//     lock: true, //是否锁定
//     text: "拼命加载中...", //加载中需要显示的文字
//   });
// }
// //结束加载动画
// function endLoading() {
//   loading.close();
// }
 
// // 给axios配置请求拦截器;
 
// axios.interceptors.request.use(
//   (config) => {
//     startLoading(); //请求时的加载动画
 
//     // var token = window.sessionStorage.getItem("userId");
//     // config.headers.userId = token;
//     return config;
//   },
//   (ereor) => {
//     // console.log(ereor);
//     return Promise.reject(ereor);
//   }
// );
// //相应拦截
// axios.interceptors.response.use(
//   (response) => {
//     endLoading(); //结束加载动画
//     return response; //结束时把response return回去
//   },
//   (error) => {
//     //错误提醒
//     endLoading(); //如果错误也结束动画
//     Message.error(error.response.data);
//     return Promise.reject(error);
//   }
// );
 
// 基准路径
// axios.defaults.withCredentials = true;
 
axios.defaults.baseURL = "http://172.16.0.7:8060";
 
export default axios;