@lambo-design/login-form 1.0.0-beta.34 → 1.0.0-beta.39

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.34",
3
+ "version": "1.0.0-beta.39",
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.175",
14
- "@lambo-design/shared": "^1.0.0-beta.339"
13
+ "@lambo-design/shared": "^1.0.0-beta.364",
14
+ "@lambo-design/core": "^4.7.1-beta.178"
15
15
  },
16
16
  "scripts": {
17
17
  "release": "pnpm release-beta && git push --follow-tags && pnpm re-publish",
@@ -51,6 +51,9 @@
51
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
+ <FormItem v-if="captchaMethod === '文字点选' || captchaMethod === '语序点选' || captchaMethod === '旋转验证码'">
55
+ <Button long :disabled="isDisabled" @click="showWordClickVerify">{{ buttonText }}</Button>
56
+ </FormItem>
54
57
  <FormItem v-if="captchaMethod === t('login-form.other.captcha-method-message-center') && channelDataList.length > 0 && channelDataList.length !== 1">
55
58
  <span class="login-method-label">请选择登录验证方式</span>
56
59
  <ButtonGroup style="display: flex;">
@@ -135,6 +138,7 @@ export default {
135
138
  templateId:{type: String},
136
139
  mailConfigId:{type: String},
137
140
  isSlideVerify:{type: Boolean},
141
+ isWordClickVerify:{type: Boolean},
138
142
  buttonText: {type:String}, // 初始按钮文本
139
143
  isDisabled: {type:Boolean},
140
144
  channelDataList:{
@@ -285,6 +289,34 @@ export default {
285
289
  this.$Message.error(this.t('login-form.box.form-user-name'));
286
290
  }
287
291
  },
292
+ showWordClickVerify(){
293
+ if (this.form.userName && this.form.userName.trim().length > 0){
294
+ let params = {
295
+ userName: this.form.userName,
296
+ password: this.form.password,
297
+ validCodeInput: this.form.validCode,
298
+ validCodeId: this.validCodeId
299
+ }
300
+ if (this.pasCryptor) {
301
+ params.pasCryptor = this.pasCryptor;
302
+ params.pasEncode = this.getCryptorPassword(this.form.password,this.form.validCode,this.pasCryptor);
303
+ } else {
304
+ params.pasMd5 = this.getCryptorPassword(this.form.password,this.form.validCode,'md5');
305
+ params.pasSm3 = this.getCryptorPassword(this.form.password,this.form.validCode,'sm3');
306
+ }
307
+ this.$emit('show-word-click-verify', true, params, this.captchaMethod)
308
+
309
+ this.setLocalUserId(this.form.userName)
310
+ if (this.rememberMe == true) {
311
+ this.setLocalStorage(this.form.userName)
312
+ }
313
+ if (this.rememberMe == false) {
314
+ this.clearLocalStorage();
315
+ }
316
+ }else{
317
+ this.$Message.error(this.t('login-form.box.form-user-name'));
318
+ }
319
+ },
288
320
  handleSubmit() {
289
321
  this.$refs.loginForm.validate((valid) => {
290
322
  if (this.captchaMethod === this.t('login-form.other.captcha-method-message-center') && !this.selectedLoginMethod) {
@@ -295,8 +327,13 @@ export default {
295
327
  && !this.isSlideVerify){
296
328
  this.$Message.error(this.t('login-form.box.form-rule-click-login'));
297
329
  }
330
+ const isWordClickMethod = this.captchaMethod === '文字点选' || this.captchaMethod === '语序点选' || this.captchaMethod === '旋转验证码'
331
+ if(valid && isWordClickMethod && !this.isWordClickVerify){
332
+ this.$Message.error(this.t('login-form.box.form-rule-click-login'));
333
+ }
298
334
  if (valid && ((this.captchaMethod == this.t('login-form.other.captcha-method-slide-image')
299
- && this.isSlideVerify) || this.captchaMethod != this.t('login-form.other.captcha-method-slide-image'))) {
335
+ && this.isSlideVerify) || (isWordClickMethod && this.isWordClickVerify)
336
+ || (!isWordClickMethod && this.captchaMethod != this.t('login-form.other.captcha-method-slide-image')))) {
300
337
  let params = {
301
338
  userName: this.form.userName,
302
339
  password: this.form.password,
@@ -340,6 +377,11 @@ export default {
340
377
  mounted() {
341
378
  this.getCaptcha();
342
379
  this.getLocalStorage();
380
+ // 新增:初始化时检查 channelDataList
381
+ if (this.channelDataList && this.channelDataList.length > 0 && !this.selectedLoginMethod) {
382
+ this.selectedLoginMethod = this.channelDataList[0].channelName;
383
+ this.$emit('login-method-change', this.selectedLoginMethod);
384
+ }
343
385
  }
344
386
  }
345
387
  </script>
package/src/login-qr.vue CHANGED
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="lambo-login-qrcode">
2
+ <div class="lambo-login-qrcode" :class="wxQrClass">
3
3
  <!-- 二维码加载状态 -->
4
4
  <div v-if="loading" class="qrcode-loading">
5
5
  <Icon type="ios-loading" size="24" spin></Icon>
@@ -60,6 +60,22 @@ export default {
60
60
  qrType:{
61
61
  type: Array,
62
62
  default: ['0','1']
63
+ },
64
+ // 企业微信登录模式: 'saas' (SaaS版) 或 'private' (私有化版)
65
+ wxLoginMode: {
66
+ type: String,
67
+ default: 'saas',
68
+ validator: (value) => ['saas', 'private'].includes(value)
69
+ },
70
+ // 私有化版本配置(当 wxLoginMode 为 'private' 时使用)
71
+ privateWxConfig: {
72
+ type: Object,
73
+ default: () => ({
74
+ appId: '',
75
+ agentId: '',
76
+ redirectUri: '',
77
+ sdkUrl: ''
78
+ })
63
79
  }
64
80
  },
65
81
  data() {
@@ -80,6 +96,9 @@ export default {
80
96
  },
81
97
  isDd(){
82
98
  return _.some(this.qrType, (item) => item ==='1');
99
+ },
100
+ wxQrClass() {
101
+ return this.wxLoginMode === 'private' ? 'wx-private' : ''
83
102
  }
84
103
  },
85
104
  mounted() {
@@ -93,12 +112,19 @@ export default {
93
112
  methods: {
94
113
  loadWxWorkSdk() {
95
114
  return new Promise((resolve) => {
96
- if (typeof ww !== 'undefined') {
115
+ if (typeof ww !== 'undefined' || typeof WwLogin !== 'undefined') {
97
116
  resolve();
98
117
  return;
99
118
  }
100
119
  const script = document.createElement('script');
101
- script.src = 'https://wwcdn.weixin.qq.com/node/open/js/wecom-jssdk-2.3.3.js';
120
+ // 根据登录模式选择不同的SDK
121
+ if (this.wxLoginMode === 'private') {
122
+ // 私有化版本SDK,优先使用传入的地址
123
+ script.src = this.privateWxConfig.sdkUrl;
124
+ } else {
125
+ // SaaS版本SDK
126
+ script.src = 'https://wwcdn.weixin.qq.com/node/open/js/wecom-jssdk-2.3.3.js';
127
+ }
102
128
  script.onload = resolve;
103
129
  document.head.appendChild(script);
104
130
  });
@@ -126,10 +152,39 @@ export default {
126
152
  if (!document.getElementById('ww_login') || this.wwLoginInstance) {
127
153
  return;
128
154
  }
129
- let appId
130
- let agentId
131
- let res =await ajax.get(config.authServerContext + '/sso/wxcp/getWxInfo')
132
- if(res.data.code === 1){
155
+
156
+ if (this.wxLoginMode === 'private') {
157
+ // 私有化版本初始化
158
+ await this.initPrivateWwLogin();
159
+ } else {
160
+ // SaaS版本初始化
161
+ await this.initSaasWwLogin();
162
+ }
163
+ },
164
+
165
+ // 私有化版本企业微信登录初始化
166
+ async initPrivateWwLogin() {
167
+ try {
168
+ this.wwLoginInstance = window.WwLogin({
169
+ "id": "ww_login",
170
+ "appid": this.privateWxConfig.appId,
171
+ "agentid": this.privateWxConfig.agentId,
172
+ "redirect_uri": this.privateWxConfig.redirectUri,
173
+ "state": 'state_' + Date.now(),
174
+ "href": ""
175
+ });
176
+ console.log('✅ 私有化企业微信登录组件初始化成功');
177
+ } catch (error) {
178
+ console.error('❌ 初始化私有化企业微信登录组件失败:', error);
179
+ }
180
+ },
181
+
182
+ // SaaS版本企业微信登录初始化
183
+ async initSaasWwLogin() {
184
+ let appId;
185
+ let agentId;
186
+ let res = await ajax.get(config.authServerContext + '/sso/wxcp/getWxInfo');
187
+ if (res.data.code === 1) {
133
188
  appId = res.data.data.appId;
134
189
  agentId = res.data.data.agentId;
135
190
  }
@@ -150,9 +205,9 @@ export default {
150
205
  onLoginSuccess: this.handleLoginSuccess,
151
206
  onLoginFail: this.handleLoginFail
152
207
  });
153
- console.log('✅ 企业微信登录组件初始化成功');
208
+ console.log('✅ SaaS企业微信登录组件初始化成功');
154
209
  } catch (error) {
155
- console.error('❌ 初始化企业微信登录组件失败:', error);
210
+ console.error('❌ 初始化SaaS企业微信登录组件失败:', error);
156
211
  }
157
212
  },
158
213
  handleLoginSuccess({ code }) {
@@ -437,13 +492,50 @@ export default {
437
492
 
438
493
 
439
494
  /* 企业微信登录组件容器 */
440
- #ww_login {
441
- width: 100% !important;
442
- max-width: 220px !important;
443
- margin: 0 auto !important;
444
- display: block !important;
495
+ .wx-saas {
496
+ #ww_login {
497
+ width: 100% !important;
498
+ max-width: 220px !important;
499
+ margin: 0 auto !important;
500
+ display: block !important;
501
+ }
502
+ .lambo-login-qrcode ::v-deep #ww_login iframe,
503
+ .qrcode-img-wrapper ::v-deep iframe {
504
+ position: relative;
505
+ top: -60px !important;
506
+ height: 360px !important;
507
+ border: none !important;
508
+ width: 100% !important;
509
+ overflow: hidden !important;
510
+ }
445
511
  }
512
+ .wx-private {
513
+ #ww_login {
514
+ width: 100% !important;
515
+ margin: 0 auto !important;
516
+ display: block !important;
517
+ }
518
+ .lambo-login-qrcode ::v-deep #ww_login iframe,
519
+ .qrcode-img-wrapper ::v-deep iframe {
520
+ position: relative;
521
+ top: 25px !important;
522
+ height: 400px !important;
523
+ border: none !important;
524
+ width: 100% !important;
525
+ overflow: hidden !important;
526
+ }
446
527
 
528
+ .qrcode-img-wrapper {
529
+ height: 400px !important;
530
+ min-height: 260px !important;
531
+ display: flex;
532
+ justify-content: center;
533
+ align-items: center;
534
+ overflow: hidden;
535
+ width: 100%;
536
+ position: relative;
537
+ }
538
+ }
447
539
  /* 钉钉登录组件容器 */
448
540
  #dingtalk_login {
449
541
  width: 100% !important;
@@ -454,16 +546,6 @@ export default {
454
546
  overflow: hidden;
455
547
  }
456
548
 
457
- .lambo-login-qrcode ::v-deep #ww_login iframe,
458
- .qrcode-img-wrapper ::v-deep iframe {
459
- position: relative;
460
- top: -60px !important;
461
- height: 360px !important;
462
- border: none !important;
463
- width: 100% !important;
464
- overflow: hidden !important;
465
- }
466
-
467
549
  /* 钉钉iframe样式 - 减少上方留白 */
468
550
  .lambo-login-qrcode ::v-deep #dingtalk_login iframe,
469
551
  .qrcode-img-wrapper ::v-deep iframe {