jufubao-base 1.0.212-beta101 → 1.0.212-beta89

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.212-beta101",
3
+ "version": "1.0.212-beta89",
4
4
  "private": false,
5
5
  "description": "聚福宝业务组件基础插件包",
6
6
  "main": "index.js",
@@ -67,4 +67,14 @@ module.exports = [
67
67
  isConsole: true,
68
68
  disabled: true,
69
69
  },
70
+ {
71
+ mapFnName: "getConOssSign",
72
+ title: "获取上传参数",
73
+ path: "/common-user/v1/h5-oss/sign",
74
+ isRule: false,
75
+ data: {
76
+ },
77
+ isConsole: true,
78
+ disabled: true,
79
+ },
70
80
  ];
@@ -42,51 +42,47 @@
42
42
  placeholder="请输入验证码"
43
43
  type="text"
44
44
  />
45
- <XdButton
45
+ <xd-button
46
46
  :disabled="disabled"
47
47
  class="jfb-base-con-phone__body-wrap-input-code-btn"
48
48
  type="primary"
49
49
  :bg-color="mainColor"
50
50
  size="small"
51
51
  @click="handleSendCode"
52
- >{{ message }}</XdButton
53
- >
52
+ >{{ message }}</xd-button>
54
53
  </view>
55
- <XdButton
54
+ <xd-button
56
55
  type="primary"
57
56
  :bg-color="mainColor"
58
57
  width="360rpx"
59
58
  radius="20rpx"
60
59
  size="small"
61
60
  :disabled="!phoneNumber || !valid_code"
62
- @click="handleConfirm"
63
- >确认领取</XdButton
64
- >
61
+ @click="handleConfirmCheck"
62
+ >确认领取</xd-button>
65
63
  </view>
66
64
  <view v-else class="jfb-base-con-phone__body-wrap-input">
67
65
  <view class="jfb-base-con-phone__body-wrap-input-phone">
68
66
  <view class="jfb-base-con-phone__body-wrap-input-phone-change">
69
67
  <view>当前登录手机号</view>
70
- <XdButton
68
+ <xd-button
71
69
  style="margin: 0"
72
70
  type="primary"
73
71
  :bg-color="mainColor"
74
72
  size="small"
75
73
  @click="showCode = true"
76
- >切换手机号</XdButton
77
- >
74
+ >切换手机号</xd-button>
78
75
  </view>
79
76
  <view>{{ showOhoneNumber }}</view>
80
77
  </view>
81
- <XdButton
78
+ <xd-button
82
79
  type="primary"
83
80
  :bg-color="mainColor"
84
81
  width="360rpx"
85
82
  radius="20rpx"
86
83
  size="medium"
87
- @click="handleConfirm"
88
- >直接领取</XdButton
89
- >
84
+ @click="handleConfirmCheck"
85
+ >直接领取</xd-button>
90
86
  </view>
91
87
  </view>
92
88
  <view
@@ -121,15 +117,28 @@
121
117
  </view>
122
118
  </view>
123
119
  <view
124
- :style="{
125
- height: layoutInfo.bodyMinHeightRpx + 'rpx',
126
- }"
120
+ :style="{height: layoutInfo.bodyMinHeightRpx + 'rpx',}"
127
121
  v-else
128
122
  class="empty_data"
129
123
  >
130
124
  <image :src="emptyBg"></image>
131
- {{ errmessage }}
125
+ <text>{{ errmessage }}</text>
132
126
  </view>
127
+ <!--签名-->
128
+ <xd-dailog :show.sync="dialogShow" title="签名" class="my_dialog">
129
+ <view class="dialog_head">
130
+ <view class="h_main">请签名</view>
131
+ <view class="h_sub">请务必由本人签收,字迹工整</view>
132
+ </view>
133
+ <view class="sign_box">
134
+ <xd-signature ref="signatureRef" v-if="showSignatureRef"></xd-signature>
135
+ </view>
136
+ <view slot="btn" class="btn_wrap">
137
+ <xd-button style="width: 220rpx;" @click="clearSign">重写</xd-button>
138
+ <xd-button style="width: 220rpx;margin-left: 60rpx;" type="primary" @click="submitSign">确定</xd-button>
139
+ </view>
140
+ </xd-dailog>
141
+ <!--签名-->
133
142
  </view>
