jufubao-movie 1.0.39-beta6 → 1.0.39-beta8

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-movie",
3
- "version": "1.0.39-beta6",
3
+ "version": "1.0.39-beta8",
4
4
  "private": false,
5
5
  "description": "聚福宝在线选座业务组件插件包",
6
6
  "main": "index.js",
@@ -81,7 +81,7 @@
81
81
  </view>
82
82
  </view>
83
83
  <!--poster-->
84
- <view id="content-ref" class="content-ref"></view>
84
+ <view v-if="type === 'hot' || type === 'rightnow'" id="content-ref" class="content-ref"></view>
85
85
  <!--film hot|rightnow-->
86
86
  <view
87
87
  v-if="type === 'hot' || type === 'rightnow'"
@@ -174,10 +174,15 @@
174
174
  ></xd-query-filter>
175
175
  </view>
176
176
  </view>
177
+ <view id="content-list-ref" v-if="type === 'list'" class="content-ref"></view>
177
178
  <view
178
179
  v-if="type === 'list'"
179
180
  class="list-cont"
180
- :style="{marginTop:outSpacing + 'rpx'}"
181
+ :style="{
182
+ marginTop:outSpacing + 'rpx',
183
+ paddingTop:paddingTop,
184
+ paddingBottom:paddingBottom,
185
+ }"
181
186
  >
182
187
  <view class="skeleton-wrap" v-if="dataList === null">
183
188
  <view
@@ -326,7 +331,7 @@
326
331
  pageSize: 10,
327
332
  total: null,
328
333
  isFirstLoadingData: false,
329
- dataList:null,
334
+
330
335
  cinemaOrgDataList:null,
331
336
  cinemaAreaList:null,
332
337
  sort_consume_mode:'',//获取影院数据排序
@@ -386,8 +391,13 @@
386
391
 
387
392
  buyPath:'',
388
393
  fimeDetailPath:'',
394
+
395
+ //页面列表展示数据
396
+ dataList:null,
389
397
  paddingTop: 0,
390
398
  paddingBottom: 0,
399
+
400
+ //计算高度预加载列表
391
401
  preRendering:[],
392
402
 
393
403
  }
@@ -442,6 +452,7 @@
442
452
  }
443
453
  return style[this.mode]
444
454
  },
455
+
445
456
  contMarginComp(){
446
457
  let str = `${this.checkValue(this.contMargin.top, 20)}rpx`;
447
458
  str = `${str} ${this.checkValue(this.contMargin.right, 20)}rpx`;
@@ -463,8 +474,6 @@
463
474
  height: 280,
464
475
  }
465
476
  },
466
-
467
-
468
477
  },
469
478
  watch: {
470
479
  container(value, oldValue) {
@@ -487,15 +496,12 @@
487
496
  this.clearDataVar();
488
497
  this.getList();
489
498
  },
490
- preRendering(){
499
+
500
+ preRendering(val){
491
501
  this.$nextTick(()=>{
492
- const query = uni.createSelectorQuery().in(this);
493
- query
494
- .select('#preRendering > .list-cont-item')
495
- .boundingClientRect((data) => {
496
- console.log("得到布局位置信息" + JSON.stringify(data));
497
- })
498
- .exec();
502
+ if(val.length > 0) {
503
+ this.handlePreRendering(val);
504
+ }
499
505
  })
500
506
  }
501
507
  },
@@ -503,8 +509,53 @@
503
509
  this.isPreview = this.$configProject.isPreview;
504
510
  this.backgroundColor = Color(this.warningColor).alpha(0.2).toString();
505
511
  this.init(this.container);
512
+
513
+ this.virtualList = new VirtualList(this, this.type ==='list'?'#content-list-ref':'#content-ref', {
514
+ fixedHeight: 240 + Number(this.outSpacing) + 20 * 2 ,
515
+ otherHeight: Number(this.outSpacing),
516
+ type:this.type ==='list'?'auto':'fixed',
517
+ //获取节点数据
518
+ getDom:(id)=>{
519
+ return new Promise((resolve,reject)=>{
520
+ uni.createSelectorQuery().in(this).select(id)
521
+ .boundingClientRect((data)=>{
522
+ if(data && data.top !== undefined) resolve(data);
523
+ else reject(null)
524
+ }).exec()
525
+ });
526
+ },
527
+ //获取当前this
528
+ getParentThis(){
529
+ return this
530
+ },
531
+ callback: ({data, paddingTop, paddingBottom}) =>{
532
+ this.paddingTop = paddingTop;
533
+ this.paddingBottom = paddingBottom;
534
+ this.dataList = data;
535
+ },
536
+ });
506
537
  },
