jufubao-base 1.0.157-beta3 → 1.0.157-beta4

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.
@@ -37,8 +37,54 @@
37
37
  field="content_name"
38
38
  :mode="config.mode"
39
39
  :dots-styles="config.dotStyleData"
40
- :style="{height: (getHeight) + 'px'}"
40
+ :style="{height: (getHeight) + 'px', width:'100%'}"
41
41
  >
42
+ <!--#ifdef MP-WEIXIN-->
43
+ <swiper
44
+ class="swiper xd-swiper-content"
45
+ :style="{width: '100%', height: getHeight + 'px'}"
46
+ :indicator-dots="false"
47
+ :autoplay="config.carouselTime > 0"
48
+ :interval="config.carouselTime"
49
+ :duration="500"
50
+ :current="current"
51
+ circular
52
+ @animationfinish="handleAnimationfinish"
53
+ >
54
+ <swiper-item
55
+ v-for="(item,index) in list"
56
+ :key="index"
57
+ :style="{width: '100%', height: getHeight + 'px'}"
58
+ >
59
+ <view
60
+ class="sreen__box-list"
61
+ :class="{
62
+ cell4: config.cells === 4,
63
+ cell5: config.cells === 5,
64
+ }"
65
+ :style="{ height: getHeight + 'px'}"
66
+ >
67
+ <view
68
+ v-for="it in item"
69
+ :key="it['content_id']"
70
+ :style="{height: boxHeight + 'px'}"
71
+ @click="handleClick(it)"
72
+ >
73
+ <view :style="{ height: height + 'px'}">
74
+ <view :style="{
75
+ borderRadius: config.radius + 'rpx',
76
+ boxShadow: config.shadow === 1? `0 0 10rpx rgba(0, 0, 0, .5)` : '',
77
+ }">
78
+ <image :src="it.image_url"></image>
79
+ </view>
80
+ </view>
81
+ <view v-if="it['content_name']" :style="{color: config.textColor}">{{it['content_name']}}</view>
82
+ </view>
83
+ </view>
84
+ </swiper-item>
85
+ </swiper>
86
+ <!--#endif-->
87
+ <!--#ifdef H5-->
42
88
  <xd-swiper
43
89
  :indicator-dots="false"
44
90
  :interval="config.carouselTime"
@@ -81,6 +127,7 @@
81
127
  </view>
82
128
  </template>
83
129
  </xd-swiper>
130
+ <!--#endif-->
84
131
  </xd-swiper-dot>
85
132
  </view>
86
133
  </view>
@@ -115,12 +162,22 @@
115
162
  padding: 0,
116
163
  status: false,
117
164
  list: [],
165
+ filterContentList:[],
118
166
  isPreview: false,
119
167
  current: 0,
120
168
  }
121
169
  },
