From 375513370cc01fcd976987d07797249600b0bb3e Mon Sep 17 00:00:00 2001
From: 杨磊 <505174330@qq.com>
Date: 星期四, 07 八月 2025 17:15:09 +0800
Subject: [PATCH] 'first'

---
 src/views/login/adminLogin.vue |   80 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 80 insertions(+), 0 deletions(-)

diff --git a/src/views/login/adminLogin.vue b/src/views/login/adminLogin.vue
new file mode 100644
index 0000000..dfb58cf
--- /dev/null
+++ b/src/views/login/adminLogin.vue
@@ -0,0 +1,80 @@
+<template>
+  <div v-loading="loading" element-loading-text="姝e湪鐧诲綍"></div>
+</template>
+
+<script>
+export default {
+  data() {
+    return {
+      loading: true,
+    };
+  },
+  created() {
+    console.log(this.$route.query);
+    this.$store.dispatch("setToken", this.$route.query.token);
+    this.getUserInfo();
+  },
+  methods: {
+    getUserInfo(callback) {
+      this.MG.identity.getCurrentAppUser().then((res) => {
+        // 鐢ㄦ埛淇℃伅浼樺厛绾э細鏁欏笀璁よ瘉 > 寰俊 > 瀛︾敓锛堟敞鍐屾椂榛樿锛�
+        if (res) {
+          let teacherRole = res.roleLinks.find(
+            (item) => item.role.refCode == "teacher"
+          );
+          let teacherInfo = res.infoList.find(
+            (item) => item.type == "teacherInfo"
+          );
+          let wechatInfo = res.infoList.find((item) => item.type == "WeChat");
+          let studentInfo = res.infoList.find((item) => item.type == "Default");
+          let phoneInfo = res.secretList.find(
+            (item) => item.type == "MobilePhone"
+          );
+          if (teacherRole && teacherInfo) {
+            let data = {};
+            try {
+              data = JSON.parse(teacherInfo.data);
+            } catch (error) {
+              data = {};
+            }
+            this.$store.dispatch("setUserInfo", {
+              ...data,
+              name: data.fullName,
+              phoneNumber: phoneInfo?.credential,
+              role: "Teacher",
+              roleId: teacherRole.role.id,
+            });
+          } else if (wechatInfo) {
+            this.$store.dispatch("setUserInfo", {
+              ...wechatInfo,
+              phoneNumber: phoneInfo?.credential,
+              role: "Student",
+            });
+          } else if (studentInfo) {
+            this.$store.dispatch("setUserInfo", {
+              ...studentInfo,
+              phoneNumber: phoneInfo?.credential,
+              role: "Student",
+            });
+          }
+        }
+        // 娓呯┖鏈湴鍌ㄥ瓨鐨勭敵璇锋牱涔︽竻鍗�
+        this.$store.commit("emptyBookList");
+     
+        this.loading = false;
+        this.$router.push({
+          path: this.$route.query.url
+            ? decodeURIComponent(this.$route.query.url)
+            : "/home",
+        });
+      });
+    },
+  },
+};
+</script>
+<style lang="less" scoped>
+div {
+  margin: auto;
+  height: 100vh;
+}
+</style>

--
Gitblit v1.9.1