seimin 1 gadu atpakaļ
vecāks
revīzija
584efd3c74
2 mainītis faili ar 8 papildinājumiem un 22 dzēšanām
  1. 7 21
      src/http/index.js
  2. 1 1
      src/router/index.js

+ 7 - 21
src/http/index.js

@@ -10,28 +10,14 @@ axios.defaults.baseURL = protocolName + '//' + domainName;
10 10
 Vue.prototype.$http = axios
11 11
 Vue.prototype.$host = protocolName + '//' + domainName
12 12
 //http response 拦截器
13
-axios.interceptors.response.use(
14
-  response => {
15
-    return response;
16
-  },
17
-  async (error) => {
18
-    let err = error.response;
19
-    console.log(err);
20
-    if (404 === error.response.status && err.request.responseURL.includes('index.html')) {
21
-      let res1 = await getLoginType();
22
-      let loginConfig = localStorage.getItem('loginConfig');
23
-      if (res1.status == 200 && res1.data.status == 200 && res1.data.data == 'web' && loginConfig) {
24
-        let { username, password } = JSON.parse(loginConfig);
25
-        let res2 = await zlogin({ username, password });
26
-        if (res2.status == 200 && res2.data.state == 200) {
27
-          location.reload();
28
-        }
29
-      }
30
-    } else {
31
-      return Promise.reject(error);
32
-    }
13
+axios.interceptors.response.use(function (response) {
14
+  return response;
15
+}, function (error) {
16
+  if(error && error.response && error.response.status == 444){
17
+    window.location.href = location.origin + '/req.jsp';
33 18
   }
34
-);
19
+  return Promise.reject(error);
20
+});
35 21
 // 获取报修人登录方式
36 22
 function getLoginType() {
37 23
   return axios.post("service/wechat/getLoginType", {});

+ 1 - 1
src/router/index.js

@@ -145,7 +145,7 @@ export default new Router({
145 145
     {
146 146
       path: '*',
147 147
       hidden: true,
148
-      redirect: { path: '/login' }
148
+      redirect: { path: '/' }
149 149
     }
150 150
   ]
151 151
 })