jufubao-base 1.0.233-beta1 → 1.0.233-beta2

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.233-beta1",
3
+ "version": "1.0.233-beta2",
4
4
  "private": false,
5
5
  "description": "聚福宝业务组件基础插件包",
6
6
  "main": "index.js",
@@ -68,10 +68,10 @@ export default {
68
68
  defaultValue: data.shareDownloadImage || null, //默认图片对象
69
69
  groupKey: "style",
70
70
  slot: true, //按钮是否使用slot
71
- oneWidth: 200, //单个图片显示宽度
72
- oneHeight: 200, //单个图片显示高度
71
+ oneWidth: 218, //单个图片显示宽度
72
+ oneHeight: 323, //单个图片显示高度
73
73
  elinputClassName: 'input40',
74
- tipsformet: '上传文件格式:@imageType@,不超过@size@MB.',
74
+ tipsformet: '上传文件格式:@imageType@,不超过@size@MB.建议尺寸:654*968px.',
75
75
  type: ['jpg', 'png', 'jpeg'],
76
76
  styleType: 'one', //其值:one=>单文件上传 auth=>证件正反面上传 list=>多文件上传
77
77
  uploadType: 'aliyun', //''=>API服务上传 qiniu=>七牛云OSS上传 aliyun=> 阿里云OSS上传
@@ -153,9 +153,10 @@
153
153
  <view class="share_card_dialog" v-show="showShareCard">
154
154
  <view class="share_modal" @click="showShareCard=false"></view>
155
155
  <view class="share_content">
156
- <canvas canvas-id="shareCanvas" id="shareCanvas" style="width: 654rpx; height: 968rpx;" ></canvas>
156
+ <image :src="canvasUrl" v-if="canvasUrl" class="share_img" style="width: 654rpx; height: 968rpx;"></image>
157
157
  </view>
158
158
  </view>
159
+ <canvas class="renderCanvas" canvas-id="shareCanvas" id="shareCanvas" style="width: 654rpx; height: 968rpx;" ></canvas>
159
160
  </view>
160
161
  </view>
161
162
  </template>
@@ -197,6 +198,7 @@ export default {
197
198
  showShareDialog: true,
198
199
  imageCache: {},
199
200
  showShareCard: false,
201
+ canvasUrl: "",
200
202
  };
201
203
  },
202
204
  computed: {
@@ -224,19 +226,30 @@ export default {
224
226
  async onJfbLoad(options) {
225
227
  this.card_number = options.card_number;
226
228
  await this.getDetail();
227
- console.log("rpxNum", this.$rpxNum)
228
- setTimeout(()=>{
229
- this.toSetShareImg('123123123123123');
230
- },1000)
229
+
230
+
231
231
  },
232
- async toSetShareImg(url){
232
+ async toSetShareImg(){
233
+ // if(this.info.transfer_record && this.info.transfer_record.transfer_auth_code){
234
+ // let url = `${document.location.origin}/${this.projectAttr.deploy_dir}${this.get_url}?transfer_auth_code=${this.info.transfer_record.transfer_auth_code}`;
235
+ // let ctx = uni.createCanvasContext("shareCanvas");
236
+ // console.log(ctx);
237
+ // ctx.save();
238
+ // ctx.drawImage(this.shareDownloadImage, 0, 0, 654*this.$rpxNum, 968*this.$rpxNum);
239
+ // ctx.restore();
240
+
241
+ // let qrImg = this.brandInfo['api_host'] + `/common/v1/image/qrcode?code_content=${url}`
242
+ // ctx.drawImage(qrImg, 200*this.$rpxNum, 500*this.$rpxNum, 250*this.$rpxNum, 250*this.$rpxNum);
243
+ // ctx.draw();
244
+ // }
245
+ let url = `123`;
233
246
  let ctx = uni.createCanvasContext("shareCanvas");
234
247
  console.log(ctx);
235
248
  ctx.save();
236
249
  ctx.drawImage(this.shareDownloadImage, 0, 0, 654*this.$rpxNum, 968*this.$rpxNum);
237
250
  ctx.restore();
238
251
 
239
- let qrImg = this.brandInfo['api_host'] + `/common/v1/image/qrcode?code_content=${123123123123123}`
252
+ let qrImg = this.brandInfo['api_host'] + `/common/v1/image/qrcode?code_content=${url}`
240
253
  ctx.drawImage(qrImg, 200*this.$rpxNum, 500*this.$rpxNum, 250*this.$rpxNum, 250*this.$rpxNum);
241
254
  ctx.draw();
242
255
  },
@@ -273,6 +286,9 @@ export default {
273
286
  return this.info.business_codes.includes(item.business_code);
274
287
  });
275
288
  }
289
+ setTimeout(() => {
290
+ this.toSetShareImg()
291
+ }, 300);
276
292
  })
