File size: 4,046 Bytes
d85edb8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 |
<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>
|