zhanghua
2024-09-12 4d00f091ca662fcfc25e28af76f6ad38d8e53304
调整修改
1个文件已修改
35 ■■■■■ 已修改文件
src/views/login/index.vue 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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 => {