ai创建登录页面

This commit is contained in:
2026-08-23 21:31:39 +08:00
parent f1236daf79
commit e0f5719072
2 changed files with 112 additions and 15 deletions
+111 -14
View File
@@ -1,8 +1,38 @@
<template> <template>
<div class="hello"> <main class="login-page">
<el-input placeholder="请输入用户名" v-model="username" clearable> </el-input> <section class="login-card">
<el-input placeholder="请输入密码" v-model="password" show-password></el-input> <p class="eyebrow">CHAT DEMO</p>
</div> <h1>欢迎回来</h1>
<p class="subtitle">登录后继续你的聊天</p>
<el-form class="login-form" @submit.native.prevent="handleLogin">
<el-form-item>
<el-input
v-model="username"
placeholder="请输入账号"
clearable
prefix-icon="el-icon-user"
></el-input>
</el-form-item>
<el-form-item>
<el-input
v-model="password"
placeholder="请输入密码"
show-password
prefix-icon="el-icon-lock"
></el-input>
</el-form-item>
<el-button class="login-button" type="primary" native-type="submit">
登录
</el-button>
</el-form>
<p class="register-tip">
还没有账号?
<router-link to="/register">立即注册</router-link>
</p>
</section>
</main>
</template> </template>
<script> <script>
@@ -13,23 +43,90 @@ export default {
username: '', username: '',
password: '' password: ''
} }
},
methods: {
handleLogin() {
// 登录接口接入后在这里提交账号和密码。
}
} }
}; };
</script> </script>
<style scoped> <style scoped>
h3 { .login-page {
margin: 40px 0 0; align-items: center;
background: #eef5f3;
background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.8), rgba(211, 235, 229, 0.75));
display: flex;
justify-content: center;
min-height: 100vh;
} }
ul {
list-style-type: none; .login-card {
padding: 0; background: #ffffff;
border: 1px solid rgba(35, 91, 80, 0.08);
border-radius: 8px;
box-shadow: 0 22px 55px rgba(35, 91, 80, 0.14);
max-width: 420px;
padding: 48px 44px 38px;
width: 100%;
} }
li {
display: inline-block; .eyebrow {
margin: 0 10px; color: #3e8b7a;
font-size: 12px;
font-weight: 700;
letter-spacing: 2px;
margin-bottom: 18px;
}
h1 {
color: #193b37;
font-size: 32px;
font-weight: 700;
line-height: 1.2;
}
.subtitle {
color: #82948f;
font-size: 14px;
margin: 12px 0 32px;
}
.login-form :deep(.el-form-item) {
margin-bottom: 18px;
}
.login-form :deep(.el-input__inner) {
border-color: #dce8e4;
border-radius: 4px;
height: 46px;
}
.login-button {
border: 0;
border-radius: 4px;
font-size: 15px;
height: 46px;
margin-top: 4px;
width: 100%;
}
.register-tip {
color: #82948f;
font-size: 13px;
margin: 26px 0 0;
text-align: center;
}
.register-tip a {
color: #2f806f;
font-weight: 600;
}
@media (max-width: 480px) {
.login-card {
padding: 36px 24px 30px;
} }
a {
color: #42b983;
} }
</style> </style>
+1 -1
View File
@@ -20,7 +20,7 @@ const routes = [
{ {
path: '/register', path: '/register',
name: 'RegisterPage', name: 'RegisterPage',
componenr: RegisterPage component: RegisterPage
}, },
{ {
path: '/index', path: '/index',