jufubao-movie 1.0.38 → 1.0.39-beta2

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" @error="handleError(item)"></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,174 @@
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() {
308
+ this.isPreview = this.$configProject.isPreview;
309
+ this.backgroundColor = Color(this.warningColor).alpha(0.2).toString();
50
310
  this.init(this.container);
51
-
52
- //todo
53
311
  },
54
312
  methods: {
55
- onJfbLoad(options) {
56
-
57
- // jfbRootExec('baiduUserLogin', {
313
+ handleError(item){
314
+ item['poster'] = 'https://img.jufubao.cn/common/error_movie.png?v20'
315
+ },
316
+ toFilmInfo(film_id){
317
+ console.warn(`toFilmInfo(影片详情).${film_id}`)
318
+ if(!this.fimeDetailPath) {
319
+ console.error('未配置链接');
320
+ return;
321
+ }
322
+ if( this.isPreview) return;
323
+ this.$xdUniHelper.navigateTo({
324
+ url: this.fimeDetailPath + `?film_id=${film_id}`
325
+ })
326
+ },
327
+ toBuyChooseCinema(film_id){
328
+ console.warn(`toBuyChooseCinema(选择影院).${film_id}`)
329
+ if(!this.buyPath) {
330
+ console.error('未配置链接');
331
+ return;
332
+ }
333
+ if(this.isPreview) return;
334
+ this.$xdUniHelper.navigateTo({
335
+ url: this.buyPath + `?film_id=${film_id}`
336
+ })
337
+ },
58
338
 
59
- // vm: this,// data: {
339
+ handleTab(value) {
340
+ if(value === this.type) return;
341
+ this.type = value;
342
+ this.getList();
343
+ },
60
344
 
61
- // account: 'gaoshiyong',// password: '123456789',// type: 3,// ...options
345
+ handleMore(){
346
+ console.warn('handleMore')
347
+ if(!this.fimeListPath) {
348
+ console.error('未配置链接');
349
+ return;
350
+ }
351
+ if( this.isPreview) return;
352
+ this.$xdUniHelper.navigateTo({
353
+ url: this.fimeListPath
354
+ })
355
+ },
356
+ onJfbLoad(options) {
357
+ this.options = options;
358
+ },
62
359
 
63
- // }
360
+ getList(){
361
+ let fName = 'getTFKRecFilmHotList';
362
+ if(this.type === 'rightnow') fName = 'getTFKRecFilmRightnowList';
363
+ if(this.isFirstLoadingData) this.$xdShowLoading({});
364
+ if(!this.isFirstLoadingData){
365
+ this.isFirstLoadingData = true;
366
+ }
367
+ jfbRootExec(fName, {
368
+ vm: this,
369
+ data: {
370
+ city_code: this.stateCity.city_code,
371
+ type: this.type,
372
+ page_token: this.pageToken,
373
+ page_size: this.pageSize
374
+ }
375
+ }).then(res => {
376
+ this.total = res['total_size']
377
+ this.dataList = res['list'] || [];
378
+ if(this.isFirstLoadingData) this.$xdHideLoading({});
379
+ }).catch(e=>{
380
+ console.error(e);
381
+ this.$xdHideLoading({});
382
+ })
64
383
 
65
- // }).then().catch()
66
384
  },
385
+
67
386
  /**
68
387
  * @description 监听事件变化
69
388
  * @param container {object} 业务组件对象自己
70
389
  */
71
390
  init(container) {
391
+ this.outSpacing = getContainerPropsValue(container, 'content.outSpacing', '20');
392
+ this.titleMargin = getContainerPropsValue(container, 'content.titleMargin', {});
393
+ this.titleBgColor = getContainerPropsValue(container, 'content.titleBgColor', '#fff');
394
+ this.titleRradius = getContainerPropsValue(container, 'content.titleRradius', '0');
395
+ this.titleStyle = getContainerPropsValue(container, 'content.titleStyle', 'button');
396
+ this.showMoreBtn = getContainerPropsValue(container, 'content.showMoreBtn', 'Y');
397
+ this.showTotal = getContainerPropsValue(container, 'content.showTotal', 'Y');
398
+ this.showHot = getContainerPropsValue(container, 'content.showHot', 'Y');
399
+ this.showRightnow = getContainerPropsValue(container, 'content.showRightnow', 'Y');
400
+ this.moreBgColor = getContainerPropsValue(container, 'content.moreBgColor', '');
401
+ this.moreTextColor = getContainerPropsValue(container, 'content.moreTextColor', '#999');
402
+ this.moreRradius = getContainerPropsValue(container, 'content.moreRradius', '40');
403
+ this.titleTextColor = getContainerPropsValue(container, 'content.titleTextColor', '#999');
404
+ this.titleTextActColor = getContainerPropsValue(container, 'content.titleTextActColor', '#333');
405
+ this.titleTextBgColor = getContainerPropsValue(container, 'content.titleTextBgColor', '');
406
+ this.titleTextActBgColor = getContainerPropsValue(container, 'content.titleTextActBgColor', '#eee');
407
+ this.titleTextRradius = getContainerPropsValue(container, 'content.titleTextRradius', '40');
408
+ this.bgImage = getContainerPropsValue(container, 'content.bgImage', '');
409
+ this.showHotName = getContainerPropsValue(container, 'content.showHotName', '');
410
+ this.showRightnowName = getContainerPropsValue(container, 'content.showRightnowName', '');
72
411
 
73
- //this.bgcolor = getContainerPropsValue(container, 'content.bgcolor', '#fff');
412
+ this.isTitleBorder = getContainerPropsValue(container, 'content.isTitleBorder', 'N');
413
+ this.isTitleBorderColor = getContainerPropsValue(container, 'content.isTitleBorderColor', '#eee');
414
+ this.isTitleShadow = getContainerPropsValue(container, 'content.isTitleShadow', 'N');
415
+ this.isTitleShadowWidth = getContainerPropsValue(container, 'content.isTitleShadowWidth', '10');
416
+ this.isTitleShadowColor = getContainerPropsValue(container, 'content.isTitleShadowColor', '#eee');
417
+
418
+ this.totalColor = getContainerPropsValue(container, 'content.totalColor', '#999');
419
+ this.pageSize = getContainerPropsValue(container, 'content.pageSize', '#999');
420
+
421
+
422
+ //内容
423
+ this.contBgColor = getContainerPropsValue(container, 'content.contBgColor', '#fff');
424
+ this.contRradius = getContainerPropsValue(container, 'content.contRradius', '10');
425
+ this.contMargin = getContainerPropsValue(container, 'content.contMargin', {});
426
+ this.contItemRradius = getContainerPropsValue(container, 'content.contItemRradius', '10');
427
+ this.isContBorder = getContainerPropsValue(container, 'content.isContBorder', 'N');
428
+ this.isContBorderColor = getContainerPropsValue(container, 'content.isContBorderColor', '#eee');
429
+ this.isContShadow = getContainerPropsValue(container, 'content.isContShadow', 'N');
430
+ this.isContShadowWidth = getContainerPropsValue(container, 'content.isContShadowWidth', '10');
431
+ this.isContShadowColor = getContainerPropsValue(container, 'content.isContShadowColor', '#eee');
432
+
433
+ //链接
434
+ this.buyPath = getContainerPropsValue(container, 'content.buyPath', {value: ""}).value;
435
+ this.fimeDetailPath = getContainerPropsValue(container, 'content.fimeDetailPath', {value: ""}).value;
436
+ this.fimeListPath = getContainerPropsValue(container, 'content.fimeListPath', {value: ""}).value;
437
+
438
+ //设置标签
439
+ this.setShowTypeList();
74
440
 
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
441
  },
95
- onJfbCustomEvent(options) {
96
- console.log('event.onJfbReachBottom', options)
442
+
443
+ setShowTypeList(){
444
+ let list = [];
445
+ if(this.showHot === 'Y') list.push(this.typeList["hot"]);
446
+ if(this.showRightnow === 'Y') list.push(this.typeList["rightnow"]);
447
+ list = this.$xdUniHelper.cloneDeep(list).map(item=>{
448
+ if(item.value === 'hot') item.label = this.showHotName ||item.label
449
+ if(item.value === 'rightnow') item.label = this.showRightnowName || item.label;
450
+ return item
451
+ });
452
+
453
+ //已有选中值不设置默认值
454
+ if(this.type === '') {
455
+ if(list.length > 0){
456
+ this.type = list[0].value;
457
+ }
458
+ else this.type = '';
459
+ }
460
+ this.showTypeListData = this.$xdUniHelper.cloneDeep(list);
461
+ this.getList();
97
462
  },
463
+
98
464
  }
99
465
  }
100
466
 
@@ -105,7 +471,144 @@
105
471
 
106
472
  .jfb-movie-tfk-film-recommend {
107
473
  &__body{
474
+ .tfk-recommend {
475
+ background-size: 100% auto;
476
+ background-position: top center;
477
+ background-repeat: no-repeat;
478
+
479
+ &__tab {
480
+ height: 60rpx;
481
+ display: flex;
482
+ justify-content: space-between;
483
+ align-items: center;
484
+
485
+ &-left {
486
+ height: 100%;
487
+ display: flex;
488
+ justify-content: flex-start;
489
+ align-items: center;
490
+
491
+ &.line > view {
492
+ margin: 0 30rpx;
493
+ }
494
+ &.button > view {
495
+ padding: 0 30rpx;
496
+ }
497
+
498
+ & > view {
499
+ height: 100%;
500
+
501
+ line-height: 60rpx;
502
+ font-size: 28rpx;
503
+ position: relative;
504
+ cursor: pointer;
505
+
506
+ & > text {
507
+ height: 6rpx;
508
+ position: absolute;
509
+ left:0;
510
+ right: 0;
511
+ bottom: -6rpx;
512
+ }
513
+ }
514
+ }
515
+
516
+ &-right {
517
+ display: flex;
518
+ justify-content: flex-end;
519
+ align-items: center;
520
+
521
+ & > view:nth-child(1) {
522
+ margin-right: 30rpx;
523
+ color: #999;
524
+ font-size: 24rpx;
525
+ }
526
+
527
+ & > view:nth-child(2) {
528
+ cursor: pointer;
529
+ height: 50rpx;
530
+ line-height: 50rpx;
531
+ padding: 0 16rpx;
532
+ display: flex;
533
+ justify-content: flex-end;
534
+ align-items: center;
535
+ font-size: 24rpx;
536
+
537
+ &.noBg {
538
+ padding: 0;
539
+ }
540
+ }
541
+ }
542
+ }
543
+
544
+ &__content {
545
+ height: 362rpx;
546
+ overflow: hidden;
547
+
548
+ & .tfk-scroll {
549
+ height: 362rpx;
550
+ white-space: nowrap;
551
+ width: 100%;
552
+ }
553
+
554
+ .skeleton-wrap {
555
+ height: 100%;
556
+ display: flex;
557
+ justify-content: flex-start;
558
+ align-items: center;
559
+ flex-flow: nowrap;
560
+ .tfk-scroll-item-btn {
561
+ .skeleton-item(100rpx);
562
+ margin: 10rpx auto 0;
563
+ }
564
+
565
+ .tfk-scroll-item-image {
566
+ .skeleton-item(170rpx, 240rpx);
567
+ }
568
+ .tfk-scroll-item-title {
569
+ .skeleton-item;
570
+ }
571
+ }
572
+
573
+ .tfk-scroll-item {
574
+ width: 170rpx;
575
+ height: 100%;
576
+ margin-right: 30rpx;
577
+ flex-shrink: 0;
578
+ display: inline-block;
579
+
580
+ &-image {
581
+ height: 240rpx;
582
+ overflow: hidden;
583
+ & > image {
584
+ width: 100%;
585
+ height: 100%;
586
+ }
587
+ }
588
+ &-title {
589
+ height: 40rpx;
590
+ margin-top: 16rpx;
591
+ text-align: center;
592
+ line-height: 40rpx;
593
+ font-size: 28rpx;
594
+ .uni-one-cut(40)
595
+ }
596
+
597
+ &-btn {
598
+ height: 50rpx;
599
+ width: 100rpx;
600
+ margin: 16rpx auto 0;
601
+ }
602
+
603
+ }
604
+ }
605
+ }
606
+ }
108
607
 
608
+ .noConfig {
609
+ line-height: 100rpx;
610
+ text-align: center;
611
+ font-size: 26rpx;
109
612
  }
110
613
  }
111
614
  </style>