@lambo-design/login-form 1.0.0-beta.16 → 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.16",
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/shared": "^1.0.0-beta.285",
14
- "@lambo-design/core": "^4.7.1-beta.167"
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-if="showRememberMe === '1'" 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
  },
@@ -124,7 +126,7 @@ export default {
124
126
  },
125
127
  data() {
126
128
  return {
127
- ValidNumText: "获取验证码",
129
+ ValidNumText: this.t('login-form.other.get-valid-code'),
128
130
  form: {
129
131
  userName: '',
130
132
  password: '',
@@ -168,20 +170,20 @@ export default {
168
170
  },
169
171
  getVaildCode() {
170
172
  let self = this;
171
- if (self.ValidNumText == "获取验证码") {
172
- 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');
173
175
  self.clock = window.setInterval(() => {
174
176
  self.countDown--;
175
- self.ValidNumText = self.countDown + "s后再次获取";
177
+ self.ValidNumText = self.countDown + self.t('login-form.other.get-valid-code-later');
176
178
  if (self.countDown <= 0) {
177
179
  window.clearInterval(self.clock);
178
- self.ValidNumText = "获取验证码";
180
+ self.ValidNumText = self.t('login-form.other.get-valid-code');
179
181
  self.countDown = self.countDownNum;
180
182
  }
181
183
  }, 1000);
182
184
  let param
183
185
  let url
184
- if(self.captchaMethod === '邮箱'){
186
+ if(self.captchaMethod === self.t('login-form.other.captcha-method-mail')){
185
187
  url = config.upmsServerContext + "/anon/user/sendMailForLogin"
186
188
  param = {
187
189
  userId: self.form.userName,
@@ -190,7 +192,7 @@ export default {
190
192
  mailConfigId: self.mailConfigId
191
193
  };
192
194
  }
193
- if(self.captchaMethod === '短信'){
195
+ if(self.captchaMethod === self.t('login-form.other.captcha-method-sms')){
194
196
  url = config.upmsServerContext + "/anon/user/sendSmsForLogin"
195
197
  param = {
196
198
  userId: self.form.userName,
@@ -206,19 +208,19 @@ export default {
206
208
  .then(function(resp) {
207
209
  if (resp.data.code == 200) {
208
210
  self.$Message.success({
209
- content: "发送成功",})
211
+ content: self.t('login-form.other.send-success'),})
210
212
  } else {
211
213
  self.$Message.error(resp.data.data);
212
214
  window.clearInterval(self.clock);
213
- self.ValidNumText = "获取验证码";
215
+ self.ValidNumText = self.t('login-form.other.get-valid-code');
214
216
  self.countDown = self.countDownNum;
215
217
  }
216
218
  }
217
219
  );
218
220
  }else{
219
- self.$Message.error("请输入用户名");
221
+ self.$Message.error(self.t('login-form.box.form-user-name'));
220
222
  window.clearInterval(self.clock);
221
- self.ValidNumText = "获取验证码";
223
+ self.ValidNumText = self.t('login-form.other.get-valid-code');
222
224
  self.countDown = self.countDownNum;
223
225
  }
224
226
  }
@@ -248,15 +250,17 @@ export default {
248
250
  this.clearLocalStorage();
249
251
  }
250
252
  }else{
251
- this.$Message.error("请输入用户名");
253
+ this.$Message.error(this.t('login-form.box.form-user-name'));
252
254
  }
253
255
  },
254
256
  handleSubmit() {
255
257
  this.$refs.loginForm.validate((valid) => {
256
- if(valid && this.captchaMethod == '滑动图片' && !this.isSlideVerify){
257
- 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'));
258
261
  }
259
- 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'))) {
260
264
  let params = {
261
265
  userName: this.form.userName,
262
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
  },