Jelajahi Sumber

单点登录

cyy 10 bulan lalu
induk
melakukan
7f7c840a67
1 mengubah file dengan 13 tambahan dan 1 penghapusan
  1. 13 1
      src/views/system/login/index.vue

+ 13 - 1
src/views/system/login/index.vue

@@ -122,6 +122,18 @@ export default {
   },
 
   created() {
+    if (this.$router.currentRoute.query.hasOwnProperty('accessToken') && this.$router.currentRoute.query.hasOwnProperty('orgCode') && this.$router.currentRoute.query.hasOwnProperty('username')) {
+      console.log(this.$router.currentRoute.query)
+
+      this.loginForm.clientKey = '1001'
+      this.loginForm.token = this.$router.currentRoute.query.accessToken
+      this.loginForm.username = this.$router.currentRoute.query.username
+      this.loginForm.password = ''
+      this.loginForm.orgCode = this.$router.currentRoute.query.orgCode
+      console.log(this.loginForm)
+
+      this.handleLogin()
+    }
     this.isRegisterOpen()
     this.loadValidCode(true)
   },
@@ -212,7 +224,7 @@ export default {
     handleLogin() {
       // eslint-disable-next-line no-undef
       const params = structuredClone(this.loginForm)
-      params.password = encryptByAes(this.loginForm.password, 'pwd')
+      params.password = this.loginForm.password === '' ? '' : encryptByAes(this.loginForm.password, 'pwd')
       this.login({
         form: params
       }).then(() => {