基于vue3.0和element-plus的组件库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.2 KiB

2 years ago
<template>
<div class="login">
<LoginForm @login="login">
</LoginForm>
</div>
</template>
<script lang="ts" setup>
import { onBeforeMount, reactive, ref } from "vue";
import { useStore } from "vuex";
import { useRouter } from "vue-router";
import md5 from "js-md5";
import { Api, LoginForm } from "noob-mengyxu";
const { state, commit } = useStore();
const router = useRouter();
onBeforeMount(() => {
state.size.headHeight = '0px';
state.size.asideWidth = '0px';
commit("initSize");
});
const login = user => {
const param = JSON.parse(JSON.stringify(user));
param.password = md5(param.password);
Api.pub.login(param).then(rsp => {
if (rsp) {
state.size.headHeight = state.size.head + 'px';
state.size.asideWidth = state.size.aside + 'px';
commit("initSize");
router.push('/')
}
})
};
</script>
<style lang='scss' scoped>
//@import url(); 引入公共css类
.login {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.canvas {
position: fixed;
z-index: -1; // background-color: black;
}
.logo {
width: 300px;
height: 90px;
}
</style>