jufubao-movie 1.0.36 → 1.0.38-beta1

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.
@@ -14,30 +14,278 @@
14
14
  </view>
15
15
  <!-- #endif -->
16
16
  <view class="jfb-movie-tfk-film-recommend__body">
17
- <view>测试插件( {{containerId}} )</view>
17
+ <view class="x-line"></view>
18
+ <view
19
+ class="tfk-recommend"
20
+ v-if="showTypeListData.length > 0"
21
+ :style="{
22
+ padding: outSpacing + 'rpx',
23
+ backgroundImage:bgImageComp
24
+ }">
25
+ <view
26
+ class="tfk-recommend__tab"
27
+ :style="{
28
+ marginBottom:outSpacing + 'rpx',
29
+ padding:titleMarginComp,
30
+ backgroundColor:titleBgColor,
31
+ borderRadius:titleRradius+'rpx',
32
+ border:titleBorder,
33
+ boxShadow: titleShadow
34
+ }"
35
+ >
36
+ <view
37
+ class="tfk-recommend__tab-left"
38
+ v-if="titleStyle === 'line'"
39
+ :class="{line:titleStyle === 'line'}"
40
+ >
41
+ <view
42
+ @click="handleTab(item.value)"
43
+ :class="{active: type === item.value}"
44
+ v-for="(item,index) in showTypeListData"
45
+ :key="index"
46
+ >{{item.label}}<text v-if="type === item.value" :style="{backgroundColor:mainColor}"></text></view>
47
+ </view>
48
+ <view
49
+ class="tfk-recommend__tab-left"
50
+ v-if="titleStyle === 'button'"
51
+ :class="{button:titleStyle === 'button'}"
52
+ >
53
+ <view
54
+ @click="handleTab(item.value)"
55
+ :class="{active: type === item.value}"
56
+ v-for="(item,index) in showTypeListData"
57
+ :key="index"
58
+ :style="{
59
+ backgroundColor: type === item.value? titleTextActBgColor: titleTextBgColor,
60
+ color: type === item.value ? titleTextActColor: titleTextColor,
61
+ borderRadius:titleTextRradius+'rpx'
62
+ }"
63
+ >{{item.label}}</view>
64
+ </view>
65
+ <view class="tfk-recommend__tab-right">
66
+ <view :style="{color:totalColor}"><template v-if="showTotal === 'Y' && total">共 {{total}} 部</template></view>
67
+ <view
68
+ v-if="showMoreBtn === 'Y'"
69
+ :class="{noBg:!isTitleMoreBg}"
70
+ @click="handleMore()"
71
+ :style="{
72
+ color: moreTextColor,
73
+ backgroundColor: moreBgColor,
74
+ borderRadius:moreRradius+'rpx'
75
+ }"
76
+ >
77
+ <text>查看全部</text>
78
+ <view v-if="!isTitleMoreBg" style="margin-left: 10rpx">
79
+ <xd-font-icon icon="iconxiangyou_xian" :color="moreTextColor" size="24"></xd-font-icon>
80
+ </view>
81
+ </view>
82
+ </view>
83
+ </view>
84
+ <view
85
+ class="tfk-recommend__content"
86
+ :style="{
87
+ padding:contPaddingComp,
88
+ backgroundColor:contBgColor,
89
+ borderRadius: contRradius + 'rpx',
90
+ border:contBorder,
91
+ boxShadow:contShadow,
92
+ }"
93
+ >
94
+ <view class="skeleton-wrap" v-if="dataList === null">
95
+ <view class="tfk-scroll-item" v-for="item in 4" :key="item">
96
+ <view class="tfk-scroll-item-image skeleton-item"></view>
97
+ <view class="tfk-scroll-item-title skeleton-item"></view>
98
+ <view class="tfk-scroll-item-btn skeleton-item"></view>
99
+ </view>
100
+ </view>
101
+ <scroll-view class="tfk-scroll" scroll-x enable-flex v-else>
102
+ <view
103
+ class="tfk-scroll-item"
104
+ v-for="item in dataList"
105
+ :key="item.id"
106
+ @click="toFilmInfo(item.id)"
107
+ >
108
+ <view class="tfk-scroll-item-image" :style="{borderRadius:contItemRradius + 'rpx'}">
109
+ <image :src="item.poster" :alt="item.show_name" mode="scaleToFill"></image>
110
+ </view>
111
+ <view class="tfk-scroll-item-title">{{item.show_name}}</view>
112
+ <view class="tfk-scroll-item-btn">
113
+ <template v-if="type === 'hot'">
114
+ <xd-button
115
+ v-if="item.show_button === '1'"
116
+ type="primary"
117
+ style="display:block;"
118
+ size="mini"
119
+ @click.stop="toBuyChooseCinema(item.id)">购票</xd-button>
120
+ <xd-button
121
+ v-else-if="item.show_button === '2'"
122
+ type="subPrimary"
123
+ style="display:block;"
124
+ size="mini"
125
+ @click.stop="toBuyChooseCinema(item.id)">预售</xd-button>
126
+ </template>
127
+ <template v-else>
128
+ <xd-button
129
+ v-if="item.show_button === '3'"
130
+ type="success"
131
+ style="display:block;"
132
+ size="mini"
133
+ @click.stop="toFilmInfo(item.id)"
134
+ >想看</xd-button>
135
+ <xd-button
136
+ v-else-if="item.show_button === '2'"
137
+ type="subPrimary"
138
+ style="display:block;"
139
+ size="mini"
140
+ @click.stop="toBuyChooseCinema(item.id)">预售</xd-button>
141
+ </template>
142
+ </view>
143
+ </view>
144
+ </scroll-view>
145
+ </view>
146
+ </view>
147
+ <template v-else>
148
+ <view
149
+ class="noConfig"
150
+ v-if="isPreview"
151
+ :style="{backgroundColor:backgroundColor, color:warningColor}"
152
+ >热映影片,即将上映未配置,此模块在线上不显</view>
153
+ </template>
18
154
  </view>
