jufubao-base 1.0.213 → 1.0.214

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.
@@ -3,81 +3,81 @@
3
3
  <view
4
4
  class="sreen__box notCarousel"
5
5
  :class="{
6
- cell4: config.cells === 4,
7
- cell5: config.cells === 5,
6
+ cell4: config['column'] === 4,
7
+ cell5: config['column'] === 5,
8
8
  }"
9
- v-if="config.isCarousel === false"
10
- :style="{
11
- height: (getHeight) + 'px'
12
- }">
9
+ v-if="config['isCarousel'] === false"
10
+ :style="[notCarouselComp,{'--title-height':titleHeight}]"
11
+ >
13
12
  <view
14
13
  v-for="item in list"
15
14
  :key="item['content_id']"
16
15
  @click="handleClick(item)"
17
- :style="{
18
- height: (height + rpxText) + 'px'
19
- }"
16
+ :style="[config['iconItemStyleComp']]"
20
17
  >
21
- <view :style="{ height: height + 'px', width:width, padding: config.iconPadding}">
22
- <view :style="{
23
- borderRadius: config.radius + 'rpx',
24
- boxShadow: config.shadow === 1? `0 0 8rpx ${config.shadowColor}` : '',
25
- }">
26
- <image :src="item.image_url" style=""></image>
18
+ <view :style="[config['iconItemBoxStyleComp']]">
19
+ <view :style="[config['iconStyleComp']]" class="image">
20
+ <image :src="item.image_url"></image>
27
21
  </view>
28
22
  </view>
29
- <view v-if="item['content_name']" :style="{color: config.textColor}">{{item['content_name']}}</view>
23
+ <view
24
+ class="content_name"
25
+ v-if="item['content_name']"
26
+ :style="[config['titleStyle']]"
27
+ >{{item['content_name']}}</view>
30
28
  </view>
31
29
  </view>
32
- <view class="sreen__box carousel" v-if="config.isCarousel === true">
30
+ <view class="sreen__box carousel" v-if="config['isCarousel'] === true">
33
31
  <xd-swiper-dot
34
32
  :current="current"
35
33
  :info="list"
36
34
  field="content_name"
37
- :mode="config.mode"
38
- :dots-styles="config.dotStyleData"
39
- :style="{height: (getHeight) + 'px', width:'100%'}"
35
+ :mode="config['mode']"
36
+ :dots-styles="config['dotStyleData']"
37
+ :style="{height: (getContHeight + getIndexHeigth) + 'px', width:'100%'}"
40
38
  >
41
39
  <!--#ifdef MP-WEIXIN-->
42
40
  <swiper
41
+ v-if="0"
43
42
  class="swiper xd-swiper-content"
44
- :style="{width: '100%', height: getHeight + 'px'}"
43
+ :style="{width: '100%', height: getContHeight + 'px'}"
45
44
  :indicator-dots="false"
46
- :autoplay="config.carouselTime > 0"
47
- :interval="config.carouselTime"
45
+ :autoplay="config['carouselTime'] > 0"
46
+ :interval="config['carouselTime'] "
48
47
  :duration="500"
49
48
  :current="current"
50
49
  circular
51
- @animationfinish="handleAnimationfinish"
50
+ @change="handleAnimationfinish"
52
51
  >
53
52
  <swiper-item
54
53
  v-for="(item,index) in list"
55
54
  :key="index"
56
- :style="{width: '100%', height: getHeight + 'px'}"
55
+ :style="{width: '100%', height: getContHeight + 'px'}"
57
56
  >
58
57
  <view
59
58
  class="sreen__box-list"
60
59
  :class="{
61
- cell4: config.cells === 4,
62
- cell5: config.cells === 5,
60
+ cell4: config['column'] === 4,
61
+ cell5: config['column'] === 5,
63
62
  }"
64
- :style="{ height: getHeight + 'px'}"
63
+ :style="[{height: getContHeight + 'px'},{'--title-height':titleHeight}]"
65
64
  >
66
65
  <view
67
66
  v-for="it in item"
68
67
  :key="it['content_id']"
