84 lines
1.8 KiB
Vue
84 lines
1.8 KiB
Vue
<script lang="ts" setup>
|
|
import {Login as LoginForm, UserName, Password, Submit, Message} from 'view-ui-plus';
|
|
import {onMounted} from "vue";
|
|
|
|
type LoginModel = {
|
|
username: string;
|
|
password: string;
|
|
}
|
|
//const emits = defineEmits(['loginSuccess'])
|
|
const emits = defineEmits<{
|
|
(e: 'loginSuccess'): void
|
|
}>()
|
|
const handleSubmit = (valid: true, params: LoginModel) => {
|
|
if (valid) {
|
|
if (params.username == 'admin' && params.password == 'admin') {
|
|
emits('loginSuccess')
|
|
} else {
|
|
Message.error('登录信息不正确')
|
|
}
|
|
}
|
|
}
|
|
|
|
</script>
|
|
<template>
|
|
<div class="mask"></div>
|
|
<div class="login-wrapper">
|
|
<div class="login-container">
|
|
<div class="logo">
|
|
<img src="../../assets/images/logo.png" alt="">
|
|
</div>
|
|
<p class="desc">营养与健康数据管理处理平台</p>
|
|
<LoginForm @on-submit="handleSubmit">
|
|
<UserName name="username" enterkeyhint/>
|
|
<Password name="password" enterkeyhint/>
|
|
<div class="submit">
|
|
<Submit/>
|
|
</div>
|
|
</LoginForm>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
<style scoped lang="scss">
|
|
.login-wrapper {
|
|
height: 100vh;
|
|
position: fixed;
|
|
inset: 0;
|
|
display: flex;
|
|
align-items: center;
|
|
text-align: center;
|
|
justify-content: center;
|
|
background: rgba(0, 0, 0, 0.1);
|
|
z-index: 101;
|
|
}
|
|
|
|
.logo {
|
|
img {
|
|
width: 200px;
|
|
}
|
|
|
|
margin-bottom: 10px;
|
|
}
|
|
|
|
.desc {
|
|
margin-bottom: 30px;
|
|
color: #ccc;
|
|
}
|
|
|
|
.submit {
|
|
margin-top: 50px;
|
|
}
|
|
|
|
.login-container {
|
|
width: 300px;
|
|
}
|
|
|
|
.mask {
|
|
position: fixed;
|
|
inset: 0;
|
|
background: url("https://bing.biturl.top/?resolution=1920&format=image&index=0&mkt=zh-CN") #fff;
|
|
z-index: 100;
|
|
filter: blur(5px);
|
|
}
|
|
</style>
|