@lambo-design/login-form 1.0.0-beta.15 → 1.0.0-beta.17

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lambo-design/login-form",
3
- "version": "1.0.0-beta.15",
3
+ "version": "1.0.0-beta.17",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "author": "lambo",
@@ -10,8 +10,8 @@
10
10
  "registry": "https://registry.npmjs.org/"
11
11
  },
12
12
  "devDependencies": {
13
- "@lambo-design/core": "^4.7.1-beta.147",
14
- "@lambo-design/shared": "^1.0.0-beta.233"
13
+ "@lambo-design/core": "^4.7.1-beta.167",
14
+ "@lambo-design/shared": "^1.0.0-beta.286"
15
15
  },
16
16
  "scripts": {
17
17
  "release": "pnpm release-beta && git push --follow-tags && pnpm re-publish",
@@ -3,32 +3,32 @@
3
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="请输入密码" type="password">
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" v-if="captchaMethod === '图片'">
20
- <Input v-model="form.validCode" class="captcha" placeholder="请输入验证码">
19
+ <FormItem prop="validCode" v-if="captchaMethod === t('login-form.other.captcha-method-image')">
20
+ <Input v-model="form.validCode" class="captcha" :placeholder="t('login-form.box.form-user-valid-code')">
21
21
  <template slot="prepend">
22
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 === '短信'">
27
+ <FormItem prop="validCode" v-if="captchaMethod === t('login-form.other.captcha-method-sms')">
28
28
  <Input
29
29
  search
30
30
  :enter-button="ValidNumText"
31
- placeholder="请查收短信并输入验证码"
31
+ :placeholder="t('login-form.box.form-user-sms-code')"
32
32
  v-model="form.validCode"
33
33
  @on-search="getVaildCode">
34
34
  <template slot="prepend">
@@ -36,11 +36,11 @@
36
36
  </template>
37
37
  </Input>
38
38
  </FormItem>
39
- <FormItem prop="validCode" v-if="captchaMethod === '邮箱'">
39
+ <FormItem prop="validCode" v-if="captchaMethod === t('login-form.other.captcha-method-mail')">
40
40
  <Input
41
41
  search
42
42
  :enter-button="ValidNumText"
43
- placeholder="请查收邮件并输入验证码"
43
+ :placeholder="t('login-form.box.form-user-mail-code')"
44
44
  v-model="form.validCode"
45
45
  @on-search="getVaildCode">
46
46
  <template slot="prepend">
@@ -48,15 +48,15 @@
48
48
  </template>
49
49
  </Input>
50
50
  </FormItem>
51
- <FormItem v-if="captchaMethod === '滑动图片'">
51
+ <FormItem v-if="captchaMethod === t('login-form.other.captcha-method-slide-image')">
52
52
  <Button long :disabled="isDisabled" @click="showSlideVerify">{{ buttonText }}</Button>
53
53
  </FormItem>
54
54
  <FormItem>
55
- <Checkbox v-model="rememberMe"><span class="remember">记住用户名</span></Checkbox>
56
- <label v-if="showForgetPassword==='1'" style="float: right;"><router-link to="/forgetPasswordForget">忘记密码?</router-link></label>
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>
57
57
  </FormItem>
58
58
  <FormItem>
59
- <Button :loading="loading" long type="primary" @click="handleSubmit">登录</Button>
59
+ <Button :loading="loading" long type="primary" @click="handleSubmit">{{ t('login-form.box.form-login') }}</Button>
60
60
  </FormItem>
61
61
  </Form>
62
62
  </template>
@@ -66,9 +66,11 @@ import {getLocalStorage, removeLocalStorage, setLocalStorage} from "@lambo-desig
66
66
  import {guid} from "@lambo-design/shared/utils/number";
67
67
  import crypto from "@lambo-design/shared/utils/crypto"
68
68
  import ajax from "@lambo-design/shared/utils/ajax";
69
+ import Locale from "@lambo-design/core/src/mixins/locale";
69
70
 
70
71
  export default {
71
72
  name: 'LoginForm',
73
+ mixins: [Locale],
72
74
  components:{
73
75
  },
74
76
  props: {
@@ -76,7 +78,7 @@ export default {
76
78
  type: Array,
77
79
  default: () => {
78
80
  return [
79
- {required: true, message: '账号不能为空', trigger: 'blur'}
81
+ {required: true, message: this.t('login-form.box.form-rule-user-name'), trigger: 'blur'}
80
82
  ]
81
83
  }
82
84
  },
@@ -84,7 +86,7 @@ export default {
84
86
  type: Array,
85
87
  default: () => {
86
88
  return [
87
- {required: true, message: '密码不能为空', trigger: 'blur'}
89
+ {required: true, message: this.t('login-form.box.form-rule-user-pas'), trigger: 'blur'}
88
90
  ]
89
91
  }
90
92
  },
@@ -92,7 +94,7 @@ export default {
92
94
  type: Array,
93
95
  default: () => {
94
96
  return [
95
- {required: true, message: '验证码不能为空', trigger: 'blur'}
97
+ {required: true, message: this.t('login-form.box.form-rule-valid-code'), trigger: 'blur'}
96
98
  ]
97
99
  }
98
100
  },
@@ -110,6 +112,10 @@ export default {
110
112
  },
111
113
  captchaMethod:{type: String},
112
114
  showForgetPassword:{type: String},
115
+ showRememberMe:{
116
+ type: String,
117
+ default: '1'
118
+ },
113
119
  passwordRetrievalMethod:{type: Array},
114
120
  smConfigId:{type: String},
115
121
  templateId:{type: String},
@@ -120,7 +126,7 @@ export default {
120
126
  },
121
127
  data() {
122
128
  return {
123
- ValidNumText: "获取验证码",
129
+ ValidNumText: this.t('login-form.other.get-valid-code'),
124
130
  form: {
125
131
  userName: '',
126
132
  password: '',
@@ -164,20 +170,20 @@ export default {
164
170
  },
165
171
  getVaildCode() {
166
172
  let self = this;
167
- if (self.ValidNumText == "获取验证码") {
168
- self.ValidNumText = self.countDown + "s后再次获取";
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');
169
175
  self.clock = window.setInterval(() => {
170
176
  self.countDown--;
171
- self.ValidNumText = self.countDown + "s后再次获取";
177
+ self.ValidNumText = self.countDown + self.t('login-form.other.get-valid-code-later');
172
178
  if (self.countDown <= 0) {
173
179
  window.clearInterval(self.clock);
174
- self.ValidNumText = "获取验证码";
180
+ self.ValidNumText = self.t('login-form.other.get-valid-code');
175
181
  self.countDown = self.countDownNum;
176
182
  }
177
183
  }, 1000);
178
184
  let param
179
185
  let url
180
- if(self.captchaMethod === '邮箱'){
186
+ if(self.captchaMethod === self.t('login-form.other.captcha-method-mail')){
181
187
  url = config.upmsServerContext + "/anon/user/sendMailForLogin"
182
188
  param = {
183
189
  userId: self.form.userName,
@@ -186,7 +192,7 @@ export default {
186
192
  mailConfigId: self.mailConfigId
187
193
  };
188
194
  }
189
- if(self.captchaMethod === '短信'){
195
+ if(self.captchaMethod === self.t('login-form.other.captcha-method-sms')){
190
196
  url = config.upmsServerContext + "/anon/user/sendSmsForLogin"
191
197
  param = {
192
198
  userId: self.form.userName,
@@ -202,19 +208,19 @@ export default {
202
208
  .then(function(resp) {
203
209
  if (resp.data.code == 200) {
204
210
  self.$Message.success({
205
- content: "发送成功",})
211
+ content: self.t('login-form.other.send-success'),})
206
212
  } else {
207
213
  self.$Message.error(resp.data.data);
208
214
  window.clearInterval(self.clock);
209
- self.ValidNumText = "获取验证码";
215
+ self.ValidNumText = self.t('login-form.other.get-valid-code');
210
216
  self.countDown = self.countDownNum;
211
217
  }
212
218
  }
213
219
  );
214
220
  }else{
215
- self.$Message.error("请输入用户名");
221
+ self.$Message.error(self.t('login-form.box.form-user-name'));
216
222
  window.clearInterval(self.clock);
217
- self.ValidNumText = "获取验证码";
223
+ self.ValidNumText = self.t('login-form.other.get-valid-code');
218
224
  self.countDown = self.countDownNum;
219
225
  }
220
226
  }
@@ -244,15 +250,17 @@ export default {
244
250
  this.clearLocalStorage();
245
251
  }
246
252
  }else{
247
- this.$Message.error("请输入用户名");
253
+ this.$Message.error(this.t('login-form.box.form-user-name'));
248
254
  }
249
255
  },
250
256
  handleSubmit() {
251
257
  this.$refs.loginForm.validate((valid) => {
252
- if(valid && this.captchaMethod == '滑动图片' && !this.isSlideVerify){
253
- this.$Message.error("请点击验证进行登录验证");
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'));
254
261
  }
255
- if (valid && ((this.captchaMethod == '滑动图片' && this.isSlideVerify) || this.captchaMethod != '滑动图片')) {
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'))) {
256
264
  let params = {
257
265
  userName: this.form.userName,
258
266
  password: this.form.password,
@@ -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
  },