jufubao-movie 1.0.36-beta1 → 1.0.36-beta3

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