sunlupeng 1 рік тому
батько
коміт
ba252a9b08
2 змінених файлів з 12 додано та 10 видалено
  1. 1 1
      src/api/login.js
  2. 11 9
      src/permission.js

+ 1 - 1
src/api/login.js

@@ -5,7 +5,7 @@ import service from '@/utils/request'
 // DD第三方-授权登录
 export function authLogin(data) {
   return request({
-    url: '/auth/ding/authLogin',
+    url: '/system/auth/ding/authLogin',
     method: 'post',
     data: data
   })

+ 11 - 9
src/permission.js

@@ -129,7 +129,7 @@ router.beforeEach((to, from, next) => {
             }).then((res) => {
               // 处理返回数据
               console.log("统一授权套件SDK==res=", res);
-              authLogin({ code: res.result.authCode, corpId: corpId })
+              authLogin({ code: res.result.authCode, corpId: corpId.corpId })
                 .then((res) => {
                   debugger
                   console.log("===登录授权=", res);
@@ -144,15 +144,17 @@ router.beforeEach((to, from, next) => {
             });
           });
         });
+      }else{
+        if (whiteList.indexOf(to.path) !== -1) {
+          // 在免登录白名单,直接进入
+          next()
+        } else {
+          const redirect = encodeURIComponent(to.fullPath) // 编码 URI,保证参数跳转回去后,可以继续带上
+          next(`/login?redirect=${redirect}`) // 否则全部重定向到登录页
+          NProgress.done()
+        }
       }
-    // if (whiteList.indexOf(to.path) !== -1) {
-    //   // 在免登录白名单,直接进入
-    //   next()
-    // } else {
-    //   const redirect = encodeURIComponent(to.fullPath) // 编码 URI,保证参数跳转回去后,可以继续带上
-    //   next(`/login?redirect=${redirect}`) // 否则全部重定向到登录页
-    //   NProgress.done()
-    // }
+   
   }
 })