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.
@@ -33,8 +33,45 @@
33
33
  field="content_name"
34
34
  :mode="config.mode"
35
35
  :dots-styles="config.dotStyleData"
36
- :style="{height:(getHeight + 46 * $rpxNum) + 'px'}"
36
+ :style="{height:(getHeight + 46 * $rpxNum) + 'px', width:'100%'}"
37
37
  >
38
+ <!--#ifdef MP-WEIXIN-->
39
+ <swiper
40
+ class="swiper xd-swiper-content"
41
+ :style="{width: '100%', height: getHeight + 'px'}"
42
+ :indicator-dots="false"
43
+ :autoplay="config.carouselTime>0"
44
+ :interval="config.carouselTime"
45
+ :duration="500"
46
+ :current="current"
47
+ circular
48
+ @animationfinish="handleAnimationfinish"
49
+ >
50
+ <swiper-item v-for="(item,index) in list" :key="index">
51
+ <view
52
+ class="sreen__box-list"
53
+ :class="{s3:config.cell === 3,s4:config.cell === 4}"
54
+ :style="{ height: getHeight + 'px' }"
55
+ >
56
+ <view
57
+ v-for="(it, indext) in item"
58
+ :key="it['content_id']"
59
+ @click="handleClick(it)"
60
+ :style="{
61
+ borderRadius: config.radius + 'rpx',
62
+ width: config.width + 'px',
63
+ height: config.height + 'px',
64
+ marginRight: (indext+1) % config.cell === 0 ? 0: config.padding + 'rpx',
65
+ marginTop: indext < config.cell ? 0 : config.padding + 'rpx',
66
+ }"
67
+ >
68
+ <image :style="{ width: width + 'px', height: height + 'px'}" :src="it.image_url" mode="widthFix"></image>
69
+ </view>
70
+ </view>
71
+ </swiper-item>
72
+ </swiper>
73
+ <!--#endif-->
74
+ <!--#ifdef H5-->
38
75
  <xd-swiper
39
76
  :indicator-dots="false"
40
77
  :interval="config.carouselTime"
@@ -45,31 +82,32 @@
45
82
  @onClickItem="handleClick"
46
83
  @animationfinish="handleAnimationfinish"
47
84
  >
48
- <template slot-scope="{ item, index}">
49
- <view
50
- class="sreen__box-list"
85
+ <template slot-scope="{ item, index}">
86
+ <view
87
+ class="sreen__box-list"
51
88
  :class="{s3:config.cell === 3,s4:config.cell === 4}"
52
- :style="{
53
- height: getHeight + 'px'
54
- }"
55
- >
56
- <view
57
- v-for="(it, indext) in item"
58
- :key="it['content_id']"
59
- :style="{
60
- borderRadius: config.radius + 'rpx',
61
- width: config.width + 'px',
62
- height: config.height + 'px',
63
- marginRight: (indext+1) % config.cell === 0 ? 0: config.padding + 'rpx',
64
- marginTop: indext < config.cell ? 0 : config.padding + 'rpx',
65
- }"
66
- @click="handleClick(it)"
67
- >
68
- <image :style="{ width: width + 'px', height: height + 'px'}" :src="it.image_url" mode="widthFix"></image>
69
- </view>
70
- </view>
71
- </template>
89
+ :style="{
90
+ height: getHeight + 'px'
91
+ }"
92
+ >
93
+ <view
94
+ v-for="(it, indext) in item"
95
+ :key="it['content_id']"
96
+ :style="{
97
+ borderRadius: config.radius + 'rpx',
98
+ width: config.width + 'px',
99
+ height: config.height + 'px',
100
+ marginRight: (indext+1) % config.cell === 0 ? 0: config.padding + 'rpx',
101
+ marginTop: indext < config.cell ? 0 : config.padding + 'rpx',
102
+ }"
103
+ @click="handleClick(it)"
104
+ >
105
+ <image :style="{ width: width + 'px', height: height + 'px'}" :src="it.image_url" mode="widthFix"></image>
106
+ </view>
107
+ </view>
108
+ </template>
72
109
  </xd-swiper>
