|  |  | 
 |  |  | import pkg from '../../package' | 
 |  |  | import { trim } from './util' | 
 |  |  | import cache from '../plugins/cache' | 
 |  |  | import { Message } from 'element-ui' | 
 |  |  |  | 
 |  |  | axios.defaults.headers.common['Content-Type'] = 'application/json;charset=UTF-8' | 
 |  |  | const axiosInstance = axios.create({ | 
 |  |  | 
 |  |  |   // 未登录 | 
 |  |  |   if (response.data.code === 401) { | 
 |  |  |     if (response.config.autoLogin !== false) { | 
 |  |  |       window.location.href = process.env.VUE_APP_ROUTER_MODE === 'history' ? '/#/login' : '/login' | 
 |  |  |       window.location.href = process.env.VUE_APP_ROUTER_MODE === 'history' ? 'admin/#/login' : 'admin/login' | 
 |  |  |     } | 
 |  |  |     return Promise.reject(response.data) | 
 |  |  |   } | 
 |  |  |   // 业务失败 | 
 |  |  |   if (!response.data.success) { | 
 |  |  |     Message.error(response.data.message) | 
 |  |  |     return Promise.reject(response.data) | 
 |  |  |   } | 
 |  |  |   return response.data.data |