jufubao-base 1.0.145-beta11 → 1.0.145-beta12

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": "jufubao-base",
3
- "version": "1.0.145-beta11",
3
+ "version": "1.0.145-beta12",
4
4
  "private": false,
5
5
  "description": "聚福宝业务组件基础插件包",
6
6
  "main": "index.js",
@@ -0,0 +1,78 @@
1
+ 'use strict';
2
+
3
+ const ICB_SDK = require('@/common/paysdk/ICB.SDK');
4
+
5
+ class ICB {
6
+ constructor() {
7
+ this.ICB_APP = ICB_SDK;
8
+ this.fail(false)
9
+ }
10
+
11
+ /**
12
+ * @description 获取版本号
13
+ * @return {*}
14
+ */
15
+ version(){
16
+ return this.ICB_APP.elifeVer()
17
+ }
18
+
19
+ fail(notExc=true){
20
+ // if(typeof window.WebViewJavascriptBridge === "undefined"){
21
+ // console.warn('初始化工商银行e生活SDK失败');
22
+ // if(notExc) throw new Error('初始化工商银行e生活SDK失败');
23
+ // }
24
+ }
25
+
26
+ /**
27
+ * @description 获取用户登录方式
28
+ * @param callback {Function} 成功回调函数
29
+ */
30
+ login(callback){
31
+ this.fail();
32
+
33
+ this.ICB_APP.merLogin(callback)
34
+ }
35
+
36
+ /**
37
+ * @description 第三方显示或隐藏tabBar
38
+ * @param show 默认值:true
39
+ */
40
+ showBar(show = true){
41
+ this.fail();
42
+ this.ICB_APP.showToolBar(show);
43
+ }
44
+
45
+ /**
46
+ * @description 第三方返回APP
47
+ */
48
+ back(){
49
+ this.fail();
50
+ this.ICB_APP.back();
51
+ }
52
+
53
+ /**
54
+ * @description 拨打电话
55
+ * @param tel 电话号码
56
+ */
57
+ callPhone(tel){
58
+ if(!tel){
59
+ console.warn(`拨打电话号码不能为空,电话号码:${tel}`);
60
+ throw new Error('拨打电话号码不能为空');
61
+ }
62
+ this.fail();
63
+ this.ICB_APP.callPhoneNumber(tel);
64
+ }
65
+
66
+ /**
67
+ * @description 是否隐藏第三方的头
68
+ * @param show
69
+ */
70
+ showThirdNavigation(show = true){
71
+ this.fail();
72
+ if(show) this.ICB_APP.showThirdWebviewNavigation()
73
+ else this.ICB_APP.hideThirdWebviewNavigation()
74
+ }
75
+
76
+ }
77
+
78
+ module.exports = new ICB();
@@ -394,7 +394,7 @@ export default {
394
394
  flex: none;
395
395
  }
396
396
  }