110
+ <!--#endif-->
73
111
  </xd-swiper-dot>
74
112
  </view>
75
113
  <view v-if="isPreview" class="carousel-mask"></view>
@@ -133,6 +171,64 @@
133
171
  handleAnimationfinish(e) {
134
172
  this.current = e.detail.current;
135
173
  },
174
+
175
+ /**
176
+ * @description 过滤不可以用
177
+ * 当前项目未H5时,过滤所有小程序应用
178
+ * 当前项目未小程序时,过滤所有非当前小程序应用
179
+ * 站外地址直接返回
180
+ * 站内地址未选值直接返回
181
+ * 预览模式全过
182
+ */
183
+ filterItem(){
184
+ let content = this.content.filter(item=>{
185
+ //预览模式
186
+ if( this.$configProject.isPreview) return true;
187
+
188
+ //非内部应用
189
+ if(item.redirect_type !== 'INN') return true
190
+
191
+ //没有配置链接
192
+ if(!item.redirect_data) return true;
193
+
194
+ //内部应用
195
+ else {
196
+ let redirect_data;
197
+ try {
198
+ redirect_data = JSON.parse(item.redirect_data);
199
+ if(!item['app_type']) item['app_type']= 'h5';
200
+
201
+ //#ifdef H5
202
+ return item['app_type'] !== 'wxmp';
203
+ //#endif
204
+
205
+ //#ifdef MP-WEIXIN
206
+ let actDir = this.$parent.projectAttr.deploy_dir;
207
+ let dir = this.getPathDir(redirect_data.page);
208
+ if(item['app_type'] === 'wxmp'){
209
+ return actDir === dir;
210
+ }
211
+ else if(item['app_type'] === 'h5') return true;
212
+ else return true
213
+ //#endif
214
+ }
215
+ catch (e) {
216
+ return true
217
+ }
218
+ }
219
+ });
220
+ console.warn(`PostersList:${JSON.stringify(content.map(item=>`${item.app_type}:${item.content_name}:${item.redirect_data}`), null,2)}`)
221
+ return content;
222
+
223
+ },
224
+
225
+ getPathDir(pathDir){
226
+ if(pathDir.indexOf('@site_domain@/') === 0) {
227
+ return pathDir.replace('@site_domain@/','').split('/')[0]
228
+ }
229
+ return ''
230
+ },
231
+
136
232
  init() {
137
233
  if (this.timer) clearTimeout(this.timer);
138
234
  this.timer = setTimeout(() => {
@@ -140,6 +236,9 @@
140
236
  this.height = Number(this.config.height);
141
237
  this.padding = Number(this.config.padding);
142
238
 
239
+ //过滤不可以用
240
+ const content = this.filterItem();
241
+
143
242
  //静态图显示
144
243
  if(this.config.isCarousel === 1) {
145
244
  this.list = this.content
@@ -156,18 +255,28 @@
156
255
  }
157
256
  }, 100)
158
257
  },
