登录页添加以及路由权限添加
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
<template>
|
||||
<div>404</div>
|
||||
</template>
|
||||
@@ -1,12 +1,95 @@
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import router from '@/router'
|
||||
|
||||
const btnLoading = ref(false)
|
||||
const formData = ref({
|
||||
username: '',
|
||||
password: '',
|
||||
})
|
||||
|
||||
// 登录提交
|
||||
const onSubmit = (values) => {
|
||||
btnLoading.value = true;
|
||||
console.log(values);
|
||||
setTimeout(() => {
|
||||
btnLoading.value = false;
|
||||
router.push({ path: '/applyList' });
|
||||
}, 1000);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="login">login</div>
|
||||
<div class="main">
|
||||
<div class="box">
|
||||
<div class="logo">
|
||||
<img src="/public/logo.png" alt="">
|
||||
<p class="login">登录</p>
|
||||
</div>
|
||||
<van-form @submit="onSubmit" size="small" label-width="1.2rem">
|
||||
<van-cell-group inset>
|
||||
<van-field
|
||||
v-model="formData.username"
|
||||
name="username"
|
||||
label="用户名"
|
||||
placeholder="请输入用户名"
|
||||
:rules="[{ required: true, message: '请输入用户名' }]"
|
||||
/>
|
||||
<van-field
|
||||
v-model="formData.password"
|
||||
type="password"
|
||||
name="password"
|
||||
label="密码"
|
||||
placeholder="请输入密码"
|
||||
:rules="[{ required: true, message: '请输入密码' }]"
|
||||
/>
|
||||
</van-cell-group>
|
||||
<van-button class="btn" :loading="btnLoading" round block size="small" type="primary" native-type="submit">登录</van-button>
|
||||
</van-form>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
:deep(.van-cell-group--inset) {
|
||||
margin: 0;
|
||||
}
|
||||
.main {
|
||||
width: 100%;
|
||||
min-height: 100vh;
|
||||
height: 100%;
|
||||
background: linear-gradient(to bottom, #3d59aa, #4d76c1, #64a1e1);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 10px;
|
||||
}
|
||||
.box {
|
||||
width: 80%;
|
||||
background: #fff;
|
||||
border-radius: 8px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 20px 12px
|
||||
}
|
||||
.logo {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.logo img {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
.login {
|
||||
font-size: 14px;
|
||||
font-size: 20px;
|
||||
}
|
||||
.btn {
|
||||
margin-top: 10px;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user