397
- & > :last-child{
397
+ & > view:last-child{
398
398
  .skeleton-wrap &{
399
399
  .skeleton-item(300rpx);
400
400
  }
@@ -18,7 +18,7 @@
18
18
  <!-- #endif -->
19
19
  <view class="jfb-base-card__body">
20
20
  <view class="jfb-base-card__body-cut">
21
- <template v-if="isWx">
21
+ <template v-if="isQrCode">
22
22
  <view
23
23
  class="jfb-base-card__body-cut-item"
24
24
  @click="handleScan"
@@ -226,10 +226,11 @@ import JfbBaseCardMixin from "./JfbBaseCardMixin";
226
226
  import componentsMixins from "@/mixins/componentsMixins";
227
227
  import extsMixins from "@/mixins/extsMixins";
228
228
  import { mapState, mapActions } from "vuex";
229
- import { getContainerPropsValue, isWechat } from "@/utils/xd.base";
229
+ import { getContainerPropsValue, isWechat,isQrCode } from "@/utils/xd.base";
230
230
  import XdNoticeBar from "@/components/XdNoticeBar/XdNoticeBar";
231
231
  import { Base64 } from "js-base64";
232
232
  const Color = require("color");
233
+
233
234
  export default {
234
235
  name: "JfbBaseCard",
235
236
  components: {
@@ -293,7 +294,7 @@ export default {
293
294
  isPreview: false,
294
295
  noticeStatus: false,
295
296
 
296
- isWx: true,
297
+ isQrCode: true,
297
298
  cutIndex: 1,
298
299
  tabIndex: 1,
299
300
  offsetIndex:0,//第几页
@@ -340,10 +341,9 @@ export default {
340
341
  this.init(this.container);
341
342
  this.noticeBackgroundColor = Color(this.warningColor).alpha(0.2).toString();
342
343
  this.isPreview = this.$configProject.isPreview;
344
+ this.isQrCode = isQrCode(this);
343
345
 
344
346
  //#ifdef H5
345
- this.isWx = this.isPreview || isWechat();
346
-
347
347
  if (!this.$configProject.isPreview) {
348
348
  jfbRootExec("getH5WxAuthorize", {
349
349
  vm: this,
@@ -442,7 +442,7 @@ export default {
442
442
  uni.scanCode({
443
443
  scanType: ["qrCode"],
444
444
  success: (res) => {
445
- let path = this.getUrlCallback(`${this.confirmUrl}?qrcode=${encodeURIComponent(res.resultStr)}`)
445
+ let path = this.getUrlCallback(`${this.confirmUrl}?qrcode=${encodeURIComponent(res.result)}`)
446
446
  this.$xdUniHelper.navigateTo({
447
447
  url: path,
448
448
  });
@@ -21,6 +21,7 @@
21
21
  <view
22
22
  class="scan_icon"
23
23
  @click="doScanCode"
24
+ v-if="isQrCode"
24
25
  >
25
26
  <xd-font-icon icon="iconsaoma1"></xd-font-icon>
26
27
  </view>
@@ -58,7 +59,7 @@
58
59
  import XdButton from "@/components/XdButton/XdButton"
59
60
  import { jfbRootExec } from "@/utils/xd.event";
60
61
  import JfbBaseCardBindV2Mixin from "./JfbBaseCardBindV2Mixin";
61
- import { getContainerPropsValue } from "@/utils/xd.base";
62
+ import { getContainerPropsValue,isQrCode } from "@/utils/xd.base";
62
63
  import componentsMixins from "@/mixins/componentsMixins";
63
64
  import extsMixins from "@/mixins/extsMixins";
64
65
  import { mapState } from "vuex"
@@ -91,6 +92,7 @@
91
92
  validImageAPIUrl: "",
92
93
  backUrl: "",
93
94
  inCallbackUrlOrg:'',//是否带有回调地址
95
+ isQrCode: false,
94
96
  }
95
97
  },
96
98
  watch: {
@@ -99,6 +101,7 @@
99
101
  }
100
102
  },
101
103
  created() {
104
+ this.isQrCode = isQrCode(this)
102
105
  this.init(this.container);
103
106
  this.validImageAPIUrl = this.brandInfo['api_host'] + '/common/v1/valid_code/image/show'
104
107
 
@@ -176,7 +179,6 @@
176
179
  success: res => {
177
180
  let result = res.resultStr;
178
181
  this.cardForm.card_qrcode = result;
179
-
180
182
  jfbRootExec("qrCardBind", {
181
183
  vm: this,
182
184
  data: {
@@ -18,7 +18,7 @@
18
18
  <!-- #endif -->
19
19
  <view class="jfb-base-card-entry__body">
20
20
  <view class="jfb-base-card-entry__body-cut">
21
- <template v-if="isWx">
21
+ <template v-if="isQrCode">
22
22
  <view
23
23
  class="jfb-base-card-entry__body-cut-item"
24
24
  @click="handleScan"
@@ -383,7 +383,7 @@ import extsMixins from "@/mixins/extsMixins";
383
383
  import colorCardMixins from "@/mixins/colorCardMixins";
384
384
  import cardListMixins from "@/mixins/cardListMixins";
385
385
  import { mapState, mapActions } from "vuex";
386
- import { getContainerPropsValue, isWechat } from "@/utils/xd.base";
386
+ import { getContainerPropsValue, isWechat,isQrCode } from "@/utils/xd.base";
387
387
  import XdNoticeBar from "@/components/XdNoticeBar/XdNoticeBar";
388
388
  import { Base64 } from "js-base64";
389
389
  const Color = require("color");
@@ -434,7 +434,6 @@ export default {
434
434
  noticeStatus: false,
435
435
  loadingCardList: true,
436
436
 
437
- isWx: true,
438
437
  cutIndex: 1,
439
438
  tabIndex: 1,
440
439
  isBack: null, //是否使用返回键
@@ -454,6 +453,7 @@ export default {
454
453
  showDisabled: 'Y',
455
454
  showCardList: false,
456
455
  showIndex:false,
456
+ isQrCode: false,
457
457
 
458
458
  //活动
459
459
  dialogEvent: false,
@@ -466,7 +466,7 @@ export default {
466
466
  this.isPreview = this.$configProject.isPreview;
467
467
 
468
468
  //#ifdef H5
469
- this.isWx = this.isPreview || isWechat();
469
+ this.isQrCode = isQrCode(this);
470
470
  if (!this.$configProject.isPreview) {
471
471
  jfbRootExec("getH5WxAuthorize", {
472
472
  vm: this,
@@ -171,7 +171,7 @@ export default {
171
171
  return this.fixedStyle({ height: 0, zIndex: 111 });
172
172
  },
173
173
  isShowBalance(){
174
- if(this.info.is_expired === "Y"){
174
+ if(this.info && this.info.is_expired === "Y"){
175
175
  return this.is_show_balance === "Y";
176
176
  }
177
177
  return true;
@@ -492,6 +492,7 @@ export default {
492
492
  height: unit(320, rpx);
493
493
  display: flex;
494
494
  align-items: center;
495
+ justify-content: center;
495
496
  }
496
497
  }
497
498
  }
@@ -23,6 +23,18 @@ module.exports = [
23
23
  phone_number_collect_url: ['收集手机号地址', 'String', '是'],
24
24
  }
25
25
  },
26
+ {
27
+ mapFnName: 'userBaseLoginIcb',
28
+ title: '工行e生活登录',
29
+ path: '/passport/v1/user/login-icbc',
30
+ isRule: false,
31
+ data: {
32
+ encrypted_params: ['用户登录信息', 'String', '必选'],
33
+ provider_id: ['登录方式id', 'Number', '必选'],
34
+ },
35
+ isConsole: true,
36
+ disabled: true,
37
+ },
26
38
  {
27
39
  mapFnName: 'phoneLogin',
28
40
  title: "手机号登录",
@@ -539,6 +539,18 @@ export default {
539
539
  },
540
540
  inline: false,
541
541
  },
542
-
542
+ {
543
+ label: '小程序手机号授权登录地址:', //label
544
+ ele: 'xd-select-pages-path', //package 名称
545
+ valueKey: 'mpAuthPhoneUrl', //form[valueKey]
546
+ groupKey: 'advanced',
547
+ placeholder: '请选择跳转地址',
548
+ value: null,
549
+ setting: {
550
+ router: XdBus.getParentApi('getPagesTree'),
551
+ },
552
+ notice: "首次快捷登录,将自动跳转至该地址",
553
+ inline: false,
554
+ },
543
555
  ]
544
556
  }
@@ -30,8 +30,7 @@
30
30
  type="primary"
31
31
  radius="20rpx"
32
32
  @click="doLoginAuth"
33
- >快捷登录</xd-button
34
- >
33
+ >{{h5FastLoginName}}</xd-button>
35
34
  <!-- #endif -->
36
35
  <!--#ifdef MP-->
37
36
  <xd-button
@@ -50,8 +49,7 @@
50
49
  type="primary"
51
50
  radius="20rpx"
52
51
  @click="doLoginAccount"
53
- >账号登录
54
- </xd-button>
52
+ >账号登录</xd-button>
55
53
  </view>
56
54
 
57
55
  <view class="protocol">
@@ -98,7 +96,7 @@
98
96
  :border="true"
99
97
  paddingBetween="40"
100
98
  >
101
- <xd-form-item class="form-item" label="手机号" content-align="left">
99
+ <xd-form-item class="form-item" label="手机号" :labelWidth="160" content-align="left">
102
100
  <xd-form-input
103
101
  v-model="accountForm.phone_number"
104
102
  placeholder="请输入11位手机号"
@@ -107,6 +105,7 @@
107
105
  <xd-form-item
108
106
  v-if="accountLoginType === 'phone'"
109
107
  label="验证码"
108
+ :labelWidth="160"
110
109
  content-align="left"
111
110
  >
112
111
  <view class="flex align-center">
@@ -125,6 +124,7 @@
125
124
  <xd-form-item
126
125
  v-if="accountLoginType === 'pwd'"
127
126
  label="密码"
127
+ :labelWidth="160"
128
128
  content-align="left"
129
129
  >
130
130
  <xd-form-input
@@ -217,7 +217,9 @@ import {
217
217
  getAllPath,
218
218
  getDomainAllPath,
219
219
  getLocalJumpOutSiteCallbackUrl,
220
+ isThirdLogin
220
221
  } from "@/utils/xd.base";
222
+ import icb from "@/common/ICB.SDK";
221
223
 
222
224
  export default {
223
225
  name: "JfbBaseLogin",
@@ -236,6 +238,7 @@ export default {
236
238
  //体验模式
237
239
  dialogPreview: false,
238
240
  previewAccout: '',
241
+ h5FastLoginName:'快捷登录',
239
242
 
240
243
  showStep: 1,
241
244
  panel_1_checked: "",
@@ -283,10 +286,11 @@ export default {
283
286
  isDebugPreview: false,
284
287
 
285
288
  isFastLoginStatus: false,
289
+ mpAuthPhoneUrl: "",
286
290
  };
287
291
  },
288
292
  computed: {
289
- ...mapState(["jfbAuthorize","siteInfo"]),
293
+ ...mapState(["jfbAuthorize","siteInfo",'loginParams']),
290
294
  panelIsChecked() {
291
295
  return this.panel_1_checked.includes(1);
292
296
  },
@@ -316,7 +320,7 @@ export default {
316
320
  this.init(this.container);
317
321
  this.base = this.jfbAuthorize.getBasePath(this);
318
322
  this.site_logo = getServiceUrl(this.projectAttr["site_logo"]);
319
- this.$xdLog.setProject('JfbBaseLogin', 'JfbBaseLogin.create.done')
323
+ this.$xdLog.setProject('JfbBaseLogin', 'JfbBaseLogin.create.done');
320
324
  },
321
325
 
322
326
  methods: {
@@ -362,35 +366,20 @@ export default {
362
366
 
363
367
 
364
368
  onJfbLoad(options) {
369
+ this.$xdLog.setProject('JfbBaseLogin', 'JfbBaseLogin.onJfbLoad.start')
365
370
  this.redirect_url = options.redirect_url ? Base64.decode(options.redirect_url): '';
366
371
  this.isDebugPreview = options['x-test'] === 'jfb-tiyan';
367
372
  // #ifdef MP-WEIXIN
368
373
  this.authWxMpListProviders();
369
374
  // #endif
370
- this.$xdLog.setProject('JfbBaseLogin', 'JfbBaseLogin.onJfbLoad.start')
375
+
371
376
  // #ifdef H5
372
- try{
373
- this.authH5ListProviders();
374
- }catch (error) {
377
+ try{ this.authH5ListProviders();}
378
+ catch (error) {
375
379
  this.$xdLog.setProject('JfbBaseLogin', 'JfbBaseLogin.onJfbLoad.error');
376
380
  this.$xdLog.setARMSError(error);
377
381
  }
378
382
  //#endif
379
-
380
- // if (options.isDebug === "1") {
381
- // getAllPath(this, "main/play/index");
382
- // getDomainAllPath(this, "main/play/index");
383
- // getLocalJumpOutSiteCallbackUrl(
384
- // this,
385
- // { customParams: 1 },
386
- // false,
387
- // "main/play/index"
388
- // );
389
- //
390
- // getAllPath(this);
391
- // getDomainAllPath(this);
392
- // getLocalJumpOutSiteCallbackUrl(this, { customParams: 1 }, false);
393
- // }
394
383
  },
395
384
 
396
385
  /**
@@ -415,6 +404,7 @@ export default {
415
404
  this.phone_number_collect_url = getContainerPropsValue(value, "content.phone_number_collect_url", {value: ''}).value;
416
405
  this.forget_pwd_url = getContainerPropsValue(value, "content.forget_pwd_url", {value: ''}).value;
417
406
  this.error_callback_url = getContainerPropsValue(value, "content.error_url", {value: ''}).value;
407
+ this.mpAuthPhoneUrl = getContainerPropsValue(value, "content.mpAuthPhoneUrl", {value: '/system/login/wxauthorize'}).value;
418
408
  this.isPreview = getContainerPropsValue(value, "content.isPreview", 'N');
419
409
  },
420
410
 
@@ -425,6 +415,11 @@ export default {
425
415
  if (res.quick_enabled) {
426
416
  this.hasAuthLogin = true;
427
417
  this.quickLogin = res.quick;
418
+
419
+ //工行处理
420
+ if(this.quickLogin.login_platform_code === 'icbc') {
421
+ this.h5FastLoginName = '工银e生活登录'
422
+ }
428
423
  }
429
424
  if (res.others.length > 0) {
430
425
  this.hasAccountLogin = true;
@@ -482,23 +477,31 @@ export default {
482
477
  },
483
478
  })
484
479
  .then((res) => {
480
+ let { redirect_url, callback_url } = this;
481
+ if (redirect_url)
482
+ redirect_url = redirect_url;
483
+ let url = Base64.encodeURI(
484
+ redirect_url || callback_url || this.settings.index
485
+ );
485
486
  //需要授权操作
486
487
  if (res.auth_code) {
487
- let { redirect_url, callback_url } = this;
488
- if (redirect_url)
489
- redirect_url = redirect_url;
490
- let url = Base64.encodeURI(
491
- redirect_url || callback_url || this.settings.index
492
- );
493
488
  this.$xdUniHelper.navigateTo({
494
- url: `/system/login/wxauthorize?auth_code=${res.auth_code}&provider_id=${this.quickLogin.provider_id}&url=${url}`,
489
+ url: `${this.mpAuthPhoneUrl}?auth_code=${res.auth_code}&provider_id=${this.quickLogin.provider_id}&url=${url}`,
495
490
  });
496
491
  }
497
492
  //无需授权直接进行登录
498
493
  else {
494
+
499
495
  if (this.jfbAuthorize !== null) {
500
496
  this.jfbAuthorize.setAllToken(res["login_info"], () => {
501
- this.toHomeAfterLogin();
497
+ //需要收集手机号码
498
+ if(res.is_collect_phone_number === 'Y'){
499
+ this.$xdUniHelper.navigateTo({
500
+ url: `${this.mpAuthPhoneUrl}?provider_id=${this.quickLogin.provider_id}&url=${url}`,
501
+ });
502
+ }else{
503
+ this.toHomeAfterLogin();
504
+ }
502
505
  });
503
506
  }
504
507
  }
@@ -550,12 +553,12 @@ export default {
550
553
  };
551
554
 
552
555
  this.$xdLog.setProject('JfbBaseLogin', 'JfbBaseLogin.onJfbLoad.loading..');
553
-
554
556
  jfbRootExec("listSiteProvider", {
555
557
  vm: this,
556
558
  data: params,
557
559
  })
558
560
  .then((res) => {
561
+ console.log('listSiteProvider',res)
559
562
  this.handleAuthResult(res);
560
563
  })
561
564
  .catch((error) => {
@@ -603,12 +606,59 @@ export default {
603
606
  setAccountLoginType(type) {
604
607
  this.accountLoginType = type;
605
608
  },
609
+
610
+ /**
611
+ * @description 工行e生活处理
612
+ */
613
+ icbcLogin(){
614
+ //无三方用户登录信息
615
+ if(!this.loginParams) {
616
+ this.status = false;
617
+ console.warn(`无三方用户登录信息`);
618
+ throw new Error('无三方用户登录信息');
619
+ }
620
+
621
+ console.warn(`LoginParams.use: ${this.loginParams}`)
622
+ this.$xdShowLoading({});
623
+ jfbRootExec("userBaseLoginIcb", {
624
+ vm: this,
625
+ data:{
626
+ encrypted_params: this.loginParams,
627
+ provider_id: this.quickLogin.provider_id
628
+ },
629
+ })
630
+ .then(res=>{
631
+ this.$xdHideLoading();
632
+ this.$xdUniHelper.redirectTo({
633
+ url: this.redirect_url || this.$settings.index,
634
+ },false, true);
635
+ })
636
+ .catch(err=>{
637
+ this.$xdHideLoading();
638
+ console.error(err);
639
+ })
640
+ },
641
+
606
642
  //h5授权登录
607
643
  doLoginAuth() {
608
644
  if(this.isFastLoginStatus) return;
609
645
  this.isFastLoginStatus = true;
610
- const { provider_id, login_platform_code, is_redirect, redirect_url } = this.quickLogin;
611
- location.href = redirect_url;
646
+
647
+ //工行处理
648
+ if(this.quickLogin && this.quickLogin.login_platform_code === 'icbc'){
649
+ window['ICBC_SDK']['merLogin']((res)=>{
650
+ console.log('ICBC_SDK',res);
651
+ this.icbcLogin(res)
652
+ })
653
+ return;
654
+ }
655
+
656
+ //跳转到第三方进行授权
657
+ if(this.quickLogin.is_redirect === 'Y') {
658
+ const { redirect_url } = this.quickLogin;
659
+ location.href = redirect_url;
660
+ }
661
+
612
662
  },
613
663
 
614
664
  //小程序授权登录
@@ -707,6 +757,7 @@ export default {
707
757
  });
708
758
  }
709
759
  },
760
+
710
761
  toHomeAfterLogin() {
711
762
  let { redirect_url, callback_url } = this;
712
763
  if (redirect_url) redirect_url = redirect_url;
@@ -767,7 +818,7 @@ export default {
767
818
  padding: 40rpx 70rpx;
768
819
  }
769
820
  .form-item {
770
- /deep/ .uni-forms-item {
821
+ ::v-deep .uni-forms-item {
771
822
  padding-left: unit(30rpx) !important;
772
823
  }
773
824
  }
@@ -777,6 +828,12 @@ export default {
777
828
  margin-right: unit(20,rpx);
778
829
  }
779
830
  .panel-login-auth {
831
+ /deep/ .uni-forms-item__label {
832
+ .label-text {
833
+ font-size: 26rpx;
834
+ color: #a6a6a6;
835
+ }
836
+ }
780
837
  .logo-wrap {
781
838
  text-align: center;
782
839
  margin: unit(165,rpx) 0;
@@ -239,8 +239,8 @@
239
239
  :key="Dindex"
240
240
  class="jfb-base-order-detail__body-delivery-bottom-item"
241
241
  >
242
- <view :style="{width: '130rpx'}">
243
- <text v-html="Ditem.label"></text>
242
+ <view style="width: 130rpx;display: flex;">
243
+ <view v-html="Ditem.label"></view>
244
244
  <text v-if="Ditem.label">:</text>
245
245
  </view>
246
246
  <view v-html="Ditem.value"></view>
@@ -563,10 +563,10 @@
563
563
  class="jfb-base-order-detail__body-order"
564
564
  >
565
565
  <view :style="{ fontWeight: item.style }">
566
- <view
567
- ><text v-html="item.label"></text
568
- ><text v-if="item.label">:</text></view
569
- >
566
+ <view style="display: flex;">
567
+ <view v-html="item.label"></view>
568
+ <text v-if="item.label">:</text>
569
+ </view>
570
570
  <view v-html="item.value"></view>
571
571
  </view>
572
572
  <view
@@ -96,7 +96,7 @@
96
96
  <view
97
97
  class="jfb-base-order-list__body-order-item-content"
98
98
  v-for="(Sitem, Sindex) in item.products"
99
- :key="getKey(Sitem.product_id,Sindex)"
99
+ :key="Sitem.key"
100
100
  v-if="(item['isOpen'] === false && Sindex < showLen) || item['isOpen']">
101
101
  <image
102
102
  :src="Sitem.product_thumb"
@@ -175,7 +175,7 @@
175
175
  class="jfb-base-order-list__body-order-item-pay"
176
176
  v-if="item.buttons.length"
177
177
  >
178
- <view v-for="(btn,index) in item.buttons" :key="btn.action+index">
178
+ <view v-for="(btn,index) in item.buttons" :key="btn.key">
179
179
  <xd-button
180
180
  :type="getBtnType(btn.action)"
181
181
  size="mini"
@@ -457,12 +457,17 @@ export default {
457
457
  console.log(res.list, "list");
458
458
  let list = res.list.map((item) => {
459
459
  item["isOpen"] = false;
460
- item.products = item.products.map((prod) => {
460
+ item.products = item.products.map((prod, i) => {
461
+ prod['key'] = prod.product_id + i;
461
462
  prod["product_thumb"] = prod.product_thumb
462
463
  ? getServiceUrl(prod.product_thumb)
463
464
  : "";
464
465
  return prod;
465
466
  });
467
+ item.buttons = item.buttons.map((btn, i) => {
468
+ btn["key"] = btn.action + i;
469
+ return btn;
470
+ })
466
471
  item["created_time_text"] = this.$xdUniHelper.getDate(
467
472
  item["created_time"] * 1000
468
473
  ).fullTime;
@@ -23,7 +23,7 @@
23
23
  borderRadius: bgRadius + 'rpx'
24
24
  }"
25
25
  >
26
- <four-screen :config="getConfig" :content="info"></four-screen>
26
+ <four-screen style="width: 100%;" :config="getConfig" :content="info"></four-screen>
27
27
  </view>
28
28
 
29
29
  </view>
@@ -17,16 +17,24 @@
17
17
  </view>
18
18
  <!-- #endif -->
19
19
  <view class="jfb-base-search__body" :style="{height:layoutInfo.bodyMinHeightRpx+'rpx'}" v-if="layoutInfo!==null">
20
+ <!--#ifdef H5-->
20
21
  <xd-baidu-search
21
22
  @onSelect="handleSelect"
22
23
  ></xd-baidu-search>
24
+ <!-- #endif -->
25
+
26
+ <!-- #ifdef MP-WEIXIN -->
27
+ base Search
28
+ <!-- #endif -->
23
29
  </view>
24
30
  </view>
25
31
  </template>
26
32
 
27
33
  <script>
28
34
  import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
35
+ // #ifdef H5
29
36
  import XdBaiduSearch from "./XdBaiduSearch";
37
+ // #endif
30
38
  import {jfbRootExec} from "@/utils/xd.event";
31
39
  import JfbBaseSearchMixin from "./JfbBaseSearchMixin";
32
40
  import componentsMixins from "@/mixins/componentsMixins";
@@ -37,7 +45,9 @@
37
45
  name: "JfbBaseSearch",
38
46
  components: {
39
47
  XdFontIcon,
40
- XdBaiduSearch
48
+ // #ifdef H5
49
+ XdBaiduSearch,
50
+ // #endif
41
51
  },
42
52
  mixins: [componentsMixins,extsMixins,JfbBaseSearchMixin],
43
53
  data() {
@@ -18,6 +18,19 @@ module.exports = [
18
18
  isConsole: true,
19
19
  disable: true,
20
20
  },
21
+ {
22
+ mapFnName: 'userPhoneCollect',
23
+ title: "收集手机号",
24
+ path: "/passport/v1/user/collect-phone-number",
25
+ isRule: false,
26
+ data: {
27
+ phone_number: ['手机号', 'String', null], //手机号
28
+ verification_code: ['手机验证码', 'String', null],
29
+ provider_id: ['登录方式id', 'Number', '必选'],
30
+ },
31
+ isConsole: true,
32
+ disable: true,
33
+ },
21
34
  {
22
35
  mapFnName: "getContentInfo",
23
36
  title: "获取内容列表",
@@ -19,6 +19,26 @@ export default {
19
19
  placeholder: '请选择文字颜色',
20
20
  classNmae: 'input80',
21
21
  },
22
+ {
23
+ abel: '授权收集手机号按钮文案:',
24
+ ele: 'el-input',
25
+ type: 'text',
26
+ valueKey: 'btnCollectPhoneText',
27
+ groupKey:'content',
28
+ value: data.btnCollectPhoneText || "授权手机号",
29
+ placeholder: '请输入授权收集手机号按钮文案',
30
+ className: 'input80',
31
+ },
32
+ {
33
+ abel: '授权登录按钮文案:',
34
+ ele: 'el-input',
35
+ type: 'text',
36
+ valueKey: 'btnLoginText',
37
+ groupKey:'content',
38
+ value: data.btnLoginText || "微信授权登录",
39
+ placeholder: '请输入授权按钮文案',
40
+ className: 'input80',
41
+ },
22
42
  {
23
43
  label: '授权按钮下面文案:',
24
44
  ele: 'el-input',
@@ -24,6 +24,7 @@
24
24
  }"
25
25
  >
26
26
  </view>
27
+ <view v-if="!auth_code" class="app-body__jump" @click="doJump">跳过</view>
27
28
  <view class="app-body__bottom">
28
29
  <view class="app-body__bottom-btn">
29
30
  <button
@@ -35,7 +36,7 @@
35
36
  boxShadow: '0 5rpx 10rpx ' + mainColor
36
37
  }"
37
38
  @getphonenumber="decryptPhoneNumber"
38
- >微信授权登录</button>
39
+ >{{ authBtnText }}</button>
39
40
  <button
40
41
  v-else
41
42
  @click="decryptPhoneNumber()"
@@ -43,7 +44,7 @@
43
44
  background: mainColor,
44
45
  boxShadow: '0 5rpx 10rpx ' + mainColor
45
46
  }"
46
- >微信授权登录</button>
47
+ >{{ authBtnText }}</button>
47
48
  </view>
48
49
  <view class="app-body__bottom-tips" v-if="notice" v-html="notice" :style="{color: textColor}"></view>
49
50
  <view class="app-body__bottom-policy">
@@ -87,7 +88,7 @@
87
88
  return {
88
89
  isPreview: false,
89
90
  selectPolicy: false,
90
- auth_code: null,
91
+ auth_code: null, //有值说明未关联
91
92
  provider_id:null,
92
93
  nextUrl: null,
93
94
  showDialog: false,
@@ -98,11 +99,16 @@
98
99
  //面板
99
100
  bgImage: '', //背景图片
100
101
  notice: '', //授权按钮下面文案
101
- textColor: '#fff'
102
+ textColor: '#fff',
103
+ btnLoginText: "", //授权按钮文案
104
+ btnCollectPhoneText: "", //授权收集手机号按钮文案
102
105
  }
103
106
  },
104
107
  computed:{
105
108
  ...mapState(['jfbAuthorize']),
109
+ authBtnText(){
110
+ return this.auth_code ? this.btnLoginText : this.btnCollectPhoneText;
111
+ }
106
112
  },
107
113
  watch: {
108
114
  container(value) {
@@ -127,6 +133,14 @@
127
133
  this.selectPolicy = !this.selectPolicy;
128
134
  },
129
135
 
136
+ doJump(){
137
+ if(!this.auth_code){
138
+ this.$xdUniHelper.redirectTo({
139
+ url: this.nextUrl
140
+ })
141
+ }
142
+ },
143
+
130
144
  decryptPhoneNumber(e) {
131
145
  if (e === undefined) {
132
146
  this.$xdConfirm({
@@ -146,6 +160,18 @@
146
160
  let {iv, encryptedData} = e.detail;
147
161
  let raw_data = JSON.stringify({iv, encryptedData});
148
162
 
163
+ //auth_code 临时授权码,走授权登录。 否则走授权收集手机号
164
+ if(this.auth_code){
165
+ this.p_userPhoneWxLogin(raw_data)
166
+ }else{
167
+ this.p_userPhoneCollect(raw_data)
168
+ }
169
+ },
170
+
171
+ /**
172
+ * @description 授权登录
173
+ */
174
+ p_userPhoneWxLogin(raw_data){
149
175
  jfbRootExec("userPhoneWxLogin", {
150
176
  vm: this,
151
177
  data: {
@@ -183,9 +209,30 @@
183
209
  zIndex: this.isPreview ? 2000 : 1400
184
210
  });
185
211
  })
186
-
187
212
  },
188
213
 
214
+ /**
215
+ * @description 授权收集手机号
216
+ */
217
+ p_userPhoneCollect(raw_data){
218
+ uni.login({
219
+ provider: "weixin",
220
+ success: (loginRes) => {
221
+ jfbRootExec("userPhoneCollect", {
222
+ vm: this,
223
+ data: {
224
+ raw_data,
225
+ third_auth_code: loginRes.code,
226
+ provider_id: this.provider_id,
227
+ }
228
+ }).then(res => {
229
+ this.$xdUniHelper.redirectTo({
230
+ url: this.nextUrl
231
+ })
232
+ })
233
+ }
234
+ })
235
+ },
189
236
 
190
237
  /**
191
238
  * @description 监听事件变化
@@ -195,6 +242,8 @@
195
242
  let bgImage = getContainerPropsValue(container, 'content.bgImage', {});
196
243
  if(bgImage.url) this.bgImage = getServiceUrl(bgImage.url);
197
244
  this.notice = getContainerPropsValue(container, 'content.notice', '');
245
+ this.btnLoginText = getContainerPropsValue(container, 'content.btnLoginText', '微信授权登录');
246
+ this.btnCollectPhoneText = getContainerPropsValue(container, 'content.btnCollectPhoneText', '获取手机号');
198
247
  this.textColor = getContainerPropsValue(container, 'content.textColor', '#fff');
199
248
  },
200
249
 
@@ -242,6 +291,12 @@
242
291
 
243
292
  }
244
293
 
294
+ &__jump {
295
+ position: absolute;
296
+ top: 40rpx;
297
+ right: 40rpx;
298
+ }
299
+
245
300
  &__bottom {
246
301
  position: absolute;
247
302
  bottom: unit(80, rpx);