1
1
<template >
2
2
<div class =" login-container" >
3
- <el-form class =" card-box login-form" autoComplete =" on" :model =" loginForm" :rules =" loginRules" ref =" loginForm" label-position =" left" >
4
- <h3 class =" title" >系统登录</h3 >
5
- <el-dropdown trigger =" click" class =' international' @command =" handleSetLanguage" >
6
- <div >
7
- <svg-icon class-name =' right-menu-item international-icon' icon-class =" language" />
8
- </div >
9
- <el-dropdown-menu slot =" dropdown" >
10
- <el-dropdown-item command =" zh" :disabled =" language==='zh'" >中文</el-dropdown-item >
11
- <el-dropdown-item command =" en" :disabled =" language==='en'" >English</el-dropdown-item >
12
- </el-dropdown-menu >
13
- </el-dropdown >
14
-
3
+ <el-form class =" login-form" autoComplete =" on" :model =" loginForm" :rules =" loginRules" ref =" loginForm" label-position =" left" >
4
+ <div class =" title-container" >
5
+ <h3 class =" title" >{{ translateKey('title')}}</h3 >
6
+ <lang-select class =" set-language" ></lang-select >
7
+ </div >
15
8
<el-form-item prop =" username" >
16
9
<span class =" svg-container svg-container_login" >
17
10
<svg-icon icon-class =" user" />
18
11
</span >
19
- <el-input name =" username" type =" text" v-model =" loginForm.username" autoComplete =" on" placeholder =" 邮箱 " />
12
+ <el-input name =" username" type =" text" v-model =" loginForm.username" autoComplete =" on" placeholder =" username " />
20
13
</el-form-item >
21
14
22
15
<el-form-item prop =" password" >
23
16
<span class =" svg-container" >
24
17
<svg-icon icon-class =" password" />
25
18
</span >
26
19
<el-input name =" password" :type =" pwdType" @keyup.enter.native =" handleLogin" v-model =" loginForm.password" autoComplete =" on"
27
- placeholder =" 密码" />
28
- <span class =" show-pwd" @click =" showPwd" ><svg-icon icon-class =" eye" /></span >
20
+ placeholder =" password" />
21
+ <span class =" show-pwd" @click =" showPwd" >
22
+ <svg-icon icon-class =" eye" />
23
+ </span >
29
24
</el-form-item >
30
25
31
- <el-button type =" primary" style =" width :100% ;margin-bottom :30px ;" :loading =" loading" @click.native.prevent =" handleLogin" >登录 </el-button >
26
+ <el-button type =" primary" style =" width :100% ;margin-bottom :30px ;" :loading =" loading" @click.native.prevent =" handleLogin" >{{translateKey('logIn')}} </el-button >
32
27
33
- <div class =" tips" >账号:admin 密码随便填</div >
34
- <div class =" tips" >账号:editor 密码随便填</div >
28
+ <div class =" tips" >
29
+ <span >{{translateKey('username')}} : admin</span >
30
+ <span >{{translateKey('password')}} : {{translateKey('any')}}</span >
31
+ </div >
32
+ <div class =" tips" >
33
+ <span >{{translateKey('username')}} : editor </span >
34
+ <span >{{translateKey('password')}} : {{translateKey('any')}}</span >
35
+ </div >
35
36
36
- <el-button class =" thirdparty-button" type =" primary" @click =" showDialog=true" >打开第三方登录 </el-button >
37
+ <el-button class =" thirdparty-button" type =" primary" @click =" showDialog=true" >{{translateKey('thirdparty')}} </el-button >
37
38
</el-form >
38
39
39
- <el-dialog title =" 第三方验证" :visible.sync =" showDialog" >
40
- 本地不能模拟,请结合自己业务进行模拟!!!<br /><br /><br />
41
- 邮箱登录成功,请选择第三方验证<br />
40
+ <el-dialog :title =" translateKey('thirdparty')" :visible.sync =" showDialog" >
41
+ {{translateKey('thirdpartyTips')}}
42
+ <br />
43
+ <br />
44
+ <br />
42
45
<social-sign />
43
46
</el-dialog >
44
47
47
50
48
51
<script >
49
52
import { isvalidUsername } from ' @/utils/validate'
53
+ import LangSelect from ' @/components/LangSelect'
50
54
import socialSign from ' ./socialsignin'
51
55
52
56
export default {
53
- components: { socialSign },
57
+ components: { LangSelect, socialSign },
54
58
name: ' login' ,
55
59
data () {
56
60
const validateUsername = (rule , value , callback ) => {
57
61
if (! isvalidUsername (value)) {
58
- callback (new Error (' 请输入正确的用户名 ' ))
62
+ callback (new Error (' Please enter the correct user name ' ))
59
63
} else {
60
64
callback ()
61
65
}
62
66
}
63
67
const validatePassword = (rule , value , callback ) => {
64
68
if (value .length < 6 ) {
65
- callback (new Error (' 密码不能小于6位 ' ))
69
+ callback (new Error (' The password can not be less than 6 digits ' ))
66
70
} else {
67
71
callback ()
68
72
}
@@ -82,6 +86,9 @@ export default {
82
86
}
83
87
},
84
88
methods: {
89
+ translateKey (key ) {
90
+ return this .$t (' login.' + key)
91
+ },
85
92
showPwd () {
86
93
if (this .pwdType === ' password' ) {
87
94
this .pwdType = ' '
@@ -135,19 +142,15 @@ export default {
135
142
</script >
136
143
137
144
<style rel="stylesheet/scss" lang="scss">
138
- @import " src/styles/mixin.scss" ;
139
- $bg :#2d3a4b ;
140
- $dark_gray :#889aa4 ;
141
- $light_gray :#eee ;
145
+ $bg :#2d3a4b ;
146
+ $light_gray :#eee ;
142
147
143
- .login-container {
144
- @include relative ;
145
- height : 100vh ;
146
- background-color : $bg ;
147
- input :-webkit-autofill {
148
- -webkit-box-shadow : 0 0 0px 1000px #293444 inset !important ;
149
- -webkit-text-fill-color : #fff !important ;
150
- }
148
+ /* reset element-ui css */
149
+ .login-container {
150
+ .el-input {
151
+ display : inline-block ;
152
+ height : 47px ;
153
+ width : 85% ;
151
154
input {
152
155
background : transparent ;
153
156
border : 0px ;
@@ -156,27 +159,62 @@ export default {
156
159
padding : 12px 5px 12px 15px ;
157
160
color : $light_gray ;
158
161
height : 47px ;
162
+ & :-webkit-autofill {
163
+ -webkit-box-shadow : 0 0 0px 1000px $bg inset !important ;
164
+ -webkit-text-fill-color : #fff !important ;
165
+ }
159
166
}
160
- .el-input {
161
- display : inline-block ;
162
- height : 47px ;
163
- width : 85% ;
164
- }
165
- .tips {
166
- font-size : 14px ;
167
- color : #fff ;
168
- margin-bottom : 10px ;
169
- }
170
- .svg-container {
171
- padding : 6px 5px 6px 15px ;
172
- color : $dark_gray ;
173
- vertical-align : middle ;
174
- width : 30px ;
175
- display : inline-block ;
176
- & _login {
177
- font-size : 20px ;
167
+ }
168
+ .el-form-item {
169
+ border : 1px solid rgba (255 , 255 , 255 , 0.1 );
170
+ background : rgba (0 , 0 , 0 , 0.1 );
171
+ border-radius : 5px ;
172
+ color : #454545 ;
173
+ }
174
+ }
175
+
176
+ </style >
177
+
178
+ <style rel="stylesheet/scss" lang="scss" scoped>
179
+ @import " src/styles/mixin.scss" ;
180
+ $bg :#2d3a4b ;
181
+ $dark_gray :#889aa4 ;
182
+ $light_gray :#eee ;
183
+
184
+ .login-container {
185
+ @include relative ;
186
+ height : 100vh ;
187
+ background-color : $bg ;
188
+ .login-form {
189
+ position : absolute ;
190
+ left : 0 ;
191
+ right : 0 ;
192
+ width : 520px ;
193
+ padding : 35px 35px 15px 35px ;
194
+ margin : 120px auto ;
195
+ }
196
+ .tips {
197
+ font-size : 14px ;
198
+ color : #fff ;
199
+ margin-bottom : 10px ;
200
+ span {
201
+ & :first-of-type {
202
+ margin-right : 16px ;
178
203
}
179
204
}
205
+ }
206
+ .svg-container {
207
+ padding : 6px 5px 6px 15px ;
208
+ color : $dark_gray ;
209
+ vertical-align : middle ;
210
+ width : 30px ;
211
+ display : inline-block ;
212
+ & _login {
213
+ font-size : 20px ;
214
+ }
215
+ }
216
+ .title-container {
217
+ position : relative ;
180
218
.title {
181
219
font-size : 26px ;
182
220
font-weight : 400 ;
@@ -185,33 +223,26 @@ export default {
185
223
text-align : center ;
186
224
font-weight : bold ;
187
225
}
188
- .login-form {
189
- position : absolute ;
190
- left : 0 ;
191
- right : 0 ;
192
- width : 400px ;
193
- padding : 35px 35px 15px 35px ;
194
- margin : 120px auto ;
195
- }
196
- .el-form-item {
197
- border : 1px solid rgba (255 , 255 , 255 , 0.1 );
198
- background : rgba (0 , 0 , 0 , 0.1 );
199
- border-radius : 5px ;
200
- color : #454545 ;
201
- }
202
- .show-pwd {
203
- position : absolute ;
204
- right : 10px ;
205
- top : 7px ;
206
- font-size : 16px ;
207
- color : $dark_gray ;
208
- cursor : pointer ;
209
- user-select :none ;
210
- }
211
- .thirdparty-button {
226
+ .set-language {
227
+ color : #fff ;
212
228
position : absolute ;
213
- right : 35 px ;
214
- bottom : 28 px ;
229
+ top : 5 px ;
230
+ right : 0 px ;
215
231
}
216
232
}
233
+ .show-pwd {
234
+ position : absolute ;
235
+ right : 10px ;
236
+ top : 7px ;
237
+ font-size : 16px ;
238
+ color : $dark_gray ;
239
+ cursor : pointer ;
240
+ user-select : none ;
241
+ }
242
+ .thirdparty-button {
243
+ position : absolute ;
244
+ right : 35px ;
245
+ bottom : 28px ;
246
+ }
247
+ }
217
248
</style >
0 commit comments