69
- :style="{height: boxHeight + 'px'}"
68
+ :style="[config['iconItemStyleComp']]"
70
69
  @click="handleClick(it)"
71
70
  >
72
- <view :style="{ height: height + 'px', padding: config.iconPadding}">
73
- <view :style="{
74
- borderRadius: config.radius + 'rpx',
75
- boxShadow: config.shadow === 1? `0 0 10rpx rgba(0, 0, 0, .5)` : '',
76
- }">
71
+ <view :style="[config['iconItemBoxStyleComp']]">
72
+ <view :style="[config['iconStyleComp']]" class="image">
77
73
  <image :src="it.image_url"></image>
78
74
  </view>
79
75
  </view>
80
- <view v-if="it['content_name']" :style="{color: config.textColor}">{{it['content_name']}}</view>
76
+ <view
77
+ class="content_name"
78
+ v-if="it['content_name']"
79
+ :style="[config['titleStyle']]"
80
+ >{{it['content_name']}}</view>
81
81
  </view>
82
82
  </view>
83
83
  </swiper-item>
@@ -85,43 +85,41 @@
85
85
  <!--#endif-->
86
86
  <!--#ifdef H5-->
87
87
  <xd-swiper
88
+ :key="h5key"
88
89
  :indicator-dots="false"
89
- :interval="config.carouselTime"
90
+ :interval="config['carouselTime']"
90
91
  :list="list"
91
92
  :current="current"
92
93
  width="100%"
93
- :height="getHeight + 'px'"
94
+ :height="getContHeight + 'px'"
94
95
  @onClickItem="handleClick"
95
- @animationfinish="handleAnimationfinish"
96
+ @change="handleAnimationfinish"
96
97
  >
97
98
  <template slot-scope="{ item, index}">
98
99
  <view
99
100
  class="sreen__box-list"
100
101
  :class="{
101
- cell4: config.cells === 4,
102
- cell5: config.cells === 5,
103
- }"
104
- :style="{
105
- height: getHeight + 'px'
102
+ cell4: config['column'] === 4,
103
+ cell5: config['column'] === 5,
106
104
  }"
105
+ :style="[{height: getContHeight + 'px'},{'--title-height':titleHeight}]"
107
106
  >
108
107
  <view
109
108
  v-for="it in item"
110
109
  :key="it['content_id']"
111
- :style="{
112
- height: boxHeight + 'px'
113
- }"
110
+ :style="[config['iconItemStyleComp']]"
114
111
  @click="handleClick(it)"
115
112
  >
116
- <view :style="{ height: height + 'px', padding: config.iconPadding}">
117
- <view :style="{
118
- borderRadius: config.radius + 'rpx',
119
- boxShadow: config.shadow === 1? `0 0 10rpx rgba(0, 0, 0, .5)` : '',
120
- }">
113
+ <view :style="[config['iconItemBoxStyleComp']]">
114
+ <view :style="[config['iconStyleComp']]" class="image">
121
115
  <image :src="it.image_url"></image>
122
116
  </view>
123
117
  </view>
124
- <view v-if="it['content_name']" :style="{color: config.textColor}">{{it['content_name']}}</view>
118
+ <view
119
+ class="content_name"
120
+ v-if="it['content_name']"
121
+ :style="[config['titleStyle']]"
122
+ >{{it['content_name']}}</view>
125
123
  </view>
126
124
  </view>
127
125
  </template>
@@ -157,36 +155,37 @@
157
155
  timer: null,
158
156
  width: 0,
159
157
  height: 0,
160
- text: 40,
158
+ indexHeigth: 48,
161
159
  padding: 0,
162
160
  status: false,
163
161
  list: [],
164
162
  filterContentList:[],
165
163
  isPreview: false,
166
164
  current: 0,
165
+ h5key: 'h5key'
167
166
  }
168
167
  },
