| | |
| | | let loadingInstance =null; |
| | | // HTTPrequest拦截 |
| | | axios.interceptors.request.use(config => { |
| | | NProgress.start() // start progress bar |
| | | /*NProgress.start() // start progress bar |
| | | loadingInstance = Loading.service({ |
| | | lock: true, |
| | | text: '', |
| | | spinner: 'el-icon-loading', |
| | | background: 'rgba(0, 0, 0, 0)' |
| | | }); |
| | | background: 'rgba(255, 0, 0, 0)' |
| | | });*/ |
| | | const TENANT_ID = getStore({ name: 'tenantId' }) |
| | | const isToken = (config.headers || {}).isToken === false |
| | | const token = store.getters.access_token |
| | | const token = window.android.getAppToken() |
| | | // const token = `dd271fdb-4b69-4eb3-a940-52d70232e56b` |
| | | if (token && !isToken) { |
| | | config.headers['Authorization'] = 'Bearer ' + token// token |
| | | config.headers['Authorization'] = 'bearer ' + token// token |
| | | } |
| | | if (TENANT_ID) { |
| | | config.headers['TENANT-ID'] = TENANT_ID // 租户ID |
| | |
| | | |
| | | // HTTPresponse拦截 |
| | | axios.interceptors.response.use(res => { |
| | | NProgress.done() |
| | | loadingInstance.close(); |
| | | // NProgress.done() |
| | | // loadingInstance.close(); |
| | | const status = Number(res.status) || 200 |
| | | const message = res.data.msg || errorCode[status] || errorCode['default'] |
| | | /* if (status === 401) { |