jufubao-third 1.0.8 → 1.0.9
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 +2 -2
- package/src/components/JfbThirdBlock/JfbThirdBlock.vue +6 -4
- package/src/components/JfbThirdBlock/JfbThirdBlockLess.less +6 -5
- package/src/components/JfbThirdPay/JfbThirdPay.vue +13 -11
- package/src/components/JfbThirdPay/JfbThirdPayLess.less +6 -5
- package/src/components/JfbThirdPay/WalletMix.js +30 -4
- package/src/mixins/componentsMixins.js +530 -46
- package/src/mixins/locationMixins.js +93 -9
- package/src/mixins/pageEditx.js +180 -84
- package/src/mixins/pageEvent.js +195 -16
- package/src/mixins/pageMain.js +2 -1
- package/src/mixins/pageUitls.js +336 -98
- package/src/mixins/posterMixins.js +122 -0
package/src/mixins/pageUitls.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import { mapState, mapActions} from 'vuex';
|
|
4
4
|
import {JfbEvent} from "@/utils/xd.event";
|
|
5
|
+
import {Base64} from 'js-base64'
|
|
6
|
+
import {parsePath} from "@/utils/linkUrl";
|
|
5
7
|
|
|
6
8
|
import {
|
|
7
9
|
AttrToTargetValues,
|
|
@@ -9,10 +11,11 @@ import {
|
|
|
9
11
|
baseCloneDeep,
|
|
10
12
|
} from "@/utils/xd.base";
|
|
11
13
|
import getServiceUrl from "@/common/getServiceUrl";
|
|
14
|
+
import {isGiftPreview} from "@/common/CheckGiftIsPreview";
|
|
12
15
|
|
|
13
16
|
export default {
|
|
14
17
|
computed: {
|
|
15
|
-
...mapState(['siteInfo', 'jfbAuthorize', 'webThemes', 'xnamespace']),
|
|
18
|
+
...mapState(['siteInfo', 'jfbAuthorize', 'webThemes', 'xnamespace', 'brandInfo']),
|
|
16
19
|
},
|
|
17
20
|
watch: {
|
|
18
21
|
webThemes: {
|
|
@@ -26,10 +29,116 @@ export default {
|
|
|
26
29
|
return {
|
|
27
30
|
themesList: {}, //保存所有业务组件使用风格列表
|
|
28
31
|
titleDefaultCount: 0, //设置标题时候计数器,最大查找uni-page-head__title样式名称次数
|
|
32
|
+
pageHeadersInfo:null, //页面headers信息
|
|
29
33
|
}
|
|
30
34
|
},
|
|
31
35
|
methods: {
|
|
32
|
-
...mapActions(['loginCardMock']),
|
|
36
|
+
...mapActions(['loginCardMock','setPagesBusinessCode','setPagesParams']),
|
|
37
|
+
|
|
38
|
+
getPropsParse(data){
|
|
39
|
+
if(typeof data === 'string') {
|
|
40
|
+
if(data === '') return {};
|
|
41
|
+
try{
|
|
42
|
+
return JSON.parse(data);
|
|
43
|
+
}
|
|
44
|
+
catch (e){
|
|
45
|
+
return {}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return {}
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
transformToData(containers){
|
|
52
|
+
return containers.map(item=>{
|
|
53
|
+
let props = item.component.props;
|
|
54
|
+
const style = this.getPropsParse(props.style);
|
|
55
|
+
const content = this.getPropsParse(props.content);
|
|
56
|
+
const advanced = this.getPropsParse(props.advanced);
|
|
57
|
+
const refContent = this.getPropsParse(props['ref_content']);
|
|
58
|
+
const propsContent = Object.assign({},style,advanced,content,refContent);
|
|
59
|
+
item.component.props['content'] = JSON.stringify(propsContent);
|
|
60
|
+
return item;
|
|
61
|
+
})
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @description Container数据转化
|
|
66
|
+
* @param containers {Array} 使用业务插件数据
|
|
67
|
+
* @return {Object}
|
|
68
|
+
*/
|
|
69
|
+
getContainerGroup(containers) {
|
|
70
|
+
//转换数据格式
|
|
71
|
+
containers = this.transformToData(containers);
|
|
72
|
+
let temp = {
|
|
73
|
+
topHeight: 0,
|
|
74
|
+
bottomHeight: 0,
|
|
75
|
+
footerHeight: 0,
|
|
76
|
+
tops: [],
|
|
77
|
+
bottoms: [],
|
|
78
|
+
bodys: [],
|
|
79
|
+
footers: [],
|
|
80
|
+
};
|
|
81
|
+
let refs = [];
|
|
82
|
+
containers.map(item => {
|
|
83
|
+
item['refreshKey'] = this.$xdUniHelper.randomChar(20);
|
|
84
|
+
if(!item.hidden) refs.push(item['container_id']);
|
|
85
|
+
let fixed = 'body';
|
|
86
|
+
let height = 0;
|
|
87
|
+
item['component']['attrs'] = AttrToTargetValues(item['component']['attrs']);
|
|
88
|
+
item['component']['attrs'].map(it => {
|
|
89
|
+
if (it['key'] === 'fixed') {
|
|
90
|
+
fixed = it['value'];
|
|
91
|
+
}
|
|
92
|
+
if (it['key'] === 'height') {
|
|
93
|
+
height = it['value'];
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
switch (fixed) {
|
|
97
|
+
case 'top':
|
|
98
|
+
temp.tops.push(item);
|
|
99
|
+
if (!item.hidden) temp.topHeight += height;
|
|
100
|
+
break;
|
|
101
|
+
case 'bottom':
|
|
102
|
+
temp.bottoms.push(item);
|
|
103
|
+
if (!item.hidden) temp.bottomHeight += height;
|
|
104
|
+
break;
|
|
105
|
+
case 'footer':
|
|
106
|
+
temp.footers.push(item);
|
|
107
|
+
if (!item.hidden) temp.footerHeight += height;
|
|
108
|
+
break;
|
|
109
|
+
default:
|
|
110
|
+
temp.bodys.push(item);
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
this.refs = refs;
|
|
114
|
+
return temp;
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
setPageTitle(){
|
|
118
|
+
// #ifdef MP-WEIXIN
|
|
119
|
+
uni.setNavigationBarTitle({
|
|
120
|
+
title: this.pageAttr.title
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
// #endif
|
|
124
|
+
|
|
125
|
+
// #ifdef H5
|
|
126
|
+
if (this.$configProject.type === 'food') {
|
|
127
|
+
let xd = getApp().globalData.$xd;
|
|
128
|
+
if (xd && xd.brandInfo && xd.brandInfo.name) {
|
|
129
|
+
document.title = xd.brandInfo.name;
|
|
130
|
+
this.setH5Title(this.pageAttr.title);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
if (this.projectAttr['site_name'] || this.projectAttr['seo_title']) {
|
|
135
|
+
document.title = this.projectAttr['seo_title'] || this.projectAttr['site_name'];
|
|
136
|
+
}
|
|
137
|
+
this.setH5Title(this.pageAttr.title);
|
|
138
|
+
}
|
|
139
|
+
// #endif
|
|
140
|
+
},
|
|
141
|
+
|
|
33
142
|
getMockCard(){
|
|
34
143
|
let pagae = this.$xdUniHelper.parseURL();
|
|
35
144
|
let card = pagae.params['x-test'];
|
|
@@ -41,18 +150,31 @@ export default {
|
|
|
41
150
|
}
|
|
42
151
|
return ''
|
|
43
152
|
},
|
|
153
|
+
|
|
154
|
+
getSpPath(dir , path ){
|
|
155
|
+
let reg = /@site_domain@/;
|
|
156
|
+
if(!reg.test(path)) return `/${dir}${path}`;
|
|
157
|
+
else return path.replace(reg, '');
|
|
158
|
+
},
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* @description 只处理H5端(小程序端无法控制链接参数)
|
|
162
|
+
* @return {boolean}
|
|
163
|
+
*/
|
|
44
164
|
checkMockCard(){
|
|
165
|
+
let login_entry = this.projectAttr.login_entry || this.$configProject.login_entry;
|
|
166
|
+
let card_entry = this.projectAttr.card_entry || this.$configProject.card_entry;
|
|
45
167
|
// #ifdef H5
|
|
46
|
-
let
|
|
47
|
-
let userLogin =
|
|
48
|
-
let cardLogin =
|
|
168
|
+
let pages = this.$xdUniHelper.parseURL();
|
|
169
|
+
let userLogin = this.getSpPath(this.projectAttr.deploy_dir, login_entry);
|
|
170
|
+
let cardLogin = this.getSpPath(this.projectAttr.deploy_dir, card_entry);
|
|
49
171
|
|
|
50
172
|
//登陆页面和卡登陆页面不启用
|
|
51
|
-
if(
|
|
173
|
+
if(pages.path === userLogin || pages.path === cardLogin) {
|
|
52
174
|
return false
|
|
53
175
|
}
|
|
54
176
|
|
|
55
|
-
let card =
|
|
177
|
+
let card = pages.params['x-test'];
|
|
56
178
|
if(card) {
|
|
57
179
|
let reg = /^(card_)[a-zA-Z0-9\-_]+$/;
|
|
58
180
|
if(reg.test(card)) return true
|
|
@@ -61,16 +183,147 @@ export default {
|
|
|
61
183
|
return false;
|
|
62
184
|
},
|
|
63
185
|
|
|
64
|
-
|
|
186
|
+
setBusinessCodeSave(options, pages){
|
|
187
|
+
let business_code = '';
|
|
188
|
+
let getType = ''
|
|
189
|
+
|
|
190
|
+
//地址栏中参数传递
|
|
191
|
+
if (!business_code && options['xnamespace']){
|
|
192
|
+
getType = '地址栏中参数传递业务线'
|
|
193
|
+
business_code = options['xnamespace'];
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
//页面中获取参数
|
|
197
|
+
if (!business_code && pages['is_business_code']){
|
|
198
|
+
business_code = pages['is_business_code'];
|
|
199
|
+
getType = '页面pages.json文件中获取业务线'
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
//文件目录中获取
|
|
203
|
+
//todo
|
|
204
|
+
//getType = '页面JSON文件中获取业务线'
|
|
205
|
+
|
|
206
|
+
//项目文件中获取
|
|
207
|
+
if(!business_code && (this.brandInfo && this.brandInfo.business_code)){
|
|
208
|
+
getType = '项目应用project.json文件中获取业务线'
|
|
209
|
+
business_code = this.brandInfo.business_code;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
//地址栏中获取特定参数
|
|
213
|
+
if(!business_code && options['x-common']) {
|
|
214
|
+
let decodeParams = Base64.decode(options['x-common']);
|
|
215
|
+
try {
|
|
216
|
+
let params = JSON.parse(decodeParams);
|
|
217
|
+
if (params.business_code){
|
|
218
|
+
business_code = params.business_code;
|
|
219
|
+
getType = '地址栏中获取全局特殊参数(x-common)中获取业务线'
|
|
220
|
+
}
|
|
221
|
+
} catch (e) {
|
|
222
|
+
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
this.setPagesBusinessCode(business_code);
|
|
227
|
+
console.warn(`获取业务线方式:${getType}`)
|
|
228
|
+
return business_code;
|
|
229
|
+
},
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* @description 检查地址是否为登陆页面
|
|
233
|
+
* @param type
|
|
234
|
+
* @returns {boolean}
|
|
235
|
+
*/
|
|
236
|
+
checkPathIsLoginAndOrCard(type = 'card'){
|
|
237
|
+
//包含: /$dir/xxx/xxx/xxx或者/pages/index/index
|
|
238
|
+
let pages = this.$xdUniHelper.parseURL();
|
|
239
|
+
let login_entry = this.projectAttr.login_entry || this.$configProject.login_entry;
|
|
240
|
+
let card_entry = this.projectAttr.card_entry || this.$configProject.card_entry;
|
|
241
|
+
|
|
242
|
+
// #ifdef H5
|
|
243
|
+
let userLogin = this.getSpPath(this.projectAttr.deploy_dir, login_entry);
|
|
244
|
+
let cardLogin = this.getSpPath(this.projectAttr.deploy_dir,card_entry);
|
|
245
|
+
if (type === 'card') return pages.path === cardLogin;
|
|
246
|
+
if (type === 'login') return pages.path === userLogin;
|
|
247
|
+
// #endif
|
|
248
|
+
// #ifdef MP-WEIXIN
|
|
249
|
+
let loginObj = parsePath(login_entry);
|
|
250
|
+
let cardObj = parsePath(card_entry);
|
|
251
|
+
if (type === 'card') return cardObj.isSameApp && pages.path === cardObj.url;
|
|
252
|
+
if (type === 'login') return loginObj.isSameApp && pages.path === loginObj.url;
|
|
253
|
+
// #endif
|
|
254
|
+
|
|
255
|
+
},
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* @description 当用户登陆当前卡不支持当前业务线时候
|
|
259
|
+
*/
|
|
260
|
+
toCardIndex(){
|
|
261
|
+
let page = this.$xdUniHelper.parseURL();
|
|
262
|
+
let {inCallback} = page.params;
|
|
263
|
+
if(inCallback) {
|
|
264
|
+
try{
|
|
265
|
+
inCallback = Base64.decode(inCallback);
|
|
266
|
+
let regIndex = /^.*(toIndex)$/;
|
|
267
|
+
if(regIndex.test(inCallback)) {
|
|
268
|
+
this.$xdUniHelper.redirectTo({url: this.$settings.index}, false, true)
|
|
269
|
+
}
|
|
270
|
+
}catch (e) {
|
|
271
|
+
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
},
|
|
276
|
+
|
|
277
|
+
setContainersLogs(containers){
|
|
278
|
+
if(containers && containers.length > 0) {
|
|
279
|
+
let log = containers.map(item=>{
|
|
280
|
+
return item.component['component_name']
|
|
281
|
+
});
|
|
282
|
+
this.$xdLog.setProject('App.containers', log.join('_'));
|
|
283
|
+
}
|
|
284
|
+
else this.$xdLog.setProject('App.containers', 'no.containers');
|
|
285
|
+
},
|
|
286
|
+
|
|
287
|
+
getUID(token){
|
|
288
|
+
let arr = token.split('.');
|
|
289
|
+
try {
|
|
290
|
+
let uid = JSON.parse(Base64.decode(arr[1]));
|
|
291
|
+
return uid['csrf_user_id'];
|
|
292
|
+
}catch (e) {
|
|
293
|
+
return null;
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* @description 设置页面公共参数
|
|
299
|
+
* @param pages
|
|
300
|
+
* @param bussCode
|
|
301
|
+
*/
|
|
302
|
+
setCommonPagesParams(pages, bussCode){
|
|
303
|
+
let isPagesUseBussCode = false;
|
|
304
|
+
if(pages.features && this.$xdUniHelper.checkVarType(pages.features) === 'array') {
|
|
305
|
+
pages.features.map(item=>{
|
|
306
|
+
if(item === 'business_limit') isPagesUseBussCode = true;
|
|
307
|
+
})
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
let folderCustomLoginEntry = '';
|
|
311
|
+
this.setPagesParams({
|
|
312
|
+
pagesParams: {
|
|
313
|
+
xnamespace:bussCode,
|
|
314
|
+
custom_login_entry: pages['is_login_entry'] || folderCustomLoginEntry || '',
|
|
315
|
+
isPagesUseBussCode: isPagesUseBussCode,
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
},
|
|
319
|
+
|
|
320
|
+
init(options){
|
|
65
321
|
this.settings = this.$settings;
|
|
66
322
|
this.site_id = this.brandInfo.site_id;
|
|
67
323
|
this.projectAttr = this.brandInfo;
|
|
68
324
|
|
|
69
325
|
//第一次上班日志
|
|
70
|
-
this.$xdLog.setProject('pages.init',
|
|
71
|
-
projectAttr: this.brandInfo,
|
|
72
|
-
site_id: this.site_id
|
|
73
|
-
});
|
|
326
|
+
this.$xdLog.setProject('App.pages.init', 'pages.init');
|
|
74
327
|
|
|
75
328
|
//预览模式设置页面ID
|
|
76
329
|
if (this.$configProject.isPreview === true) {
|
|
@@ -79,10 +332,20 @@ export default {
|
|
|
79
332
|
this.pageAttr['page_id'] = page_id;
|
|
80
333
|
}
|
|
81
334
|
|
|
335
|
+
|
|
336
|
+
//当用户登陆当前卡不支持当前业务线时候(选择去换业务线)
|
|
337
|
+
this.toCardIndex();
|
|
338
|
+
|
|
82
339
|
//获取用户信息
|
|
83
340
|
this.getPageAttr(this.page_id)
|
|
84
341
|
.then(async (res) => {
|
|
85
342
|
|
|
343
|
+
//configs.template_type
|
|
344
|
+
// 模板类型 1=克隆 2=软链 3=原创模板
|
|
345
|
+
if(res.configs['template_type']) {
|
|
346
|
+
this.isReferenceTemplate = res.configs['template_type'] === 2
|
|
347
|
+
}
|
|
348
|
+
|
|
86
349
|
//设置页面信息
|
|
87
350
|
this.pageAttr = {...this.pageAttr, ...this.parsePageConfig(res)};
|
|
88
351
|
if (this.pageAttr['config']) this.pageAttr['configs'] = this.pageAttr['config'];
|
|
@@ -93,17 +356,42 @@ export default {
|
|
|
93
356
|
} else this.setPageConfig(this.pageAttr);
|
|
94
357
|
|
|
95
358
|
//计算页面插件信息
|
|
359
|
+
this.setContainersLogs(res['containers'])
|
|
96
360
|
this.containers = this.getContainerGroup(res['containers']);
|
|
97
361
|
|
|
362
|
+
//检查是否为成功页面
|
|
363
|
+
this.isSpecialPages = this.checkSpecialPages(res['containers']);
|
|
364
|
+
|
|
98
365
|
//保存页面headers变量
|
|
99
|
-
if (res['headers'])
|
|
100
|
-
|
|
366
|
+
if (res['headers']) {
|
|
367
|
+
this.setPagesHeader(res['headers']);
|
|
368
|
+
this.pageHeadersInfo = this.$xdUniHelper.cloneDeep(res['headers'])
|
|
369
|
+
}
|
|
370
|
+
else{
|
|
371
|
+
this.setPagesHeader({});
|
|
372
|
+
this.pageHeadersInfo = {};
|
|
373
|
+
}
|
|
101
374
|
|
|
102
375
|
//保存页面权限
|
|
103
376
|
if (res['permission']) this.setPagesPermission(res['permission']);
|
|
104
377
|
else this.setPagesPermission({can_card: false, can_sign: false});
|
|
105
378
|
this.loadStatus = true;
|
|
106
379
|
|
|
380
|
+
//设置业务线
|
|
381
|
+
const bussCode = this.setBusinessCodeSave(this.$xdUniHelper.parseURL().params, this.pageAttr);
|
|
382
|
+
|
|
383
|
+
//保存页面参数和地址参数
|
|
384
|
+
this.setCommonPagesParams(this.pageAttr, bussCode)
|
|
385
|
+
this.$xdLog.setProject('App.user.card.start', 'pages.check.userAndCard.start');
|
|
386
|
+
|
|
387
|
+
//礼包预览使用免登陆模式(H5模式)
|
|
388
|
+
// #ifdef H5
|
|
389
|
+
if(isGiftPreview()){
|
|
390
|
+
this.handleDoneLoad()
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
// #endif
|
|
394
|
+
|
|
107
395
|
//检查用户是否登录
|
|
108
396
|
if (!await this.checkLoginAndCardLogin(res.permission['can_sign'])) {
|
|
109
397
|
return;
|
|
@@ -112,9 +400,12 @@ export default {
|
|
|
112
400
|
//登陆测试卡
|
|
113
401
|
if(this.checkMockCard()) {
|
|
114
402
|
if(this.getMockCard()){
|
|
115
|
-
|
|
403
|
+
let mock = await this.loginCardMock({card_number: this.getMockCard()});
|
|
404
|
+
if (!mock.status) {
|
|
116
405
|
this.$xdAlert({
|
|
117
|
-
content:
|
|
406
|
+
content: (mock.message && mock.message.data && mock.message.data.message) ?
|
|
407
|
+
mock.message.data.message:
|
|
408
|
+
'当前登陆的卡券或服务不可用,请重试!',
|
|
118
409
|
width: '60vw',
|
|
119
410
|
time: 3000
|
|
120
411
|
})
|
|
@@ -139,97 +430,46 @@ export default {
|
|
|
139
430
|
}
|
|
140
431
|
}
|
|
141
432
|
|
|
433
|
+
this.$xdLog.setProject('App.user.card.done', 'pages.check.userAndCard.done');
|
|
434
|
+
if(this.jfbAuthorize.getToken('user') !== null) {
|
|
435
|
+
this.$xdLog.setConfig(this.getUID(this.jfbAuthorize.getToken('user')))
|
|
436
|
+
}
|
|
142
437
|
|
|
438
|
+
this.handleDoneLoad()
|
|
143
439
|
|
|
144
|
-
|
|
145
|
-
|
|
440
|
+
})
|
|
441
|
+
.catch(err=>{
|
|
442
|
+
console.error(err)
|
|
443
|
+
this.$xdLog.catch(err)
|
|
444
|
+
});
|
|
445
|
+
},
|
|
146
446
|
|
|
447
|
+
handleDoneLoad(){
|
|
147
448
|
|
|
148
|
-
|
|
449
|
+
//用户状态已经检查完成
|
|
450
|
+
this.isCheckAuth = true;
|
|
149
451
|
|
|
150
|
-
// #ifdef MP-WEIXIN
|
|
151
|
-
uni.setNavigationBarTitle({
|
|
152
|
-
title: '首页'
|
|
153
|
-
});
|
|
154
452
|
|
|
155
|
-
|
|
453
|
+
//设置标题
|
|
454
|
+
this.setPageTitle();
|
|
455
|
+
this.isCheckAuth = true;
|
|
156
456
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
document.title = xd.brandInfo.name;
|
|
162
|
-
this.setH5Title('首页');
|
|
163
|
-
}
|
|
164
|
-
} else {
|
|
165
|
-
if (this.projectAttr['site_name'] || this.projectAttr['seo_title']) {
|
|
166
|
-
document.title = this.projectAttr['seo_title'] || this.projectAttr['site_name'];
|
|
167
|
-
}
|
|
168
|
-
this.setH5Title('首页');
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
// #endif
|
|
457
|
+
//执行onload事件
|
|
458
|
+
this.$xdLog.setProject(`App.getPages`, 'App.getPages.done');
|
|
459
|
+
this.onInitLoad();
|
|
460
|
+
},
|
|
172
461
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
462
|
+
checkSpecialPages(containers=[]){
|
|
463
|
+
let flag = false;
|
|
464
|
+
let packArrays = ['JfbBaseSuccess'];
|
|
465
|
+
if(containers instanceof Array) {
|
|
466
|
+
containers.map(item=>{
|
|
467
|
+
if(packArrays.includes(item.component['component_name'])) {
|
|
468
|
+
flag = true;
|
|
180
469
|
}
|
|
181
470
|
})
|
|
182
|
-
.catch();
|
|
183
|
-
|
|
184
|
-
// #ifdef H5
|
|
185
|
-
if (this.$configProject.viewType === 'preview') {
|
|
186
|
-
XdBus.addEvent('onDelPackage', (data) => {
|
|
187
|
-
this.deleteComponent(data);
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
//注册事件
|
|
191
|
-
this.regAddComponent();
|
|
192
|
-
this.editComponent();
|
|
193
|
-
this.regMoveComponent()
|
|
194
471
|
}
|
|
195
|
-
|
|
196
|
-
},
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* @description 检查页面强制卡登陆(废弃)
|
|
200
|
-
* @param can_card
|
|
201
|
-
*/
|
|
202
|
-
checkNameSpace(can_card) {
|
|
203
|
-
return true;
|
|
204
|
-
if (!can_card) {
|
|
205
|
-
console.warn('not-card-login:非强制卡登陆')
|
|
206
|
-
return new Promise((resolve)=>{
|
|
207
|
-
resolve(true)
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
let maxNTime = 30;
|
|
212
|
-
let timer = null;
|
|
213
|
-
let nTime = 0;
|
|
214
|
-
return new Promise((resolve)=>{
|
|
215
|
-
console.warn('card-login:强制卡登陆');
|
|
216
|
-
timer = setInterval(async ()=>{
|
|
217
|
-
if(nTime > maxNTime){
|
|
218
|
-
console.warn(`card-login-to-max-time:${nTime}`)
|
|
219
|
-
clearInterval(timer);
|
|
220
|
-
}
|
|
221
|
-
else{
|
|
222
|
-
if (this.xnamespace) {
|
|
223
|
-
console.warn(`card-login-get-to-namespace:${this.xnamespace}`)
|
|
224
|
-
let status = await this.jfbAuthorize.checkLoginCardSupportBizCode(can_card, this);
|
|
225
|
-
resolve(status);
|
|
226
|
-
clearInterval(timer)
|
|
227
|
-
}
|
|
228
|
-
else nTime++;
|
|
229
|
-
}
|
|
230
|
-
}, 50)
|
|
231
|
-
});
|
|
232
|
-
|
|
472
|
+
return flag
|
|
233
473
|
},
|
|
234
474
|
|
|
235
475
|
/**
|
|
@@ -249,8 +489,6 @@ export default {
|
|
|
249
489
|
* @param type {Object} 导航模式 (false|true)false=>系统 true => 自定义
|
|
250
490
|
*/
|
|
251
491
|
setPreviewSetPageConfig(type) {
|
|
252
|
-
console.log('navigationStyle', this.$configProject.extras)
|
|
253
|
-
|
|
254
492
|
if (type) {
|
|
255
493
|
this.pageAttr['showBar'] = this.pageAttr['is_bar'] || false;
|
|
256
494
|
this.pageAttr['backgroundImage'] = this.pageAttr.configs['background_image'] || 'none';
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
methods:{
|
|
5
|
+
/**
|
|
6
|
+
* @description 过滤不可以用
|
|
7
|
+
* 当前项目未H5时,过滤所有小程序应用
|
|
8
|
+
* 当前项目未小程序时,过滤所有非当前小程序应用
|
|
9
|
+
* 站外地址直接返回
|
|
10
|
+
* 站内地址未选值直接返回
|
|
11
|
+
* 预览模式全过
|
|
12
|
+
*/
|
|
13
|
+
posterFilterNoUseData(list = []){
|
|
14
|
+
let content = this.$xdUniHelper.cloneDeep(list).filter(item=>{
|
|
15
|
+
//预览模式
|
|
16
|
+
if( this.$configProject.isPreview) return true;
|
|
17
|
+
|
|
18
|
+
//非内部应用
|
|
19
|
+
if(item.redirect_type !== 'INN') return true
|
|
20
|
+
|
|
21
|
+
//没有配置链接
|
|
22
|
+
if(!item.redirect_data) return true;
|
|
23
|
+
|
|
24
|
+
//内部应用
|
|
25
|
+
else {
|
|
26
|
+
let redirect_data;
|
|
27
|
+
try {
|
|
28
|
+
redirect_data = JSON.parse(item.redirect_data);
|
|
29
|
+
if(!item['app_type']) item['app_type']= 'h5';
|
|
30
|
+
|
|
31
|
+
//#ifdef H5
|
|
32
|
+
return item['app_type'] !== 'wxmp';
|
|
33
|
+
//#endif
|
|
34
|
+
|
|
35
|
+
//#ifdef MP-WEIXIN
|
|
36
|
+
let actDir = this.$parent['projectAttr']['deploy_dir'];
|
|
37
|
+
let dir = this.getPosterPathDir(redirect_data.page);
|
|
38
|
+
if(item['app_type'] === 'wxmp'){
|
|
39
|
+
return actDir === dir;
|
|
40
|
+
}
|
|
41
|
+
else if(item['app_type'] === 'h5') return true;
|
|
42
|
+
else return true
|
|
43
|
+
//#endif
|
|
44
|
+
}
|
|
45
|
+
catch (e) {
|
|
46
|
+
return true
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
console.warn(`PostersList:${JSON.stringify(content.map(item=>`${item.app_type}:${item.content_name}:${item.redirect_data}`), null,2)}`)
|
|
51
|
+
return content;
|
|
52
|
+
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
getPosterPathDir(pathDir){
|
|
56
|
+
if(pathDir.indexOf('@site_domain@/') === 0) {
|
|
57
|
+
return pathDir.replace('@site_domain@/','').split('/')[0]
|
|
58
|
+
}
|
|
59
|
+
return ''
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
handlePosterClick(item) {
|
|
63
|
+
if(!item.redirect_data) {
|
|
64
|
+
console.warn(`未配置链接地址: ${item.redirect_data}`);
|
|
65
|
+
console.error(`未配置链接地址: ${item.redirect_data}`);
|
|
66
|
+
return
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
//内部链接跳转地址
|
|
70
|
+
if (item.redirect_type === 'INN') {
|
|
71
|
+
try {
|
|
72
|
+
let url = JSON.parse(item.redirect_data);
|
|
73
|
+
let params = '';
|
|
74
|
+
if(url.page) {
|
|
75
|
+
if (item['redirect_params']) params = `?${item['redirect_params']}`;
|
|
76
|
+
this.$xdUniHelper.navigateTo({url: url.page + params})
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
console.error(`应用链接配置错误: ${url.page}`)
|
|
80
|
+
}
|
|
81
|
+
} catch (e) {
|
|
82
|
+
console.error(`应用链接配置错误: ${item.redirect_data}`)
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
//外部链接
|
|
87
|
+
if (item.redirect_type === 'URL') {
|
|
88
|
+
let reg = /^(http:\/\/|https:\/\/|\/\/)+.+$/;
|
|
89
|
+
let spReg = /(-apiuri\/v)/;
|
|
90
|
+
//#ifdef MP-WEIXIN
|
|
91
|
+
try {
|
|
92
|
+
let url = JSON.parse(item.redirect_data);
|
|
93
|
+
if (reg.test(url.url) || spReg.test(url.url)) {
|
|
94
|
+
console.warn(`广告跳转外站: ${url.url}`)
|
|
95
|
+
this.$xdUniHelper.navigateTo(url);
|
|
96
|
+
} else {
|
|
97
|
+
console.error(`广告跳转外站配置错误: ${url.url}`)
|
|
98
|
+
}
|
|
99
|
+
} catch (e) {
|
|
100
|
+
console.error(`广告跳转外站配置错误: ${item.redirect_data}`)
|
|
101
|
+
}
|
|
102
|
+
//#endif
|
|
103
|
+
//#ifdef H5
|
|
104
|
+
try {
|
|
105
|
+
let url = JSON.parse(item.redirect_data);
|
|
106
|
+
console.warn(`广告跳转外站: ${url.url}`);
|
|
107
|
+
this.$xdUniHelper.redirectTo(url, false)
|
|
108
|
+
} catch (e) {
|
|
109
|
+
console.error(`广告跳转外站配置错误: ${item.redirect_data}`)
|
|
110
|
+
}
|
|
111
|
+
//#endif
|
|
112
|
+
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
//无跳转地址
|
|
116
|
+
if(item.redirect_type === 'EMP') {
|
|
117
|
+
console.warn(`无跳转地址`);
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
}
|
|
122
|
+
|