@lambo-design/login-form 1.0.0-beta.2 → 1.0.0-beta.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +12 -5
- package/src/login-form.vue +161 -18
- package/src/login-page.vue +3 -1
- package/src/styles/css/login-form.less +12 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lambo-design/login-form",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.21",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "lambo",
|
|
@@ -9,9 +9,16 @@
|
|
|
9
9
|
"access": "public",
|
|
10
10
|
"registry": "https://registry.npmjs.org/"
|
|
11
11
|
},
|
|
12
|
-
"
|
|
13
|
-
"@lambo-design/
|
|
14
|
-
"@lambo-design/
|
|
12
|
+
"devDependencies": {
|
|
13
|
+
"@lambo-design/core": "^4.7.1-beta.171",
|
|
14
|
+
"@lambo-design/shared": "^1.0.0-beta.318"
|
|
15
15
|
},
|
|
16
|
-
"scripts": {
|
|
16
|
+
"scripts": {
|
|
17
|
+
"release": "pnpm release-beta && git push --follow-tags && pnpm re-publish",
|
|
18
|
+
"release-major": "standard-version --release-as major",
|
|
19
|
+
"release-minor": "standard-version --release-as minor",
|
|
20
|
+
"release-patch": "standard-version --release-as patch",
|
|
21
|
+
"release-beta": "standard-version --prerelease beta",
|
|
22
|
+
"re-publish": "pnpm publish --access public --no-git-checks"
|
|
23
|
+
}
|
|
17
24
|
}
|
package/src/login-form.vue
CHANGED
|
@@ -1,34 +1,62 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<Form ref="loginForm" class="lambo-login-form"
|
|
3
|
-
:model="form" :rules="rules"
|
|
3
|
+
:model="form" :rules="rules" :label-width="0"
|
|
4
4
|
@keydown.enter.native="handleSubmit">
|
|
5
5
|
<FormItem prop="userName">
|
|
6
|
-
<Input v-model="form.userName" placeholder="
|
|
6
|
+
<Input v-model="form.userName" :placeholder="t('login-form.box.form-user-name')">
|
|
7
7
|
<span slot="prepend">
|
|
8
8
|
<Icon :size="16" type="ios-person"></Icon>
|
|
9
9
|
</span>
|
|
10
10
|
</Input>
|
|
11
11
|
</FormItem>
|
|
12
12
|
<FormItem prop="password">
|
|
13
|
-
<Input v-model="form.password" placeholder="
|
|
13
|
+
<Input v-model="form.password" :placeholder="t('login-form.box.form-user-pas')" type="password">
|
|
14
14
|
<span slot="prepend">
|
|
15
15
|
<Icon :size="14" type="md-lock"></Icon>
|
|
16
16
|
</span>
|
|
17
17
|
</Input>
|
|
18
18
|
</FormItem>
|
|
19
|
-
<FormItem prop="validCode">
|
|
20
|
-
<Input v-model="form.validCode" class="captcha" placeholder="
|
|
19
|
+
<FormItem prop="validCode" class="captcha-container" >
|
|
20
|
+
<Input v-model="form.validCode" class="captcha" :placeholder="t('login-form.box.form-user-valid-code')">
|
|
21
21
|
<template slot="prepend">
|
|
22
|
-
<img class="prefix" src="
|
|
22
|
+
<img class="prefix" src="@/assets/images/captcha.svg">
|
|
23
23
|
</template>
|
|
24
24
|
</Input>
|
|
25
25
|
<div class="Imgbox"><img :src="captchaUrl" class="captchaImg" @click="getCaptcha"></div>
|
|
26
26
|
</FormItem>
|
|
27
|
+
<FormItem prop="validCode" v-if="captchaMethod === t('login-form.other.captcha-method-sms')">
|
|
28
|
+
<Input
|
|
29
|
+
search
|
|
30
|
+
:enter-button="ValidNumText"
|
|
31
|
+
:placeholder="t('login-form.box.form-user-sms-code')"
|
|
32
|
+
v-model="form.validCode"
|
|
33
|
+
@on-search="getVaildCode">
|
|
34
|
+
<template slot="prepend">
|
|
35
|
+
<img class="prefix" src="@/assets/images/captcha.svg">
|
|
36
|
+
</template>
|
|
37
|
+
</Input>
|
|
38
|
+
</FormItem>
|
|
39
|
+
<FormItem prop="validCode" v-if="captchaMethod === t('login-form.other.captcha-method-mail')">
|
|
40
|
+
<Input
|
|
41
|
+
search
|
|
42
|
+
:enter-button="ValidNumText"
|
|
43
|
+
:placeholder="t('login-form.box.form-user-mail-code')"
|
|
44
|
+
v-model="form.validCode"
|
|
45
|
+
@on-search="getVaildCode">
|
|
46
|
+
<template slot="prepend">
|
|
47
|
+
<img class="prefix" src="@/assets/images/captcha.svg">
|
|
48
|
+
</template>
|
|
49
|
+
</Input>
|
|
50
|
+
</FormItem>
|
|
51
|
+
<FormItem v-if="captchaMethod === t('login-form.other.captcha-method-slide-image')">
|
|
52
|
+
<Button long :disabled="isDisabled" @click="showSlideVerify">{{ buttonText }}</Button>
|
|
53
|
+
</FormItem>
|
|
27
54
|
<FormItem>
|
|
28
|
-
<Checkbox v-model="rememberMe"><span class="remember"
|
|
55
|
+
<Checkbox v-if="showRememberMe === '1'" v-model="rememberMe"><span class="remember">{{ t('login-form.box.form-remember') }}</span></Checkbox>
|
|
56
|
+
<label v-if="showForgetPassword === '1'" style="float: right;"><router-link to="/forgetPasswordForget">{{ t('login-form.box.form-forget') }}</router-link></label>
|
|
29
57
|
</FormItem>
|
|
30
58
|
<FormItem>
|
|
31
|
-
<Button :loading="loading" long type="primary" @click="handleSubmit"
|
|
59
|
+
<Button :loading="loading" long type="primary" @click="handleSubmit">{{ t('login-form.box.form-login') }}</Button>
|
|
32
60
|
</FormItem>
|
|
33
61
|
</Form>
|
|
34
62
|
</template>
|
|
@@ -37,31 +65,36 @@ import config from "@lambo-design/shared/config/config";
|
|
|
37
65
|
import {getLocalStorage, removeLocalStorage, setLocalStorage} from "@lambo-design/shared/utils/platform";
|
|
38
66
|
import {guid} from "@lambo-design/shared/utils/number";
|
|
39
67
|
import crypto from "@lambo-design/shared/utils/crypto"
|
|
68
|
+
import ajax from "@lambo-design/shared/utils/ajax";
|
|
69
|
+
import Locale from "@lambo-design/core/src/mixins/locale";
|
|
40
70
|
|
|
41
71
|
export default {
|
|
42
72
|
name: 'LoginForm',
|
|
73
|
+
mixins: [Locale],
|
|
74
|
+
components:{
|
|
75
|
+
},
|
|
43
76
|
props: {
|
|
44
77
|
userNameRules: {
|
|
45
78
|
type: Array,
|
|
46
|
-
default: ()
|
|
79
|
+
default: function() {
|
|
47
80
|
return [
|
|
48
|
-
{required: true, message: '
|
|
81
|
+
{required: true, message: this.$t('login-form.box.form-rule-user-name'), trigger: 'blur'}
|
|
49
82
|
]
|
|
50
83
|
}
|
|
51
84
|
},
|
|
52
85
|
passwordRules: {
|
|
53
86
|
type: Array,
|
|
54
|
-
default: ()
|
|
87
|
+
default: function() {
|
|
55
88
|
return [
|
|
56
|
-
{required: true, message: '
|
|
89
|
+
{required: true, message: this.$t('login-form.box.form-rule-user-pas'), trigger: 'blur'}
|
|
57
90
|
]
|
|
58
91
|
}
|
|
59
92
|
},
|
|
60
93
|
validCodeRules: {
|
|
61
94
|
type: Array,
|
|
62
|
-
default: ()
|
|
95
|
+
default: function() {
|
|
63
96
|
return [
|
|
64
|
-
{required: true, message: '
|
|
97
|
+
{required: true, message: this.$t('login-form.box.form-rule-valid-code'), trigger: 'blur'}
|
|
65
98
|
]
|
|
66
99
|
}
|
|
67
100
|
},
|
|
@@ -76,17 +109,33 @@ export default {
|
|
|
76
109
|
pasCryptor: {
|
|
77
110
|
type: String,
|
|
78
111
|
default: 'sm3'
|
|
79
|
-
}
|
|
112
|
+
},
|
|
113
|
+
captchaMethod:{type: String},
|
|
114
|
+
showForgetPassword:{type: String},
|
|
115
|
+
showRememberMe:{
|
|
116
|
+
type: String,
|
|
117
|
+
default: '1'
|
|
118
|
+
},
|
|
119
|
+
passwordRetrievalMethod:{type: Array},
|
|
120
|
+
smConfigId:{type: String},
|
|
121
|
+
templateId:{type: String},
|
|
122
|
+
mailConfigId:{type: String},
|
|
123
|
+
isSlideVerify:{type: Boolean},
|
|
124
|
+
buttonText: {type:String}, // 初始按钮文本
|
|
125
|
+
isDisabled: {type:Boolean},
|
|
80
126
|
},
|
|
81
127
|
data() {
|
|
82
128
|
return {
|
|
129
|
+
ValidNumText: this.t('login-form.other.get-valid-code'),
|
|
83
130
|
form: {
|
|
84
131
|
userName: '',
|
|
85
132
|
password: '',
|
|
86
133
|
validCode: ''
|
|
87
134
|
},
|
|
88
135
|
rememberMe: false,
|
|
89
|
-
validCodeId: ''
|
|
136
|
+
validCodeId: '',
|
|
137
|
+
countDown: 60,
|
|
138
|
+
countDownNum: 60,
|
|
90
139
|
}
|
|
91
140
|
},
|
|
92
141
|
computed: {
|
|
@@ -119,9 +168,99 @@ export default {
|
|
|
119
168
|
false
|
|
120
169
|
)
|
|
121
170
|
},
|
|
171
|
+
getVaildCode() {
|
|
172
|
+
let self = this;
|
|
173
|
+
if (self.ValidNumText == self.t('login-form.other.get-valid-code')) {
|
|
174
|
+
self.ValidNumText = self.countDown + self.t('login-form.other.get-valid-code-later');
|
|
175
|
+
self.clock = window.setInterval(() => {
|
|
176
|
+
self.countDown--;
|
|
177
|
+
self.ValidNumText = self.countDown + self.t('login-form.other.get-valid-code-later');
|
|
178
|
+
if (self.countDown <= 0) {
|
|
179
|
+
window.clearInterval(self.clock);
|
|
180
|
+
self.ValidNumText = self.t('login-form.other.get-valid-code');
|
|
181
|
+
self.countDown = self.countDownNum;
|
|
182
|
+
}
|
|
183
|
+
}, 1000);
|
|
184
|
+
let param
|
|
185
|
+
let url
|
|
186
|
+
if(self.captchaMethod === self.t('login-form.other.captcha-method-mail')){
|
|
187
|
+
url = config.upmsServerContext + "/anon/user/sendMailForLogin"
|
|
188
|
+
param = {
|
|
189
|
+
userId: self.form.userName,
|
|
190
|
+
//mailAddress: self.form.mailAddress
|
|
191
|
+
validCodeId: self.validCodeId,
|
|
192
|
+
mailConfigId: self.mailConfigId
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
if(self.captchaMethod === self.t('login-form.other.captcha-method-sms')){
|
|
196
|
+
url = config.upmsServerContext + "/anon/user/sendSmsForLogin"
|
|
197
|
+
param = {
|
|
198
|
+
userId: self.form.userName,
|
|
199
|
+
//phoneNumber: self.form.phoneNumber
|
|
200
|
+
validCodeId: self.validCodeId,
|
|
201
|
+
smConfigId: self.smConfigId,
|
|
202
|
+
templateId: self.templateId
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
if (self.form.userName && self.form.userName.trim().length > 0){
|
|
206
|
+
ajax
|
|
207
|
+
.post(url, param)
|
|
208
|
+
.then(function(resp) {
|
|
209
|
+
if (resp.data.code == 200) {
|
|
210
|
+
self.$Message.success({
|
|
211
|
+
content: self.t('login-form.other.send-success'),})
|
|
212
|
+
} else {
|
|
213
|
+
self.$Message.error(resp.data.data);
|
|
214
|
+
window.clearInterval(self.clock);
|
|
215
|
+
self.ValidNumText = self.t('login-form.other.get-valid-code');
|
|
216
|
+
self.countDown = self.countDownNum;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
);
|
|
220
|
+
}else{
|
|
221
|
+
self.$Message.error(self.t('login-form.box.form-user-name'));
|
|
222
|
+
window.clearInterval(self.clock);
|
|
223
|
+
self.ValidNumText = self.t('login-form.other.get-valid-code');
|
|
224
|
+
self.countDown = self.countDownNum;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
showSlideVerify(){
|
|
229
|
+
if (this.form.userName && this.form.userName.trim().length > 0){
|
|
230
|
+
let params = {
|
|
231
|
+
userName: this.form.userName,
|
|
232
|
+
password: this.form.password,
|
|
233
|
+
validCodeInput: this.form.validCode,
|
|
234
|
+
validCodeId: this.validCodeId
|
|
235
|
+
}
|
|
236
|
+
if (this.pasCryptor) {
|
|
237
|
+
params.pasCryptor = this.pasCryptor;
|
|
238
|
+
params.pasEncode = this.getCryptorPassword(this.form.password,this.form.validCode,this.pasCryptor);
|
|
239
|
+
} else {
|
|
240
|
+
params.pasMd5 = this.getCryptorPassword(this.form.password,this.form.validCode,'md5');
|
|
241
|
+
params.pasSm3 = this.getCryptorPassword(this.form.password,this.form.validCode,'sm3');
|
|
242
|
+
}
|
|
243
|
+
this.$emit('show-slide-verify', true,params)
|
|
244
|
+
|
|
245
|
+
this.setLocalUserId(this.form.userName)
|
|
246
|
+
if (this.rememberMe == true) {
|
|
247
|
+
this.setLocalStorage(this.form.userName)
|
|
248
|
+
}
|
|
249
|
+
if (this.rememberMe == false) {
|
|
250
|
+
this.clearLocalStorage();
|
|
251
|
+
}
|
|
252
|
+
}else{
|
|
253
|
+
this.$Message.error(this.t('login-form.box.form-user-name'));
|
|
254
|
+
}
|
|
255
|
+
},
|
|
122
256
|
handleSubmit() {
|
|
123
257
|
this.$refs.loginForm.validate((valid) => {
|
|
124
|
-
if (
|
|
258
|
+
if(valid && this.captchaMethod == this.t('login-form.other.captcha-method-slide-image')
|
|
259
|
+
&& !this.isSlideVerify){
|
|
260
|
+
this.$Message.error(this.t('login-form.box.form-rule-click-login'));
|
|
261
|
+
}
|
|
262
|
+
if (valid && ((this.captchaMethod == this.t('login-form.other.captcha-method-slide-image')
|
|
263
|
+
&& this.isSlideVerify) || this.captchaMethod != this.t('login-form.other.captcha-method-slide-image'))) {
|
|
125
264
|
let params = {
|
|
126
265
|
userName: this.form.userName,
|
|
127
266
|
password: this.form.password,
|
|
@@ -136,6 +275,7 @@ export default {
|
|
|
136
275
|
params.pasSm3 = this.getCryptorPassword(this.form.password,this.form.validCode,'sm3');
|
|
137
276
|
}
|
|
138
277
|
this.$emit('on-success-valid', params)
|
|
278
|
+
this.setLocalUserId(this.form.userName)
|
|
139
279
|
if (this.rememberMe == true) {
|
|
140
280
|
this.setLocalStorage(this.form.userName)
|
|
141
281
|
}
|
|
@@ -154,6 +294,9 @@ export default {
|
|
|
154
294
|
setLocalStorage(name) {
|
|
155
295
|
setLocalStorage("username", name);
|
|
156
296
|
},
|
|
297
|
+
setLocalUserId(name){
|
|
298
|
+
setLocalStorage('userId',name)
|
|
299
|
+
},
|
|
157
300
|
clearLocalStorage() {
|
|
158
301
|
removeLocalStorage("username");
|
|
159
302
|
}
|
|
@@ -165,5 +308,5 @@ export default {
|
|
|
165
308
|
}
|
|
166
309
|
</script>
|
|
167
310
|
<style lang="less">
|
|
168
|
-
@import 'styles/css/login-form';
|
|
311
|
+
@import 'styles/css/login-form';
|
|
169
312
|
</style>
|
package/src/login-page.vue
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="lambo-login" :style="backGroundStyle">
|
|
3
3
|
<div class="lambo-login-con" :style="formStyle">
|
|
4
|
-
<Card :bordered="false" icon="log-in" title="
|
|
4
|
+
<Card :bordered="false" icon="log-in" :title="t('login-page.box.welcome-login')">
|
|
5
5
|
<div class="lambo-form-con">
|
|
6
6
|
<LamboLoginForm ref="login" :loading="formLoading"
|
|
7
7
|
:captcha-img-url="formCaptchaImgUrl"
|
|
@@ -15,9 +15,11 @@
|
|
|
15
15
|
|
|
16
16
|
<script>
|
|
17
17
|
import LamboLoginForm from './login-form'
|
|
18
|
+
import Locale from "@lambo-design/core/src/mixins/locale";
|
|
18
19
|
|
|
19
20
|
export default {
|
|
20
21
|
name: 'LamboLoginPage',
|
|
22
|
+
mixins: [Locale],
|
|
21
23
|
components: {
|
|
22
24
|
LamboLoginForm
|
|
23
25
|
},
|
|
@@ -5,15 +5,23 @@
|
|
|
5
5
|
height: 13px;
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
|
+
.captcha-container {
|
|
9
|
+
.ivu-form-item-content {
|
|
10
|
+
display: flex;
|
|
11
|
+
justify-content: space-between;
|
|
12
|
+
width: 100%;
|
|
13
|
+
align-items: center;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
8
16
|
.captcha {
|
|
9
17
|
width: calc(100% - 100px);
|
|
10
18
|
}
|
|
11
19
|
.Imgbox {
|
|
12
20
|
width: 90px;
|
|
13
|
-
height: 33px;
|
|
14
|
-
float: right;
|
|
15
|
-
padding:
|
|
16
|
-
margin-top: -33px;
|
|
21
|
+
height: var(--input-height-base, 33px);
|
|
22
|
+
//float: right;
|
|
23
|
+
padding: 1px;
|
|
24
|
+
//margin-top: -33px;
|
|
17
25
|
background-color: #f8f8f9;
|
|
18
26
|
.captchaImg {
|
|
19
27
|
width: 100%;
|