From b90ada044a588a78292d87783fcd9a08e4b0a03f Mon Sep 17 00:00:00 2001 From: zhuo <2089219845@qq.com> Date: 星期二, 18 三月 2025 10:35:48 +0800 Subject: [PATCH] 单点登录完成 --- src/views/thirdpartylogin.vue | 22 ++++++++-------------- 1 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/views/thirdpartylogin.vue b/src/views/thirdpartylogin.vue index 692ce99..35f0931 100644 --- a/src/views/thirdpartylogin.vue +++ b/src/views/thirdpartylogin.vue @@ -5,25 +5,19 @@ export default { data() { return { - SSO: window.location.hash - } + code: null // 鐢ㄤ簬瀛樺偍鑾峰彇鍒扮殑 code 鍙傛暟 + }; }, created() { - this.initLogin() - console.log(this.SSO) + this.initLogin(); }, methods: { initLogin() { - const code = this.SSO.split('&')[0].split('=')[1] - console.log(code) - - if (code) { - this.$store.dispatch('LoginBySSO', code).then(() => { - this.$router.push({ path: '/' }) - }) - } + this.$store.dispatch('LoginBySSO', {code: this.$route.query.code}).then(() => { + this.$router.push({path: '/'}); + }); } } -} +}; </script> -<style scoped></style> +<style scoped></style> \ No newline at end of file -- Gitblit v1.9.3