接口监听 跳转login
import http from './modules/api/http';Vue.prototype.$axios = http;Vue.http.interceptors.push((request, next) => { if (request.method === 'GET') { request.headers.map["If-Modified-Since"] = ["0"]; //IEget缓存解决 } clearTimeout(loadingTimer); loadingTimer = setTimeout(() => { vm.$Loading.start(); }, 300); next((response) => { if (loadingTimer) { clearTimeout(loadingTimer); loadingTimer = null; } vm.$Loading.finish(); if (response.status === 401) { router.push('/login'); //没有权限弹出去 } if (String(response.status)[0] === '5') {//非本地测试敞开 // if( /(127.0.0.1)/.test(window.location.href) ){ // alert('服务器外部谬误'); //服务器外部谬误 // }; } });}