paleDriver7's picture
Upload 14 files
d85edb8 verified
<template>
<div class="login-container">
<h2>用户登录</h2>
<form @submit.prevent="submitForm">
<!-- 用户名/邮箱 -->
<div class="form-group">
<label for="username">用户名/邮箱:</label>
<input
type="text"
id="username"
v-model="username"
placeholder="请输入用户名或邮箱"
required
/>
</div>
<!-- 密码 -->
<div class="form-group">
<label for="password">密码:</label>
<input
type="password"
id="password"
v-model="password"
placeholder="请输入密码"
required
/>
</div>
<!-- 错误信息 -->
<div v-if="errorMessage" class="error-message">
{{ errorMessage }}
</div>
<!-- 登录按钮 -->
<div class="form-group">
<button type="submit">登录</button>
</div>
<div class="register-link">
<p>还没有账号?<router-link to="/register">注册</router-link></p>
</div>
</form>
</div>
</template>
<script>
export default {
data() {
return {
username: "",
password: "",
errorMessage: "",
};
},
methods: {
submitForm() {
// 简化后不再校验用户名和密码
this.errorMessage = "";
// 跳转到 DecisionList 页面
this.$router.push('/decision-list'); // 跳转到首页或者 DecisionList 页面
},
},
};
</script>
<style scoped>
/* 背景设计 */
body {
background: linear-gradient(to right, #6a11cb, #2575fc); /* 漸變背景 */
font-family: 'Arial', sans-serif;
}
/* 登录容器 */
.login-container {
max-width: 400px;
margin: 100px auto;
padding: 30px;
border-radius: 10px;
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
background-color: white;
text-align: center;
}
/* 标题 */
h2 {
font-size: 24px;
color: #333;
margin-bottom: 30px;
font-weight: 600;
}
/* 输入框容器 */
.form-group {
margin-bottom: 20px;
}
label {
font-size: 14px;
color: #555;
margin-bottom: 8px;
display: block;
font-weight: 500;
}
/* 输入框样式 */
input {
width: 100%;
padding: 12px;
font-size: 16px;
border: 1px solid #ccc;
border-radius: 6px;
margin-top: 5px;
box-sizing: border-box;
transition: all 0.3s ease;
}
/* 输入框聚焦样式 */
input:focus {
border-color: #2575fc;
box-shadow: 0 0 5px rgba(37, 117, 252, 0.5);
outline: none;
}
/* 按钮样式 */
button {
width: 100%;
padding: 12px;
font-size: 16px;
background-color: #2575fc;
color: white;
border: none;
border-radius: 6px;
cursor: pointer;
transition: all 0.3s ease;
}
button:hover {
background-color: #1d61d6;
transform: translateY(-2px);
}
/* 错误提示信息 */
.error-message {
color: red;
font-size: 14px;
margin-top: 10px;
}
/* 注册链接 */
.register-link {
margin-top: 20px;
}
.register-link a {
color: #2575fc;
font-size: 14px;
text-decoration: none;
font-weight: 500;
}
.register-link a:hover {
text-decoration: underline;
}
.profile-container {
display: flex;
}
.sidebar {
width: 250px;
padding: 20px;
background-color: #f4f4f4;
}
.profile-main {
flex-grow: 1;
padding: 20px;
}
.profile-header {
display: flex;
align-items: center;
margin-bottom: 20px;
}
.profile-header .avatar {
width: 50px;
height: 50px;
border-radius: 50%;
margin-right: 20px;
}
.logout-button {
margin-top: 20px;
}
.logout-button button {
padding: 10px 20px;
background-color: #ff4444;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}
.logout-button button:hover {
background-color: #ff0000;
}
</style>