jufubao-base 1.0.157-beta4 → 1.0.157-beta5

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.
@@ -1,4 +1,3 @@
1
- <script src="JfbBasePosterBigSmallMixin.js"></script>
2
1
  <template>
3
2
  <view
4
3
  class="jfb-base-poster-big-small"
@@ -11,7 +10,9 @@
11
10
  :class="{ editx: isEditx && active }"
12
11
  v-if="isEditx && active"
13
12
  >
14
- <view class="jfb-base-poster-big-small__edit-icon" @click="delEdit">删除</view>
13
+ <view class="jfb-base-poster-big-small__edit-icon" @click="delEdit"
14
+ >删除</view
15
+ >
15
16
  </view>
16
17
  <!-- #endif -->
17
18
  <view class="jfb-base-poster-big-small__body">
@@ -21,7 +22,6 @@
21
22
  margin: margin,
22
23
  flexDirection: position === 1 ? 'row' : 'row-reverse',
23
24
  }"
24
- v-if="isShowAd"
25
25
  >
26
26
  <view
27
27
  v-if="isCarousel === 1"
@@ -60,26 +60,6 @@
60
60
  :mode="dot_type"
61
61
  :dots-styles="dotStyleData"
62
62
  >
63
- <!--#ifdef MP-WEIXIN-->
64
- <swiper
65
- :style="{width: bigWidth + 'rpx', height: bigHeight + 'rpx'}"
66
- :indicator-dots="false"
67
- :autoplay="carouselTime>0"
68
- :interval="carouselTime"
69
- :duration="500"
70
- :current="current"
71
- circular
72
- @animationfinish="handleBigAnimationfinish"
73
- >
74
- <swiper-item v-for="(item,index) in bigList" :key="index" @click.stop="handleClick(item)">
75
- <image
76
- :style="{borderRadius: radius + 'rpx',width: bigWidth + 'rpx',height: bigHeight + 'rpx',}"
77
- :src="item['image_url']"
78
- mode="aspectFill"></image>
79
- </swiper-item>
80
- </swiper>
81
- <!--#endif-->
82
- <!--#ifdef H5-->
83
63
  <xd-swiper
84
64
  :indicator-dots="false"
85
65
  :list="bigList"
@@ -91,10 +71,15 @@
91
71
  @animationfinish="handleBigAnimationfinish"
92
72
  >
93
73
  <template slot-scope="{ item, index }">
94
- <image :style="{borderRadius: radius + 'rpx',}" :src="item['image_url']" mode="aspectFill"></image>
74
+ <image
75
+ :style="{
76
+ borderRadius: radius + 'rpx',
77
+ }"
78
+ :src="item['image_url']"
79
+ mode="aspectFill"
80
+ ></image>
95
81
  </template>
96
82
  </xd-swiper>
97
- <!--#endif-->
98
83
  </xd-swiper-dot>
99
84
  <view v-if="isPreview" class="carousel-mask"></view>
100
85
  </view>
@@ -127,7 +112,7 @@
127
112
  }"
128
113
  :src="topList[0].image_url"
129
114
  mode="aspectFill"
130
- ></image></view
115
+ ></image> </view
131
116
  ></view>
132
117
  <view
133
118
  v-else
@@ -144,26 +129,6 @@
144
129
  :mode="top_dot_type"
145
130
  :dots-styles="topDotStyleData"
146
131
  >
147
- <!--#ifdef MP-WEIXIN-->
148
- <swiper
149
- :style="{width: bigWidth + 'rpx', height: smallHeight + 'rpx'}"
150
- :indicator-dots="false"
151
- :autoplay="topCarouselTime>0"
152
- :interval="topCarouselTime"
153
- :duration="500"
154
- :current="current"
155
- circular
156
- @animationfinish="handleBigAnimationfinish"
157
- >
158
- <swiper-item v-for="(item,index) in topList" :key="index" @click.stop="handleClick(item)">
159
- <image
160
- :style="{borderRadius: radius + 'rpx',width: bigWidth + 'rpx',height: smallHeight + 'rpx',}"
161
- :src="item['image_url']"
162
- mode="aspectFill"></image>
163
- </swiper-item>
164
- </swiper>
165
- <!--#endif-->
166
- <!--#ifdef H5-->
167
132
  <xd-swiper
168
133
  :indicator-dots="false"