19
155
  </view>
20
156
  </template>
21
157
 
22
158
  <script>
23
159
  import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
160
+ import XdButton from "@/components/XdButton/XdButton.vue";
24
161
  import { jfbRootExec } from "@/utils/xd.event";
25
162
  import JfbMovieTfkFilmRecommendMixin from "./JfbMovieTfkFilmRecommendMixin";
26
163
  import { getContainerPropsValue } from "@/utils/xd.base";
27
164
  import componentsMixins from "@/mixins/componentsMixins";
28
165
  import extsMixins from "@/mixins/extsMixins";
166
+ import getServiceUrl from "@/common/getServiceUrl";
167
+ const Color = require('color');
168
+ import {mapState} from "vuex";
169
+
170
+
29
171
  export default {
30
172
  name: "JfbMovieTfkFilmRecommend",
31
173
  components: {
32
- XdFontIcon
174
+ XdFontIcon,
175
+ XdButton
33
176
  },
34
177
  mixins: [
35
178
  componentsMixins, extsMixins, JfbMovieTfkFilmRecommendMixin
36
179
  ],
37
180
  data() {
38
181
  return {
182
+ options: {},
183
+ type:'', //hot rightnow
184
+ typeList:{hot:{label: '热映影片', value: 'hot'},rightnow:{label: '即将上映', value: 'rightnow'}},
185
+ typeListStatus: false,
186
+ backgroundColor:'',
187
+ isPreview: false,
188
+ pageToken:'1',
189
+ pageSize: '20',
190
+ total: null,
191
+ dataList:null,
192
+ showTypeListData:[],
193
+
194
+ //基础配置
195
+ outSpacing:'',
196
+ showMoreBtn: 'Y',
197
+ showTotal:'Y',
198
+ showHot: 'Y',
199
+ showRightnow:'Y',
200
+ bgImage:'',
201
+ showHotName:'',
202
+ showRightnowName: '',
203
+
204
+ //标题
205
+ titleMargin:{},
206
+ titleBgColor: '#fff',
207
+ titleRradius: '0',
208
+ titleStyle:'button',
209
+ titleTextColor:'#999',
210
+ titleTextActColor:'#333',
211
+ titleTextBgColor:'',
212
+ titleTextActBgColor:'#eee',
213
+ titleTextRradius: '30',
214
+
215
+ isTitleBorder:'N',
216
+ isTitleBorderColor:'',
217
+ isTitleShadow:'N',
218
+ isTitleShadowColor:'#eee',
219
+ isTitleShadowWidth:'0',
39
220
 
40
- //todo
221
+ moreBgColor:'',
222
+ moreTextColor:'#999',
223
+ moreRradius: '40',
224
+ totalColor: '#999',
225
+
226
+ //内容
227
+ contMargin: {},
228
+ contBgColor:'#fff',
229
+ contRradius:'0',
230
+ contItemRradius:'10',
231
+ isContBorder:'N',
232
+ isContBorderColor:'',
233
+ isContShadow:'N',
234
+ isContShadowColor:'#eee',
235
+ isContShadowWidth:'0',
236
+
237
+ buyPath:'',
238
+ fimeDetailPath:'',
239
+ fimeListPath:'',
240
+ }
241
+ },
242
+ computed:{
243
+ ...mapState({
244
+ stateCity: state => state.cityLocation.city
245
+ }),
246
+
247
+ bgImageComp(){
248
+ if(!this.bgImage || !this.bgImage.url) return 'none';
249
+ return `url(${getServiceUrl(this.bgImage.url)})`;
250
+ },
251
+
252
+ isTitleMoreBg(){
253
+ return !!this.moreBgColor;
254
+ },
255
+
256
+ titleBorder() {
257
+ if (this.isTitleBorder === 'Y') return `2rpx solid ${this.isTitleBorderColor}`;
258
+ else return '0';
259
+ },
260
+ titleShadow(){
261
+ if(this.isTitleShadow === 'Y') return `0 0 ${this.isTitleShadowWidth}rpx ${this.isTitleShadowColor}`;
262
+ else return '0 0 0 rgba(0,0,0,0)';
263
+ },
264
+
265
+ contBorder() {
266
+ if (this.isContBorder === 'Y') return `2rpx solid ${this.isContBorderColor}`;
267
+ else return '0';
268
+ },
269
+ contShadow(){
270
+ if(this.isContShadow === 'Y') return `0 0 ${this.isContShadowWidth}rpx ${this.isContShadowColor}`;
271
+ else return '0 0 0 rgba(0,0,0,0)';
272
+ },
273
+
274
+
275
+ titleMarginComp(){
276
+ let str = `${this.checkValue(this.titleMargin.top, 20)}rpx`;
277
+ str = `${str} ${this.checkValue(this.titleMargin.right, 20)}rpx`;
278
+ str = `${str} ${this.checkValue(this.titleMargin.bottom, 20)}rpx`;
279
+ str = `${str} ${this.checkValue(this.titleMargin.left, 20)}rpx`;
280
+ return str
281
+ },
282
+
283
+ contPaddingComp(){
284
+ let str = `${this.checkValue(this.contMargin.top, 20)}rpx`;
285
+ str = `${str} ${this.checkValue(this.contMargin.right, 20)}rpx`;
286
+ str = `${str} ${this.checkValue(this.contMargin.bottom, 20)}rpx`;
287
+ str = `${str} ${this.checkValue(this.contMargin.left, 20)}rpx`;
288
+ return str
41
289
  }
42
290
  },
43
291
  watch: {
@@ -45,56 +293,171 @@
45
293
  if (JSON.stringify(value) === JSON.stringify(oldValue)) return;
46
294
  if (this.$configProject['isPreview']) this.init(value)
47
295
  },
296
+ stateCity(n, o){
297
+ if(n && JSON.stringify(n) !== JSON.stringify(o)){
298
+ this.dataList = null;
299
+ this.getList();
300
+ }
301
+ },
302
+ showTypeList(){
303
+ this.typeListStatus = true;
304
+ this.getList();
305
+ },
48
306
  },
