From 4d00f091ca662fcfc25e28af76f6ad38d8e53304 Mon Sep 17 00:00:00 2001
From: zhanghua <314079846@qq.com>
Date: 星期四, 12 九月 2024 16:57:34 +0800
Subject: [PATCH] 调整修改
---
src/views/login/index.vue | 35 ++++++++++++++++++++++-------------
1 files changed, 22 insertions(+), 13 deletions(-)
diff --git a/src/views/login/index.vue b/src/views/login/index.vue
index 9e8f838..10ac0b8 100644
--- a/src/views/login/index.vue
+++ b/src/views/login/index.vue
@@ -66,22 +66,31 @@
immediate: true,
},
},
+ beforeRouteUpdate(route, from, next) {
+ this.redirect = route.query && route.query.redirect;
+ let code = route.query.code;
+ if (code) {
+ this.getUserDate(code);
+ } else {
+ this.getWeChatUrl();
+ }
+ },
mounted() {
- let code = this.$route.query.code;
- if (code) {
- this.getUserDate(code);
- } else {
- this.getWeChatUrl();
- }
+ let code = this.$route.query.code;
+ if (code) {
+ this.getUserDate(code);
+ } else {
+ this.getWeChatUrl();
+ }
},
methods: {
- getUserDate(code) {
- login({
- code: code,
- }).then((res) => {
- localStorage.setItem("user", JSON.stringify(res));
- this.$router.push("/student");
- });
+ getUserDate(code) {
+ login({
+ code: code,
+ }).then((res) => {
+ localStorage.setItem("user", JSON.stringify(res));
+ this.$router.push("/student");
+ });
},
getWeChatUrl() {
// api.wachatQrUrl().then(res => {
--
Gitblit v1.8.0