134
143
  </view>
135
144
  </template>
@@ -145,12 +154,16 @@ import extsMixins from "@/mixins/extsMixins";
145
154
  import { mapState } from "vuex";
146
155
  import colorCardMixins from "@/mixins/colorCardMixins";
147
156
  import getServiceUrl from "@/common/getServiceUrl";
157
+ import XdDailog from "@/components/XdDailog/XdDailog"
158
+ import XdSignature from "@/components/XdSignature/XdSignature"
148
159
 
149
160
  export default {
150
161
  name: "JfbBaseConPhone",
151
162
  components: {
152
163
  XdFontIcon,
153
164
  XdButton,
165
+ XdDailog,
166
+ XdSignature
154
167
  },
155
168
  computed: {
156
169
  ...mapState(["pageBusinessCode"]),
@@ -162,6 +175,8 @@ export default {
162
175
  data() {
163
176
  return {
164
177
  showCode: true,
178
+ phone_signature:'N', //是否需要签名
179
+ phone_signature_url: '', //签名url地址
165
180
  phoneNumber: "", //手机号
166
181
  valid_code: "", //验证码
167
182
  btnOneName: "",
@@ -191,6 +206,11 @@ export default {
191
206
  bottomHeight: "",
192
207
  bottomWidth: "750",
193
208
  showBtn: "N",
209
+
210
+ //签名
211
+ dialogShow: false,
212
+ showSignatureRef: false,
213
+
194
214
  };
195
215
  },
196
216
  watch: {
@@ -210,15 +230,17 @@ export default {
210
230
  },
211
231
  methods: {
212
232
  async onJfbLoad(options) {
213
- await jfbRootExec("getUserPhone", {
233
+ let res = await jfbRootExec("getUserPhone", {
214
234
  vm: this,
215
235
  data: {},
216
- }).then((res) => {
217
- this.showOhoneNumber = res.phone_number;
218
- if (this.showOhoneNumber) {
219
- this.showCode = false;
220
- }
221
236
  });
237
+ //返回信息设置
238
+ this.showOhoneNumber = res.phone_number;
239
+ if (this.showOhoneNumber) {
240
+ this.showCode = false;
241
+ }
242
+
243
+ //参数设置
222
244
  this.options = options;
223
245
  this.activity_id = options.activity_id;
224
246
  this.method = options.distribution_method
@@ -226,6 +248,106 @@ export default {
226
248
  : "phone";
227
249
  await this.getList();
228
250
  },
251
+
252
+ //==签名==========
253
+ clearSign(){
254
+ this.$refs.signatureRef.clear()
255
+ },
256
+ submitSign(){
257
+ this.$refs.signatureRef.canvasToTempFilePath({
258
+ success: async (res) => {
259
+ let url = res.tempFilePath
260
+ if(!res.isEmpty){
261
+ //上传签名图片
262
+ this.$xdShowLoading({});
263
+ this.phone_signature_url = await this.doSubmitSign(url);
264
+ this.$xdHideLoading();
265
+ this.dialogShow = false;
266
+ this.handleConfirm();
267
+ }else{
268
+ uni.showToast({
269
+ title: "签名不能为空",
270
+ icon: "none"
271
+ })
272
+ }
273
+ }
274
+ })
275
+ },
276
+ doSubmitSign(url){
277
+ let fileName = "sign.png";
278
+ let file = null;
279
+ // #ifdef H5
280
+ file = this.base64ToFile(url,fileName);
281
+ // #endif
282
+ return new Promise((resolve,reject) => {
283
+ jfbRootExec("getConOssSign", {
284
+ vm: this,
285
+ data: { name: fileName }
286
+ }).then(res => {
287
+ console.log(res);
288
+ let OSSAccessKeyId = res['id']
289
+ let cdnUrl = res['cdn_url']
290
+ delete res['id']
291
+ delete res['cdn_url']
292
+ // #ifdef H5
293
+ uni.uploadFile({
294
+ url: res.action,
295
+ file: file,
296
+ name: 'file',
297
+ formData: {
298
+ ...res,
299
+ OSSAccessKeyId: OSSAccessKeyId,
300
+ name: fileName,
301
+ cdnUrl: cdnUrl,
302
+ success_action_status: 200
303
+ },
304
+ success: (r) => {
305
+ resolve(`/${res.key}`);
306
+ },
307
+ fail:(err)=>{
308
+ resolve('');
309
+ console.error(err)
310
+ }
311
+ });
312
+ // #endif
313
+ // #ifdef MP-WEIXIN
314
+ wx.uploadFile({
315
+ url: res.action,
316
+ filePath: url,
317
+ name: 'file',
318
+ formData: {
319
+ ...res,
320
+ OSSAccessKeyId: OSSAccessKeyId,
321
+ name: fileName,
322
+ cdnUrl: cdnUrl,
323
+ success_action_status: 200
324
+ },
325
+ success: (res) => {
326
+ resolve(`/${res.key}`);
327
+ },
328
+ fail:(err)=>{
329
+ console.error(err)
330
+ }
331
+ });
332
+ // #endif
333
+ }).catch(err => {
334
+ console.error(err)
335
+ reject();
336
+ })
337
+ })
338
+ },
339
+ base64ToFile(base64String, filename){
340
+ var arr = base64String.split(',');
341
+ var mime = arr[0].match(/:(.*?);/)[1];
342
+ var bstr = atob(arr[1]);
343
+ var n = bstr.length;
344
+ var u8arr = new Uint8Array(n);
345
+ while(n--) {
346
+ u8arr[n] = bstr.charCodeAt(n);
347
+ }
348
+ return new File([u8arr], filename, {type:mime});
349
+ },
350
+ //==签名==========
229
351
  filterSpaces(event) {
230
352
  // 使用replace方法去除用户输入的空格
231
353
  let value = event.target.value.replace(/\s+/g, "");
@@ -239,11 +361,7 @@ export default {
239
361
  const regex = /^1[3-9]\d{9}$/;
240
362
 
241
363
  // 检查输入的手机号是否符合格式
242
- if (phoneNumber.match(regex)) {
243
- return true;
244
- } else {
245
- return false;
246
- }
364
+ return !!phoneNumber.match(regex);
247
365
  },
248
366
  getList() {
249
367
  jfbRootExec("getCouponPhoneList", {
@@ -263,6 +381,7 @@ export default {
263
381
  this.btnTwoName = res.button_name_two;
264
382
  this.btnOneUrl = res.button_url_one;
265
383
  this.btnTwoUrl = res.button_url_two;
384
+ this.phone_signature = res.phone_signature || 'N';
266
385
  let image = await getImageInfo(getServiceUrl(res.background));
267
386
  let image1 = await getImageInfo(getServiceUrl(res.used_background));
268
387
  console.log({ ...image }, "imageimage");
@@ -341,22 +460,33 @@ export default {
341
460
  }
342
461
  }, 1000);
343
462
  },
463
+ handleConfirmCheck(){
464
+ //不需要签名逻辑
465
+ if(this.phone_signature === 'N') {
466
+ this.handleConfirm();
467
+ return
468
+ }
469
+ //开启签名功能
470
+ this.dialogShow = true;
471
+ this.showSignatureRef = true;
472
+
473
+ },
344
474
  handleConfirm() {
475
+ let data = {
476
+ ...this.options,
477
+ distribution_method: this.method,
478
+ namespace: this.pageBusinessCode,
479
+ activity_id: this.activity_id,
480
+ phone: this.showCode ? this.phoneNumber : null,
481
+ valid_code: this.showCode ? this.valid_code : null,
482
+ biz_name: "login",
483
+ }
484
+ if(this.phone_signature === 'Y') data['phone_signature'] = this.phone_signature_url;
345
485
  this.$xdShowLoading({});
346
- jfbRootExec("getAllCouponPhone", {
347
- vm: this,
348
- data: {
349
- ...this.options,
350
- distribution_method: this.method,
351
- namespace: this.pageBusinessCode,
352
- activity_id: this.activity_id,
353
- phone: this.showCode ? this.phoneNumber : null,
354
- valid_code: this.showCode ? this.valid_code : null,
355
- biz_name: "login",
356
- },
357
- })
486
+ jfbRootExec("getAllCouponPhone", {vm: this, data: data})
358
487
  .then((res) => {
359
- if (res.code == 400) {
488
+ //失败状态
489
+ if (res.code === 400) {
360
490
  this.$xdHideLoading();
361
491
  this.$xdAlert({
362
492
  content: res.message,
@@ -367,6 +497,8 @@ export default {
367
497
  this.getList();
368
498
  return;
369
499
  }
500
+
501
+ //成功处理
370
502
  this.order_num = res.tmp_order_number;
371
503
  setTimeout(() => {
372
504
  this.getResult();
@@ -540,5 +672,36 @@ export default {
540
672
  }
541
673
  }
542
674
  }
675
+
676
+ .my_dialog{
677
+ /deep/ .xd-dailog__body-content-box{
678
+ padding: 0;
679
+ }
680
+ .dialog_head{
681
+ display: flex;
682
+ align-items: center;
683
+ justify-content: space-between;
684
+ padding: 48rpx 0;
685
+
686
+ .h_main{
687
+ font-size: 36rpx;
688
+ color: #333333;
689
+ font-weight: 500;
690
+ }
691
+ .h_sub{
692
+ font-size: 24rpx;
693
+ color: #808080;
694
+ font-weight: 400;
695
+ }
696
+ }
697
+ .sign_box{
698
+ width: 600rpx;
699
+ height: 460rpx;
700
+ background-color: #F2F2F2;
701
+ }
702
+ .btn_wrap{
703
+ display: flex;
704
+ }
705
+ }
543
706
  }
544
707
  </style>
@@ -117,7 +117,6 @@ export default {
117
117
  setting: {
118
118
  router: XdBus.getParentApi('getPagesTree'),
119
119
  icons:ICONS,
120
-
121
120
  showField: {
122
121
  path: true,
123
122
  icon: true,
@@ -68,7 +68,6 @@
68
68
  :current="current"
69
69
  circular
70
70
  @animationfinish="handleAnimationfinish"
71
- @change="handleChange"
72
71
  >
73
72
  <swiper-item v-for="(item,index) in info" :key="index" @click.stop="handleClick(item,index)">
74
73
  <image :style="{width: getOneWidth + 'rpx', height: getOneHeight + 'rpx'}" :src="item['image_url']" mode="aspectFill"></image>
@@ -84,7 +83,6 @@
84
83
  :height="getOneHeight + 'rpx'"
85
84
  :interval="carouselTime"
86
85
  @onClickItem="handleClick"
87
- @change="handleChange"
88
86
  @animationfinish="handleAnimationfinish"
89
87
  >
90
88
  <template slot-scope="{ item, index}">
@@ -448,14 +446,7 @@
448
446
  }
449
447
  return temp
450
448
  },
451
-
452
- handleAnimationfinish(e){
453
-
454
- },
455
-
456
- handleChange(e) {
457
- this.current = e.detail.current;
458
-
449
+ handleAnimationfinish(e) {
459
450
  //不支持背景不处理
460
451
  if(this.isSupport==='N') return;
461
452
  console.warn(`handleAnimationfinish.start`)
@@ -478,6 +469,7 @@
478
469
  let bg = null;
479
470
  if(this.currentImage) bg = this.currentImage;
480
471
  this.$xdRoot.$emit("setLayoutPageBg", bg);
472
+ this.current = e.detail.current;
481
473
  }
482
474
  },
483
475
 
@@ -552,7 +544,6 @@
552
544
  }
553
545
  })
554
546
  },
555
-
556
547
  handleOne(list){
557
548
  this.info = this.handleImage(list);
558
549