258
+
159
259
  handleClick(item) {
260
+ if(!item.redirect_data) {
261
+ console.warn(`未配置链接地址: ${item.redirect_data}`);
262
+ console.error(`未配置链接地址: ${item.redirect_data}`);
263
+ return
264
+ }
265
+
160
266
  //内部链接跳转地址
161
267
  if (item.redirect_type === 'INN') {
162
268
  try {
163
269
  let url = JSON.parse(item.redirect_data);
164
270
  let params = '';
165
- if (item['redirect_params']) params = `?${item['redirect_params']}`;
166
- this.$xdUniHelper.navigateTo({
167
- url: url.page + params
168
- })
271
+ if(url.page) {
272
+ if (item['redirect_params']) params = `?${item['redirect_params']}`;
273
+ this.$xdUniHelper.navigateTo({url: url.page + params})
274
+ }
275
+ else {
276
+ console.error(`应用链接配置错误: ${url.page}`)
277
+ }
169
278
  } catch (e) {
170
- console.error(e)
279
+ console.error(`应用链接配置错误: ${item.redirect_data}`)
171
280
  }
172
281
  }
173
282
 
@@ -177,29 +286,32 @@
177
286
  //#ifdef MP-WEIXIN
178
287
  try {
179
288
  let url = JSON.parse(item.redirect_data);
180
- if (reg.test(url.url) && this.$configProject.extras.webview) {
289
+ if (reg.test(url.url)) {
181
290
  console.warn(`广告跳转外站: ${url.url}`)
182
- this.$xdUniHelper.navigateTo({
183
- url: `${this.$configProject.extras.webview}?seatUrl=${Base64.encodeURI(url.url)}`
184
- });
291
+ this.$xdUniHelper.navigateTo(url);
185
292
  } else {
186
- throw Error('地址错误')
293
+ console.error(`广告跳转外站配置错误: ${url.url}`)
187
294
  }
188
295
  } catch (e) {
189
- console.error(e)
296
+ console.error(`广告跳转外站配置错误: ${item.redirect_data}`)
190
297
  }
191
298
  //#endif
192
299
  //#ifdef H5
193
300
  try {
194
301
  let url = JSON.parse(item.redirect_data);
195
302
  console.warn(`广告跳转外站: ${url.url}`);
196
- this.$xdUniHelper.navigateTo(url)
303
+ this.$xdUniHelper.redirectTo(url, false)
197
304
  } catch (e) {
198
- console.error(e)
305
+ console.error(`广告跳转外站配置错误: ${item.redirect_data}`)
199
306
  }
200
307
  //#endif
201
308
 
202
309
  }
310
+
311
+ //无跳转地址
312
+ if(item.redirect_type === 'EMP') {
313
+ console.warn(`无跳转地址`);
314
+ }
203
315
  },
204
316
  }
205
317
  }
@@ -209,6 +321,7 @@
209
321
  .sreen {
210
322
  width: calc(100% + 4px); /**防止宽度不够问**/
211
323
  position: relative;
324
+ height: 100%;
212
325
 
213
326
  & .carousel-mask {
214
327
  position: absolute;
@@ -226,6 +339,7 @@
226
339
  flex-wrap: wrap;
227
340
  overflow: hidden;
228
341
  width: calc(100% + 20px); /**防止宽度不够问**/
342
+ height: 100%;
229
343
 
230
344
  & > view {
231
345
  display: flex;
@@ -238,6 +352,8 @@
238
352
  }
239
353
 
240
354
  &__box.carousel {
355
+ width: 100%;
356
+ height: 100%;
241
357
  display: flex;
242
358
  justify-content: flex-start;
243
359
  align-items: flex-start;
@@ -247,6 +363,7 @@
247
363
 
248
364
  & .sreen__box-list {
249
365
  width: calc(100% + 20px); /**防止宽度不够问**/
366
+ height: 100%;
250
367
  display: flex;
251
368
  justify-content: flex-start;
252
369
  align-items: flex-start;
@@ -50,7 +50,6 @@ export default {
50
50
  value: params.height || 500,
51
51
  className: 'input40',
52
52
  placeholder: '请广告位内容间距设置',
53
- disabled:xiugai,
54
53
  notice: '广告位选取内容后,将无法修改,单位:像素,默认: <span style="color:red">500</span>像素',
55
54
  inline: false,
56
55
  },
@@ -60,7 +59,6 @@ export default {
60
59
  groupKey:'style',
61
60
  valueKey: 'margin',
62
61
  value: params.margin || null,
63
- disabled: xiugai,
64
62
  setting: { type: 'margin'},
65
63
  placeholder: '请设置广告位边距设置',
66
64
  notice: '广告位选取内容后,将无法修改,单位:像素',
@@ -72,10 +70,9 @@ export default {
72
70
  type: 'number',
73
71
  valueKey: 'msMargin',
74
72
  groupKey:'style',
75
- value: params.msMargin || 10,
73
+ value: params.msMargin,
76
74
  className: 'input40',
77
75
  placeholder: '请广告位内容间距设置',
78
- disabled: xiugai,
79
76
  notice: '广告位选取内容后,将无法修改,单位:像素,默认: <span style="color:red">10</span>像素',
80
77
  inline: false,
81
78
  },