ArvinQi 7 лет назад
Родитель
Сommit
8ea3df933d
1 измененных файлов с 6 добавлено и 4 удалено
  1. 6 4
      plugins/nuxtAxios.js

+ 6 - 4
plugins/nuxtAxios.js

@@ -40,8 +40,9 @@ export default function ({ $axios, redirect, req, ...args }) {
         const data = res.data;
         // 不跳转到login的页面reg list
         const excludePath = ['/user/register', '/cert/type/:id', '/type/vip/', '/cert/', '/user/:id'];
+        const includePath = ['/user/register', '/cert/type/:id', '/type/vip/', '/cert/', '/user/:id'];
         const needLogin = path => {
-            let result = true;
+            let result = false;
             excludePath.forEach(reg => {
                 reg = reg.replace(/:id/, '');
                 if (RegExp(reg).test(path)) {
@@ -54,9 +55,10 @@ export default function ({ $axios, redirect, req, ...args }) {
         if(data.status === 1) {
             return res;
         } else if(data.status === -99) {
-            if (req && req.url && needLogin(req.url)) {
-                redirect('/?loginbox=show');
-            }
+            console.log(req && req.url)
+            // if (req && req.url && needLogin(req.url)) {
+            //     redirect('/?loginbox=show');
+            // }
             return res;
         } else {
             Vue.prototype.$message.error(data.info);