From 7993a0db6e5aac799c5fc703ca5c776da78e2933 Mon Sep 17 00:00:00 2001
From: 龚焕茏 <2842157468@qq.com>
Date: 星期四, 12 九月 2024 16:43:54 +0800
Subject: [PATCH] 跳转中间页

---
 src/views/login/index.vue   |   19 +------------------
 src/router/index.js         |    6 ++++++
 src/views/logging/index.vue |   32 ++++++++++++++++++++++++++++++++
 3 files changed, 39 insertions(+), 18 deletions(-)

diff --git a/src/router/index.js b/src/router/index.js
index b259f99..e3eb2c5 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -38,6 +38,12 @@
   },
 
   {
+    path: "/logging",
+    component: () => import("@/views/logging/index"),
+    hidden: true,
+  },
+
+  {
     path: "/404",
     component: () => import("@/views/404"),
     hidden: true,
diff --git a/src/views/logging/index.vue b/src/views/logging/index.vue
new file mode 100644
index 0000000..5763f57
--- /dev/null
+++ b/src/views/logging/index.vue
@@ -0,0 +1,32 @@
+<template>
+    <div>
+        鐧诲綍涓�︹��
+    </div>
+</template>
+
+<script>
+import { login } from "@/api/user";
+
+export default {
+    mounted() {
+        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");
+            });
+        },
+    }
+}
+</script>
+
+<style></style>
\ No newline at end of file
diff --git a/src/views/login/index.vue b/src/views/login/index.vue
index 9e8f838..e1f016d 100644
--- a/src/views/login/index.vue
+++ b/src/views/login/index.vue
@@ -17,7 +17,6 @@
 <script>
 import { validUsername } from "@/utils/validate";
 import wxlogin from "vue-wxlogin";
-import { login } from "@/api/user";
 export default {
     name: "Login",
     components: { wxlogin },
@@ -38,7 +37,7 @@
         };
         return {
             appid: "wx7103925df6236723",
-            redirect_uri: encodeURIComponent("https://dingdang.9village.cn/#/login"),
+            redirect_uri: encodeURIComponent("https://dingdang.9village.cn/#/logging"),
             state: "1",
             href: "data:text/css;base64,LmltcG93ZXJCb3ggLnFyY29kZSB7CiAgICAgICAgICBib3JkZXI6IG5vbmU7CiAgICAgICAgICB3aWR0aDogMTQwcHg7CiAgICAgICAgICBoZWlnaHQ6IDE0MHB4OwogICAgICAgIH0=", // 鑷畾涔夋牱寮忛摼鎺�
             loginForm: {
@@ -66,23 +65,7 @@
             immediate: true,
         },
     },
-    mounted() {
-      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");
-          });
-        },
         getWeChatUrl() {
             // api.wachatQrUrl().then(res => {
             //   if (res && res.code === '0000') {

--
Gitblit v1.8.0