Parcourir la source

前端 request拦截器

pzc il y a 4 ans
Parent
commit
5a8f7488e7
3 fichiers modifiés avec 6 ajouts et 6 suppressions
  1. 1 1
      UI/src/pages/login/model.js
  2. 3 3
      UI/src/utils/config.js
  3. 2 2
      UI/src/utils/request.js

+ 1 - 1
UI/src/pages/login/model.js

@@ -20,7 +20,7 @@ export default {
         const data = yield call(login, payload)
         const { locationQuery } = yield select(_ => _.app)
         if (data.success) {
-          console.log(data);
+          //console.log(data);
           const user = decode(data.result.access_token);
           user.staffid = data.result.access_token;
           util.auth.setUser(user);

+ 3 - 3
UI/src/utils/config.js

@@ -7,9 +7,8 @@ const APIV3Auth = 'http://192.168.50.32:13001/oauth2'
 // const WXAPIV5= 'http://192.168.50.32:7000'
 // const WXMpAPI= 'http://192.168.50.32:13001/mpwechat'
 // const staticMpAPI = 'http://192.168.50.32:8081'
-const WXAPIV5= 'http://192.168.50.32:7000'
-const WXMpAPI= 'http://192.168.50.39:8081'
-// const WXMpAPI= 'http://192.168.10.68:8081'
+const WXAPIV5= 'http://localhost:7000'
+const WXMpAPI= 'http://localhost:8081'
 const staticMpAPI = 'http://192.168.50.39:8081'
 module.exports =  {
   name: '亮健营销平台',
@@ -35,6 +34,7 @@ module.exports =  {
   'http://localhost:8081',
   'http://192.168.50.32:8004',
   'http://localhost:8005',
+  'http://192.168.50.32:8005',
   'http://localhost:7000',  
   'http://192.168.50.32:7000',
   ],

+ 2 - 2
UI/src/utils/request.js

@@ -94,11 +94,11 @@ const fetch = (options) => {
     return response
   },
   error => {
-    if (!error.response) {
+    if (!error.response && error.request) {
       // util.auth.removeToken();
       // permission.clear();
 
-      // confirm('过期')
+      // confirm('接口出错或者登陆过期');
       // // router.push('/login');
       // router.replace({
       //   path: '/login'