169
168
  computed:{
170
- getHeight() {
171
- let len = this.filterContentList.length
172
-
173
- //数量小于等于2,3行
174
- if(len <= this.config.cells) {
175
- return this.height + this.rpxText
169
+ titleHeight(){
170
+ return parseInt(this.config.titleStyle.lineHeight)+'rpx'
171
+ },
172
+ notCarouselComp(){
173
+ return {
174
+ height: this.height * this.config.row + 'px'
176
175
  }
177
-
178
- //三行小于等于两个数量
179
- if(this.config.jdRows === 3) {
180
- if(len <= this.config.cells * 2) {
181
- return this.height * 2 + this.rpxText * 2
182
- }
176
+ },
177
+ getIndexHeigth(){
178
+ if(['indexes', 'nav'].includes(this.config['mode'])) return 60 * this.$rpxNum
179
+ return (this.config['mode'] === 'normal'?0:48) * this.$rpxNum;
180
+ },
181
+ getContHeight() {
182
+ let realRow = Math.min(Math.ceil(this.filterContentList.length/this.config.column),this.config['row']);
183
+ //数量小于等于1,2行
184
+ if(realRow < 3) {
185
+ return this.height * realRow;
183
186
  }
184
-
185
- return this.height * this.config.jdRows + this.rpxText * this.config.jdRows;
187
+ return this.height * this.config['row'];
186
188
  },
187
- rpxText(){
188
- return this.$rpxNum * this.text
189
- },
190
189
  boxHeight(){
191
190
  return this.height + this.$rpxNum * this.text;
192
191
  }
@@ -280,25 +279,27 @@
280
279
  //静态图显示
281
280
  if(this.config.isCarousel === false) {
282
281
  this.list = content.filter((item,index)=>{
283
- return index < (this.config.cells * this.config.jdRows);
282
+ return index < (this.config['column'] * this.config['row']);
284
283
  })
285
284
  }
286
285
  //轮播图显示
287
286
  else {
288
- let num = this.config.cells * this.config.jdRows;
287
+ let num = this.config['column'] * this.config['row'];
289
288
  let maxPage = Math.ceil(content.length / num);
290
289
  let arr = [];
291
290
  for(let i =1 ; i <= maxPage; i++) {
292
291
  arr.push(this.$xdUniHelper.getLocalPaginationData(content, i, num))
293
292
  }
294
293
  this.list = arr;
294
+ this.h5key = Date.now()
295
295
  }
296
296
 
297
-
298
- }, 100)
297
+ }, 500)
299
298
  },
300
299
 
