jufubao-movie 1.0.39-beta9 → 1.0.39
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 +1 -1
- package/src/components/JfbMovieLineCinemaChoose/Api.js +3 -3
- package/src/components/JfbMovieLineCinemaChoose/JfbMovieLineCinemaChoose.vue +13 -9
- package/src/components/JfbMovieLineCinemaChoose/Mock.js +2 -2
- package/src/components/JfbMovieLineFilm/JfbMovieLineFilm.vue +16 -3
- package/src/components/JfbMovieLineFilmInfo/JfbMovieLineFilmInfo.vue +2 -4
- package/src/components/JfbMovieLineFilmInfo/Mock.js +1 -1
- package/src/components/JfbMovieLineLineSeat/XdOnlineSeat.vue +11 -0
- package/src/components/JfbMovieTfkFilmList/Attr.js +5 -238
- package/src/components/JfbMovieTfkFilmList/ContentItem.vue +2 -2
- package/src/components/JfbMovieTfkFilmList/JfbMovieTfkFilmList.vue +200 -110
- package/src/components/JfbMovieTfkFilmList/PosterAttr.js +257 -0
- package/src/components/JfbMovieTfkFilmList/XdPoster.vue +160 -0
- package/src/components/JfbMovieTfkFilmList/XdQueryFilter.vue +2 -1
- package/src/components/JfbMovieTfkFilmRecommend/JfbMovieTfkFilmRecommend.vue +6 -2
- package/src/lib/VirtualList.js +85 -64
- package/src/mixins/posterMixins.js +0 -59
package/src/lib/VirtualList.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
//原点对象
|
|
3
|
-
let __orgUpdateTop = null;
|
|
4
|
-
let idx = 0;
|
|
5
2
|
|
|
6
3
|
export default class VirtualList {
|
|
7
4
|
virtualType='fixed';
|
|
8
|
-
virtualBufferHeight=
|
|
5
|
+
virtualBufferHeight= 300;
|
|
9
6
|
virtualFixedItemHeight; //固定模式高度设置
|
|
10
7
|
//virtualVue; //当前组件vm实例(小程序不可用)
|
|
11
8
|
virtualTotalData=[]; //数组长度
|
|
12
9
|
virtualHeightObj = {}; //高度序列index: {max:xx,min:xx}
|
|
10
|
+
autoHeight = []; //保存动态高度高度值
|
|
13
11
|
$el= null; //开始点元素
|
|
14
12
|
offsetTop= null;//开始点元素的偏移量
|
|
15
13
|
eqMaxTimer = 0;//
|
|
16
|
-
|
|
14
|
+
marginTopAndBottom= 0; //上下边距
|
|
15
|
+
paddingTopAndBottom= 0; //上下边距
|
|
17
16
|
orgUpdateTop = 0; //开始点元素原点偏移量
|
|
18
17
|
isFirst = true;
|
|
19
18
|
startIndex= 0;
|
|
20
19
|
endIndex= 0;
|
|
21
20
|
screenHeight=0;//全屏高度
|
|
21
|
+
contentRefBottomMargin= 0 //计算偏移量容器与内容直接的边距
|
|
22
22
|
|
|
23
23
|
top=0;
|
|
24
24
|
bottom=0;
|
|
@@ -27,6 +27,7 @@ export default class VirtualList {
|
|
|
27
27
|
options = null;
|
|
28
28
|
|
|
29
29
|
|
|
30
|
+
|
|
30
31
|
/**
|
|
31
32
|
* @description 初始化或者重置对象
|
|
32
33
|
* @param $vm {Vue} vue对象
|
|
@@ -34,23 +35,25 @@ export default class VirtualList {
|
|
|
34
35
|
* @param params {Object}
|
|
35
36
|
* @param params.type {string} 元素高度为固定或者非固定 其值:auto|fixed
|
|
36
37
|
* @param params.fixedHeight {number} 固定(rpx)(fixed)模式 (必选)
|
|
38
|
+
* @param params.marginTopAndBottom {Number} 上下边距 单位:rpx
|
|
39
|
+
* @param params.paddingTopAndBottom {Number} 上下填充 单位:rpx
|
|
40
|
+
* @param params.contentRefBottomMargin {Number} 计算偏移量容器与内容直接的边距 rpx
|
|
37
41
|
* @param params.bufferHeight {number} 缓冲高度(rpx)
|
|
38
|
-
* @param params.otherHeight {number} 其他高度(rpx)
|
|
39
42
|
* @param params.callback {Function} 回调方法
|
|
40
43
|
*/
|
|
41
44
|
constructor($vm ,$el, params ) {
|
|
42
45
|
this.options = params;
|
|
43
|
-
this
|
|
46
|
+
this.$pxNum = $vm.$pxNum
|
|
47
|
+
this.virtualBufferHeight = 300;
|
|
44
48
|
if(params.type && ['auto','fixed'].includes(params.type)) this.virtualType = params.type;
|
|
45
49
|
if(params.bufferHeight) this.virtualBufferHeight = params.bufferHeight * $vm.$rpxNum;
|
|
46
|
-
if(params.
|
|
47
|
-
if(params.
|
|
48
|
-
|
|
49
|
-
|
|
50
|
+
if(params.marginTopAndBottom) this.marginTopAndBottom = params.marginTopAndBottom * $vm.$rpxNum;
|
|
51
|
+
if(params.paddingTopAndBottom) this.paddingTopAndBottom = params.paddingTopAndBottom * $vm.$rpxNum;
|
|
52
|
+
if(params.contentRefBottomMargin) this.contentRefBottomMargin = params.contentRefBottomMargin * $vm.$rpxNum;
|
|
53
|
+
if(params.fixedHeight) this.virtualFixedItemHeight = params.fixedHeight * $vm.$rpxNum;
|
|
50
54
|
this.virtualTotalData = [];
|
|
51
55
|
this.$el = $el;
|
|
52
56
|
$vm.$nextTick(()=>{
|
|
53
|
-
debugger
|
|
54
57
|
this.checkOffsetTop();
|
|
55
58
|
});
|
|
56
59
|
this.screenHeight = uni.getSystemInfoSync().safeArea.height;
|
|
@@ -64,7 +67,7 @@ export default class VirtualList {
|
|
|
64
67
|
*/
|
|
65
68
|
checkOffsetTop(){
|
|
66
69
|
|
|
67
|
-
|
|
70
|
+
//检查前后返回值相等并且大于5次就不在检查
|
|
68
71
|
if(this.eqMaxTimer >= 5) {
|
|
69
72
|
this.status = true;
|
|
70
73
|
return
|
|
@@ -76,15 +79,15 @@ export default class VirtualList {
|
|
|
76
79
|
this.eqMaxTimer++;
|
|
77
80
|
}
|
|
78
81
|
else this.offsetTop = offsetTop;
|
|
79
|
-
this.orgUpdateTop = offsetTop + this.
|
|
80
|
-
|
|
82
|
+
this.orgUpdateTop = offsetTop + this.contentRefBottomMargin;
|
|
83
|
+
this.computedMinAndMaxFixed();
|
|
81
84
|
setTimeout(()=>{
|
|
82
85
|
this.checkOffsetTop();
|
|
83
|
-
},
|
|
86
|
+
}, 10)
|
|
84
87
|
}).catch(res=>{
|
|
85
88
|
setTimeout(()=>{
|
|
86
89
|
this.checkOffsetTop();
|
|
87
|
-
},
|
|
90
|
+
}, 10)
|
|
88
91
|
})
|
|
89
92
|
}
|
|
90
93
|
|
|
@@ -96,22 +99,39 @@ export default class VirtualList {
|
|
|
96
99
|
* @description 固定高度模式初始化列表记录范围
|
|
97
100
|
*/
|
|
98
101
|
computedMinAndMaxFixed(){
|
|
99
|
-
|
|
102
|
+
if(this.virtualType === 'fixed' &&
|
|
103
|
+
this.virtualFixedItemHeight === undefined
|
|
104
|
+
) throw new Error(`FixedHeight is require, got is ${this.virtualFixedItemHeight}`);
|
|
105
|
+
|
|
106
|
+
let itemHeight = this.virtualFixedItemHeight + this.marginTopAndBottom + this.paddingTopAndBottom;
|
|
107
|
+
let height = this.virtualFixedItemHeight;
|
|
108
|
+
|
|
100
109
|
this.virtualTotalData.map((item,index)=>{
|
|
110
|
+
if(this.virtualType === 'auto'){
|
|
111
|
+
itemHeight = this.autoHeight[index] + this.marginTopAndBottom + this.paddingTopAndBottom;
|
|
112
|
+
height = this.autoHeight[index];
|
|
113
|
+
}
|
|
114
|
+
|
|
101
115
|
if(index === 0) {
|
|
102
116
|
this.virtualHeightObj[index] = {
|
|
103
117
|
min: this.orgUpdateTop,
|
|
104
|
-
max: this.orgUpdateTop + itemHeight
|
|
118
|
+
max: this.orgUpdateTop + itemHeight,
|
|
119
|
+
height: height * this.$pxNum ,
|
|
120
|
+
itemHeight
|
|
105
121
|
}
|
|
106
122
|
}
|
|
107
123
|
else {
|
|
108
124
|
let prev = this.virtualHeightObj[index-1];
|
|
109
125
|
this.virtualHeightObj[index] = {
|
|
110
126
|
min: prev.max,
|
|
111
|
-
max: prev.max + itemHeight
|
|
127
|
+
max: prev.max + itemHeight,
|
|
128
|
+
height: height * this.$pxNum ,
|
|
129
|
+
itemHeight
|
|
112
130
|
}
|
|
113
131
|
}
|
|
114
132
|
});
|
|
133
|
+
|
|
134
|
+
console.log(this.virtualHeightObj)
|
|
115
135
|
}
|
|
116
136
|
|
|
117
137
|
/**
|
|
@@ -121,29 +141,24 @@ export default class VirtualList {
|
|
|
121
141
|
*/
|
|
122
142
|
pushVirtualData(data, height){
|
|
123
143
|
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
144
|
//清空响应对象
|
|
132
145
|
if(this.virtualTotalData.length > 0) this.isFirst = false;
|
|
146
|
+
this.virtualTotalData = this.virtualTotalData.concat(this.cloneDeep(data));
|
|
133
147
|
|
|
134
148
|
//非固定模式
|
|
135
149
|
if(this.virtualType === 'auto') {
|
|
136
150
|
if(!height) throw new Error(`height is require, got is ${height}`);
|
|
137
|
-
this.
|
|
151
|
+
this.autoHeight = this.autoHeight.concat(height)
|
|
152
|
+
this.computedMinAndMaxFixed();
|
|
138
153
|
}
|
|
139
154
|
|
|
140
155
|
//固定模式
|
|
141
156
|
if(this.virtualType === 'fixed') {
|
|
142
|
-
this.virtualTotalData = this.virtualTotalData.concat(this.cloneDeep(data));
|
|
143
157
|
this.computedMinAndMaxFixed();
|
|
144
|
-
if(this.isFirst) this.onScrollEvent(0);
|
|
145
158
|
}
|
|
146
159
|
|
|
160
|
+
//首次加载
|
|
161
|
+
if(this.isFirst) this.onScrollEvent(0);
|
|
147
162
|
this.isFirst = false
|
|
148
163
|
}
|
|
149
164
|
else {
|
|
@@ -151,7 +166,6 @@ export default class VirtualList {
|
|
|
151
166
|
this.pushVirtualData(data, height)
|
|
152
167
|
},100)
|
|
153
168
|
}
|
|
154
|
-
|
|
155
169
|
}
|
|
156
170
|
|
|
157
171
|
/**
|
|
@@ -159,7 +173,7 @@ export default class VirtualList {
|
|
|
159
173
|
* @param scrollTop
|
|
160
174
|
*/
|
|
161
175
|
onScrollEvent(scrollTop) {
|
|
162
|
-
|
|
176
|
+
|
|
163
177
|
if(!this.status || this.virtualTotalData.length === 0) {
|
|
164
178
|
/**@type Function **/
|
|
165
179
|
this.virtualCallback({
|
|
@@ -171,24 +185,16 @@ export default class VirtualList {
|
|
|
171
185
|
}
|
|
172
186
|
|
|
173
187
|
//非固定计算索引
|
|
174
|
-
let time = new Date().getTime();
|
|
175
188
|
//计算开始索引
|
|
176
189
|
Object.keys(this.virtualHeightObj).map((key,index)=>{
|
|
177
|
-
let top = scrollTop -
|
|
190
|
+
let top = scrollTop - this.virtualBufferHeight;
|
|
178
191
|
|
|
179
192
|
//滚动高度小于元素顶部与屏幕顶部偏移量直接取值0索引
|
|
180
|
-
if(top
|
|
193
|
+
if(top < this.orgUpdateTop) {
|
|
181
194
|
this.startIndex = 0;
|
|
182
195
|
return;
|
|
183
196
|
}
|
|
184
197
|
|
|
185
|
-
|
|
186
|
-
////距离底部有1屏幕高度
|
|
187
|
-
let maxScroll = this.virtualHeightObj[this.virtualTotalData.length -1].max - this.screenHeight;
|
|
188
|
-
if(scrollTop >= maxScroll) {
|
|
189
|
-
top = maxScroll;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
198
|
if(top >= this.virtualHeightObj[key].min && top < this.virtualHeightObj[key].max){
|
|
193
199
|
this.startIndex = Number(key);
|
|
194
200
|
}
|
|
@@ -197,50 +203,65 @@ export default class VirtualList {
|
|
|
197
203
|
//计算结束索引
|
|
198
204
|
this.endIndex = this.virtualTotalData.length;
|
|
199
205
|
Object.keys(this.virtualHeightObj).map((key,index)=>{
|
|
200
|
-
let top = scrollTop
|
|
206
|
+
let top = scrollTop < this.orgUpdateTop ? this.orgUpdateTop : scrollTop
|
|
201
207
|
let endScrollTop = top + this.screenHeight + this.virtualBufferHeight;
|
|
202
|
-
|
|
208
|
+
|
|
209
|
+
////距离底部有1屏幕高度
|
|
210
|
+
let maxScroll = this.virtualHeightObj[this.virtualTotalData.length -1].max;
|
|
211
|
+
if(endScrollTop >= maxScroll) {
|
|
212
|
+
endScrollTop = maxScroll;
|
|
213
|
+
}
|
|
214
|
+
if(endScrollTop > this.virtualHeightObj[key].min && endScrollTop <= this.virtualHeightObj[key].max){
|
|
203
215
|
this.endIndex = Number(key);
|
|
204
216
|
}
|
|
205
217
|
});
|
|
206
218
|
|
|
219
|
+
//计算数据是否显示
|
|
220
|
+
let data = this.cloneDeep(this.virtualTotalData).map((item,index)=>{
|
|
221
|
+
item['is_content_show'] = index >= this.startIndex && index <= this.endIndex;
|
|
222
|
+
item['is_content_height'] = this.virtualHeightObj[index].height
|
|
223
|
+
return item
|
|
224
|
+
});
|
|
207
225
|
|
|
208
|
-
this.
|
|
209
|
-
this.bottom = this.virtualHeightObj[this.virtualTotalData.length-1].max - this.virtualHeightObj[this.endIndex-1].max.toString() + 'px'
|
|
210
|
-
console.log('onScrollEvent.index',this.endIndex - this.startIndex, this.startIndex,this.endIndex, this.top, this.bottom);
|
|
211
|
-
|
|
226
|
+
console.log('onScrollEvent.index',this.endIndex - this.startIndex, this.startIndex,this.endIndex, scrollTop);
|
|
212
227
|
|
|
213
228
|
/**@type Function **/
|
|
214
229
|
this.virtualCallback({
|
|
215
|
-
|
|
216
|
-
paddingBottom: this.bottom,
|
|
217
|
-
data: this.cloneDeep(this.virtualTotalData).slice(this.startIndex, this.endIndex + 1)
|
|
230
|
+
data: data
|
|
218
231
|
});
|
|
232
|
+
|
|
219
233
|
}
|
|
220
234
|
|
|
221
235
|
/**
|
|
222
236
|
* @description 切换Tab调用此方法(对外)
|
|
223
|
-
* @param virtualType {string} 类型 fixed
|
|
237
|
+
* @param virtualType {string} 类型 auto|fixed
|
|
224
238
|
* @param $vm {Vue} vue实例 (在自动高度模式必选)
|
|
225
239
|
* @param ref 元素对象 (在自动高度模式必选)
|
|
226
240
|
*/
|
|
227
|
-
onChangeTab($vm , ref , virtualType
|
|
241
|
+
onChangeTab($vm , ref , virtualType){
|
|
228
242
|
this.virtualTotalData = [];
|
|
229
243
|
this.isFirst = true;
|
|
244
|
+
this.autoHeight = [];
|
|
245
|
+
this.endIndex = 0;
|
|
246
|
+
this.startIndex = 0;
|
|
230
247
|
|
|
231
248
|
//改变顶部偏移量元素
|
|
232
|
-
if(virtualType && virtualType !== this.virtualType) {
|
|
233
|
-
if(!$vm) throw new Error(
|
|
234
|
-
if(!ref) throw new Error(`ref is require, got is ${$vm.$xdUniHelper.checkVarType(ref)}, value is ${ref}`);
|
|
249
|
+
if(['auto','fixed'].includes(virtualType) && virtualType !== this.virtualType) {
|
|
250
|
+
if(!$vm) throw new Error(`onChangeTab, $vm is require, got is ${$vm.$xdUniHelper.checkVarType($vm)},value is ${$vm}`);
|
|
251
|
+
if(!ref) throw new Error(`onChangeTab, ref is require, got is ${$vm.$xdUniHelper.checkVarType(ref)}, value is ${ref}`);
|
|
235
252
|
this.virtualType = virtualType;
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
253
|
+
this.orgUpdateTop = 0;
|
|
254
|
+
this.$el = ref;
|
|
255
|
+
this.status = false;
|
|
256
|
+
this.eqMaxTimer = 4;
|
|
257
|
+
$vm.$nextTick(()=>{
|
|
258
|
+
this.checkOffsetTop();
|
|
259
|
+
});
|
|
260
|
+
this.virtualCallback({
|
|
261
|
+
paddingTop: this.top,
|
|
262
|
+
paddingBottom: this.bottom,
|
|
263
|
+
data:null,
|
|
264
|
+
});
|
|
244
265
|
}
|
|
245
266
|
}
|
|
246
267
|
}
|
|
@@ -61,65 +61,6 @@ export default {
|
|
|
61
61
|
}
|
|
62
62
|
return ''
|
|
63
63
|
},
|
|
64
|
-
|
|
65
|
-
handlePosterClick(item) {
|
|
66
|
-
if(!item.redirect_data) {
|
|
67
|
-
console.warn(`未配置链接地址: ${item.redirect_data}`);
|
|
68
|
-
console.error(`未配置链接地址: ${item.redirect_data}`);
|
|
69
|
-
return
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
//内部链接跳转地址
|
|
73
|
-
if (item.redirect_type === 'INN') {
|
|
74
|
-
try {
|
|
75
|
-
let url = JSON.parse(item.redirect_data);
|
|
76
|
-
let params = '';
|
|
77
|
-
if(url.page) {
|
|
78
|
-
if (item['redirect_params']) params = `?${item['redirect_params']}`;
|
|
79
|
-
this.$xdUniHelper.navigateTo({url: url.page + params})
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
console.error(`应用链接配置错误: ${url.page}`)
|
|
83
|
-
}
|
|
84
|
-
} catch (e) {
|
|
85
|
-
console.error(`应用链接配置错误: ${item.redirect_data}`)
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
//外部链接
|
|
90
|
-
if (item.redirect_type === 'URL') {
|
|
91
|
-
let reg = /^(http:\/\/|https:\/\/|\/\/)+.+$/;
|
|
92
|
-
let spReg = /(-apiuri\/v)/;
|
|
93
|
-
//#ifdef MP-WEIXIN
|
|
94
|
-
try {
|
|
95
|
-
let url = JSON.parse(item.redirect_data);
|
|
96
|
-
if (reg.test(url.url) || spReg.test(url.url)) {
|
|
97
|
-
console.warn(`广告跳转外站: ${url.url}`)
|
|
98
|
-
this.$xdUniHelper.navigateTo(url);
|
|
99
|
-
} else {
|
|
100
|
-
console.error(`广告跳转外站配置错误: ${url.url}`)
|
|
101
|
-
}
|
|
102
|
-
} catch (e) {
|
|
103
|
-
console.error(`广告跳转外站配置错误: ${item.redirect_data}`)
|
|
104
|
-
}
|
|
105
|
-
//#endif
|
|
106
|
-
//#ifdef H5
|
|
107
|
-
try {
|
|
108
|
-
let url = JSON.parse(item.redirect_data);
|
|
109
|
-
console.warn(`广告跳转外站: ${url.url}`);
|
|
110
|
-
this.$xdUniHelper.redirectTo(url, false)
|
|
111
|
-
} catch (e) {
|
|
112
|
-
console.error(`广告跳转外站配置错误: ${item.redirect_data}`)
|
|
113
|
-
}
|
|
114
|
-
//#endif
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
//无跳转地址
|
|
119
|
-
if(item.redirect_type === 'EMP') {
|
|
120
|
-
console.warn(`无跳转地址`);
|
|
121
|
-
}
|
|
122
|
-
},
|
|
123
64
|
},
|
|
124
65
|
}
|
|
125
66
|
|