jufubao-forms 1.0.4-beta3 → 1.0.4-beta5

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-forms",
3
- "version": "1.0.4-beta3",
3
+ "version": "1.0.4-beta5",
4
4
  "private": false,
5
5
  "description": "聚福宝表单业务插件库",
6
6
  "main": "index.js",
@@ -102,11 +102,14 @@
102
102
  :src="getServiceUrl(videoSrc)"
103
103
  :controls="false"
104
104
  :show-center-play-btn="false"
105
+ :autoplay="false"
106
+ :loop="false"
105
107
  @pause="handleVideoPause(item)"
106
108
  @ended="handleVideoPause(item)"
109
+ @click="handleVideoPlay(item)"
107
110
  ></video>
108
111
  <view v-if="!formPaly[item.field_value + '_play']" class="video_cover">
109
- <image :src="formPaly[item.field_value + '_cover']" style="width: 100%;height: 100%;" mode="aspectFit"></image>
112
+ <image :src="formPaly[item.field_value + '_cover']" style="width: 100%;height: 100%;" mode="aspectFill"></image>
110
113
  <view class="video_play" @click="handleVideoPlay(item)">
111
114
  <xd-font-icon icon="iconplayright" color="#fff" size="60"></xd-font-icon>
112
115
  </view>
@@ -243,6 +246,7 @@
243
246
  emptyImage: getServiceUrl('/common/empty/qa.png'),
244
247
  uploadImgList: [],
245
248
  uploadVideoList: [],
249
+ imgHost: "",
246
250
 
247
251
  //面板
248
252
  submitPagePath: "",
@@ -290,6 +294,9 @@
290
294
  methods: {
291
295
  getServiceUrl,
292
296
  onJfbLoad(options) {
297
+ let imgHost = this.projectAttr['img_host'] || this.$settings.cdnUrl;
298
+ this.imgHost = imgHost;
299
+
293
300
  if (!this.isPreview){
294
301
  if(!options.form_id) {
295
302
  return uni.showToast({
@@ -481,18 +488,20 @@
481
488
  console.log('chooseImage',res);
482
489
  this.$xdShowLoading({});
483
490
  for(let i = 0; i < res.tempFiles.length; i++){
484
- let file = res.tempFiles[i];
485
- //文件file不能大于item.media_size(MB)
486
- if(file.size > item.media_size * 1024 * 1024){
487
- uni.showToast({
488
- title: '图片大小不能超过' + item.media_size + 'MB',
489
- duration: 2000,
490
- icon: "none"
491
- });
492
- this.$xdHideLoading();
493
- return;
491
+ if(i < Number(item.media_count)){
492
+ let file = res.tempFiles[i];
493
+ //文件file不能大于item.media_size(MB)
494
+ if(file.size > item.media_size * 1024 * 1024){
495
+ uni.showToast({
496
+ title: '图片大小不能超过' + item.media_size + 'MB',
497
+ duration: 2000,
498
+ icon: "none"
499
+ });
500
+ this.$xdHideLoading();
501
+ return;
502
+ }
503
+ await this.uploadOneImage(file, item);
494
504
  }
495
- await this.uploadOneImage(file, item);
496
505
  }
497
506
  this.$xdHideLoading();
498
507
  }
@@ -505,8 +514,13 @@
505
514
  handleVideoPlay(item){
506
515
  let videoContext = uni.createVideoContext('video_' + item.field_value, this);
507
516
  if(videoContext){
508
- videoContext.play();
509
- this.$set(this.formPaly, item.field_value + '_play', true)
517
+ if(!this.formPaly[item.field_value + '_play']){
518
+ this.$set(this.formPaly, item.field_value + '_play', true)
519
+ videoContext.play();
520
+ }else{
521
+ this.$set(this.formPaly, item.field_value + '_play', false)
522
+ videoContext.pause();
523
+ }
510
524
  }
511
525
  },
512
526
  handleVideoPause(item){
@@ -531,11 +545,17 @@
531
545
  let video = await this.uploadImage(file);
532
546
  let videoUrl = getVideoUrl(video);
533
547
  console.log("videoUrl", videoUrl);
534
- this.form[item.field_value].push(video);
548
+ this.form[item.field_value].push(videoUrl.url);
535
549
  this.formPaly[item.field_value + '_cover'] = videoUrl.url_cover;
536
550
  this.handleClearError(item);
537
551
  this.$xdHideLoading();
538
552
  }catch(err){
553
+ uni.showToast({
554
+ title: '上传失败,重新上传',
555
+ duration: 2000,
556
+ icon: "none"
557
+ });
558
+ this.form[item.field_value] = [];
539
559
  this.$xdHideLoading();
540
560
  }
541
561
  }
@@ -567,7 +587,7 @@
567
587
  resolve(`/${res.key}`);
568
588
  },
569
589
  fail:(err)=>{
570
- resolve('');
590
+ reject(err);
571
591
  console.error(err)
572
592
  }
573
593
  });
@@ -630,7 +650,8 @@
630
650
  contents,
631
651
  form_id: this.form_id,
632
652
  bucket: this.bucket,
633
- foreign_id: this.foreign_id
653
+ foreign_id: this.foreign_id,
654
+ domain: this.imgHost
634
655
  }
635
656
  }).then(res => {
636
657
  this.$xdHideLoading();
@@ -910,6 +931,8 @@
910
931
  margin-bottom: 20rpx;
911
932
  position: relative;
912
933
  overflow: hidden;
934
+ display: flex;
935
+ align-items: center;
913
936
  .video_cover{
914
937
  position: absolute;
915
938
  z-index: 2;