169
134
  :list="topList"
@@ -175,11 +140,17 @@
175
140
  @animationfinish="handleTopAnimationfinish"
176
141
  >
177
142
  <template slot-scope="{ item, index }">
178
- <image :style="{borderRadius: topRadius + 'rpx',}" :src="item['image_url']" mode="aspectFill"></image>
143
+ <image
144
+ :style="{
145
+ borderRadius: topRadius + 'rpx',
146
+ }"
147
+ :src="item['image_url']"
148
+ mode="aspectFill"
149
+ ></image>
179
150
  </template>
180
151
  </xd-swiper>
181
- <!--#endif-->
182
152
  </xd-swiper-dot>
153
+
183
154
  <view v-if="isPreview" class="carousel-mask"></view>
184
155
  </view>
185
156
  </view>
@@ -222,26 +193,6 @@
222
193
  :mode="bottom_dot_type"
223
194
  :dots-styles="bottomDotStyleData"
224
195
  >
225
- <!--#ifdef MP-WEIXIN-->
226
- <swiper
227
- :style="{width: bigWidth + 'rpx', height: smallHeight + 'rpx'}"
228
- :indicator-dots="false"
229
- :autoplay="bottomCarouselTime>0"
230
- :interval="bottomCarouselTime"
231
- :duration="500"
232
- :current="current"
233
- circular
234
- @animationfinish="handleBigAnimationfinish"
235
- >
236
- <swiper-item v-for="(item,index) in bottomList" :key="index" @click.stop="handleClick(item)">
237
- <image
238
- :style="{borderRadius: radius + 'rpx',width: bigWidth + 'rpx',height: smallHeight + 'rpx',}"
239
- :src="item['image_url']"
240
- mode="aspectFill"></image>
241
- </swiper-item>
242
- </swiper>
243
- <!--#endif-->
244
- <!--#ifdef H5-->
245
196
  <xd-swiper
246
197
  :indicator-dots="false"
247
198
  :list="bottomList"
@@ -262,8 +213,8 @@
262
213
  ></image>
263
214
  </template>
264
215
  </xd-swiper>
265
- <!--#endif-->
266
216
  </xd-swiper-dot>
217
+
267
218
  <view v-if="isPreview" class="carousel-mask"></view>
268
219
  </view>
269
220
  </view>
