登录页面设计

1234546576878

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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<link
href="https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css"
rel="stylesheet"
/>
</head>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: "Poppins" sans-serif;
}
body {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background: url("https://cdn.jsdelivr.net/gh/8023time/image-storage-address/img/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20241016221935.png")
no-repeat;
background-size: cover;
background-position: center;
}
.wrapper {
width: 420px;
background-color: transparent;
border: 2px solid rgba(255, 255, 255, 0.2);
backdrop-filter: blur(20px);
color: #fff;
border-radius: 10px;
padding: 30px 40px;
}
.wrapper h1 {
font-size: 36px;
text-align: center;
}
.wrapper .input-box {
position: relative;
width: 100%;
height: 50px;
margin: 30px 0;
}
.input-box input {
width: 100%;
height: 100%;
background: transparent;
border: none;
outline: none;
border: 2px solid rgba(255, 255, 255, 0.2);
border-radius: 40px;
font-size: 16px;
color: #fff;
padding: 20px 45px 20px 20px;
}
.input-box input::placeholder {
color: #fff;
}
.input-box i {
position: absolute;
right: 20px;
top: 50%;
transform: translateY(-50%);
font-size: 20px;
}
.wrapper .btn {
width: 100%;
height: 45px;
background: #fff;
border: none;
outline: none;
border-radius: 40px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
color: #333;
cursor: pointer;

font-size: 16px;
font-weight: 600;
}
.wrapper .btn:hover {
background: #5a9acf;
color: #fff;
}
</style>
<body>
<div class="wrapper">
<form action="">
<h1>Login</h1>
<div class="input-box">
<input type="text" placeholder="Username" required />
<i class="bx bxs-user"></i>
</div>
<div class="input-box">
<input type="password" placeholder="password" required />
<i class="bx bxs-lock-alt"></i>
</div>

<button type="submit" class="btn">Login</button>
</form>
</div>
</body>
</html>
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
<script setup>
import "boxicons/css/boxicons.min.css";
import router from "@/router";
import { Notyf } from "notyf";
import "notyf/notyf.min.css";
import { ref } from "vue";

let form = ref(null);

let notyf = new Notyf({
duration: 3000,
className: "x-notification",
position: { x: "right", y: "top" },
});

let userdata = ref({
username: "",
password: "",
});

const formrules = {
username: [
{ required: true, message: "请输入用户名", trigger: "change" },
{ min: 2, max: 8, message: "用户名必须为2-8为字符", trigger: "change" },
],
password: [
{ required: true, message: "请输入你的密码", trigger: "change" },
{ min: 6, max: 15, message: "密码必须为6-15位字符", trigger: "change" },
],
};

const SubmitEvent = async () => {
await form.validate();
await LoginApi.login(userdata.value)
.then((resquest) => {
if (resquest.data.code === 200) {
notyf.success("登录成功!");
userstore.setuserinfor(resquest.data.data);
userstore.settoken(resquest.data.token);
setTimeout(() => {
router.push("/");
}, 1000);
} else {
notyf.error("登录失败!");
}
})
.catch((error) => {
notyf.error(error.message || "登录失败,请重试!");
});
};
</script>

<template>
<div class="content">
<div class="wrapper">
<el-form :model="userdata" :rules="formrules" ref="form">
<h1>Login</h1>
<el-form-item class="input-box" prop="username">
<el-input
class="custom-input"
v-model="userdata.username"
placeholder="Username"
type="text"
></el-input>
<i class="bx bxs-user"></i>
</el-form-item>
<el-form-item class="input-box" prop="password">
<el-input
class="custom-input"
v-model="userdata.password"
placeholder="Password"
type="password"
></el-input>
<i class="bx bxs-lock"></i>
</el-form-item>

<button @click="SubmitEvent()" type="submit" class="btn">Login</button>
</el-form>
</div>
</div>
</template>

<style scoped>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: "Poppins", sans-serif;
}

html,
body {
overflow: hidden;
}

.content {
overflow: hidden;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background: url("https://cdn.jsdelivr.net/gh/8023time/image-storage-address/img/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20241016221935.png")
no-repeat;
background-size: cover;
background-position: center;
}

.wrapper {
overflow: hidden;
width: 420px;
background-color: transparent;
border: 2px solid rgba(255, 255, 255, 0.2);
backdrop-filter: blur(20px);
color: #fff;
border-radius: 10px;
padding: 30px 40px;
}

.wrapper h1 {
font-size: 36px;
text-align: center;
}

.input-box {
position: relative;
width: 100%;
height: 50px;
margin: 30px 0;
}