277
293
  .catch((err) => {
278
294
  this.$xdHideLoading({});
@@ -362,8 +378,21 @@ export default {
362
378
  handleShare() {
363
379
  //#ifdef H5
364
380
  let share = `${document.location.origin}/${this.projectAttr.deploy_dir}${this.get_url}?transfer_auth_code=${this.info.transfer_record.transfer_auth_code}`;
365
- this.toSetShareImg(share)
366
381
  this.showShareCard = true;
382
+ if(this.canvasUrl) return;
383
+ this.$nextTick(() => {
384
+ uni.canvasToTempFilePath({
385
+ canvasId: "shareCanvas",
386
+ success: (res) => {
387
+ this.canvasUrl = res.tempFilePath;
388
+ console.log(res, 'canvasUrl');
389
+ },
390
+ fail: (err) => {
391
+ this.$xdHideLoading({});
392
+ console.log(err);
393
+ },
394
+ })
395
+ })
367
396
  // #endif
368
397
  // #ifdef MP-WEIXIN
369
398
  this.setShareInfo({
@@ -392,6 +421,10 @@ export default {
392
421
  &__body {
393
422
  padding: 28rpx;
394
423
  color: #333;
424
+ .renderCanvas{
425
+ position: fixed;
426
+ bottom: -999999px;
427
+ }
395
428
  .share_card_dialog{
396
429
  .share_modal{
397
430
  width: 100vh;
@@ -408,6 +441,11 @@ export default {
408
441
  top: 50%;
409
442
  left: 50%;
410
443
  transform: translate(-50%, -50%);
444
+ .share_img{
445
+ position: absolute;
446
+ top: 0;
447
+ left: 0;
448
+ }
411
449
  }
412
450
  }
413
451
  .qrcode_card {
@@ -37,6 +37,8 @@ export default {
37
37
  //图片高度= 上下内边距 + 单个内容高度*行数 + 指示器高度
38
38
  //图片宽度= 750 - 左右外边距
39
39
  let outWidth = 750;
40
+ if(!params.margin) params.margin = {};
41
+ if(!params.contentPadding) params.contentPadding = {};
40
42
  let marginLeft = params.margin.left || 0;
41
43
  let marginRight = params.margin.right || 0;
42
44
  let paddingLeft = params.contentPadding.left || 0;
@@ -82,6 +82,7 @@
82
82
  contentPadding:{},
83
83
  bgColor:'rgba(0,0,0,0)',
84
84
  bgRadius: 0,
85
+ bgImage: "",
85
86
  }
86
87
  },
87
88
  computed: {
@@ -192,6 +193,7 @@
192
193
  margin: this.getMarginAndPadding(this.margin, 0),
193
194
  padding:this.getMarginAndPadding(this.contentPadding, 0),
194
195
  backgroundColor: this.bgColor,
196
+ backgroundImage: this.bgImage ? `url(${getServiceUrl(this.bgImage)})` : '',
195
197
  borderRadius: this.bgRadius + 'rpx'
196
198
  }
197
199
  }
@@ -273,6 +275,7 @@
273
275
 
274
276
  //样式设置
275
277
  this.bgColor = getContainerPropsValue(container, 'content.bgColor','rgba(0,0,0,0)');
278
+ this.bgImage = getServiceUrl(getContainerPropsValue(container, 'content.bgImage', {url: ""}).url)
276
279
  this.bgRadius = getContainerPropsValue(container, 'content.bgRadius', '0');
277
280
  this.contentPadding = getContainerPropsValue(container, 'content.contentPadding', {});
278
281
  this.margin = getContainerPropsValue(container, 'content.margin', {});
@@ -327,6 +330,7 @@
327
330
  justify-content: center;
328
331
  align-items: center;
329
332
  display: flex;
333
+ background-size: cover;
330
334
  }
331
335
 
332
336
  }