@@ -295,7 +246,6 @@ export default {
295
246
  mixins: [componentsMixins, extsMixins, JfbBasePosterBigSmallMixin],
296
247
  data() {
297
248
  return {
298
- params:{},
299
249
  height: 0, //组件高度
300
250
  mS: {
301
251
  top: 0,
@@ -330,7 +280,6 @@ export default {
330
280
  //大图
331
281
  current: 0,
332
282
  carouselTime: 5, //轮播图轮播周期
333
-
334
283
  bigList: [],
335
284
  number: null,
336
285
  dot_type: "dot",
@@ -346,7 +295,6 @@ export default {
346
295
  bottomRadius: 0, //小图上圆角
347
296
  bottomCurrent: 0, //小图上
348
297
  bottomIsCarousel: 1,
349
- bottomCarouselTime:0,
350
298
 
351
299
  //小图上
352
300
  topList: [],
@@ -356,7 +304,6 @@ export default {
356
304
  topCurrent: 0, //小图上
357
305
  topIsCarousel: 1,
358
306
  smallHeight: 0,
359
- topCarouselTime:0,
360
307
 
361
308
  timer: null,
362
309
 
@@ -520,10 +467,6 @@ export default {
520
467
  };
521
468
  return style[this.bottom_dot_type];
522
469
  },
523
- isShowAd(){
524
- if(this.bigList.length === 0 && this.topList.length === 0 && this.bottomList.length === 0 ) return false
525
- return true
526
- },
527
470
  },
528
471
  watch: {
529
472
  container(value,oloValue) {
@@ -556,9 +499,6 @@ export default {
556
499
  if (res.list.length === 0 && this.isPreview) {
557
500
  res.list = this.getTestData("big");
558
501
  }
559
-
560
- res.list = this.filterItem(res.list);
561
-
562
502
  //将res.list中的image_url替换为服务地址
563
503
  this.bigList =
564
504
  res.list &&
@@ -573,7 +513,6 @@ export default {
573
513
  .catch((error) => {
574
514
  console.error(error);
575
515
  });
576
-
577
516
  //获取小图上列表
578
517
  jfbRootExec("getListPosterContent", {
579
518
  vm: this,
@@ -588,9 +527,6 @@ export default {
588
527
  if (res.list.length === 0 && this.isPreview) {
589
528
  res.list = this.getTestData("top");
590
529
  }
591
-
592
- res.list = this.filterItem(res.list);
593
-
594
530
  //将res.list中的image_url替换为服务地址
595
531
  this.topList =
596
532
  res.list &&
@@ -605,7 +541,6 @@ export default {
605
541
  .catch((error) => {
606
542
  console.error(error);
607
543
  });
608
-
609
544
  //获取小图下列表
610
545
  jfbRootExec("getListPosterContent", {
611
546
  vm: this,
@@ -620,9 +555,6 @@ export default {
620
555
  if (res.list.length === 0 && this.isPreview) {
621
556
  res.list = this.getTestData("bottom");
622
557
  }
623
-
624
- res.list = this.filterItem(res.list);
625
-
626
558
  //将res.list中的image_url替换为服务地址
627
559
  this.bottomList =
628
560
  res.list &&
@@ -647,136 +579,65 @@ export default {
647
579
  handleBottomAnimationfinish(e) {
648
580
  this.bottomCurrent = e.detail.current;
649
581
  },
650
-
651
- /**
652
- * @description 过滤不可以用
653
- * 当前项目未H5时,过滤所有小程序应用
654
- * 当前项目未小程序时,过滤所有非当前小程序应用
655
- * 站外地址直接返回
656
- * 站内地址未选值直接返回
657
- * 预览模式全过
658
- */
659
- filterItem(list = []){
660
- let content = list.filter(item=>{
661
- //预览模式
662
- if( this.$configProject.isPreview) return true;
663
-
664
- //非内部应用
665
- if(item.redirect_type !== 'INN') return true
666
-
667
- //没有配置链接
668
- if(!item.redirect_data) return true;
669
-
670
- //内部应用
671
- else {
672
- let redirect_data;
673
- try {
674
- redirect_data = JSON.parse(item.redirect_data);
675
- if(!item['app_type']) item['app_type']= 'h5';
676
-
677
- //#ifdef H5
678
- return item['app_type'] !== 'wxmp';
679
- //#endif
680
-
681
- //#ifdef MP-WEIXIN
682
- let actDir = this.$parent.projectAttr.deploy_dir;
683
- let dir = this.getPathDir(redirect_data.page);
684
- if(item['app_type'] === 'wxmp'){
685
- return actDir === dir;
686
- }
687
- else if(item['app_type'] === 'h5') return true;
688
- else return true
689
- //#endif
690
- }
691
- catch (e) {
692
- return true
693
- }
694
- }
695
- });
696
- console.warn(`PostersList:${JSON.stringify(content.map(item=>`${item.app_type}:${item.content_name}:${item.redirect_data}`), null,2)}`)
697
- return content;
698
-
699
- },
700
-
701
- getPathDir(pathDir){
702
- if(pathDir.indexOf('@site_domain@/') === 0) {
703
- return pathDir.replace('@site_domain@/','').split('/')[0]
704
- }
705
- return ''
706
- },
707
-
708
582
  handleClick(item) {
709
- if(!item.redirect_data) {
710
- console.warn(`未配置链接地址: ${item.redirect_data}`);
711
- console.error(`未配置链接地址: ${item.redirect_data}`);
712
- return
713
- }
714
-
715
583
  //内部链接跳转地址
716
- if (item.redirect_type === 'INN') {
584
+ if (item.redirect_type === "INN") {
717
585
  try {
718
586
  let url = JSON.parse(item.redirect_data);
719
- let params = '';
720
- if(url.page) {
721
- if (item['redirect_params']) params = `?${item['redirect_params']}`;
722
- this.$xdUniHelper.navigateTo({url: url.page + params})
723
- }
724
- else {
725
- console.error(`应用链接配置错误: ${url.page}`)
726
- }
587
+ let params = "";
588
+ if (item["redirect_params"]) params = `?${item["redirect_params"]}`;
589
+ this.$xdUniHelper.navigateTo({
590
+ url: url.page + params,
591
+ });
727
592
  } catch (e) {
728
- console.error(`应用链接配置错误: ${item.redirect_data}`)
593
+ console.error(e);
729
594
  }
730
595
  }
731
596
 
732
597
  //外部链接
733
- if (item.redirect_type === 'URL') {
598
+ if (item.redirect_type === "URL") {
734
599
  let reg = /^(http:\/\/|https:\/\/|\/\/)+.+$/;
735
600
  //#ifdef MP-WEIXIN
736
601
  try {
737
602
  let url = JSON.parse(item.redirect_data);
738
- if (reg.test(url.url)) {
739
- console.warn(`广告跳转外站: ${url.url}`)
740
- this.$xdUniHelper.navigateTo(url);
603
+ if (reg.test(url.url) && this.$configProject.extras.webview) {
604
+ console.warn(`广告跳转外站: ${url.url}`);
605
+ this.$xdUniHelper.navigateTo({
606
+ url: `${
607
+ this.$configProject.extras.webview
608
+ }?seatUrl=${Base64.encodeURI(url.url)}`,
609
+ });
741
610
  } else {
742
- console.error(`广告跳转外站配置错误: ${url.url}`)
611
+ throw Error("地址错误");
743
612
  }
744
613
  } catch (e) {
745
- console.error(`广告跳转外站配置错误: ${item.redirect_data}`)
614
+ console.error(e);
746
615
  }
747
616
  //#endif
748
617
  //#ifdef H5
749
618
  try {
750
619
  let url = JSON.parse(item.redirect_data);
751
620
  console.warn(`广告跳转外站: ${url.url}`);
752
- this.$xdUniHelper.redirectTo(url, false)
621
+ this.$xdUniHelper.navigateTo(url)
753
622
  } catch (e) {
754
- console.error(`广告跳转外站配置错误: ${item.redirect_data}`)
623
+ console.error(e);
755
624
  }
756
625
  //#endif
757
-
758
- }
759
-
760
- //无跳转地址
761
- if(item.redirect_type === 'EMP') {
762
- console.warn(`无跳转地址`);
763
626
  }
764
627
  },
765
-
766
-
767
628
  getTestData(type) {
768
629
  let width;
769
630
  let height;
770
631
  // 根据type参数,设置width和height
771
- if (type === "big") {
632
+ if (type == "big") {
772
633
  width = this.bigWidth;
773
634
  height = this.bigHeight;
774
635
  }
775
- if (type === "top") {
636
+ if (type == "top") {
776
637
  width = this.bigWidth;
777
638
  height = this.smallHeight;
778
639
  }
779
- if (type === "bottom") {
640
+ if (type == "bottom") {
780
641
  width = this.bigWidth;
781
642
  height = this.smallHeight;
782
643
  }
@@ -797,7 +658,6 @@ export default {
797
658
  // 返回临时数组
798
659
  return temp;
799
660
  },
800
-
801
661
  /**
802
662
  * @description 监听事件变化
803
663
  * @param container {object} 业务组件对象自己
@@ -884,7 +744,6 @@ export default {
884
744
  getContainerPropsValue(container, "content.bottomCarouselTime", 5)
885
745
  ) * 1000;
886
746
  },
887
-
888
747
  onJfbUpdate(data) {
889
748
  this.onJfbLoad(this.params);
890
749
  }
@@ -122,120 +122,50 @@
122
122
  this.init(this.container);
123
123
  },
124
124
  methods: {
125
- /**
126
- * @description 过滤不可以用
127
- * 当前项目未H5时,过滤所有小程序应用
128
- * 当前项目未小程序时,过滤所有非当前小程序应用
129
- * 站外地址直接返回
130
- * 站内地址未选值直接返回
131
- * 预览模式全过
132
- */
133
- filterItem(list){
134
- let content = list.filter(item=>{
135
- //预览模式
136
- if( this.$configProject.isPreview) return true;
137
-
138
- //非内部应用
139
- if(item.redirect_type !== 'INN') return true
140
-
141
- //没有配置链接
142
- if(!item.redirect_data) return true;
143
-
144
- //内部应用
145
- else {
146
- let redirect_data;
147
- try {
148
- redirect_data = JSON.parse(item.redirect_data);
149
- if(!item['app_type']) item['app_type']= 'h5';
150
-
151
- //#ifdef H5
152
- return item['app_type'] !== 'wxmp';
153
- //#endif
154
-
155
- //#ifdef MP-WEIXIN
156
- let actDir = this.projectAttr.deploy_dir;
157
- let dir = this.getPathDir(redirect_data.page);
158
- if(item['app_type'] === 'wxmp'){
159
- return actDir === dir;
160
- }
161
- else if(item['app_type'] === 'h5') return true;
162
- else return true
163
- //#endif
164
- }
165
- catch (e) {
166
- return true
167
- }
168
- }
169
- });
170
- console.warn(`PostTypeList:${JSON.stringify(content.map(item=>`${item.app_type}:${item.content_name}:${item.redirect_data}`), null,2)}`)
171
- return content;
172
-
173
- },
174
-
175
- getPathDir(pathDir){
176
- if(pathDir.indexOf('@site_domain@/') === 0) {
177
- return pathDir.replace('@site_domain@/','').split('/')[0]
178
- }
179
- return ''
180
- },
181
-
182
-
183
- handleClick(item) {
184
- if(!item.redirect_data) {
185
- console.warn(`未配置链接地址: ${item.redirect_data}`);
186
- console.error(`未配置链接地址: ${item.redirect_data}`);
187
- return
188
- }
189
-
125
+ handleClick(item){
190
126
  //内部链接跳转地址
191
- if (item.redirect_type === 'INN') {
192
- try {
127
+ if(item.redirect_type === 'INN') {
128
+ try{
193
129
  let url = JSON.parse(item.redirect_data);
194
130
  let params = '';
195
- if(url.page) {
196
- if (item['redirect_params']) params = `?${item['redirect_params']}`;
197
- this.$xdUniHelper.navigateTo({url: url.page + params})
198
- }
199
- else {
200
- console.error(`应用链接配置错误: ${url.page}`)
201
- }
202
- } catch (e) {
203
- console.error(`应用链接配置错误: ${item.redirect_data}`)
131
+ if(item['redirect_params']) params = `?${item['redirect_params']}`;
132
+ this.$xdUniHelper.navigateTo({
133
+ url: url.page + params
134
+ })
135
+ }catch (e) {
136
+ console.error(e)
204
137
  }
205
138
  }
206
139
 
207
140
  //外部链接
208
- if (item.redirect_type === 'URL') {
141
+ if(item.redirect_type === 'URL') {
209
142
  let reg = /^(http:\/\/|https:\/\/|\/\/)+.+$/;
210
143
  //#ifdef MP-WEIXIN
211
144
  try {
212
145
  let url = JSON.parse(item.redirect_data);
213
- if (reg.test(url.url)) {
146
+ if(reg.test(url.url) && this.$configProject.extras.webview) {
214
147
  console.warn(`广告跳转外站: ${url.url}`)
215
- this.$xdUniHelper.navigateTo(url);
148
+ this.$xdUniHelper.navigateTo({
149
+ url: `${this.$configProject.extras.webview}?seatUrl=${Base64.encodeURI(url.url)}`
150
+ });
216
151
  } else {
217
- console.error(`广告跳转外站配置错误: ${url.url}`)
152
+ throw Error('地址错误')
218
153
  }
219
154
  } catch (e) {
220
- console.error(`广告跳转外站配置错误: ${item.redirect_data}`)
155
+ console.error(e)
221
156
  }
222
157
  //#endif
223
158
  //#ifdef H5
224
159
  try {
225
160
  let url = JSON.parse(item.redirect_data);
226
161
  console.warn(`广告跳转外站: ${url.url}`);
227
- this.$xdUniHelper.redirectTo(url, false)
162
+ this.$xdUniHelper.navigateTo(url)
228
163
  } catch (e) {
229
- console.error(`广告跳转外站配置错误: ${item.redirect_data}`)
164
+ console.error(e)
230
165
  }
231
166
  //#endif
232
167
 
233
168
  }
234
-
235
- //无跳转地址
236
- if(item.redirect_type === 'EMP') {
237
- console.warn(`无跳转地址`);
238
- }
239
169
  },
240
170
 
241
171
  getTestData() {
@@ -282,7 +212,8 @@
282
212
  }
283
213
  }
284
214
 
285
- this.list = this.filterItem(list);
215
+
216
+ this.list = list;
286
217
  this.noData = this.list.length === 0;
287
218
  })
288
219
  .catch(error => {