b25b036d
wuxw
v1.9 优化日期
|
1
|
<template>
|
a42b3256
wuxw
HC小区管理系统前段vue版正在开发中
|
2
3
|
<div class="login-container">
<div class="login-card">
|
f9988111
wuxw
优化系统
|
4
5
6
|
<div class="login-title" v-if="logo">
<img :src="logo" alt="logo">
</div>
|
a42b3256
wuxw
HC小区管理系统前段vue版正在开发中
|
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
<el-form :model="loginForm" :rules="rules" ref="loginForm">
<el-form-item prop="username">
<el-input v-model="loginForm.username" :placeholder="$t('login.usernamePlaceholder')"></el-input>
</el-form-item>
<el-form-item prop="passwd">
<el-input v-model="loginForm.passwd" type="password" :placeholder="$t('login.passwordPlaceholder')"></el-input>
</el-form-item>
<el-form-item prop="validateCode" class="captcha-item">
<div class="captcha-container">
<el-input v-model="loginForm.validateCode" :placeholder="$t('login.captchaPlaceholder')"></el-input>
<img :src="captchaUrl" @click="refreshCaptcha" class="captcha-img" alt="验证码">
</div>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm('loginForm')" :loading="loading">{{ $t('login.login')
}}</el-button>
</el-form-item>
</el-form>
<!-- Add a white line and copyright info below the form -->
<div class="divider"></div>
|
b45f6e5d
wuxw
登陆页面
|
27
|
<div class="copyright">©2020-2025 <span v-html="companyName"></span></div>
|
a42b3256
wuxw
HC小区管理系统前段vue版正在开发中
|
28
29
30
31
32
33
34
35
|
</div>
<select-login-user ref="selectLoginUserRef" @select="handleSelect"></select-login-user>
</div>
</template>
<script>
import { login, getCaptcha, _loadStaffPrivileges } from '@/api/user/loginApi';
import { _loadCommunityInfo } from '@/api/community/communityApi';
|
f9988111
wuxw
优化系统
|
36
|
import {listSystemInfo} from '@/api/system/systemInfoManageApi'
|
a42b3256
wuxw
HC小区管理系统前段vue版正在开发中
|
37
38
|
import selectLoginUser from '@/components/user/selectLoginUser.vue';
|
f9988111
wuxw
优化系统
|
39
|
|
a42b3256
wuxw
HC小区管理系统前段vue版正在开发中
|
40
41
42
43
|
export default {
name: 'Login',
data() {
return {
|
f9988111
wuxw
优化系统
|
44
45
|
logo: '',
companyName:'',
|
a42b3256
wuxw
HC小区管理系统前段vue版正在开发中
|
46
|
loginForm: {
|
b25b036d
wuxw
v1.9 优化日期
|
47
48
|
username: 'wuxw',
passwd: 'admin',
|
a42b3256
wuxw
HC小区管理系统前段vue版正在开发中
|
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
validateCode: ''
},
captchaUrl: '',
loading: false,
rules: {
username: [
{ required: true, message: this.$t('login.usernamePlaceholder'), trigger: 'blur' }
],
passwd: [
{ required: true, message: this.$t('login.passwordPlaceholder'), trigger: 'blur' }
],
validateCode: [
{ required: true, message: this.$t('login.captchaPlaceholder'), trigger: 'blur' }
]
}
};
},
created() {
|
20ca5dc6
wuxw
优化登陆日志
|
67
|
localStorage.clear();
|
f9988111
wuxw
优化系统
|
68
|
this.getSystemInfo()
|
ee7ccad3
wuxw
v1.9 优化数据权限界面间距比较大问题
|
69
70
71
|
setTimeout(() => {
this.refreshCaptcha();
}, 1000);
|
f9988111
wuxw
优化系统
|
72
|
|
a42b3256
wuxw
HC小区管理系统前段vue版正在开发中
|
73
74
75
76
77
|
},
components: {
selectLoginUser
},
methods: {
|
f9988111
wuxw
优化系统
|
78
79
80
81
82
|
async getSystemInfo() {
const { data } = await listSystemInfo({ page: 1, row: 1 });
this.logo = data[0].logoUrl
this.companyName = data[0].companyName
},
|
a42b3256
wuxw
HC小区管理系统前段vue版正在开发中
|
83
84
85
86
87
|
async submitForm(formName) {
this.$refs[formName].validate(async (valid) => {
if (valid) {
this.loading = true;
try {
|
cf9ca7dc
wuxw
优化前段代码bug
|
88
|
const { data } = await login(this.loginForm).catch(error => {
|
b0260112
wuxw
v1.9 登陆错误信息提示
|
89
|
this.$message.error(error);
|
cf9ca7dc
wuxw
优化前段代码bug
|
90
91
92
|
this.refreshCaptcha();
return { data: [] };
});
|
b0260112
wuxw
v1.9 登陆错误信息提示
|
93
94
95
|
if (!data || data.length == 0) {
return;
}
|
a42b3256
wuxw
HC小区管理系统前段vue版正在开发中
|
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
|
if (data && data.length > 1) {
this.$refs.selectLoginUserRef.openDialog(data);
return;
}
this.handleSelect(data[0]);
} catch (error) {
console.error('登录失败:', error);
this.refreshCaptcha();
} finally {
this.loading = false;
}
} else {
return false;
}
});
},
async handleSelect(_userData) {
localStorage.setItem('token', _userData.token);
let _user = {
userId: _userData.userId,
name: _userData.name,
tel: _userData.tel
}
localStorage.setItem('user', JSON.stringify(_user));
await _loadStaffPrivileges();
await _loadCommunityInfo();
this.$router.push('/');
},
async refreshCaptcha() {
try {
const res = await getCaptcha();
console.log(res);
this.captchaUrl = res;
} catch (error) {
console.error('获取验证码失败:', error);
this.$message.error(this.$t('login.getCaptchaFailed'));
}
}
}
};
</script>
<style scoped>
.login-container {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background: url('/img/login-bg_x.png') no-repeat center center;
background-size: cover;
position: relative;
overflow: hidden;
}
.login-card {
width: 300px;
padding: 20px;
background-color: rgba(0, 0, 0, 0.5);
border-radius: 4px;
position: absolute;
left: 50%;
top: 35%;
margin: -150px 0 0 -150px;
z-index: 99;
text-align: center;
padding: 30px;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}
.login-card .login-title {
color: #fff;
text-align: center;
|
a42b3256
wuxw
HC小区管理系统前段vue版正在开发中
|
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
223
224
225
226
227
228
229
230
231
232
233
234
235
|
font-size: 48px;
}
.el-form-item {
margin-bottom: 20px;
}
.el-input__inner {
background: #fff;
border: none;
border-radius: 5px;
color: #333;
height: 40px;
}
.captcha-container {
display: flex;
align-items: center;
gap: 10px;
}
.captcha-item .el-input {
width: 70%;
height: 38px;
line-height: 1.3;
border-width: 1px;
border-style: solid;
background-color: #fff;
border-radius: 2px;
}
.captcha-img {
height: 40px;
cursor: pointer;
border-radius: 5px;
}
.el-button--primary {
width: 100%;
background: #1E9FFF;
border: none;
border-radius: 100px;
font-size: 14px;
height: 38px;
}
.el-button--primary:hover {
opacity: 0.8;
color: #fff;
}
/* Style for the white line */
.divider {
width: 100%;
height: 1px;
background-color: #fff;
margin: 10px 0;
}
/* Style for the copyright text */
.copyright {
color: #fff;
font-size: 14px;
text-align: center;
margin-top: 10px;
}
</style>
|