122
170
  computed:{
123
171
  getHeight() {
172
+ let len = this.filterContentList.length
173
+ //不足一行数量,设置高度
174
+ if(len > 0 && len <= this.config.cells * 1){
175
+ return this.height + this.rpxText
176
+ }
177
+ //不足二行数量,设置高度
178
+ if(len > this.config.cells && len <= this.config.cells * 2 && this.config.jdRows >=2){
179
+ return this.height * 2 + this.rpxText * 2
180
+ }
124
181
  return this.height * this.config.jdRows + this.rpxText * this.config.jdRows;
125
182
  },
126
183
  rpxText(){
@@ -147,6 +204,65 @@
147
204
  handleAnimationfinish(e) {
148
205
  this.current = e.detail.current;
149
206
  },
207
+
208
+ /**
209
+ * @description 过滤不可以用
210
+ * 当前项目未H5时,过滤所有小程序应用
211
+ * 当前项目未小程序时,过滤所有非当前小程序应用
212
+ * 站外地址直接返回
213
+ * 站内地址未选值直接返回
214
+ * 预览模式全过
215
+ */
216
+ filterItem(){
217
+ let content = this.content.filter(item=>{
218
+ //预览模式
219
+ if( this.$configProject.isPreview) return true;
220
+
221
+ //非内部应用
222
+ if(item.redirect_type !== 'INN') return true
223
+
224
+ //没有配置链接
225
+ if(!item.redirect_data) return true;
226
+
227
+ //内部应用
228
+ else {
229
+ let redirect_data;
230
+ try {
231
+ redirect_data = JSON.parse(item.redirect_data);
232
+ if(!item['app_type']) item['app_type']= 'h5';
233
+
234
+ //#ifdef H5
235
+ return item['app_type'] !== 'wxmp';
236
+ //#endif
237
+
238
+ //#ifdef MP-WEIXIN
239
+ let actDir = this.$parent.projectAttr.deploy_dir;
240
+ let dir = this.getPathDir(redirect_data.page);
241
+ if(item['app_type'] === 'wxmp'){
242
+ return actDir === dir;
243
+ }
244
+ else if(item['app_type'] === 'h5') return true;
245
+ else return true
246
+ //#endif
247
+ }
248
+ catch (e) {
249
+ return true
250
+ }
251
+ }
252
+ });
253
+ console.warn(`PostTypeLists:${JSON.stringify(content.map(item=>`${item.app_type}:${item.content_name}:${item.redirect_data}`), null,2)}`)
254
+ this.filterContentList = this.$xdUniHelper.checkVarType(content);
255
+ return content;
256
+
257
+ },
258
+
259
+ getPathDir(pathDir){
260
+ if(pathDir.indexOf('@site_domain@/') === 0) {
261
+ return pathDir.replace('@site_domain@/','').split('/')[0]
262
+ }
263
+ return ''
264
+ },
265
+
150
266
  init() {
151
267
  if (this.timer) clearTimeout(this.timer);
152
268
  this.timer = setTimeout(() => {
@@ -154,19 +270,22 @@
154
270
  this.height = this.config.height;
155
271
  this.padding = 0;
156
272
 
273
+ //过滤不可以用
274
+ const content = this.filterItem();
275
+
157
276
  //静态图显示
158
277
  if(this.config.isCarousel === false) {
159
- this.list = this.content.filter((item,index)=>{
278
+ this.list = content.filter((item,index)=>{
160
279
  return index < (this.config.cells * this.config.jdRows);
161
280
  })
162
281
  }
163
282
  //轮播图显示
164
283
  else {
165
284
  let num = this.config.cells * this.config.jdRows;
166
- let maxPage = Math.ceil(this.content.length / num);
285
+ let maxPage = Math.ceil(content.length / num);
167
286
  let arr = [];
168
287
  for(let i =1 ; i <= maxPage; i++) {
169
- arr.push(this.$xdUniHelper.getLocalPaginationData(this.content, i, num))
288
+ arr.push(this.$xdUniHelper.getLocalPaginationData(content, i, num))
170
289
  }
171
290
  this.list = arr;
172
291
  }
@@ -174,19 +293,28 @@
174
293
 
175
294
  }, 100)
176
295
  },
296
+
177
297
  handleClick(item) {
178
- debugger
298
+ if(!item.redirect_data) {
299
+ console.warn(`未配置链接地址: ${item.redirect_data}`);
300
+ console.error(`未配置链接地址: ${item.redirect_data}`);
301
+ return
302
+ }
303
+
179
304
  //内部链接跳转地址
180
305
  if (item.redirect_type === 'INN') {
181
306
  try {
182
307
  let url = JSON.parse(item.redirect_data);
183
308
  let params = '';
184
- if (item['redirect_params']) params = `?${item['redirect_params']}`;
185
- this.$xdUniHelper.navigateTo({
186
- url: url.page + params
187
- })
309
+ if(url.page) {
310
+ if (item['redirect_params']) params = `?${item['redirect_params']}`;
311
+ this.$xdUniHelper.navigateTo({url: url.page + params})
312
+ }
313
+ else {
314
+ console.error(`应用链接配置错误: ${url.page}`)
315
+ }
188
316
  } catch (e) {
189
- console.error(e)
317
+ console.error(`应用链接配置错误: ${item.redirect_data}`)
190
318
  }
191
319
  }
192
320
 
@@ -196,29 +324,32 @@
196
324
  //#ifdef MP-WEIXIN
197
325
  try {
198
326
  let url = JSON.parse(item.redirect_data);
199
- if (reg.test(url.url) && this.$configProject.extras.webview) {
327
+ if (reg.test(url.url)) {
200
328
  console.warn(`广告跳转外站: ${url.url}`)
201
- this.$xdUniHelper.navigateTo({
202
- url: `${this.$configProject.extras.webview}?seatUrl=${Base64.encodeURI(url.url)}`
203
- });
329
+ this.$xdUniHelper.navigateTo(url);
204
330
  } else {
205
- throw Error('地址错误')
331
+ console.error(`广告跳转外站配置错误: ${url.url}`)
206
332
  }
207
333
  } catch (e) {
208
- console.error(e)
334
+ console.error(`广告跳转外站配置错误: ${item.redirect_data}`)
209
335
  }
210
336
  //#endif
211
337
  //#ifdef H5
212
338
  try {
213
339
  let url = JSON.parse(item.redirect_data);
214
340
  console.warn(`广告跳转外站: ${url.url}`);
215
- this.$xdUniHelper.navigateTo(url)
341
+ this.$xdUniHelper.redirectTo(url, false)
216
342
  } catch (e) {
217
- console.error(e)
343
+ console.error(`广告跳转外站配置错误: ${item.redirect_data}`)
218
344
  }
219
345
  //#endif
220
346
 
221
347
  }
348
+
349
+ //无跳转地址
350
+ if(item.redirect_type === 'EMP') {
351
+ console.warn(`无跳转地址`);
352
+ }
222
353
  },
223
354
  }
224
355
  }
@@ -227,6 +358,7 @@
227
358
  <style scoped lang="less">
228
359
  .sreen {
229
360
  width: calc(100% + 2px); /**防止宽度不够问**/
361
+ height: 100%;
230
362
  position: relative;
231
363
 
232
364
  & .carousel-mask {
@@ -241,6 +373,7 @@
241
373
 
242
374
  &__box.notCarousel {
243
375
  width: 100%;
376
+ height: 100%;
244
377
  display: flex;
245
378
  justify-content: flex-start;
246
379
  align-items: flex-start;
@@ -333,6 +466,8 @@
333
466
  }
334
467
 
335
468
  &__box.carousel {
469
+ width: 100%;
470
+ height: 100%;
336
471
  display: flex;
337
472
  justify-content: flex-start;
338
473
  align-items: flex-start;
@@ -341,6 +476,8 @@
341
476
  }
342
477
 
343
478
  & .sreen__box-list {
479
+ width: 100%;
480
+ height: 100%;
344
481
  display: flex;
345
482
  justify-content: flex-start;
346
483
  align-items: flex-start;
@@ -131,41 +131,6 @@
131
131
  handleAnimationfinish(e) {
132
132
  this.current = e.detail.current;
133
133
  },
134
- handleClick(item, index){
135
- this.current = index;
136
- const handle = (data) => {
137
- try {
138
- return JSON.parse(data);
139
- } catch (e) {
140
- return {}
141
- }
142
- };
143
- if(this.$configProject.isPreview) {
144
- console.log(item)
145
- }
146
- else {
147
- if (item['redirect_type'] === 'EMP') return;
148
- let url = '';
149
-
150
- if (item['redirect_type'] === 'URL') {
151
- url = handle(item['redirect_data']).url || ''
152
- }
153
-
154
- if (item['redirect_type'] === 'INN') {
155
- url = handle(item['redirect_data']).page || ''
156
- }
157
- if (item['redirect_type'] === 'APP') {
158
- return;
159
- }
160
- if (url === '') {
161
- return;
162
- }
163
-
164
- if(url.indexOf('?') === -1) url = `${url}?vs=${new Date().getTime()}`;
165
- else url = `${url}&vs=${new Date().getTime()}`;
166
- this.$xdUniHelper.navigateTo({url})
167
- }
168
- },
169
134
  handleImage(list){
170
135
  return list.map(item => {
171
136
  return {
@@ -16,6 +16,7 @@
16
16
  <view class="jfb-base-video__body">
17
17
  <view class="x-line"></view>
18
18
  <view
19
+ v-if="isShow"
19
20
  class="x-video"
20
21
  :style="{
21
22
  backgroundColor:bgColor,
@@ -26,15 +27,13 @@
26
27
  height:contentHeight + 'rpx'
27
28
  }"
28
29
  >
29
-
30
30
  <xd-video
31
31
  v-if="video !== null && video !== ''"
32
32
  :key="videoKey"
33
33
  :poster="videoSetting"
34
34
  :video="video"
35
- :pack-this="$vm"
36
35
  ></xd-video>
37
- <view class="not-video" v-if="video === ''">
36
+ <view class="not-video" v-if="isPreview && video === ''">
38
37
  <image :src="getVideoSrc"></image>
39
38
  </view>
40
39
  </view>
@@ -60,7 +59,7 @@
60
59
  mixins: [componentsMixins,extsMixins,JfbBaseVideoMixin],
61
60
  data() {
62
61
  return {
63
- selfMask: true,
62
+ isPreview: false,
64
63
  page_size: 1,
65
64
  options:{},
66
65
 
@@ -73,11 +72,14 @@
73
72
  width:750,
74
73
  bgColor:'',
75
74
  radius:0,
76
- $vm: {},
77
- videoKey : Date.now()
75
+ videoKey : Date.now(),
78
76
  }
79
77
  },
80
78
  computed: {
79
+ isShow(){
80
+ if(this.isPreview) return true;
81
+ else return this.video
82
+ },
81
83
  iconFont(){
82
84
  if(this.autoplay === 'N') return 'iconplayright'
83
85
  if(this.autoplay === 'E') return 'iconshibai';
@@ -126,7 +128,6 @@
126
128
  }
127
129
  },
128
130
  created() {
129
- this.$vm = this;
130
131
  this.isPreview = this.$configProject.isPreview;
131
132
  this.init(this.container);
132
133
  },
@@ -50,10 +50,6 @@
50
50
  type: String|Number,
51
51
  default: 0
52
52
  },
53
- packThis:{
54
- type:Object,
55
- required: true
56
- },
57
53
  video:{
58
54
  type:Object,
59
55
  required: true