.custom-input {
width: 100%;
height: 100%;
background: transparent;
border: none;
outline: none;
border: 2px solid rgba(255, 255, 255, 0.2);
border-radius: 40px;
font-size: 16px;
color: #fff;
padding: 20px 45px 20px 20px;
}

.custom-input::placeholder {
color: rgba(255, 255, 255, 0.7);
}

.input-box i {
position: absolute;
right: 20px;
top: 50%;
transform: translateY(-50%);
font-size: 20px;
color: rgba(255, 255, 255, 0.6);
}

.wrapper .btn {
width: 100%;
height: 45px;
background: #fff;
border: none;
outline: none;
border-radius: 40px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
color: #333;
cursor: pointer;
font-size: 16px;
font-weight: 600;
}

.wrapper .btn:hover {
background: #5a9acf;
color: #fff;
}

:deep(.el-input__wrapper) {
background: transparent !important;
box-shadow: none !important;
}

:deep(.el-input__inner) {
background: transparent !important;
color: #fff !important;
}

:deep(.el-form-item__error) {
color: #ff4d4f !important;
font-size: 12px !important;
margin-top: 5px !important;
position: absolute !important;
left: 0 !important;
top: 100% !important;
}
</style>

jdjqidqnd

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
214
215
216
217
218
219
220
221
222
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Login Page</title>
<link
href="https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css"
rel="stylesheet"
/>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: Arial, sans-serif;
}

html,
body {
width: 100%;
height: 100%;
overflow: hidden;
}

.login-container {
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 100%;
background: url("https://cdn.jsdelivr.net/gh/8023time/image-storage-address/img/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20241016221935.png")
no-repeat center center / cover;
display: flex;
align-items: center;
justify-content: center;
}

.row-bg {
display: flex;
align-items: center;
justify-content: center;
width: 800px;
max-width: 90%;
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(10px);
border-radius: 20px;
overflow: hidden;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.login-left {
width: 50%;
height: 480px;
display: flex;
justify-content: center;
align-items: center;
padding: 40px;
}

.logo {
width: 200px;
height: 200px;
background: url("https://cdn.jsdelivr.net/gh/8023time/image-storage-address/basic-img/avatar.jpg")
no-repeat center center / cover;
border: 5px solid #fff;
border-radius: 50%;
}

.login-right {
width: 50%;
height: 480px;
background: rgba(255, 255, 255, 0.9);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 40px;
}

.login-title {
font-size: 2.5rem;
font-weight: bold;
color: #409eff;
margin-bottom: 30px;
text-align: center;
}

.el-form-item {
width: 100%;
margin-bottom: 20px;
position: relative;
}

.el-form-item i {
position: absolute;
left: 15px;
top: 50%;
transform: translateY(-50%);
font-size: 20px;
color: #999;
}

.el-input {
width: 100%;
height: 50px;
padding: 0 20px 0 50px;
border: 2px solid rgba(144, 69, 69, 0.2);
border-radius: 25px;
font-size: 16px;
color: #333;
background: rgba(255, 255, 255, 0.8);
outline: none;
transition: all 0.3s ease;
}

.el-input:focus {
border-color: #409eff;
box-shadow: 0 0 8px rgba(64, 158, 255, 0.6);
}

.el-input::placeholder {
color: rgba(0, 0, 0, 0.5);
}

.login-button {
width: 100%;
height: 50px;
font-size: 1.2rem;
color: white;
border: none;
border-radius: 25px;
background-color: #66b1ff;
cursor: pointer;
transition: all 0.3s ease;
}

.login-button:hover {
background-color: #409eff;
transform: translateY(-2px);
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

@media (max-width: 768px) {
.row-bg {
flex-direction: column;
width: 90%;
}

.login-left {
display: none;
}

.login-right {
width: 100%;
padding: 20px;
}

.login-title {
font-size: 2rem;
}

.el-input {
height: 45px;
font-size: 14px;
}

.login-button {
height: 45px;
font-size: 1rem;
}
}
</style>
</head>

<body>
<div class="login-container">
<div class="row-bg">
<div class="login-left">
<div class="logo"></div>
</div>
<div class="login-right">
<form
id="loginForm"
class="demo-ruleForm"
action="your-backend-login-endpoint"
method="POST"
>
<div class="el-form-item">
<h1 class="login-title">Login</h1>
</div>
<div class="el-form-item">
<i class="bx bxs-user"></i>
<input
type="text"
id="username"
name="username"
placeholder="Username"
class="el-input"
required
/>
</div>
<div class="el-form-item">
<i class="bx bxs-lock-alt"></i>
<input
type="password"
id="password"
name="password"
placeholder="Password"
class="el-input"
required
/>
</div>
<div class="el-form-item">
<button type="submit" class="login-button">Login</button>
</div>
</form>
</div>
</div>
</div>
</body>
</html>