text: import axios from 'axios';
  
  import nprogress from 'nprogress'
  /* 引用进度条和样式  start 开始 done 结束*/
  import 'nprogress/nprogress.css'
  
  function endLoading() {
      loading.close();
  }
  let loading;
  
  function startLoading() {
      loading = Vue.prototype.$loading({
          lock: true,
          text: "加载中...",
          background: "rgba(0, 0, 0, 0.8)"
      });
  }
  let needLoadingRequestCount = 0;
  
  function showFullScreenLoading() {
      if (needLoadingRequestCount === 0) {
          startLoading();
      }
      needLoadingRequestCount++;
  };
  
  function tryHideFullScreenLoading() {
      if (needLoadingRequestCount <= 0) return;
      needLoadingRequestCount--;
      if (needLoadingRequestCount === 0) {
          endLoading();
      }
  };
  
  /* 设置时间 */
  //在main.js设置全局的请求次数，请求的间隙
  axios.defaults.retry = 4;
  axios.defaults.retryDelay = 1000;
  axios.interceptors.response.use(undefined, function axiosRetryInterceptor(err) {
      var config = err.config;
      // If config does not exist or the retry option is not set, reject
      if (!config || !config.retry) return Promise.reject(err);
      // Set the variable for keeping track of the retry count
      config.__retryCount = config.__retryCount || 0;
      // Check if we've maxed out the total number of retries
      if (config.__retryCount >= config.retry) {
          // Reject with the error
          return Promise.reject(err);
      }
      // Increase the retry count
      config.__retryCount += 1;
      // Create new promise to handle exponential backoff
      var backoff = new Promise(function (resolve) {
          setTimeout(function () {
              resolve();
          }, config.retryDelay || 1);
      });
      // Return the promise in which recalls axios to retry the request
      return backoff.then(function () {
          return axios(config);
      });
  });
  
  
  
  
  export const requests = axios.create({
      // baseURL: process.env.NODE_ENV === "development" ? "/spring/user":'http://52.14.102.178:8071/spring/user',
      baseURL: process.env.VUE_APP_BASE_API,
      // baseURL:'http://52.14.102.178:8071/spring/user',
      /*  baseURL: process.env.NODE_ENV === "development" ? "http://52.14.102.178:8071/spring/user":'http://52.14.102.178:8071/spring/user/spring/user', */
      timeout: 25000,
  })
  
  //axios设置请求拦截器
  requests.interceptors.request.use(config => {
      debugger
      showFullScreenLoading();
      return config
  }, err => {
      console.log(err)
  })
  
  //axios设置响应拦截器
  requests.interceptors.response.use(response => {
      tryHideFullScreenLoading();
      nprogress.done()
      return response.data //拦截处理响应结果，直接返回需要的数据
  }, err => {
      console.log(err)
  })