Browse Source

修改了单点登录登陆地址

duanxiaoduan 1 year ago
parent
commit
c51c432ed0
3 changed files with 31 additions and 3 deletions
  1. 0 0
      dist/index.html
  2. 11 1
      src/permission.js
  3. 20 2
      src/store/modules/user.js

File diff suppressed because it is too large
+ 0 - 0
dist/index.html


+ 11 - 1
src/permission.js

@@ -76,7 +76,17 @@ router.beforeEach(async(to, from, next) => {
       NProgress.done()
        // next({ path: '/login' })
       // 构建要跳转的URL
-       const externalURL = "https://id.xiandaimuye.com/api/v1/oauth2/authorize?response_type=code&client_id=fTBm64I4k3kqHYtoFTUpvirCDxxCfx7I&redirect_uri=http://tmrwatch.cn:8082/api/v1/oauth2/token";
+      // const url = window.location.protocol + "//"+window.location.host + '/'
+      // const url = 'http://192.168.61.41/'
+      // const url = 'http://tmrwatch.cn:8082/'
+      var url = process.env.VUE_APP_BASE_API
+      //获取当前url
+      
+      if(url.indexOf('/')==0 && url.length==1){
+        url= window.location.protocol + "//"+window.location.host+url
+      }
+      //        const externalURL = "https://id.xiandaimuye.com/api/v1/oauth2/authorize?response_type=code&client_id=fTBm64I4k3kqHYtoFTUpvirCDxxCfx7I&redirect_uri=http://tmrwatch.cn:8082/api/v1/oauth2/token";
+      const externalURL = "https://id.xiandaimuye.com/api/v1/oauth2/authorize?response_type=code&client_id=fTBm64I4k3kqHYtoFTUpvirCDxxCfx7I&redirect_uri="+url+'api/v1/oauth2/token';
       // 使用 $router.push 进行页面跳转
       // 注意: 这里的跳转是在当前窗口进行的,如果需要在新标签页打开,可以使用 window.open(externalURL)
       window.open(externalURL, "_self");

+ 20 - 2
src/store/modules/user.js

@@ -173,7 +173,16 @@ const actions = {
             removeToken()
             resetRouter()
             resolve()
-            const externalURL = "https://id.xiandaimuye.com/api/v1/logout?redirect_url=http://tmrwatch.cn:8082&client_id=fTBm64I4k3kqHYtoFTUpvirCDxxCfx7I";
+            // const url = process.env.VUE_APP_BASE_API
+            // const url = 'http://192.168.61.41/'
+            // const url = 'http://tmrwatch.cn:8082/'
+            var url = process.env.VUE_APP_BASE_API
+            //获取当前url
+
+            if(url.indexOf('/')==0 && url.length==1){
+              url= window.location.protocol + "//"+window.location.host+url
+            }
+            const externalURL = "https://id.xiandaimuye.com/api/v1/logout?redirect_url="+url+ '&client_id=fTBm64I4k3kqHYtoFTUpvirCDxxCfx7I';
             // 使用 $router.push 进行页面跳转
             // 注意: 这里的跳转是在当前窗口进行的,如果需要在新标签页打开,可以使用 window.open(externalURL)
             window.open(externalURL, "_self");
@@ -265,7 +274,16 @@ const actions = {
         removeToken()
         resetRouter()
         resolve()
-        const externalURL = "https://id.xiandaimuye.com/api/v1/logout?redirect_url=http://tmrwatch.cn:8082&client_id=fTBm64I4k3kqHYtoFTUpvirCDxxCfx7I";
+        // const url = process.env.VUE_APP_BASE_API
+        // const url = 'http://192.168.61.41/'
+        // const url = 'http://tmrwatch.cn:8082/'
+        var url = process.env.VUE_APP_BASE_API
+        //获取当前url
+        
+        if(url.indexOf('/')==0 && url.length==1){
+          url= window.location.protocol + "//"+window.location.host+url
+        }
+        const externalURL = "https://id.xiandaimuye.com/api/v1/logout?redirect_url=" + url + '&client_id=fTBm64I4k3kqHYtoFTUpvirCDxxCfx7I';
         // 使用 $router.push 进行页面跳转
         // 注意: 这里的跳转是在当前窗口进行的,如果需要在新标签页打开,可以使用 window.open(externalURL)
         window.open(externalURL, "_self");

Some files were not shown because too many files changed in this diff