@lambo-design/login-form 1.0.0-beta.16 → 1.0.0-beta.18

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.18",
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.287"
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,12 @@ 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";
70
+ import { t } from '@lambo-design/core/src/locale';
69
71
 
70
72
  export default {
71
73
  name: 'LoginForm',
74
+ mixins: [Locale],
72
75
  components:{
73
76
  },
74
77
  props: {
@@ -76,7 +79,7 @@ export default {
76
79
  type: Array,
77
80
  default: () => {
78
81
  return [
79
- {required: true, message: '账号不能为空', trigger: 'blur'}
82
+ {required: true, message: t('login-form.box.form-rule-user-name'), trigger: 'blur'}
80
83
  ]
81
84
  }
82
85
  },
@@ -84,7 +87,7 @@ export default {
84
87
  type: Array,
85
88
  default: () => {
86
89
  return [
87
- {required: true, message: '密码不能为空', trigger: 'blur'}
90
+ {required: true, message: t('login-form.box.form-rule-user-pas'), trigger: 'blur'}
88
91
  ]
89
92
  }
90
93
  },
@@ -92,7 +95,7 @@ export default {
92
95
  type: Array,
93
96
  default: () => {
94
97
  return [
95
- {required: true, message: '验证码不能为空', trigger: 'blur'}
98
+ {required: true, message: t('login-form.box.form-rule-valid-code'), trigger: 'blur'}
96
99
  ]
97
100
  }
98
101
  },
@@ -124,7 +127,7 @@ export default {
124
127
  },
125
128
  data() {
126
129
  return {
127
- ValidNumText: "获取验证码",
130
+ ValidNumText: this.t('login-form.other.get-valid-code'),
128
131
  form: {
129
132
  userName: '',
130
133
  password: '',
@@ -168,20 +171,20 @@ export default {
168
171
  },
169
172
  getVaildCode() {
170
173
  let self = this;
171
- if (self.ValidNumText == "获取验证码") {
172
- self.ValidNumText = self.countDown + "s后再次获取";
174
+ if (self.ValidNumText == self.t('login-form.other.get-valid-code')) {
175
+ self.ValidNumText = self.countDown + self.t('login-form.other.get-valid-code-later');
173
176
  self.clock = window.setInterval(() => {
174
177
  self.countDown--;
175
- self.ValidNumText = self.countDown + "s后再次获取";
178
+ self.ValidNumText = self.countDown + self.t('login-form.other.get-valid-code-later');
176
179
  if (self.countDown <= 0) {
177
180
  window.clearInterval(self.clock);
178
- self.ValidNumText = "获取验证码";
181
+ self.ValidNumText = self.t('login-form.other.get-valid-code');
179
182
  self.countDown = self.countDownNum;
180
183
  }
181
184
  }, 1000);
182
185
  let param
183
186
  let url
184
- if(self.captchaMethod === '邮箱'){
187
+ if(self.captchaMethod === self.t('login-form.other.captcha-method-mail')){
185
188
  url = config.upmsServerContext + "/anon/user/sendMailForLogin"
186
189
  param = {
187
190
  userId: self.form.userName,
@@ -190,7 +193,7 @@ export default {
190
193
  mailConfigId: self.mailConfigId
191
194
  };
192
195
  }
193
- if(self.captchaMethod === '短信'){
196
+ if(self.captchaMethod === self.t('login-form.other.captcha-method-sms')){
194
197
  url = config.upmsServerContext + "/anon/user/sendSmsForLogin"
195
198
  param = {
196
199
  userId: self.form.userName,
@@ -206,19 +209,19 @@ export default {
206
209
  .then(function(resp) {
207
210
  if (resp.data.code == 200) {
208
211
  self.$Message.success({
209
- content: "发送成功",})
212
+ content: self.t('login-form.other.send-success'),})
210
213
  } else {
211
214
  self.$Message.error(resp.data.data);
212
215
  window.clearInterval(self.clock);
213
- self.ValidNumText = "获取验证码";
216
+ self.ValidNumText = self.t('login-form.other.get-valid-code');
214
217
  self.countDown = self.countDownNum;
215
218
  }
216
219
  }
217
220
  );
218
221
  }else{
219
- self.$Message.error("请输入用户名");
222
+ self.$Message.error(self.t('login-form.box.form-user-name'));
220
223
  window.clearInterval(self.clock);
221
- self.ValidNumText = "获取验证码";
224
+ self.ValidNumText = self.t('login-form.other.get-valid-code');
222
225
  self.countDown = self.countDownNum;
223
226
  }
224
227
  }
@@ -248,15 +251,17 @@ export default {
248
251
  this.clearLocalStorage();
249
252
  }
250
253
  }else{
251
- this.$Message.error("请输入用户名");
254
+ this.$Message.error(this.t('login-form.box.form-user-name'));
252
255
  }
253
256
  },
254
257
  handleSubmit() {
255
258
  this.$refs.loginForm.validate((valid) => {
256
- if(valid && this.captchaMethod == '滑动图片' && !this.isSlideVerify){
257
- this.$Message.error("请点击验证进行登录验证");
259
+ if(valid && this.captchaMethod == this.t('login-form.other.captcha-method-slide-image')
260
+ && !this.isSlideVerify){
261
+ this.$Message.error(this.t('login-form.box.form-rule-click-login'));
258
262
  }
259
- if (valid && ((this.captchaMethod == '滑动图片' && this.isSlideVerify) || this.captchaMethod != '滑动图片')) {
263
+ if (valid && ((this.captchaMethod == this.t('login-form.other.captcha-method-slide-image')
264
+ && this.isSlideVerify) || this.captchaMethod != this.t('login-form.other.captcha-method-slide-image'))) {
260
265
  let params = {
261
266
  userName: this.form.userName,
262
267
  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
  },