49
307
  created() {
50
- this.init(this.container);
51
-
52
- //todo
308
+ this.isPreview = this.$configProject.isPreview;
309
+ this.backgroundColor = Color(this.warningColor).alpha(0.2).toString();
310
+ this.init(this.container, true);
53
311
  },
54
312
  methods: {
55
- onJfbLoad(options) {
56
-
57
- // jfbRootExec('baiduUserLogin', {
313
+ toFilmInfo(film_id){
314
+ console.warn(`toFilmInfo(影片详情).${film_id}`)
315
+ if(!this.fimeDetailPath) {
316
+ console.error('未配置链接');
317
+ return;
318
+ }
319
+ if( this.isPreview) return;
320
+ this.$xdUniHelper.navigateTo({
321
+ url: this.fimeDetailPath + `?film_id=${film_id}`
322
+ })
323
+ },
324
+ toBuyChooseCinema(film_id){
325
+ console.warn(`toBuyChooseCinema(选择影院).${film_id}`)
326
+ if(!this.buyPath) {
327
+ console.error('未配置链接');
328
+ return;
329
+ }
330
+ if(this.isPreview) return;
331
+ this.$xdUniHelper.navigateTo({
332
+ url: this.buyPath + `?film_id=${film_id}`
333
+ })
334
+ },
58
335
 
59
- // vm: this,// data: {
336
+ handleTab(value) {
337
+ if(value === this.type) return;
338
+ this.type = value;
339
+ this.getList();
340
+ },
60
341
 
61
- // account: 'gaoshiyong',// password: '123456789',// type: 3,// ...options
342
+ handleMore(){
343
+ console.warn('handleMore')
344
+ if(!this.fimeListPath) {
345
+ console.error('未配置链接');
346
+ return;
347
+ }
348
+ if( this.isPreview) return;
349
+ this.$xdUniHelper.navigateTo({
350
+ url: this.fimeListPath
351
+ })
352
+ },
353
+ onJfbLoad(options) {
354
+ this.options = options;
355
+ },
62
356
 
63
- // }
357
+ getList(){
358
+ let fName = 'getTFKRecFilmHotList';
359
+ if(this.type === 'rightnow') fName = 'getTFKRecFilmRightnowList';
360
+ if(this.isFirstLoadingData) this.$xdShowLoading({});
361
+ if(!this.isFirstLoadingData){
362
+ this.isFirstLoadingData = true;
363
+ }
364
+ jfbRootExec(fName, {
365
+ vm: this,
366
+ data: {
367
+ city_code: this.stateCity.city_code,
368
+ type: this.type,
369
+ page_token: this.pageToken,
370
+ page_size: this.pageSize
371
+ }
372
+ }).then(res => {
373
+ this.total = res['total_size']
374
+ this.dataList = res['list'] || [];
375
+ if(this.isFirstLoadingData) this.$xdHideLoading({});
376
+ }).catch(e=>{
377
+ console.error(e);
378
+ this.$xdHideLoading({});
379
+ })
64
380
 
65
- // }).then().catch()
66
381
  },
382
+
67
383
  /**
68
384
  * @description 监听事件变化
69
385
  * @param container {object} 业务组件对象自己
70
386
  */
71
387
  init(container) {
388
+ this.outSpacing = getContainerPropsValue(container, 'content.outSpacing', '20');
389
+ this.titleMargin = getContainerPropsValue(container, 'content.titleMargin', {});
390
+ this.titleBgColor = getContainerPropsValue(container, 'content.titleBgColor', '#fff');
391
+ this.titleRradius = getContainerPropsValue(container, 'content.titleRradius', '0');
392
+ this.titleStyle = getContainerPropsValue(container, 'content.titleStyle', 'button');
393
+ this.showMoreBtn = getContainerPropsValue(container, 'content.showMoreBtn', 'Y');
394
+ this.showTotal = getContainerPropsValue(container, 'content.showTotal', 'Y');
395
+ this.showHot = getContainerPropsValue(container, 'content.showHot', 'Y');
396
+ this.showRightnow = getContainerPropsValue(container, 'content.showRightnow', 'Y');
397
+ this.moreBgColor = getContainerPropsValue(container, 'content.moreBgColor', '');
398
+ this.moreTextColor = getContainerPropsValue(container, 'content.moreTextColor', '#999');
399
+ this.moreRradius = getContainerPropsValue(container, 'content.moreRradius', '40');
400
+ this.titleTextColor = getContainerPropsValue(container, 'content.titleTextColor', '#999');
401
+ this.titleTextActColor = getContainerPropsValue(container, 'content.titleTextActColor', '#333');
402
+ this.titleTextBgColor = getContainerPropsValue(container, 'content.titleTextBgColor', '');
403
+ this.titleTextActBgColor = getContainerPropsValue(container, 'content.titleTextActBgColor', '#eee');
404
+ this.titleTextRradius = getContainerPropsValue(container, 'content.titleTextRradius', '40');
405
+ this.bgImage = getContainerPropsValue(container, 'content.bgImage', '');
406
+ this.showHotName = getContainerPropsValue(container, 'content.showHotName', '');
407
+ this.showRightnowName = getContainerPropsValue(container, 'content.showRightnowName', '');
72
408
 
73
- //this.bgcolor = getContainerPropsValue(container, 'content.bgcolor', '#fff');
409
+ this.isTitleBorder = getContainerPropsValue(container, 'content.isTitleBorder', 'N');
410
+ this.isTitleBorderColor = getContainerPropsValue(container, 'content.isTitleBorderColor', '#eee');
411
+ this.isTitleShadow = getContainerPropsValue(container, 'content.isTitleShadow', 'N');
412
+ this.isTitleShadowWidth = getContainerPropsValue(container, 'content.isTitleShadowWidth', '10');
413
+ this.isTitleShadowColor = getContainerPropsValue(container, 'content.isTitleShadowColor', '#eee');
414
+
415
+ this.totalColor = getContainerPropsValue(container, 'content.totalColor', '#999');
416
+ this.pageSize = getContainerPropsValue(container, 'content.pageSize', '#999');
417
+
418
+
419
+ //内容
420
+ this.contBgColor = getContainerPropsValue(container, 'content.contBgColor', '#fff');
421
+ this.contRradius = getContainerPropsValue(container, 'content.contRradius', '10');
422
+ this.contMargin = getContainerPropsValue(container, 'content.contMargin', {});
423
+ this.contItemRradius = getContainerPropsValue(container, 'content.contItemRradius', '10');
424
+ this.isContBorder = getContainerPropsValue(container, 'content.isContBorder', 'N');
425
+ this.isContBorderColor = getContainerPropsValue(container, 'content.isContBorderColor', '#eee');
426
+ this.isContShadow = getContainerPropsValue(container, 'content.isContShadow', 'N');
427
+ this.isContShadowWidth = getContainerPropsValue(container, 'content.isContShadowWidth', '10');
428
+ this.isContShadowColor = getContainerPropsValue(container, 'content.isContShadowColor', '#eee');
429
+
430
+ //链接
431
+ this.buyPath = getContainerPropsValue(container, 'content.buyPath', {value: ""}).value;
432
+ this.fimeDetailPath = getContainerPropsValue(container, 'content.fimeDetailPath', {value: ""}).value;
433
+ this.fimeListPath = getContainerPropsValue(container, 'content.fimeListPath', {value: ""}).value;
434
+
435
+ //设置标签
436
+ this.setShowTypeList();
74
437
 
75
- //this.height = getContainerPropsValue(container, 'content.height', 10);
76
- },
77
- onJfbScroll(options) {
78
- console.log('event.onJfbScroll', options)
79
- },
80
- onJfbReachBottom(options) {
81
- console.log('event.onJfbReachBottom', options)
82
- },
83
- onJfbShow(options) {
84
- console.log('event.onJfbShow', options)
85
- },
86
- onJfbHide(options) {
87
- console.log('event.onJfbHide', options)
88
- },
89
- onJfbBack(options) {
90
- console.log('event.onJfbBack', options)
91
- },
92
- onJfbUpdate(...data) {
93
- console.log('event.onJfbUpdate', data)
94
438
  },
95
- onJfbCustomEvent(options) {
96
- console.log('event.onJfbReachBottom', options)
439
+
440
+ setShowTypeList(){
441
+ let list = [];
442
+ if(this.showHot === 'Y') list.push(this.typeList["hot"]);
443
+ if(this.showRightnow === 'Y') list.push(this.typeList["rightnow"]);
444
+ list = this.$xdUniHelper.cloneDeep(list).map(item=>{
445
+ if(item.value === 'hot') item.label = this.showHotName ||item.label
446
+ if(item.value === 'rightnow') item.label = this.showRightnowName || item.label;
447
+ return item
448
+ });
449
+
450
+ //已有选中值不设置默认值
451
+ if(this.type === '') {
452
+ if(list.length > 0){
453
+ this.type = list[0].value;
454
+ }
455
+ else this.type = '';
456
+ }
457
+ this.showTypeListData = this.$xdUniHelper.cloneDeep(list);
458
+ this.getList();
97
459
  },
460
+
98
461
  }
99
462
  }
100
463
 
@@ -105,7 +468,144 @@
105
468
 
106
469
  .jfb-movie-tfk-film-recommend {
107
470
  &__body{
471
+ .tfk-recommend {
472
+ background-size: 100% auto;
473
+ background-position: top center;
474
+ background-repeat: no-repeat;
475
+
476
+ &__tab {
477
+ height: 60rpx;
478
+ display: flex;
479
+ justify-content: space-between;
480
+ align-items: center;
481
+
482
+ &-left {
483
+ height: 100%;
484
+ display: flex;
485
+ justify-content: flex-start;
486
+ align-items: center;
487
+
488
+ &.line > view {
489
+ margin: 0 30rpx;
490
+ }
491
+ &.button > view {
492
+ padding: 0 30rpx;
493
+ }
494
+
495
+ & > view {
496
+ height: 100%;
497
+
498
+ line-height: 60rpx;
499
+ font-size: 28rpx;
500
+ position: relative;
501
+ cursor: pointer;
502
+
503
+ & > text {
504
+ height: 6rpx;
505
+ position: absolute;
506
+ left:0;
507
+ right: 0;
508
+ bottom: -6rpx;
509
+ }
510
+ }
511
+ }
512
+
513
+ &-right {
514
+ display: flex;
515
+ justify-content: flex-end;
516
+ align-items: center;
517
+
518
+ & > view:nth-child(1) {
519
+ margin-right: 30rpx;
520
+ color: #999;
521
+ font-size: 24rpx;
522
+ }
523
+
524
+ & > view:nth-child(2) {
525
+ cursor: pointer;
526
+ height: 50rpx;
527
+ line-height: 50rpx;
528
+ padding: 0 16rpx;
529
+ display: flex;
530
+ justify-content: flex-end;
531
+ align-items: center;
532
+ font-size: 24rpx;
533
+
534
+ &.noBg {
535
+ padding: 0;
536
+ }
537
+ }
538
+ }
539
+ }
540
+
541
+ &__content {
542
+ height: 362rpx;
543
+ overflow: hidden;
544
+
545
+ & .tfk-scroll {
546
+ height: 362rpx;
547
+ white-space: nowrap;
548
+ width: 100%;
549
+ }
550
+
551
+ .skeleton-wrap {
552
+ height: 100%;
553
+ display: flex;
554
+ justify-content: flex-start;
555
+ align-items: center;
556
+ flex-flow: nowrap;
557
+ .tfk-scroll-item-btn {
558
+ .skeleton-item(100rpx);
559
+ margin: 10rpx auto 0;
560
+ }
561
+
562
+ .tfk-scroll-item-image {
563
+ .skeleton-item(170rpx, 240rpx);
564
+ }
565
+ .tfk-scroll-item-title {
566
+ .skeleton-item;
567
+ }
568
+ }
569
+
570
+ .tfk-scroll-item {
571
+ width: 170rpx;
572
+ height: 100%;
573
+ margin-right: 30rpx;
574
+ flex-shrink: 0;
575
+ display: inline-block;
576
+
577
+ &-image {
578
+ height: 240rpx;
579
+ overflow: hidden;
580
+ & > image {
581
+ width: 100%;
582
+ height: 100%;
583
+ }
584
+ }
585
+ &-title {
586
+ height: 40rpx;
587
+ margin-top: 16rpx;
588
+ text-align: center;
589
+ line-height: 40rpx;
590
+ font-size: 28rpx;
591
+ .uni-one-cut(40)
592
+ }
593
+
594
+ &-btn {
595
+ height: 50rpx;
596
+ width: 100rpx;
597
+ margin: 16rpx auto 0;
598
+ }
599
+
600
+ }
601
+ }
602
+ }
603
+ }
108
604
 
605
+ .noConfig {
606
+ line-height: 100rpx;
607
+ text-align: center;
608
+ font-size: 26rpx;
109
609
  }
110
610
  }
111
611
  </style>