jufubao-base 1.0.220-beta4 → 1.0.221-beta1
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.
- package/package.json +1 -1
- package/src/components/JfbBaseOrderList/JfbBaseOrderList.vue +5 -2
- package/src/components/JfbBasePoster/JfbBasePoster.vue +22 -109
- package/src/components/JfbBasePoster/MoreScreen.vue +62 -113
- package/src/components/JfbBasePosterBigSmall/JfbBasePosterBigSmall.vue +9 -105
- package/src/components/JfbBasePosterEntry/JfbBasePosterEntry.vue +8 -114
- package/src/components/JfbBasePosterType/FourScreen.vue +4 -116
- package/src/components/JfbBasePosterType/JfbBasePosterType.vue +1 -1
- package/src/mixins/componentsMixins.js +127 -28
- package/src/mixins/posterMixins.js +143 -31
|
@@ -49,17 +49,17 @@
|
|
|
49
49
|
import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
|
|
50
50
|
import { jfbRootExec } from "@/utils/xd.event";
|
|
51
51
|
import JfbBasePosterEntryMixin from "./JfbBasePosterEntryMixin";
|
|
52
|
+
import posterMixins from "@/mixins/posterMixins";
|
|
52
53
|
import componentsMixins from "@/mixins/componentsMixins";
|
|
53
54
|
import extsMixins from "@/mixins/extsMixins"
|
|
54
55
|
import { getContainerPropsValue } from "@/utils/xd.base";
|
|
55
56
|
import getServiceUrl from '@/common/getServiceUrl';
|
|
56
|
-
import {Base64} from "js-base64";
|
|
57
57
|
export default {
|
|
58
58
|
name: "JfbBasePosterEntry",
|
|
59
59
|
components: {
|
|
60
60
|
XdFontIcon
|
|
61
61
|
},
|
|
62
|
-
mixins: [componentsMixins,extsMixins,JfbBasePosterEntryMixin],
|
|
62
|
+
mixins: [componentsMixins,extsMixins,JfbBasePosterEntryMixin,posterMixins],
|
|
63
63
|
data() {
|
|
64
64
|
return {
|
|
65
65
|
noData: false,
|
|
@@ -122,121 +122,12 @@
|
|
|
122
122
|
this.init(this.container);
|
|
123
123
|
},
|
|
124
124
|
methods: {
|
|
125
|
-
/**
|
|
126
|
-
* @description 过滤不可以用
|
|
127
|
-
* 当前项目未H5时,过滤所有小程序应用
|
|
128
|
-
* 当前项目未小程序时,过滤所有非当前小程序应用
|
|
129
|
-
* 站外地址直接返回
|
|
130
|
-
* 站内地址未选值直接返回
|
|
131
|
-
* 预览模式全过
|
|
132
|
-
*/
|
|
133
125
|
filterItem(list){
|
|
134
|
-
|
|
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
|
-
|
|
126
|
+
return this.filterPosterItem(this.$xdUniHelper.cloneDeep(list))
|
|
173
127
|
},
|
|
174
128
|
|
|
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
129
|
handleClick(item) {
|
|
184
|
-
|
|
185
|
-
console.warn(`未配置链接地址: ${item.redirect_data}`);
|
|
186
|
-
console.error(`未配置链接地址: ${item.redirect_data}`);
|
|
187
|
-
return
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
//内部链接跳转地址
|
|
191
|
-
if (item.redirect_type === 'INN') {
|
|
192
|
-
try {
|
|
193
|
-
let url = JSON.parse(item.redirect_data);
|
|
194
|
-
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}`)
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
//外部链接
|
|
208
|
-
if (item.redirect_type === 'URL') {
|
|
209
|
-
let reg = /^(http:\/\/|https:\/\/|\/\/)+.+$/;
|
|
210
|
-
let spReg = /(-apiuri\/v)/;
|
|
211
|
-
//#ifdef MP-WEIXIN
|
|
212
|
-
try {
|
|
213
|
-
let url = JSON.parse(item.redirect_data);
|
|
214
|
-
if (reg.test(url.url) || spReg.test(url.url)) {
|
|
215
|
-
console.warn(`广告跳转外站: ${url.url}`)
|
|
216
|
-
this.$xdUniHelper.navigateTo(url);
|
|
217
|
-
} else {
|
|
218
|
-
console.error(`广告跳转外站配置错误: ${url.url}`)
|
|
219
|
-
}
|
|
220
|
-
} catch (e) {
|
|
221
|
-
console.error(`广告跳转外站配置错误: ${item.redirect_data}`)
|
|
222
|
-
}
|
|
223
|
-
//#endif
|
|
224
|
-
//#ifdef H5
|
|
225
|
-
try {
|
|
226
|
-
let url = JSON.parse(item.redirect_data);
|
|
227
|
-
console.warn(`广告跳转外站: ${url.url}`);
|
|
228
|
-
this.$xdUniHelper.redirectTo(url, false)
|
|
229
|
-
} catch (e) {
|
|
230
|
-
console.error(`广告跳转外站配置错误: ${item.redirect_data}`)
|
|
231
|
-
}
|
|
232
|
-
//#endif
|
|
233
|
-
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
//无跳转地址
|
|
237
|
-
if(item.redirect_type === 'EMP') {
|
|
238
|
-
console.warn(`无跳转地址`);
|
|
239
|
-
}
|
|
130
|
+
this.handlePosterClick(item);
|
|
240
131
|
},
|
|
241
132
|
|
|
242
133
|
getTestData() {
|
|
@@ -283,7 +174,10 @@
|
|
|
283
174
|
}
|
|
284
175
|
}
|
|
285
176
|
|
|
286
|
-
this.list = this.filterItem(list)
|
|
177
|
+
this.list = this.filterItem(list).map(item=>{
|
|
178
|
+
if(item.image_url) item.image_url = getServiceUrl(item.image_url, 'size8')
|
|
179
|
+
return item;
|
|
180
|
+
});
|
|
287
181
|
this.noData = this.list.length === 0;
|
|
288
182
|
})
|
|
289
183
|
.catch(error => {
|
|
@@ -133,6 +133,7 @@
|
|
|
133
133
|
<script>
|
|
134
134
|
import XdSwiperDot from "./XdSwiperDot";
|
|
135
135
|
import XdSwiper from "@/components/XdSwiper/XdSwiper";
|
|
136
|
+
import posterMixins from "@/mixins/posterMixins";
|
|
136
137
|
|
|
137
138
|
export default {
|
|
138
139
|
components:{
|
|
@@ -140,6 +141,7 @@
|
|
|
140
141
|
XdSwiper
|
|
141
142
|
},
|
|
142
143
|
name: "FourScreen",
|
|
144
|
+
mixins:[posterMixins],
|
|
143
145
|
props: {
|
|
144
146
|
config: {
|
|
145
147
|
type: Object,
|
|
@@ -208,64 +210,6 @@
|
|
|
208
210
|
this.current = e.detail.current;
|
|
209
211
|
},
|
|
210
212
|
|
|
211
|
-
/**
|
|
212
|
-
* @description 过滤不可以用
|
|
213
|
-
* 当前项目未H5时,过滤所有小程序应用
|
|
214
|
-
* 当前项目未小程序时,过滤所有非当前小程序应用
|
|
215
|
-
* 站外地址直接返回
|
|
216
|
-
* 站内地址未选值直接返回
|
|
217
|
-
* 预览模式全过
|
|
218
|
-
*/
|
|
219
|
-
filterItem(){
|
|
220
|
-
let content = this.content.filter(item=>{
|
|
221
|
-
//预览模式
|
|
222
|
-
if( this.$configProject.isPreview) return true;
|
|
223
|
-
|
|
224
|
-
//非内部应用
|
|
225
|
-
if(item.redirect_type !== 'INN') return true
|
|
226
|
-
|
|
227
|
-
//没有配置链接
|
|
228
|
-
if(!item.redirect_data) return true;
|
|
229
|
-
|
|
230
|
-
//内部应用
|
|
231
|
-
else {
|
|
232
|
-
let redirect_data;
|
|
233
|
-
try {
|
|
234
|
-
redirect_data = JSON.parse(item.redirect_data);
|
|
235
|
-
if(!item['app_type']) item['app_type']= 'h5';
|
|
236
|
-
|
|
237
|
-
//#ifdef H5
|
|
238
|
-
return item['app_type'] !== 'wxmp';
|
|
239
|
-
//#endif
|
|
240
|
-
|
|
241
|
-
//#ifdef MP-WEIXIN
|
|
242
|
-
let actDir = this.$parent.projectAttr.deploy_dir;
|
|
243
|
-
let dir = this.getPathDir(redirect_data.page);
|
|
244
|
-
if(item['app_type'] === 'wxmp'){
|
|
245
|
-
return actDir === dir;
|
|
246
|
-
}
|
|
247
|
-
else if(item['app_type'] === 'h5') return true;
|
|
248
|
-
else return true
|
|
249
|
-
//#endif
|
|
250
|
-
}
|
|
251
|
-
catch (e) {
|
|
252
|
-
return true
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
});
|
|
256
|
-
console.warn(`PostTypeLists:${JSON.stringify(content.map(item=>`${item.app_type}:${item.content_name}:${item.redirect_data}`), null,2)}`)
|
|
257
|
-
this.filterContentList = this.$xdUniHelper.cloneDeep(content);
|
|
258
|
-
return content;
|
|
259
|
-
|
|
260
|
-
},
|
|
261
|
-
|
|
262
|
-
getPathDir(pathDir){
|
|
263
|
-
if(pathDir.indexOf('@site_domain@/') === 0) {
|
|
264
|
-
return pathDir.replace('@site_domain@/','').split('/')[0]
|
|
265
|
-
}
|
|
266
|
-
return ''
|
|
267
|
-
},
|
|
268
|
-
|
|
269
213
|
init() {
|
|
270
214
|
if (this.timer) clearTimeout(this.timer);
|
|
271
215
|
this.timer = setTimeout(() => {
|
|
@@ -274,7 +218,7 @@
|
|
|
274
218
|
this.padding = 0;
|
|
275
219
|
|
|
276
220
|
//过滤不可以用
|
|
277
|
-
const content = this.
|
|
221
|
+
const content = this.filterPosterItem(this.$xdUniHelper.cloneDeep(this.content));
|
|
278
222
|
|
|
279
223
|
//静态图显示
|
|
280
224
|
if(this.config.isCarousel === false) {
|
|
@@ -299,63 +243,7 @@
|
|
|
299
243
|
|
|
300
244
|
handleClick(item) {
|
|
301
245
|
if(this.config.isPreview) return;
|
|
302
|
-
|
|
303
|
-
if(!item.redirect_data) {
|
|
304
|
-
console.warn(`未配置链接地址: ${item.redirect_data}`);
|
|
305
|
-
console.error(`未配置链接地址: ${item.redirect_data}`);
|
|
306
|
-
return
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
//内部链接跳转地址
|
|
310
|
-
if (item.redirect_type === 'INN') {
|
|
311
|
-
try {
|
|
312
|
-
let url = JSON.parse(item.redirect_data);
|
|
313
|
-
let params = '';
|
|
314
|
-
if(url.page) {
|
|
315
|
-
if (item['redirect_params']) params = `?${item['redirect_params']}`;
|
|
316
|
-
this.$xdUniHelper.navigateTo({url: url.page + params})
|
|
317
|
-
}
|
|
318
|
-
else {
|
|
319
|
-
console.error(`应用链接配置错误: ${url.page}`)
|
|
320
|
-
}
|
|
321
|
-
} catch (e) {
|
|
322
|
-
console.error(`应用链接配置错误: ${item.redirect_data}`)
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
//外部链接
|
|
327
|
-
if (item.redirect_type === 'URL') {
|
|
328
|
-
let reg = /^(http:\/\/|https:\/\/|\/\/)+.+$/;
|
|
329
|
-
let spReg = /(-apiuri\/v)/;
|
|
330
|
-
//#ifdef MP-WEIXIN
|
|
331
|
-
try {
|
|
332
|
-
let url = JSON.parse(item.redirect_data);
|
|
333
|
-
if (reg.test(url.url) || spReg.test(url.url)) {
|
|
334
|
-
console.warn(`广告跳转外站: ${url.url}`)
|
|
335
|
-
this.$xdUniHelper.navigateTo(url);
|
|
336
|
-
} else {
|
|
337
|
-
console.error(`广告跳转外站配置错误: ${url.url}`)
|
|
338
|
-
}
|
|
339
|
-
} catch (e) {
|
|
340
|
-
console.error(`广告跳转外站配置错误: ${item.redirect_data}`)
|
|
341
|
-
}
|
|
342
|
-
//#endif
|
|
343
|
-
//#ifdef H5
|
|
344
|
-
try {
|
|
345
|
-
let url = JSON.parse(item.redirect_data);
|
|
346
|
-
console.warn(`广告跳转外站: ${url.url}`);
|
|
347
|
-
this.$xdUniHelper.redirectTo(url, false)
|
|
348
|
-
} catch (e) {
|
|
349
|
-
console.error(`广告跳转外站配置错误: ${item.redirect_data}`)
|
|
350
|
-
}
|
|
351
|
-
//#endif
|
|
352
|
-
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
//无跳转地址
|
|
356
|
-
if(item.redirect_type === 'EMP') {
|
|
357
|
-
console.warn(`无跳转地址`);
|
|
358
|
-
}
|
|
246
|
+
this.handlePosterClick(item);
|
|
359
247
|
},
|
|
360
248
|
}
|
|
361
249
|
}
|
|
@@ -213,6 +213,9 @@ export default {
|
|
|
213
213
|
if(this['hideMask'] === true) zIndex = -1;
|
|
214
214
|
if(this['closeMask'] === true) zIndex = -1;
|
|
215
215
|
if(this['closeMask'] === false) zIndex = 4;
|
|
216
|
+
//#ifdef H5
|
|
217
|
+
document.querySelector(':root').style.setProperty('--preview-z-index', 4);
|
|
218
|
+
//#endif
|
|
216
219
|
|
|
217
220
|
//生产元素
|
|
218
221
|
if(this.$configProject.isPreview) {
|
|
@@ -292,7 +295,7 @@ export default {
|
|
|
292
295
|
},
|
|
293
296
|
|
|
294
297
|
methods:{
|
|
295
|
-
...mapActions(['setXNamespace','setStyleCommon']),
|
|
298
|
+
...mapActions(['setXNamespace','setStyleCommon','wxCodeForGetAppId']),
|
|
296
299
|
...mapMutations(['setCurrentStyle']),
|
|
297
300
|
|
|
298
301
|
/**
|
|
@@ -312,6 +315,8 @@ export default {
|
|
|
312
315
|
}
|
|
313
316
|
},
|
|
314
317
|
|
|
318
|
+
|
|
319
|
+
|
|
315
320
|
/**
|
|
316
321
|
* @description 检查是否同域名
|
|
317
322
|
* @param url
|
|
@@ -470,13 +475,17 @@ export default {
|
|
|
470
475
|
if (typeof AttrObj[type] === "function") {
|
|
471
476
|
let params = getContainerFnPropsValue(this.container, `${type}`);
|
|
472
477
|
let Attr = this.$xdUniHelper.customClone(this.Attr);
|
|
473
|
-
AttrObj[type] = Attr[type](params);
|
|
474
478
|
AttrObj[`${type}.isFn`] = true;
|
|
475
479
|
AttrObj[`${type}.Fn`] = Attr[type];
|
|
480
|
+
AttrObj[type] = Attr[type](params);
|
|
476
481
|
} else {
|
|
477
482
|
AttrObj[type].map(item => {
|
|
478
|
-
if (item.value !== undefined)
|
|
479
|
-
|
|
483
|
+
if (item.value !== undefined) {
|
|
484
|
+
item.value = getContainerPropsValue(this.container, `${type}.${item.valueKey}`, item.value);
|
|
485
|
+
if(item.defaultValue !== undefined) {
|
|
486
|
+
item.defaultValue = getContainerPropsValue(this.container, `${type}.${item.valueKey}`, item.value);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
480
489
|
});
|
|
481
490
|
AttrObj[`${type}.isFn`] = false;
|
|
482
491
|
}
|
|
@@ -497,6 +506,12 @@ export default {
|
|
|
497
506
|
//#endif
|
|
498
507
|
},
|
|
499
508
|
|
|
509
|
+
/**
|
|
510
|
+
* @description 判断是否有值并返回默认值
|
|
511
|
+
* @param value {Number} 判断的值
|
|
512
|
+
* @param dValue {Number} 默认值
|
|
513
|
+
* @return {number}
|
|
514
|
+
*/
|
|
500
515
|
checkValue(value, dValue = 0){
|
|
501
516
|
if(value === undefined || value === '' || value === null) return dValue;
|
|
502
517
|
return Number(value || 0);
|
|
@@ -504,7 +519,7 @@ export default {
|
|
|
504
519
|
|
|
505
520
|
/**
|
|
506
521
|
* @description 获取图片链接
|
|
507
|
-
* @param image
|
|
522
|
+
* @param image {Object} 图片对象
|
|
508
523
|
* @return {string}
|
|
509
524
|
*/
|
|
510
525
|
getBgImage(image = {}){
|
|
@@ -517,17 +532,30 @@ export default {
|
|
|
517
532
|
return bg
|
|
518
533
|
},
|
|
519
534
|
|
|
520
|
-
|
|
535
|
+
/**
|
|
536
|
+
* @description 阴影样式生成
|
|
537
|
+
* @param defaultObj {Object} 默认值
|
|
538
|
+
* @param newObj {Object} 新组件对象
|
|
539
|
+
* @return {string} 例如:`0,0,10rpx,rgba(0,0,0,0)`
|
|
540
|
+
*/
|
|
521
541
|
getXdShadow(defaultObj, newObj){
|
|
522
542
|
if(newObj.type === 'N' || this.$xdUniHelper.isEmpty(newObj)) return `0 0 0 rgba(0,0,0,0)`;
|
|
523
543
|
return this.getXdBorder(defaultObj,newObj,'shadow')
|
|
524
544
|
},
|
|
525
545
|
|
|
526
|
-
|
|
546
|
+
/**
|
|
547
|
+
* @description 边框样式生成
|
|
548
|
+
* @param defaultObj {Object} 默认值
|
|
549
|
+
* @param newObj {Object} 新组件对象
|
|
550
|
+
* @param type {string} border/shadow
|
|
551
|
+
* @return {string} 例如:`2rpx solid rgba(0,0,0,0)`
|
|
552
|
+
*/
|
|
527
553
|
getXdBorder(defaultObj, newObj, type='border'){
|
|
528
|
-
//使用默认值
|
|
529
|
-
if(newObj.type ==='D')
|
|
530
|
-
|
|
554
|
+
//使用默认值()
|
|
555
|
+
if((this.$xdUniHelper.isEmpty(newObj) && defaultObj.type === 'D')
|
|
556
|
+
|| newObj.type ==='D'
|
|
557
|
+
){
|
|
558
|
+
if(type === 'border') return `${defaultObj.width * this.$rpxNum}px ${defaultObj.style||'solid'} ${defaultObj.color}`;
|
|
531
559
|
return `0 0 ${defaultObj.width}rpx ${defaultObj.color}`;
|
|
532
560
|
}
|
|
533
561
|
if(newObj.type === 'N' || this.$xdUniHelper.isEmpty(newObj)) return `0`;
|
|
@@ -538,10 +566,20 @@ export default {
|
|
|
538
566
|
if(value.width) width = value.width;
|
|
539
567
|
if(value.color) color = value.color;
|
|
540
568
|
if(value.style) style = value.style;
|
|
541
|
-
if(type === 'border') return `${width}
|
|
569
|
+
if(type === 'border') return `${width* this.$rpxNum}px ${style} ${color}`
|
|
542
570
|
return `0 0 ${width}rpx ${color}`;
|
|
543
571
|
},
|
|
544
572
|
|
|
573
|
+
/**
|
|
574
|
+
* @description 兼容新老border与shadow组件数据
|
|
575
|
+
* @param newObj {Object} 新对象border与shadow
|
|
576
|
+
* @param oldObj {Object} 新对象border与shadow
|
|
577
|
+
* @param oldObj.width {Number}老border与shadow的宽度字段
|
|
578
|
+
* @param oldObj.color {String} 老border与shadow的颜色字段
|
|
579
|
+
* @param oldObj.style {String|undefined} 老border样式默认值:solid
|
|
580
|
+
* @param type {String}
|
|
581
|
+
* @return {string} 例如:`2rpx solid rgba(0,0,0,0)`
|
|
582
|
+
*/
|
|
545
583
|
getBorderCompatibleOldStyle(newObj={}, oldObj={}, type='border'){
|
|
546
584
|
let contWidth = 0;
|
|
547
585
|
let contColor = 'rgba(0.0.0.0)';
|
|
@@ -560,11 +598,19 @@ export default {
|
|
|
560
598
|
|
|
561
599
|
if(type === 'border'){
|
|
562
600
|
if(oldObj.type === 'N' && newObj.type === 'N') return 0;
|
|
563
|
-
return `${contWidth}
|
|
601
|
+
return `${contWidth* this.$rpxNum}px ${contrStyle} ${contColor}`
|
|
564
602
|
}
|
|
565
603
|
return `0 0 ${contWidth}rpx ${contColor}` ;
|
|
566
604
|
},
|
|
567
605
|
|
|
606
|
+
/**
|
|
607
|
+
* @description 兼容新老border与shadow组件数据
|
|
608
|
+
* @param newShadow {Object} 新对象border与shadow
|
|
609
|
+
* @param oldShadow {Object} 新对象border与shadow
|
|
610
|
+
* @param oldShadow.width {Number}老border与shadow的宽度字段
|
|
611
|
+
* @param oldShadow.color {String} 老border与shadow的颜色字段
|
|
612
|
+
* @return {string} 例如:`0,0,10rpx,rgba(0,0,0,1)`
|
|
613
|
+
*/
|
|
568
614
|
getShadowCompatibleOldStyle(newShadow={},oldShadow={}){
|
|
569
615
|
return this.getBorderCompatibleOldStyle(newShadow,oldShadow, 'shadow')
|
|
570
616
|
},
|
|
@@ -625,9 +671,10 @@ export default {
|
|
|
625
671
|
},
|
|
626
672
|
|
|
627
673
|
/**
|
|
628
|
-
* @description
|
|
674
|
+
* @description 获取margin或者padding的值
|
|
629
675
|
* @param marAndPadding {Object}
|
|
630
|
-
* @param defVale {Object|number}
|
|
676
|
+
* @param defVale {Object|number} 格式:10 或者 {top:10, left:10, right: 10, bottom:10}
|
|
677
|
+
* @return {string} 例如:`10rpx 10rpx 10rpx 10rpx`
|
|
631
678
|
*/
|
|
632
679
|
getMarginAndPadding(marAndPadding, defVale){
|
|
633
680
|
let top = 0, left=0,bottom=0,right=0;
|
|
@@ -651,11 +698,11 @@ export default {
|
|
|
651
698
|
},
|
|
652
699
|
|
|
653
700
|
/**
|
|
654
|
-
* @description
|
|
655
|
-
* @param obj
|
|
656
|
-
* @param type
|
|
657
|
-
* @param defValue
|
|
658
|
-
* @return {
|
|
701
|
+
* @description 获取margin和padding的上下或者左右值的和
|
|
702
|
+
* @param obj {Object} margin或者padding的值
|
|
703
|
+
* @param type {string} RL|TB
|
|
704
|
+
* @param defValue {Object|number} 格式:10 或者 {top:10, left:10, right: 10, bottom:10}
|
|
705
|
+
* @return {number}
|
|
659
706
|
*/
|
|
660
707
|
getPMValue(obj = {},type='RL', defValue) {
|
|
661
708
|
if(this.$xdUniHelper.checkVarType(obj) !== 'object') obj = {};
|
|
@@ -743,6 +790,14 @@ export default {
|
|
|
743
790
|
},
|
|
744
791
|
//#endif
|
|
745
792
|
|
|
793
|
+
/**
|
|
794
|
+
* @description 启动导航功能
|
|
795
|
+
* @param latitude {string|number}
|
|
796
|
+
* @param longitude {string|number}
|
|
797
|
+
* @param name {string} 地点名称
|
|
798
|
+
* @param address {string} 地点详细地址
|
|
799
|
+
* @param cb {Function} 成功回调方法
|
|
800
|
+
*/
|
|
746
801
|
handleOpenLocation({latitude,longitude, name, address}, cb){
|
|
747
802
|
//latitude = latitude||39.961521814959795;
|
|
748
803
|
//longitude = longitude || 116.84499635227222
|
|
@@ -786,52 +841,96 @@ export default {
|
|
|
786
841
|
},
|
|
787
842
|
|
|
788
843
|
/**
|
|
789
|
-
* @description
|
|
844
|
+
* @description 判断站内设置的地址是否可以进行跳转
|
|
790
845
|
* 当前项目为H5时,过滤所有小程序应用
|
|
791
846
|
* 当前项目为小程序时,过滤所有非当前小程序应用
|
|
792
847
|
* 站外地址直接返回
|
|
793
848
|
* 站内地址未选值直接返回
|
|
794
849
|
* 预览模式全过
|
|
795
|
-
* @param url {
|
|
850
|
+
* @param url {string} json数据
|
|
851
|
+
* @return {null|string}
|
|
796
852
|
*/
|
|
797
853
|
checkUrlIsValid(url){
|
|
798
854
|
let projectAttr = this.$root.projectAttr;
|
|
799
855
|
//url = '{"dir":"wtxsaas","host":"sandbox-website-05.jufubao.cn","path":"\/main\/order\/detail","appType":"h5","site_id":"17928cc37788be02","site_url":"https:\/\/sandbox-website-05.jufubao.cn\/wtxsaas\/main\/order\/detail","frontPath":"\/wtxsaas\/main\/order\/detail","fixed_business_code":""}'
|
|
800
|
-
|
|
856
|
+
//数据为空
|
|
857
|
+
if(url === '' || url === null || url === undefined) return null;
|
|
801
858
|
try {
|
|
802
859
|
let redirect_data = JSON.parse(url);
|
|
860
|
+
//兼容数据
|
|
861
|
+
if(redirect_data.app) redirect_data = redirect_data.app;
|
|
862
|
+
//兼容老数据
|
|
803
863
|
if(!redirect_data['appType']) redirect_data['appType']= 'h5';
|
|
804
|
-
|
|
805
864
|
//#ifdef H5
|
|
806
|
-
|
|
865
|
+
|
|
866
|
+
//H5 -> MP
|
|
867
|
+
if(redirect_data['appType'] === 'wxmp'){
|
|
868
|
+
//todo 待支持H5跳转到小程序
|
|
869
|
+
return null;
|
|
870
|
+
}
|
|
807
871
|
else {
|
|
872
|
+
//相同H5应用
|
|
808
873
|
if(redirect_data.dir === projectAttr.deploy_dir) {
|
|
809
874
|
return redirect_data.path
|
|
810
875
|
}
|
|
876
|
+
//不相同H5应用
|
|
811
877
|
else {
|
|
812
878
|
return `//${projectAttr.host}${redirect_data.frontPath}`
|
|
813
879
|
}
|
|
814
|
-
|
|
815
880
|
}
|
|
816
881
|
//#endif
|
|
817
882
|
|
|
818
883
|
//#ifdef MP-WEIXIN
|
|
819
884
|
let dir = redirect_data.dir;
|
|
820
885
|
if(redirect_data['appType'] === 'wxmp'){
|
|
886
|
+
//相同小程序应用
|
|
821
887
|
if(projectAttr.deploy_dir === dir) return redirect_data.path;
|
|
822
|
-
|
|
888
|
+
|
|
889
|
+
//MP -> MP
|
|
890
|
+
else{
|
|
891
|
+
//todo 待支持微信小程序跳转微信小程序
|
|
892
|
+
return null;
|
|
893
|
+
}
|
|
823
894
|
}
|
|
824
895
|
else if(redirect_data['appType'] === 'h5'){
|
|
825
896
|
return `https://${projectAttr.host}${redirect_data.frontPath}`
|
|
826
897
|
}
|
|
827
|
-
|
|
898
|
+
//其他情况
|
|
899
|
+
else {
|
|
900
|
+
return null;
|
|
901
|
+
}
|
|
828
902
|
//#endif
|
|
829
|
-
}
|
|
903
|
+
}
|
|
904
|
+
catch (e){
|
|
830
905
|
console.error(e);
|
|
831
906
|
return null;
|
|
832
907
|
}
|
|
908
|
+
},
|
|
833
909
|
|
|
910
|
+
handleH5ToMP(app_id,url,params){
|
|
911
|
+
debugger
|
|
834
912
|
},
|
|
913
|
+
|
|
914
|
+
handleMpToMP(app_id,url,params){
|
|
915
|
+
|
|
916
|
+
},
|
|
917
|
+
/**
|
|
918
|
+
* @description 处理站点应用内部跳转微信小程序处理
|
|
919
|
+
* @param code {string} 站点内部微信小程序aopen_app_code
|
|
920
|
+
* @param type {string} h5|wxmp
|
|
921
|
+
* @param url {string} 内部链接地址
|
|
922
|
+
* @param params {string} 自定义参数 例如:id=1&cid=1234
|
|
923
|
+
*/
|
|
924
|
+
codeForGetAppId(code, type, url,params){
|
|
925
|
+
this.wxCodeForGetAppId({app_code: code})
|
|
926
|
+
.then(app_id=>{
|
|
927
|
+
if(type === 'h5') this.handleH5ToMP(app_id,url, params || '');
|
|
928
|
+
if(type === 'wxmp') this.handleMpToMP( app_id, url, params || '')
|
|
929
|
+
})
|
|
930
|
+
.catch(err=>{
|
|
931
|
+
console.error(err)
|
|
932
|
+
})
|
|
933
|
+
}
|
|
835
934
|
}
|
|
836
935
|
}
|
|
837
936
|
|