zhanghua
2024-09-12 aeb2269b65863fcda25f13937a01a7ff3237ee50
src/layout/index.vue
@@ -14,6 +14,7 @@
<script>
import { Navbar, Sidebar, AppMain } from './components'
import ResizeMixin from './mixin/ResizeHandler'
import { login } from "@/api/user";
export default {
  name: 'Layout',
@@ -42,7 +43,24 @@
      }
    }
  },
  mounted() {
    // 获取地址栏code
    let code = this.$route.query.code;
    if (code) {
      this.getUserDate(code);
    }
    //  else {
    //     this.$router.push("/login");
    // }
  },
  methods: {
    getUserDate(code) {
      login({
        code: code,
      }).then((res) => {
        localStorage.setItem("user", JSON.stringify(res));
      });
    },
    handleClickOutside() {
      this.$store.dispatch('app/closeSideBar', { withoutAnimation: false })
    }