jufubao-movie 1.0.39-beta5 → 1.0.39-beta6

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-beta5",
3
+ "version": "1.0.39-beta6",
4
4
  "private": false,
5
5
  "description": "聚福宝在线选座业务组件插件包",
6
6
  "main": "index.js",
@@ -79,7 +79,6 @@
79
79
  mixins: [componentsMixins,extsMixins,JfbMovieLineLineSeatMixin],
80
80
  data() {
81
81
  return {
82
- hideMask: true,
83
82
  scheduleId: '',
84
83
  filmId: '',
85
84
  cinemaId: '',
@@ -8,48 +8,53 @@
8
8
  <image v-if="!errorStatus" :src="item['poster']" :alt="item['show_name']" @error="handleError()" ></image>
9
9
  </view>
10
10
  <view class="middle">
11
- <view class="name">{{item['show_name']}}</view>
12
- <view class="other">类型:{{item['type']}}</view>
13
- <view class="other">导演:{{item['director']}}</view>
14
- <view class="other">主演:{{item['leading_role']}}</view>
15
- </view>
16
- <view class="right">
17
- <view class="score">
18
- <template v-if="item['remark']">
19
- <text>评分:</text><text :style="{color:color}">{{item['remark']}}</text>
20
- </template>
11
+ <view class="top">
12
+ <view class="name">{{item['show_name']}}</view>
13
+ <view class="score">
14
+ <template v-if="item['remark']">
15
+ <text>评分:</text><text :style="{color:color}">{{item['remark']}}</text>
16
+ </template>
17
+ </view>
21
18
  </view>
22
- <view class="btn">
23
- <template v-if="type === 'hot'">
24
- <xd-button
25
- v-if="item['show_button'] === '1'"
26
- type="primary"
27
- style="display:block;"
28
- size="small"
29
- @click.stop="handleBuy(item)">购票</xd-button>
30
- <xd-button
31
- v-else-if="item['show_button'] === '2'"
32
- type="subPrimary"
33
- style="display:block;"
34
- size="small"
35
- @click="handleBuy(item)">预售</xd-button>
36
- </template>
37
- <template v-if="type === 'rightnow'">
38
- <xd-button
39
- v-if="item['show_button'] === '3'"
40
- type="success"
41
- style="display:block;"
42
- size="small"
43
- @click.stop="handleDetail(item)"
44
- >想看</xd-button>
45
- <xd-button
46
- v-else-if="item['show_button'] === '2'"
47
- type="subPrimary"
48
- style="display:block;"
49
- size="small"
50
- @click.stop="handleBuy(item)">预售</xd-button>
51
- </template>
19
+ <view class="bottom">
20
+ <view>
21
+ <view class="other">类型:{{item['type']}}</view>
22
+ <view class="other">导演:{{item['director']}}</view>
23
+ <view class="other">主演:{{item['leading_role']}}</view>
24
+ </view>
25
+ <view class="btn">
26
+ <template v-if="type === 'hot'">
27
+ <xd-button
28
+ v-if="item['show_button'] === '1'"
29
+ type="primary"
30
+ style="display:block;"
31
+ size="small"
32
+ @click.stop="handleBuy(item)">购票</xd-button>
33
+ <xd-button
34
+ v-else-if="item['show_button'] === '2'"
35
+ type="subPrimary"
36
+ style="display:block;"
37
+ size="small"
38
+ @click="handleBuy(item)">预售</xd-button>
39
+ </template>
40
+ <template v-if="type === 'rightnow'">
41
+ <xd-button
42
+ v-if="item['show_button'] === '3'"
43
+ type="success"
44
+ style="display:block;"
45
+ size="small"
46
+ @click.stop="handleDetail(item)"
47
+ >想看</xd-button>
48
+ <xd-button
49
+ v-else-if="item['show_button'] === '2'"
50
+ type="subPrimary"
51
+ style="display:block;"
52
+ size="small"
53
+ @click.stop="handleBuy(item)">预售</xd-button>
54
+ </template>
55
+ </view>
52
56
  </view>
57
+
53
58
  </view>
54
59
  </view>
55
60
  </template>
@@ -125,50 +130,89 @@
125
130
  }
126
131
  .middle {
127
132
  flex: 1;
128
- & .name {
129
- font-size: 36rpx;
130
- font-weight: 600;
133
+
134
+ & .top {
135
+ display: flex;
136
+ justify-content: space-between;
137
+ align-items: flex-end;
131
138
  margin-bottom: 20rpx;
132
- .uni-max-cut(2, 90);
133
- line-height: 45rpx;
134
- }
135
139
 
136
- & .other {
137
- font-size: 25rpx;
138
- color: #999;
139
- .uni-max-cut(1,36);
140
- line-height: 36rpx;
141
- margin-bottom: 10rpx;
142
- &:last-child {
143
- margin-bottom: 0!important;
140
+ & > view:first-child{
141
+ flex: 1;
142
+ font-size: 36rpx;
143
+ font-weight: 600;
144
+ .uni-max-cut(2, 90);
145
+ line-height: 45rpx;
146
+ }
147
+ & >view:nth-child(2) {
148
+ flex-shrink: 0;
149
+ height: 45rpx;
150
+ line-height: 45rpx;
151
+ margin-left: 20rpx;
152
+ text-align: right;
153
+ & > text:nth-child(1) {
154
+ font-size: 20rpx;
155
+ }
156
+ & > text:nth-child(2) {
157
+ font-size: 28rpx;
158
+ }
144
159
  }
145
160
  }
146
- }
147
161
 
148
- .right {
149
- flex-shrink: 0;
150
- display: flex;
151
- align-content: space-between;
152
- align-items: flex-end;
153
- justify-content: flex-end;
154
- flex-flow: wrap;
155
- box-sizing: border-box;
156
- width: 160rpx;
157
- height: 200rpx;
162
+ & .bottom {
163
+ display: flex;
164
+ justify-content: space-between;
165
+ align-items: center;
158
166
 
159
- & .score {
160
- height: 40rpx;
161
- width:100%;
162
- text-align: right;
163
- & > text:nth-child(1) {
164
- font-size: 20rpx;
165
- }
166
- & > text:nth-child(2) {
167
- font-size: 28rpx;
167
+ & > view:first-child {
168
+ flex: 1;
169
+ & > view {
170
+ font-size: 25rpx;
171
+ color: #999;
172
+ .uni-max-cut(1,36);
173
+ line-height: 36rpx;
174
+ margin-bottom: 10rpx;
175
+ &:last-child {
176
+ margin-bottom: 0!important;
177
+ }
178
+ }
168
179
  }
169
180
 
181
+ & .btn {
182
+ width: 140rpx;
183
+ flex-shrink: 0;
184
+ margin-left: 20rpx;
185
+ }
170
186
  }
187
+ //& .name {
188
+ // font-size: 36rpx;
189
+ // font-weight: 600;
190
+ // margin-bottom: 20rpx;
191
+ // .uni-max-cut(2, 90);
192
+ // line-height: 45rpx;
193
+ //}
194
+ //
195
+ //& .other {
171
196
 
197
+ //}
172
198
  }
199
+
200
+ //.right {
201
+ // flex-shrink: 0;
202
+ // display: flex;
203
+ // align-content: space-between;
204
+ // align-items: flex-end;
205
+ // justify-content: flex-end;
206
+ // flex-flow: wrap;
207
+ // box-sizing: border-box;
208
+ // width: 160rpx;
209
+ // height: 200rpx;
210
+ //
211
+ // & .score {
212
+
213
+ //
214
+ // }
215
+ //
216
+ //}
173
217
  }
174
218
  </style>
@@ -471,7 +471,6 @@
471
471
  if (JSON.stringify(value) === JSON.stringify(oldValue)) return;
472
472
  if (this.$configProject['isPreview']) this.init(value)
473
473
  },
474
-
475
474
  posterNum(){
476
475
  if (this.$configProject['isPreview']){
477
476
  this.onJfbLoad();
@@ -876,10 +875,7 @@
876
875
  },
877
876
 
878
877
  onJfbScroll(options){
879
- if(!this.pageToken || this.dataList === null) return false;
880
- if(this.type === 'hot' || this.type === 'rightnow'){
881
- this.virtualList.onScrollEvent(options.e.scrollTop);
882
- }
878
+ this.virtualList.onScrollEvent(options.e.scrollTop);
883
879
  },
884
880
 
885
881
  setShowTypeList(){
@@ -182,7 +182,6 @@
182
182
  ],
183
183
  data() {
184
184
  return {
185
- hideMask: true,
186
185
  options: {},
187
186
  type:'', //hot rightnow
188
187
  typeList:{hot:{label: '热映影片', value: 'hot'},rightnow:{label: '即将上映', value: 'rightnow'}},
@@ -1,12 +1,13 @@
1
1
  'use strict';
2
2
  //原点对象
3
3
  let __orgUpdateTop = null;
4
+ let idx = 0;
4
5
 
5
6
  export default class VirtualList {
6
7
  virtualType='fixed';
7
8
  virtualBufferHeight= 300;
8
9
  virtualFixedItemHeight; //固定模式高度设置
9
- virtualVue; //当前组件vm实例
10
+ //virtualVue; //当前组件vm实例(小程序不可用)
10
11
  virtualTotalData=[]; //数组长度
11
12
  virtualHeightObj = {}; //高度序列index: {max:xx,min:xx}
12
13
  $el= null; //开始点元素
@@ -22,7 +23,9 @@ export default class VirtualList {
22
23
  top=0;
23
24
  bottom=0;
24
25
  virtualCallback= ()=>{};
25
- status= false
26
+ status= false;
27
+ options = null;
28
+
26
29
 
27
30
  /**
28
31
  * @description 初始化或者重置对象
@@ -35,59 +38,63 @@ export default class VirtualList {
35
38
  * @param params.otherHeight {number} 其他高度(rpx)
36
39
  * @param params.callback {Function} 回调方法
37
40
  */
38
- constructor($vm,$el, params ) {
39
- this.virtualVue = $vm;
40
- this.virtualBufferHeight = 480 * this.virtualVue.$rpxNum;
41
+ constructor($vm ,$el, params ) {
42
+ this.options = params;
43
+ this.virtualBufferHeight = 480 * $vm.$rpxNum;
41
44
  if(params.type && ['auto','fixed'].includes(params.type)) this.virtualType = params.type;
42
- if(params.bufferHeight) this.virtualBufferHeight = params.bufferHeight * this.virtualVue.$rpxNum;
43
- if(params.otherHeight) this.otherHeight = params.otherHeight * this.virtualVue.$rpxNum;
45
+ if(params.bufferHeight) this.virtualBufferHeight = params.bufferHeight * $vm.$rpxNum;
46
+ if(params.otherHeight) this.otherHeight = params.otherHeight * $vm.$rpxNum;
44
47
  if(this.virtualType === 'fixed'){
45
48
  if(params.fixedHeight === undefined) throw new Error(`FixedHeight is require, got is ${params.fixedHeight}`);
46
- else this.virtualFixedItemHeight = params.fixedHeight * this.virtualVue.$rpxNum;
49
+ else this.virtualFixedItemHeight = params.fixedHeight * $vm.$rpxNum;
47
50
  }
48
51
  this.virtualTotalData = [];
49
- this.virtualVue.virtualViewData = null;
50
52
  this.$el = $el;
51
- this.virtualVue.$nextTick(()=>{
53
+ $vm.$nextTick(()=>{
52
54
  this.checkOffsetTop();
53
55
  });
54
56
  this.screenHeight = uni.getSystemInfoSync().safeArea.height;
55
57
  if(typeof params.callback !== 'function') {
56
58
  throw new Error(`FixedHeight is require, got is ${params.fixedHeight}`);
57
59
  }else this.virtualCallback = params.callback;
58
-
59
60
  }
60
61
 
62
+ /**
63
+ * @description 获取原点的偏移量
64
+ */
61
65
  checkOffsetTop(){
62
- if(__orgUpdateTop) {
63
- this.orgUpdateTop = __orgUpdateTop;
64
- this.status = true;
65
- return;
66
- }
66
+
67
67
  //相对了10次不在检查
68
- if(this.eqMaxTimer >= 3) {
68
+ if(this.eqMaxTimer >= 5) {
69
69
  this.status = true;
70
- __orgUpdateTop = this.orgUpdateTop;
71
70
  return
72
71
  }
73
- if(this.virtualVue.$refs[this.$el]) {
74
- let offsetTop = this.virtualVue.$refs[this.$el].$el.getBoundingClientRect().top;
72
+
73
+ this.options.getDom(this.$el).then(res=>{
74
+ let offsetTop = res.top
75
75
  if(this.offsetTop === offsetTop) {
76
76
  this.eqMaxTimer++;
77
77
  }
78
78
  else this.offsetTop = offsetTop;
79
79
  this.orgUpdateTop = offsetTop + this.otherHeight;
80
80
  if(this.virtualType === 'fixed') this.computedMinAndMaxFixed();
81
- }
82
- setTimeout(()=>{
83
- this.checkOffsetTop();
84
- }, 200)
81
+ setTimeout(()=>{
82
+ this.checkOffsetTop();
83
+ }, 100)
84
+ }).catch(res=>{
85
+ setTimeout(()=>{
86
+ this.checkOffsetTop();
87
+ }, 100)
88
+ })
85
89
  }
86
90
 
87
91
  cloneDeep(data){
88
92
  return JSON.parse(JSON.stringify(data));
89
93
  }
90
94
 
95
+ /**
96
+ * @description 固定高度模式初始化列表记录范围
97
+ */
91
98
  computedMinAndMaxFixed(){
92
99
  let itemHeight = this.virtualFixedItemHeight;
93
100
  this.virtualTotalData.map((item,index)=>{
@@ -107,32 +114,62 @@ export default class VirtualList {
107
114
  });
108
115
  }
109
116
 
117
+ /**
118
+ * @description 新增数据时候调用此方法(对外)
119
+ * @param data {Array} 列表数据
120
+ * @param height {Array} 高度数组
121
+ */
110
122
  pushVirtualData(data, height){
111
- //清空响应对象
112
- this.virtualVue.virtualViewData = null;
113
- if(this.virtualTotalData.length > 0) this.isFirst = false;
114
-
115
- //非固定模式
116
- if(this.virtualType === 'auto') {
117
- if(!height) throw new Error(`height is require, got is ${height}`);
118
- this.virtualHeightObj = Object.assign({},this.virtualHeightObj, this.cloneDeep(height));
119
- }
123
+ if(this.status) {
124
+ // data = data.map((item,index)=>{
125
+ // return {
126
+ // ...item,
127
+ // show_name: `【${idx} - ${index}】${item.show_name}`,
128
+ // }
129
+ // });
130
+ idx++;
131
+ //清空响应对象
132
+ if(this.virtualTotalData.length > 0) this.isFirst = false;
133
+
134
+ //非固定模式
135
+ if(this.virtualType === 'auto') {
136
+ if(!height) throw new Error(`height is require, got is ${height}`);
137
+ this.virtualHeightObj = Object.assign({},this.virtualHeightObj, this.cloneDeep(height));
138
+ }
139
+
140
+ //固定模式
141
+ if(this.virtualType === 'fixed') {
142
+ this.virtualTotalData = this.virtualTotalData.concat(this.cloneDeep(data));
143
+ this.computedMinAndMaxFixed();
144
+ if(this.isFirst) this.onScrollEvent(0);
145
+ }
120
146
 
121
- //固定模式
122
- if(this.virtualType === 'fixed') {
123
- this.virtualTotalData = this.virtualTotalData.concat(this.cloneDeep(data));
124
- this.computedMinAndMaxFixed();
125
- if(this.isFirst) this.onScrollEvent(0);
147
+ this.isFirst = false
148
+ }
149
+ else {
150
+ setTimeout(()=>{
151
+ this.pushVirtualData(data, height)
152
+ },100)
126
153
  }
127
154
 
128
- this.isFirst = false
129
155
  }
130
156
 
131
157
  /**
132
- * @description 滚动事件
158
+ * @description 滚动事件(对外)
133
159
  * @param scrollTop
134
160
  */
135
161
  onScrollEvent(scrollTop) {
162
+ //console.log('onScrollEvent',scrollTop)
163
+ if(!this.status || this.virtualTotalData.length === 0) {
164
+ /**@type Function **/
165
+ this.virtualCallback({
166
+ paddingTop:0,
167
+ paddingBottom: 0,
168
+ data: []
169
+ });
170
+ return;
171
+ }
172
+
136
173
  //非固定计算索引
137
174
  let time = new Date().getTime();
138
175
  //计算开始索引
@@ -170,14 +207,41 @@ export default class VirtualList {
170
207
 
171
208
  this.top = this.virtualHeightObj[this.startIndex].min - this.orgUpdateTop.toString() + 'px'
172
209
  this.bottom = this.virtualHeightObj[this.virtualTotalData.length-1].max - this.virtualHeightObj[this.endIndex-1].max.toString() + 'px'
173
- console.log('onScrollEvent.index',this.endIndex - this.startIndex, this.startIndex,this.endIndex, this.top, this.bottom)
210
+ console.log('onScrollEvent.index',this.endIndex - this.startIndex, this.startIndex,this.endIndex, this.top, this.bottom);
211
+
174
212
 
175
213
  /**@type Function **/
176
214
  this.virtualCallback({
177
- paddingTop:this.top,
215
+ paddingTop: this.top,
178
216
  paddingBottom: this.bottom,
179
- data:this.cloneDeep(this.virtualTotalData).slice(this.startIndex, this.endIndex + 1)}
180
- );
217
+ data: this.cloneDeep(this.virtualTotalData).slice(this.startIndex, this.endIndex + 1)
218
+ });
219
+ }
220
+
221
+ /**
222
+ * @description 切换Tab调用此方法(对外)
223
+ * @param virtualType {string} 类型
224
+ * @param $vm {Vue} vue实例 (在自动高度模式必选)
225
+ * @param ref 元素对象 (在自动高度模式必选)
226
+ */
227
+ onChangeTab($vm , ref , virtualType = 'fixed'){
228
+ this.virtualTotalData = [];
229
+ this.isFirst = true;
230
+
231
+ //改变顶部偏移量元素
232
+ if(virtualType && virtualType !== this.virtualType) {
233
+ if(!$vm) throw new Error(`$vm is require, got is ${$vm.$xdUniHelper.checkVarType($vm)},value is ${$vm}`);
234
+ if(!ref) throw new Error(`ref is require, got is ${$vm.$xdUniHelper.checkVarType(ref)}, value is ${ref}`);
235
+ this.virtualType = virtualType;
236
+ if(type === 'auto' && $vm && ref) {
237
+ this.$el = ref;
238
+ this.status = false;
239
+ this.eqMaxTimer = 3;
240
+ $vm.$nextTick(()=>{
241
+ this.checkOffsetTop();
242
+ });
243
+ }
244
+ }
181
245
  }
182
246
  }
183
247