301
300
  handleClick(item) {
301
+ if(this.config.isPreview) return;
302
+
302
303
  if(!item.redirect_data) {
303
304
  console.warn(`未配置链接地址: ${item.redirect_data}`);
304
305
  console.error(`未配置链接地址: ${item.redirect_data}`);
@@ -366,6 +367,26 @@
366
367
  height: 100%;
367
368
  position: relative;
368
369
 
370
+ & .image {
371
+ width: 100%;
372
+ height: 100%;
373
+ overflow: hidden;
374
+ & > image {
375
+ width: 100%;
376
+ height: 100%;
377
+ }
378
+ }
379
+
380
+ .content_name {
381
+ text-align: center;
382
+ max-height: var(--title-height);
383
+ overflow: hidden;
384
+ text-overflow: ellipsis;
385
+ display: -webkit-box;
386
+ -webkit-line-clamp: 1;
387
+ -webkit-box-orient: vertical;
388
+ }
389
+
369
390
  & .carousel-mask {
370
391
  position: absolute;
371
392
  left: 0;
@@ -386,88 +407,17 @@
386
407
  flex-wrap: wrap;
387
408
  overflow: hidden;
388
409
 
389
- //行
390
- &.cell4 {
391
- //图片+文字外框
392
- & > view {
393
- width: calc(100% / 4);
394
- flex-shrink: 0;
395
-
396
- //图片
397
- & > view:first-child {
398
- overflow: hidden;
399
- display: flex;
400
- justify-content: center;
401
- align-items: center;
402
- box-sizing: border-box;
403
-
404
- & > view {
405
- width: 100%;
406
- height: 100%;
407
- overflow: hidden;
408
- display: flex;
409
- justify-content: center;
410
- align-items: center;
411
- & > image {
412
- width: 100%;
413
- height: 100%;
414
- }
415
- }
416
- }
417
410
 
418
- & > view:last-child {
419
- text-align: center;
420
- line-height: unit(36, rpx);
421
- width: 90%;
422
- margin: 0 5%;
423
- overflow: hidden;
424
- font-size: unit(24, rpx);
425
- .uni-max-cut(1, 36);
426
-
427
- }
428
- }
429
- }
430
-
431
- &.cell5 {
432
- & > view {
433
- width: calc(100% / 5);
434
- flex-shrink: 0;
435
-
436
- //图片
437
- & > view:first-child {
438
- overflow: hidden;
439
- display: flex;
440
- justify-content: center;
441
- align-items: center;
442
- width: 100%;
443
- box-sizing: border-box;
444
-
445
- & > view {
446
- width: 100%;
447
- height: 100%;
448
- overflow: hidden;
449
- display: flex;
450
- justify-content: center;
451
- align-items: center;
452
-
453
- & > image {
454
- width: 100%;
455
- height: 100%;
456
- }
457
- }
458
- }
459
-
460
- & > view:last-child {
461
- text-align: center;
462
- line-height: unit(36, rpx);
463
- width: 90%;
464
- margin: 0 5%;
465
- overflow: hidden;
466
- font-size: unit(24, rpx);
467
- .uni-max-cut(1, 36);
468
- }
469
- }
470
- }
411
+ &.cell4 {
412
+ & > view:nth-child(4n) {
413
+ margin-right: 0!important;
414
+ }
415
+ }
416
+ &.cell5 {
417
+ & > view:nth-child(5n) {
418
+ margin-right: 0!important;
419
+ }
420
+ }
471
421
  }
472
422
 
473
423
  &__box.carousel {
@@ -490,84 +440,16 @@
490
440
  flex-wrap: wrap;
491
441
  overflow: hidden;
492
442
 
493
- //行
494
- &.cell4 {
495
- //图片+文字外框
496
- & > view {
497
- width: calc(100% / 4);
498
- flex-shrink: 0;
499
-
500
- //图片
501
- & > view:first-child {
502
- overflow: hidden;
503
- display: flex;
504
- justify-content: center;
505
- align-items: center;
506
- width: 100%;
507
- box-sizing: border-box;
508
-
509
- & > view {
510
- width: 100%;
511
- height: 100%;
512
- display: flex;
513
- justify-content: center;
514
- align-items: center;
515
- overflow: hidden;
516
-
517
- & > image {
518
- width: 100%;
519
- height: 100%;
520
- }
521
- }
522
- }
523
-
524
- & > view:last-child {
525
- text-align: center;
526
- line-height: 15px;
527
- font-size: unit(24, rpx);
528
- }
529
- }
530
- }
531
-
532
- &.cell5 {
533
- & > view {
534
- width: calc(100% / 5);
535
- flex-shrink: 0;
536
-
537
- //图片
538
- & > view:first-child {
539
- overflow: hidden;
540
- display: flex;
541
- justify-content: center;
542
- align-items: center;
543
- width: 100%;
544
- box-sizing: border-box;
545
-
546
- & > view {
547
- width: 100%;
548
- height: 100%;
549
- overflow: hidden;
550
- display: flex;
551
- justify-content: center;
552
- align-items: center;
553
-
554
- & > image {
555
- width: 100%;
556
- height: 100%;
557
- }
558
- }
559
- }
560
-
561
- & > view:last-child {
562
- text-align: center;
563
- line-height: unit(36, rpx);
564
- width: 90%;
565
- margin: 0 5%;
566
- overflow: hidden;
567
- font-size: unit(24, rpx);
568
- }
569
- }
570
- }
443
+ &.cell4 {
444
+ & > view:nth-child(4n) {
445
+ margin-right: 0!important;
446
+ }
447
+ }
448
+ &.cell5 {
449
+ & > view:nth-child(5n) {
450
+ margin-right: 0!important;
451
+ }
452
+ }
571
453
  }
572
454
  }
573
455