507
538
  methods: {
539
+ /**
540
+ * @description 非固定高度处理
541
+ * @param list
542
+ */
543
+ handlePreRendering(list){
544
+ const query = uni.createSelectorQuery().in(this);
545
+ query
546
+ .selectAll('#preRendering > .list-cont-item')
547
+ .boundingClientRect((data) => {
548
+ if(data && data.length > 0) {
549
+ let height = [];
550
+ data.map(item=>{
551
+ height[item.dataset.index] = item.height + Number(this.outSpacing) * this.$rpxNum;
552
+ });
553
+ this.virtualList.pushVirtualData(list,height);
554
+ }
555
+ })
556
+ .exec();
557
+ },
558
+
508
559
  clearDataVar(){
509
560
  this.dataList = null;
510
561
  this.pageToken = '1';
@@ -602,6 +653,7 @@
602
653
  this.areaName = sortData.area_name;
603
654
  this.pageToken = '1';
604
655
  this.dataList = null;
656
+ this.virtualList.onChangeTab();
605
657
  this.getList();
606
658
  setTimeout(()=>{
607
659
  this.curQueryTab = '';
@@ -647,7 +699,6 @@
647
699
 
648
700
  //过滤之后不够分页直接返回值
649
701
  if(fitlerData.length <= this.pageSize) {
650
- this.dataList = this.$xdUniHelper.cloneDeep(fitlerData);
651
702
  this.preRendering = this.$xdUniHelper.cloneDeep(fitlerData);
652
703
  this.pageToken = ''
653
704
  return;
@@ -664,7 +715,6 @@
664
715
  }
665
716
 
666
717
  this.preRendering = this.$xdUniHelper.cloneDeep(list);
667
- this.dataList = (this.dataList||[]).concat(this.$xdUniHelper.cloneDeep(list));
668
718
  if(this.pageSize < list.length) this.pageToken = '';
669
719
  else this.pageToken = (Number(this.pageToken)+1) + '';
670
720
  },
@@ -672,7 +722,10 @@
672
722
  handleTab(value){
673
723
  if(value === this.type) return;
674
724
  if(value === 'hot' || value === 'rightnow' ) {
675
- this.virtualList.onChangeTab();
725
+ this.virtualList.onChangeTab(this,'#content-ref', 'fixed' );
726
+ }
727
+ if(value === 'list') {
728
+ this.virtualList.onChangeTab(this,'#content-list-ref', 'auto' );
676
729
  }
677
730
  this.type = value;
678
731
  this.dataList = null;
@@ -735,25 +788,26 @@
735
788
 
736
789
  //影院列表处理
737
790
  if(this.type === 'list') {
738
- //res['list'].splice(0, 31);
791
+ debugger
739
792
  this.cinemaOrgDataList = res['list'];
740
793
  this.cinemaAreaList = [{area_code:'all', area_name:'全城'}].concat(res['area_list']);
741
794
 
795
+ //预览模式
796
+ if(this.isPreview) {
797
+ this.dataList = (this.dataList||[]).concat(res['list'].slice(0, 20));
798
+ return;
799
+ }
800
+
742
801
  //小于数量页面显示记录
743
802
  if(res['list'].length <= this.pageSize) {
744
- this.dataList = res['list'];
803
+ //this.dataList = res['list'];
745
804
  this.preRendering = this.$xdUniHelper.cloneDeep(res['list']);
746
805
  this.pageToken = '';
747
806
  return
748
807
  }
749
808
 
750
- if(this.isPreview) {
751
- this.dataList = (this.dataList||[]).concat(res['list'].slice(0, 20));
752
- }
753
- else {
754
- //正常处理
755
- this.getCinemaOrgData();
756
- }
809
+ //正常处理
810
+ this.getCinemaOrgData();
757
811
 
758
812
  }
759
813
 
@@ -765,34 +819,6 @@
765
819
 
766
820
  onJfbLoad(options) {
767
821
  this.options = options;
768
-
769
- this.virtualList = new VirtualList(this, '#content-ref', {
770
- fixedHeight: 240 + Number(this.outSpacing) + 20 * 2 ,
771
- otherHeight: Number(this.outSpacing),
772
- //获取节点数据
773
- getDom:(id)=>{
774
- return new Promise((resolve,reject)=>{
775
- uni.createSelectorQuery().in(this).select(id)
776
- .boundingClientRect((data)=>{
777
- if(data && data.top !== undefined) resolve(data);
778
- else reject(null)
779
- }).exec()
780
- });
781
- },
782
- //获取当前this
783
- getParentThis(){
784
- return this
785
- },
786
- callback: ({data, paddingTop, paddingBottom}) =>{
787
- if(this.type === 'hot' ||this.type ==='rightnow' ) {
788
- this.paddingTop = paddingTop;
789
- this.paddingBottom = paddingBottom;
790
- this.dataList = data;
791
- }
792
-
793
- },
794
- });
795
-
796
822
  jfbRootExec('getTFKPosterContent', {
797
823
  vm: this,
798
824
  data: {
@@ -5,7 +5,7 @@ let idx = 0;
5
5
 
6
6
  export default class VirtualList {
7
7
  virtualType='fixed';
8
- virtualBufferHeight= 300;
8
+ virtualBufferHeight= 0;
9
9
  virtualFixedItemHeight; //固定模式高度设置
10
10
  //virtualVue; //当前组件vm实例(小程序不可用)
11
11
  virtualTotalData=[]; //数组长度
@@ -44,13 +44,13 @@ export default class VirtualList {
44
44
  if(params.type && ['auto','fixed'].includes(params.type)) this.virtualType = params.type;
45
45
  if(params.bufferHeight) this.virtualBufferHeight = params.bufferHeight * $vm.$rpxNum;
46
46
  if(params.otherHeight) this.otherHeight = params.otherHeight * $vm.$rpxNum;
47
- if(this.virtualType === 'fixed'){
48
- if(params.fixedHeight === undefined) throw new Error(`FixedHeight is require, got is ${params.fixedHeight}`);
49
- else this.virtualFixedItemHeight = params.fixedHeight * $vm.$rpxNum;
47
+ if(params.fixedHeight){
48
+ this.virtualFixedItemHeight = params.fixedHeight * $vm.$rpxNum;
50
49
  }
51
50
  this.virtualTotalData = [];
52
51
  this.$el = $el;
53
52
  $vm.$nextTick(()=>{
53
+ debugger
54
54
  this.checkOffsetTop();
55
55
  });
56
56
  this.screenHeight = uni.getSystemInfoSync().safeArea.height;
@@ -220,7 +220,7 @@ export default class VirtualList {
220
220
 
221
221
  /**
222
222
  * @description 切换Tab调用此方法(对外)
223
- * @param virtualType {string} 类型
223
+ * @param virtualType {string} 类型 fixed|auto
224
224
  * @param $vm {Vue} vue实例 (在自动高度模式必选)
225
225
  * @param ref 元素对象 (在自动高度模式必选)
226
226
  */