|  | @@ -2,21 +2,21 @@ import axios from 'axios'
 | 
	
		
			
				|  |  |  import { MessageBox, Message } from 'element-ui'
 | 
	
		
			
				|  |  |  import store from '@/store'
 | 
	
		
			
				|  |  |  import { getToken } from '@/utils/auth'
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -//获取当前url
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -var aa = window.GLOBAL.SERVICE_URL
 | 
	
		
			
				|  |  | -// var aa = process.env.VUE_APP_BASE_API
 | 
	
		
			
				|  |  | -//获取当前url
 | 
	
		
			
				|  |  | -if(aa.indexOf('/')==0 && aa.length==1){
 | 
	
		
			
				|  |  | -  aa= window.location.protocol + "//"+window.location.host+aa
 | 
	
		
			
				|  |  | -}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +//获取当前url
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +//var aa = window.GLOBAL.SERVICE_URL
 | 
	
		
			
				|  |  | +var aa = process.env.VUE_APP_BASE_API
 | 
	
		
			
				|  |  | +//获取当前url
 | 
	
		
			
				|  |  | +if(aa.indexOf('/')==0 && aa.length==1){
 | 
	
		
			
				|  |  | +  aa= window.location.protocol + "//"+window.location.host+aa
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  |    const service = axios.create({
 | 
	
		
			
				|  |  | -    baseURL: aa, // url = base url + request url
 | 
	
		
			
				|  |  | -    withCredentials: true, // send cookies when cross-domain requests
 | 
	
		
			
				|  |  | -    timeout: 60000 ,// request timeout
 | 
	
		
			
				|  |  | -  })
 | 
	
		
			
				|  |  | -// request interceptor
 | 
	
		
			
				|  |  | +    baseURL: aa, // url = base url + request url
 | 
	
		
			
				|  |  | +    withCredentials: true, // send cookies when cross-domain requests
 | 
	
		
			
				|  |  | +    timeout: 60000 ,// request timeout
 | 
	
		
			
				|  |  | +  })
 | 
	
		
			
				|  |  | +// request interceptor
 | 
	
		
			
				|  |  |  service.interceptors.request.use(
 | 
	
		
			
				|  |  |    config => {
 | 
	
		
			
				|  |  |      // do something before request is sent
 | 
	
	
		
			
				|  | @@ -29,10 +29,10 @@ service.interceptors.request.use(
 | 
	
		
			
				|  |  |      if (store.getters.token) {
 | 
	
		
			
				|  |  |        if (process.env.VUE_APP_BASE_API === '/dev-api') {
 | 
	
		
			
				|  |  |          config.headers['X-Token'] = getToken()
 | 
	
		
			
				|  |  | -      } else {
 | 
	
		
			
				|  |  | +      } else {
 | 
	
		
			
				|  |  |          config.headers['Authorization'] = 'Bearer ' + getToken()
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |      return config
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    error => {
 | 
	
	
		
			
				|  | @@ -45,7 +45,7 @@ service.interceptors.request.use(
 | 
	
		
			
				|  |  |  // response interceptor
 | 
	
		
			
				|  |  |  service.interceptors.response.use(
 | 
	
		
			
				|  |  |    response => {
 | 
	
		
			
				|  |  | -    const res = response.data
 | 
	
		
			
				|  |  | +    const res = response.data
 | 
	
		
			
				|  |  |      // if the custom code is not 20000, it is judged as an error.
 | 
	
		
			
				|  |  |      if (res.code !== 200) {
 | 
	
		
			
				|  |  |        if (res.code === 10000 || res.code === 50012 || res.code === 50014) {
 | 
	
	
		
			
				|  | @@ -73,37 +73,37 @@ service.interceptors.response.use(
 | 
	
		
			
				|  |  |        return res
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  | -  error => {
 | 
	
		
			
				|  |  | -    if (error.response.data.code === 10000) {
 | 
	
		
			
				|  |  | -      MessageBox.confirm('你已经注销登陆,你可以取消或重新登陆', '确认注销', {
 | 
	
		
			
				|  |  | -        confirmButtonText: '重新登陆',
 | 
	
		
			
				|  |  | -        cancelButtonText: '取消',
 | 
	
		
			
				|  |  | -        type: 'warning'
 | 
	
		
			
				|  |  | -      }).then(() => {
 | 
	
		
			
				|  |  | -        store.dispatch('user/resetToken').then(() => {
 | 
	
		
			
				|  |  | -          location.reload()
 | 
	
		
			
				|  |  | -        })
 | 
	
		
			
				|  |  | -      })
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -    let config = error.config
 | 
	
		
			
				|  |  | -    if (!config) {
 | 
	
		
			
				|  |  | -      Message({ message: error.msg, type: 'error', duration: 5 * 1000 })
 | 
	
		
			
				|  |  | -      return Promise.reject(error)
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -    // 设置请求超时次数
 | 
	
		
			
				|  |  | -    // config.__retryCount = config.__retryCount || 0
 | 
	
		
			
				|  |  | -    // if (config.__retryCount >= 3) {
 | 
	
		
			
				|  |  | -    //   Message({ message:'操作失败'+error.response.data.errors[0], type: 'error', duration: 5 * 1000 })
 | 
	
		
			
				|  |  | -    //   return Promise.reject(error)
 | 
	
		
			
				|  |  | -    // }
 | 
	
		
			
				|  |  | -    // config.__retryCount += 1
 | 
	
		
			
				|  |  | -    // let backoff = new Promise((resolve) => {
 | 
	
		
			
				|  |  | -    //   setTimeout(() => {
 | 
	
		
			
				|  |  | -    //     resolve()
 | 
	
		
			
				|  |  | -    //   }, config.retryDelay || 1)
 | 
	
		
			
				|  |  | -    // })
 | 
	
		
			
				|  |  | -    // return backoff.then(() => {
 | 
	
		
			
				|  |  | -    //   return service(config)
 | 
	
		
			
				|  |  | +  error => {
 | 
	
		
			
				|  |  | +    if (error.response.data.code === 10000) {
 | 
	
		
			
				|  |  | +      MessageBox.confirm('你已经注销登陆,你可以取消或重新登陆', '确认注销', {
 | 
	
		
			
				|  |  | +        confirmButtonText: '重新登陆',
 | 
	
		
			
				|  |  | +        cancelButtonText: '取消',
 | 
	
		
			
				|  |  | +        type: 'warning'
 | 
	
		
			
				|  |  | +      }).then(() => {
 | 
	
		
			
				|  |  | +        store.dispatch('user/resetToken').then(() => {
 | 
	
		
			
				|  |  | +          location.reload()
 | 
	
		
			
				|  |  | +        })
 | 
	
		
			
				|  |  | +      })
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    let config = error.config
 | 
	
		
			
				|  |  | +    if (!config) {
 | 
	
		
			
				|  |  | +      Message({ message: error.msg, type: 'error', duration: 5 * 1000 })
 | 
	
		
			
				|  |  | +      return Promise.reject(error)
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    // 设置请求超时次数
 | 
	
		
			
				|  |  | +    // config.__retryCount = config.__retryCount || 0
 | 
	
		
			
				|  |  | +    // if (config.__retryCount >= 3) {
 | 
	
		
			
				|  |  | +    //   Message({ message:'操作失败'+error.response.data.errors[0], type: 'error', duration: 5 * 1000 })
 | 
	
		
			
				|  |  | +    //   return Promise.reject(error)
 | 
	
		
			
				|  |  | +    // }
 | 
	
		
			
				|  |  | +    // config.__retryCount += 1
 | 
	
		
			
				|  |  | +    // let backoff = new Promise((resolve) => {
 | 
	
		
			
				|  |  | +    //   setTimeout(() => {
 | 
	
		
			
				|  |  | +    //     resolve()
 | 
	
		
			
				|  |  | +    //   }, config.retryDelay || 1)
 | 
	
		
			
				|  |  | +    // })
 | 
	
		
			
				|  |  | +    // return backoff.then(() => {
 | 
	
		
			
				|  |  | +    //   return service(config)
 | 
	
		
			
				|  |  |      // })
 | 
	
		
			
				|  |  |      Message({
 | 
	
		
			
				|  |  |        message: "操作错误!"+error.response.data.errors[0],
 |