@fonixtree/magic-design 0.0.166 → 0.0.167
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/es/composite-comp/bol/components/ImageGallery/pc/index.js +2 -2
- package/es/composite-comp/bol/components/Newsletter/defaultJSON.js +14 -0
- package/es/composite-comp/bol/config-panels/NewsletterConfig/InputField/index.js +5 -2
- package/es/constants/index.js +0 -1
- package/es/core/Designer/ConfigPanel/index.js +8 -0
- package/es/decorator/compositeDecorator.js +7 -1
- package/es/utils/androidUtil.js +8 -2
- package/es/utils/businessUtil.js +57 -46
- package/es/utils/coreUtil.js +17 -40
- package/lib/composite-comp/bol/components/ImageGallery/pc/index.js +2 -2
- package/lib/composite-comp/bol/components/Newsletter/defaultJSON.js +14 -0
- package/lib/composite-comp/bol/config-panels/NewsletterConfig/InputField/index.js +5 -2
- package/lib/constants/index.js +0 -1
- package/lib/core/Designer/ConfigPanel/index.js +8 -0
- package/lib/decorator/compositeDecorator.js +7 -1
- package/lib/utils/androidUtil.js +8 -2
- package/lib/utils/businessUtil.js +57 -46
- package/lib/utils/coreUtil.js +17 -40
- package/package.json +1 -1
|
@@ -140,8 +140,8 @@ function (_super) {
|
|
|
140
140
|
}, /*#__PURE__*/_react["default"].createElement(_components.MetaImage, {
|
|
141
141
|
data: item.image,
|
|
142
142
|
maxHeight: item.image.content.pcImgSrc ? PC_IMG_SIZE[colNum].maxH : PC_IMG_SIZE[colNum].defH,
|
|
143
|
-
maxWidth: item.image.content.pcImgSrc ? '100%' : PC_IMG_SIZE[colNum].defW
|
|
144
|
-
|
|
143
|
+
maxWidth: item.image.content.pcImgSrc ? '100%' : PC_IMG_SIZE[colNum].defW // minHeight={PC_IMG_SIZE[colNum].minH}
|
|
144
|
+
,
|
|
145
145
|
minWidth: PC_IMG_SIZE[colNum].minW
|
|
146
146
|
}));
|
|
147
147
|
}));
|
|
@@ -82,6 +82,20 @@ var getDefaultMetaButtonJson = function getDefaultMetaButtonJson() {
|
|
|
82
82
|
iconUrl: '',
|
|
83
83
|
layout: 'right'
|
|
84
84
|
},
|
|
85
|
+
spacing: {
|
|
86
|
+
pc: {
|
|
87
|
+
paddingTop: 14,
|
|
88
|
+
paddingBottom: 14,
|
|
89
|
+
paddingLeft: 24,
|
|
90
|
+
paddingRight: 24
|
|
91
|
+
},
|
|
92
|
+
mobile: {
|
|
93
|
+
paddingTop: 12,
|
|
94
|
+
paddingBottom: 12,
|
|
95
|
+
paddingLeft: 20,
|
|
96
|
+
paddingRight: 20
|
|
97
|
+
}
|
|
98
|
+
},
|
|
85
99
|
text: 'Subscribe',
|
|
86
100
|
hover: null
|
|
87
101
|
};
|
|
@@ -89,6 +89,7 @@ function (_super) {
|
|
|
89
89
|
|
|
90
90
|
var data = this.props.data;
|
|
91
91
|
var textData = data.content;
|
|
92
|
+
console.log('data', data);
|
|
92
93
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
93
94
|
className: "m-text-config",
|
|
94
95
|
style: {
|
|
@@ -97,8 +98,10 @@ function (_super) {
|
|
|
97
98
|
}, /*#__PURE__*/_react["default"].createElement(_common.Field, {
|
|
98
99
|
title: (0, _locale.i18n)('PLACEHOLDER')
|
|
99
100
|
}, /*#__PURE__*/_react["default"].createElement(_antd.Input, {
|
|
100
|
-
onChange: function onChange(
|
|
101
|
-
data.placeholder =
|
|
101
|
+
onChange: function onChange(e) {
|
|
102
|
+
data.placeholder = e.target.value;
|
|
103
|
+
|
|
104
|
+
_this.selfRender();
|
|
102
105
|
},
|
|
103
106
|
value: data.placeholder
|
|
104
107
|
})), /*#__PURE__*/_react["default"].createElement(_common.Field, {
|
package/es/constants/index.js
CHANGED
|
@@ -260,6 +260,10 @@ function (_super) {
|
|
|
260
260
|
groupName = (panelProps === null || panelProps === void 0 ? void 0 : panelProps.title.text) || (0, _locale.i18n)('NAVIGATION_NAME');
|
|
261
261
|
break;
|
|
262
262
|
|
|
263
|
+
case 'IMAGE_TEXT':
|
|
264
|
+
groupName = panelProps.title.text;
|
|
265
|
+
break;
|
|
266
|
+
|
|
263
267
|
case 'TEXT':
|
|
264
268
|
groupName = panelProps.content.title.text;
|
|
265
269
|
break;
|
|
@@ -268,6 +272,10 @@ function (_super) {
|
|
|
268
272
|
groupName = panelProps.groupName.text;
|
|
269
273
|
break;
|
|
270
274
|
|
|
275
|
+
case 'BUTTON':
|
|
276
|
+
groupName = panelProps.button.text;
|
|
277
|
+
break;
|
|
278
|
+
|
|
271
279
|
case 'VIDEO':
|
|
272
280
|
groupName = 'Video' + (panelIndex + 1);
|
|
273
281
|
break;
|
|
@@ -112,10 +112,16 @@ function compositeDecorator(WrappedComponent) {
|
|
|
112
112
|
var _b = window.magicDesign,
|
|
113
113
|
device = _b.device,
|
|
114
114
|
compWidth = _b.compWidth;
|
|
115
|
+
var zIndex = '0';
|
|
116
|
+
|
|
117
|
+
if (nodeData.type === 'CAROUSEL' || nodeData.type === 'IMAGE_GALLERY') {
|
|
118
|
+
zIndex = '1';
|
|
119
|
+
}
|
|
120
|
+
|
|
115
121
|
var wrapStyle = {
|
|
116
122
|
border: 'none',
|
|
117
123
|
position: 'relative',
|
|
118
|
-
zIndex:
|
|
124
|
+
zIndex: zIndex,
|
|
119
125
|
margin: '0 auto'
|
|
120
126
|
}; // 复合组件内边距
|
|
121
127
|
|
package/es/utils/androidUtil.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.sendToJs = exports.sendToIos = exports.sendToAndroid = exports.iosSendToJs = exports.connectWebViewJavascriptBridge = exports.browserVersion = void 0;
|
|
6
|
+
exports.sendToJs = exports.sendToIos = exports.sendToApp = exports.sendToAndroid = exports.iosSendToJs = exports.connectWebViewJavascriptBridge = exports.browserVersion = void 0;
|
|
7
7
|
|
|
8
8
|
// 判断访问终端
|
|
9
9
|
var browserVersion = function browserVersion() {
|
|
@@ -110,4 +110,10 @@ var sendToIos = function sendToIos(params) {
|
|
|
110
110
|
if (window.webkit) window.webkit.messageHandlers.jsFunc.postMessage(params);
|
|
111
111
|
};
|
|
112
112
|
|
|
113
|
-
exports.sendToIos = sendToIos;
|
|
113
|
+
exports.sendToIos = sendToIos;
|
|
114
|
+
|
|
115
|
+
var sendToApp = function sendToApp(params) {
|
|
116
|
+
window.flutter_inject_js_bridge.postMessage(JSON.stringify(params));
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
exports.sendToApp = sendToApp;
|
package/es/utils/businessUtil.js
CHANGED
|
@@ -5,11 +5,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.renderPreview = exports.parseUrl = exports.listToTree = exports.getPromotionList = exports.computeStyle = exports.canNumber = void 0;
|
|
7
7
|
|
|
8
|
+
var _qs = _interopRequireDefault(require("qs"));
|
|
9
|
+
|
|
10
|
+
var _lodash = require("lodash");
|
|
11
|
+
|
|
8
12
|
var _constants = require("../constants");
|
|
9
13
|
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
|
+
|
|
16
|
+
/* eslint-disable import/no-cycle */
|
|
10
17
|
var parseUrl = function parseUrl(url) {
|
|
11
|
-
var
|
|
12
|
-
var pcLink = url;
|
|
18
|
+
var link = url;
|
|
13
19
|
var params;
|
|
14
20
|
|
|
15
21
|
var _a = url.split('-'),
|
|
@@ -20,11 +26,11 @@ var parseUrl = function parseUrl(url) {
|
|
|
20
26
|
switch (type) {
|
|
21
27
|
// 商品详情
|
|
22
28
|
case _constants.urlType.PRODUCT_DETAIL:
|
|
23
|
-
|
|
24
|
-
h5Link = "/product/detail/" + arg1 + "?productId=" + (arg2 !== null && arg2 !== void 0 ? arg2 : '');
|
|
29
|
+
link = "/product/detail/" + arg1 + "?productId=" + (arg2 !== null && arg2 !== void 0 ? arg2 : '');
|
|
25
30
|
params = {
|
|
26
|
-
|
|
27
|
-
|
|
31
|
+
action: 'jump',
|
|
32
|
+
params: {
|
|
33
|
+
type: 'PRODUCT_DETAIL',
|
|
28
34
|
offerId: arg1,
|
|
29
35
|
productId: arg2
|
|
30
36
|
}
|
|
@@ -33,50 +39,42 @@ var parseUrl = function parseUrl(url) {
|
|
|
33
39
|
|
|
34
40
|
case _constants.urlType.CATG_PROD_LIST:
|
|
35
41
|
// 商品列表
|
|
36
|
-
|
|
37
|
-
h5Link = "/product/list/" + arg1;
|
|
42
|
+
link = "/product/list/" + arg1;
|
|
38
43
|
params = {
|
|
39
|
-
|
|
40
|
-
|
|
44
|
+
action: 'jump',
|
|
45
|
+
params: {
|
|
46
|
+
type: 'PRODUCT_LIST',
|
|
41
47
|
catgId: arg1
|
|
42
48
|
}
|
|
43
49
|
};
|
|
44
50
|
break;
|
|
45
|
-
|
|
46
|
-
case _constants.urlType.GIVEAWAY_MISSION:
|
|
47
|
-
// 零元购
|
|
48
|
-
pcLink = '';
|
|
49
|
-
h5Link = "/special-mission?campaignId=" + arg1;
|
|
50
|
-
params = {
|
|
51
|
-
type: 'GIVEAWAY_MISSION',
|
|
52
|
-
data: {
|
|
53
|
-
campaignId: arg1
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
break;
|
|
51
|
+
// 海报页面
|
|
57
52
|
|
|
58
53
|
case _constants.urlType.CUSTOMIZED:
|
|
59
|
-
|
|
60
|
-
pcLink = "/poster/" + arg1;
|
|
61
|
-
h5Link = "/poster/" + arg1;
|
|
54
|
+
link = "/poster/" + arg1;
|
|
62
55
|
params = {
|
|
63
|
-
|
|
56
|
+
action: 'jump',
|
|
64
57
|
data: {
|
|
65
|
-
|
|
58
|
+
type: 'NAVIGATE',
|
|
59
|
+
url: h5Link
|
|
66
60
|
}
|
|
67
61
|
};
|
|
68
62
|
break;
|
|
63
|
+
// 商品列表
|
|
69
64
|
|
|
70
65
|
case _constants.urlType.PROD_FILTER:
|
|
71
|
-
|
|
72
|
-
h5Link = "/product/list?" + arg1;
|
|
66
|
+
link = "/product/list?" + arg1;
|
|
73
67
|
params = {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
68
|
+
action: 'jump',
|
|
69
|
+
params: {
|
|
70
|
+
type: 'PRODUCT_LIST',
|
|
71
|
+
params: (0, _lodash.pickBy)(_qs["default"].parse(arg1), function (value) {
|
|
72
|
+
return value;
|
|
73
|
+
})
|
|
77
74
|
}
|
|
78
75
|
};
|
|
79
76
|
break;
|
|
77
|
+
// 锚点
|
|
80
78
|
|
|
81
79
|
case _constants.urlType.ANCHOR:
|
|
82
80
|
// document.getElementById(id) && document.getElementById(id).scrollIntoView({ behavior: 'smooth' });
|
|
@@ -91,31 +89,44 @@ var parseUrl = function parseUrl(url) {
|
|
|
91
89
|
case _constants.urlType.GET_COUPON:
|
|
92
90
|
// 领取优惠券
|
|
93
91
|
params = {
|
|
94
|
-
type: '
|
|
95
|
-
|
|
92
|
+
type: 'operation',
|
|
93
|
+
params: {
|
|
94
|
+
action: 'GET_COUPON',
|
|
96
95
|
couponId: arg1
|
|
97
96
|
}
|
|
98
97
|
};
|
|
99
98
|
break;
|
|
100
99
|
|
|
101
|
-
case '/spike':
|
|
102
|
-
params = {
|
|
103
|
-
type: 'FLASH_SHOP_MORE'
|
|
104
|
-
};
|
|
105
|
-
break;
|
|
106
|
-
|
|
107
100
|
default:
|
|
108
|
-
|
|
109
|
-
|
|
101
|
+
var map = {
|
|
102
|
+
'/main/cart': 'CART',
|
|
103
|
+
'/main/account': 'ACCOUNT',
|
|
104
|
+
'/my-coupon': 'MY_COUPON',
|
|
105
|
+
'/coupon-center': 'COUPON_CENTER',
|
|
106
|
+
'/main/community': 'COMMUNITY',
|
|
107
|
+
'/message-center': 'MESSAGE',
|
|
108
|
+
'/spike': 'FLASH',
|
|
109
|
+
'/check-in-gift': 'CHECK_IN',
|
|
110
|
+
'/invite': 'INVITE',
|
|
111
|
+
'/special-mission': 'SOCIAL_COMMERCE',
|
|
112
|
+
'/main/category': 'CATEGORY',
|
|
113
|
+
'/main/social-commerce': 'SOCIAL_COMMERCE',
|
|
114
|
+
'/social-commerce/my-cashback': 'CASHBACK',
|
|
115
|
+
'/account/wallet': 'WALLET',
|
|
116
|
+
'/product/GroupBuy': 'GROUP'
|
|
117
|
+
};
|
|
118
|
+
link = url;
|
|
110
119
|
params = {
|
|
111
|
-
|
|
120
|
+
action: 'jump',
|
|
121
|
+
params: {
|
|
122
|
+
type: map[url]
|
|
123
|
+
}
|
|
112
124
|
};
|
|
113
125
|
}
|
|
114
126
|
|
|
115
127
|
return {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
params: params
|
|
128
|
+
link: link,
|
|
129
|
+
data: params
|
|
119
130
|
};
|
|
120
131
|
};
|
|
121
132
|
/** 刷新预览区域 */
|
package/es/utils/coreUtil.js
CHANGED
|
@@ -182,8 +182,6 @@ var __generator = void 0 && (void 0).__generator || function (thisArg, body) {
|
|
|
182
182
|
}
|
|
183
183
|
};
|
|
184
184
|
|
|
185
|
-
var _this = void 0;
|
|
186
|
-
|
|
187
185
|
/** 根据楼层设置的终端类型,判断是否展示该楼层 */
|
|
188
186
|
var isActiveFloor = function isActiveFloor(activeTerminal) {
|
|
189
187
|
return !activeTerminal || activeTerminal === 'ALL' || activeTerminal === window.magicDesign.device.toUpperCase();
|
|
@@ -289,53 +287,32 @@ var getCoupon = function getCoupon(couponId) {
|
|
|
289
287
|
var clickUrl = function clickUrl(url) {
|
|
290
288
|
console.log('clickUrl...', url);
|
|
291
289
|
|
|
292
|
-
if (window.magicDesign.readOnly || window.magicDesign.mode !== 'renderer' || !url || window.magicDesign.outputType == 'html') {
|
|
293
|
-
return;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
290
|
var _a = (0, _businessUtil.parseUrl)(url),
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
params = _a.params;
|
|
291
|
+
link = _a.link,
|
|
292
|
+
data = _a.data;
|
|
300
293
|
|
|
301
|
-
var
|
|
302
|
-
|
|
294
|
+
var params = data.params;
|
|
295
|
+
console.log('data', data);
|
|
296
|
+
console.log('link', link);
|
|
303
297
|
|
|
304
|
-
if (
|
|
305
|
-
getCoupon(data.couponId);
|
|
298
|
+
if (window.magicDesign.readOnly || window.magicDesign.mode !== 'renderer' || !url || window.magicDesign.outputType == 'html') {
|
|
306
299
|
return;
|
|
307
300
|
}
|
|
308
301
|
|
|
309
|
-
if (
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
(0, _commonUtil.navigateTo)(newUrl);
|
|
317
|
-
} else {
|
|
318
|
-
window.location.href = newUrl;
|
|
319
|
-
}
|
|
302
|
+
if ((0, _androidUtil.browserVersion)().isApp) {
|
|
303
|
+
(0, _androidUtil.sendToApp)(params);
|
|
304
|
+
} else {
|
|
305
|
+
// 领取优惠券
|
|
306
|
+
if (params.type === 'GET_COUPON') {
|
|
307
|
+
getCoupon(params.couponId);
|
|
308
|
+
return;
|
|
320
309
|
}
|
|
321
310
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
sendToAndroid({
|
|
327
|
-
type: 'jump',
|
|
328
|
-
params: {
|
|
329
|
-
url: h5Link
|
|
330
|
-
}
|
|
331
|
-
});
|
|
332
|
-
} else if ((0, _androidUtil.browserVersion)().ios) {
|
|
333
|
-
if (type === 'CUSTOMIZED') {
|
|
334
|
-
// 适配ios 从首页跳转自定义页面
|
|
335
|
-
_this.goH5Page(h5Link);
|
|
311
|
+
if (link.startsWith('/')) {
|
|
312
|
+
(0, _commonUtil.navigateTo)(newUrl);
|
|
313
|
+
} else {
|
|
314
|
+
window.location.href = newUrl;
|
|
336
315
|
}
|
|
337
|
-
|
|
338
|
-
sendToIos(params);
|
|
339
316
|
}
|
|
340
317
|
};
|
|
341
318
|
|
|
@@ -140,8 +140,8 @@ function (_super) {
|
|
|
140
140
|
}, /*#__PURE__*/_react["default"].createElement(_components.MetaImage, {
|
|
141
141
|
data: item.image,
|
|
142
142
|
maxHeight: item.image.content.pcImgSrc ? PC_IMG_SIZE[colNum].maxH : PC_IMG_SIZE[colNum].defH,
|
|
143
|
-
maxWidth: item.image.content.pcImgSrc ? '100%' : PC_IMG_SIZE[colNum].defW
|
|
144
|
-
|
|
143
|
+
maxWidth: item.image.content.pcImgSrc ? '100%' : PC_IMG_SIZE[colNum].defW // minHeight={PC_IMG_SIZE[colNum].minH}
|
|
144
|
+
,
|
|
145
145
|
minWidth: PC_IMG_SIZE[colNum].minW
|
|
146
146
|
}));
|
|
147
147
|
}));
|
|
@@ -82,6 +82,20 @@ var getDefaultMetaButtonJson = function getDefaultMetaButtonJson() {
|
|
|
82
82
|
iconUrl: '',
|
|
83
83
|
layout: 'right'
|
|
84
84
|
},
|
|
85
|
+
spacing: {
|
|
86
|
+
pc: {
|
|
87
|
+
paddingTop: 14,
|
|
88
|
+
paddingBottom: 14,
|
|
89
|
+
paddingLeft: 24,
|
|
90
|
+
paddingRight: 24
|
|
91
|
+
},
|
|
92
|
+
mobile: {
|
|
93
|
+
paddingTop: 12,
|
|
94
|
+
paddingBottom: 12,
|
|
95
|
+
paddingLeft: 20,
|
|
96
|
+
paddingRight: 20
|
|
97
|
+
}
|
|
98
|
+
},
|
|
85
99
|
text: 'Subscribe',
|
|
86
100
|
hover: null
|
|
87
101
|
};
|
|
@@ -89,6 +89,7 @@ function (_super) {
|
|
|
89
89
|
|
|
90
90
|
var data = this.props.data;
|
|
91
91
|
var textData = data.content;
|
|
92
|
+
console.log('data', data);
|
|
92
93
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
93
94
|
className: "m-text-config",
|
|
94
95
|
style: {
|
|
@@ -97,8 +98,10 @@ function (_super) {
|
|
|
97
98
|
}, /*#__PURE__*/_react["default"].createElement(_common.Field, {
|
|
98
99
|
title: (0, _locale.i18n)('PLACEHOLDER')
|
|
99
100
|
}, /*#__PURE__*/_react["default"].createElement(_antd.Input, {
|
|
100
|
-
onChange: function onChange(
|
|
101
|
-
data.placeholder =
|
|
101
|
+
onChange: function onChange(e) {
|
|
102
|
+
data.placeholder = e.target.value;
|
|
103
|
+
|
|
104
|
+
_this.selfRender();
|
|
102
105
|
},
|
|
103
106
|
value: data.placeholder
|
|
104
107
|
})), /*#__PURE__*/_react["default"].createElement(_common.Field, {
|
package/lib/constants/index.js
CHANGED
|
@@ -260,6 +260,10 @@ function (_super) {
|
|
|
260
260
|
groupName = (panelProps === null || panelProps === void 0 ? void 0 : panelProps.title.text) || (0, _locale.i18n)('NAVIGATION_NAME');
|
|
261
261
|
break;
|
|
262
262
|
|
|
263
|
+
case 'IMAGE_TEXT':
|
|
264
|
+
groupName = panelProps.title.text;
|
|
265
|
+
break;
|
|
266
|
+
|
|
263
267
|
case 'TEXT':
|
|
264
268
|
groupName = panelProps.content.title.text;
|
|
265
269
|
break;
|
|
@@ -268,6 +272,10 @@ function (_super) {
|
|
|
268
272
|
groupName = panelProps.groupName.text;
|
|
269
273
|
break;
|
|
270
274
|
|
|
275
|
+
case 'BUTTON':
|
|
276
|
+
groupName = panelProps.button.text;
|
|
277
|
+
break;
|
|
278
|
+
|
|
271
279
|
case 'VIDEO':
|
|
272
280
|
groupName = 'Video' + (panelIndex + 1);
|
|
273
281
|
break;
|
|
@@ -112,10 +112,16 @@ function compositeDecorator(WrappedComponent) {
|
|
|
112
112
|
var _b = window.magicDesign,
|
|
113
113
|
device = _b.device,
|
|
114
114
|
compWidth = _b.compWidth;
|
|
115
|
+
var zIndex = '0';
|
|
116
|
+
|
|
117
|
+
if (nodeData.type === 'CAROUSEL' || nodeData.type === 'IMAGE_GALLERY') {
|
|
118
|
+
zIndex = '1';
|
|
119
|
+
}
|
|
120
|
+
|
|
115
121
|
var wrapStyle = {
|
|
116
122
|
border: 'none',
|
|
117
123
|
position: 'relative',
|
|
118
|
-
zIndex:
|
|
124
|
+
zIndex: zIndex,
|
|
119
125
|
margin: '0 auto'
|
|
120
126
|
}; // 复合组件内边距
|
|
121
127
|
|
package/lib/utils/androidUtil.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.sendToJs = exports.sendToIos = exports.sendToAndroid = exports.iosSendToJs = exports.connectWebViewJavascriptBridge = exports.browserVersion = void 0;
|
|
6
|
+
exports.sendToJs = exports.sendToIos = exports.sendToApp = exports.sendToAndroid = exports.iosSendToJs = exports.connectWebViewJavascriptBridge = exports.browserVersion = void 0;
|
|
7
7
|
|
|
8
8
|
// 判断访问终端
|
|
9
9
|
var browserVersion = function browserVersion() {
|
|
@@ -110,4 +110,10 @@ var sendToIos = function sendToIos(params) {
|
|
|
110
110
|
if (window.webkit) window.webkit.messageHandlers.jsFunc.postMessage(params);
|
|
111
111
|
};
|
|
112
112
|
|
|
113
|
-
exports.sendToIos = sendToIos;
|
|
113
|
+
exports.sendToIos = sendToIos;
|
|
114
|
+
|
|
115
|
+
var sendToApp = function sendToApp(params) {
|
|
116
|
+
window.flutter_inject_js_bridge.postMessage(JSON.stringify(params));
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
exports.sendToApp = sendToApp;
|
|
@@ -5,11 +5,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.renderPreview = exports.parseUrl = exports.listToTree = exports.getPromotionList = exports.computeStyle = exports.canNumber = void 0;
|
|
7
7
|
|
|
8
|
+
var _qs = _interopRequireDefault(require("qs"));
|
|
9
|
+
|
|
10
|
+
var _lodash = require("lodash");
|
|
11
|
+
|
|
8
12
|
var _constants = require("../constants");
|
|
9
13
|
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
|
+
|
|
16
|
+
/* eslint-disable import/no-cycle */
|
|
10
17
|
var parseUrl = function parseUrl(url) {
|
|
11
|
-
var
|
|
12
|
-
var pcLink = url;
|
|
18
|
+
var link = url;
|
|
13
19
|
var params;
|
|
14
20
|
|
|
15
21
|
var _a = url.split('-'),
|
|
@@ -20,11 +26,11 @@ var parseUrl = function parseUrl(url) {
|
|
|
20
26
|
switch (type) {
|
|
21
27
|
// 商品详情
|
|
22
28
|
case _constants.urlType.PRODUCT_DETAIL:
|
|
23
|
-
|
|
24
|
-
h5Link = "/product/detail/" + arg1 + "?productId=" + (arg2 !== null && arg2 !== void 0 ? arg2 : '');
|
|
29
|
+
link = "/product/detail/" + arg1 + "?productId=" + (arg2 !== null && arg2 !== void 0 ? arg2 : '');
|
|
25
30
|
params = {
|
|
26
|
-
|
|
27
|
-
|
|
31
|
+
action: 'jump',
|
|
32
|
+
params: {
|
|
33
|
+
type: 'PRODUCT_DETAIL',
|
|
28
34
|
offerId: arg1,
|
|
29
35
|
productId: arg2
|
|
30
36
|
}
|
|
@@ -33,50 +39,42 @@ var parseUrl = function parseUrl(url) {
|
|
|
33
39
|
|
|
34
40
|
case _constants.urlType.CATG_PROD_LIST:
|
|
35
41
|
// 商品列表
|
|
36
|
-
|
|
37
|
-
h5Link = "/product/list/" + arg1;
|
|
42
|
+
link = "/product/list/" + arg1;
|
|
38
43
|
params = {
|
|
39
|
-
|
|
40
|
-
|
|
44
|
+
action: 'jump',
|
|
45
|
+
params: {
|
|
46
|
+
type: 'PRODUCT_LIST',
|
|
41
47
|
catgId: arg1
|
|
42
48
|
}
|
|
43
49
|
};
|
|
44
50
|
break;
|
|
45
|
-
|
|
46
|
-
case _constants.urlType.GIVEAWAY_MISSION:
|
|
47
|
-
// 零元购
|
|
48
|
-
pcLink = '';
|
|
49
|
-
h5Link = "/special-mission?campaignId=" + arg1;
|
|
50
|
-
params = {
|
|
51
|
-
type: 'GIVEAWAY_MISSION',
|
|
52
|
-
data: {
|
|
53
|
-
campaignId: arg1
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
break;
|
|
51
|
+
// 海报页面
|
|
57
52
|
|
|
58
53
|
case _constants.urlType.CUSTOMIZED:
|
|
59
|
-
|
|
60
|
-
pcLink = "/poster/" + arg1;
|
|
61
|
-
h5Link = "/poster/" + arg1;
|
|
54
|
+
link = "/poster/" + arg1;
|
|
62
55
|
params = {
|
|
63
|
-
|
|
56
|
+
action: 'jump',
|
|
64
57
|
data: {
|
|
65
|
-
|
|
58
|
+
type: 'NAVIGATE',
|
|
59
|
+
url: h5Link
|
|
66
60
|
}
|
|
67
61
|
};
|
|
68
62
|
break;
|
|
63
|
+
// 商品列表
|
|
69
64
|
|
|
70
65
|
case _constants.urlType.PROD_FILTER:
|
|
71
|
-
|
|
72
|
-
h5Link = "/product/list?" + arg1;
|
|
66
|
+
link = "/product/list?" + arg1;
|
|
73
67
|
params = {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
68
|
+
action: 'jump',
|
|
69
|
+
params: {
|
|
70
|
+
type: 'PRODUCT_LIST',
|
|
71
|
+
params: (0, _lodash.pickBy)(_qs["default"].parse(arg1), function (value) {
|
|
72
|
+
return value;
|
|
73
|
+
})
|
|
77
74
|
}
|
|
78
75
|
};
|
|
79
76
|
break;
|
|
77
|
+
// 锚点
|
|
80
78
|
|
|
81
79
|
case _constants.urlType.ANCHOR:
|
|
82
80
|
// document.getElementById(id) && document.getElementById(id).scrollIntoView({ behavior: 'smooth' });
|
|
@@ -91,31 +89,44 @@ var parseUrl = function parseUrl(url) {
|
|
|
91
89
|
case _constants.urlType.GET_COUPON:
|
|
92
90
|
// 领取优惠券
|
|
93
91
|
params = {
|
|
94
|
-
type: '
|
|
95
|
-
|
|
92
|
+
type: 'operation',
|
|
93
|
+
params: {
|
|
94
|
+
action: 'GET_COUPON',
|
|
96
95
|
couponId: arg1
|
|
97
96
|
}
|
|
98
97
|
};
|
|
99
98
|
break;
|
|
100
99
|
|
|
101
|
-
case '/spike':
|
|
102
|
-
params = {
|
|
103
|
-
type: 'FLASH_SHOP_MORE'
|
|
104
|
-
};
|
|
105
|
-
break;
|
|
106
|
-
|
|
107
100
|
default:
|
|
108
|
-
|
|
109
|
-
|
|
101
|
+
var map = {
|
|
102
|
+
'/main/cart': 'CART',
|
|
103
|
+
'/main/account': 'ACCOUNT',
|
|
104
|
+
'/my-coupon': 'MY_COUPON',
|
|
105
|
+
'/coupon-center': 'COUPON_CENTER',
|
|
106
|
+
'/main/community': 'COMMUNITY',
|
|
107
|
+
'/message-center': 'MESSAGE',
|
|
108
|
+
'/spike': 'FLASH',
|
|
109
|
+
'/check-in-gift': 'CHECK_IN',
|
|
110
|
+
'/invite': 'INVITE',
|
|
111
|
+
'/special-mission': 'SOCIAL_COMMERCE',
|
|
112
|
+
'/main/category': 'CATEGORY',
|
|
113
|
+
'/main/social-commerce': 'SOCIAL_COMMERCE',
|
|
114
|
+
'/social-commerce/my-cashback': 'CASHBACK',
|
|
115
|
+
'/account/wallet': 'WALLET',
|
|
116
|
+
'/product/GroupBuy': 'GROUP'
|
|
117
|
+
};
|
|
118
|
+
link = url;
|
|
110
119
|
params = {
|
|
111
|
-
|
|
120
|
+
action: 'jump',
|
|
121
|
+
params: {
|
|
122
|
+
type: map[url]
|
|
123
|
+
}
|
|
112
124
|
};
|
|
113
125
|
}
|
|
114
126
|
|
|
115
127
|
return {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
params: params
|
|
128
|
+
link: link,
|
|
129
|
+
data: params
|
|
119
130
|
};
|
|
120
131
|
};
|
|
121
132
|
/** 刷新预览区域 */
|
package/lib/utils/coreUtil.js
CHANGED
|
@@ -182,8 +182,6 @@ var __generator = void 0 && (void 0).__generator || function (thisArg, body) {
|
|
|
182
182
|
}
|
|
183
183
|
};
|
|
184
184
|
|
|
185
|
-
var _this = void 0;
|
|
186
|
-
|
|
187
185
|
/** 根据楼层设置的终端类型,判断是否展示该楼层 */
|
|
188
186
|
var isActiveFloor = function isActiveFloor(activeTerminal) {
|
|
189
187
|
return !activeTerminal || activeTerminal === 'ALL' || activeTerminal === window.magicDesign.device.toUpperCase();
|
|
@@ -289,53 +287,32 @@ var getCoupon = function getCoupon(couponId) {
|
|
|
289
287
|
var clickUrl = function clickUrl(url) {
|
|
290
288
|
console.log('clickUrl...', url);
|
|
291
289
|
|
|
292
|
-
if (window.magicDesign.readOnly || window.magicDesign.mode !== 'renderer' || !url || window.magicDesign.outputType == 'html') {
|
|
293
|
-
return;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
290
|
var _a = (0, _businessUtil.parseUrl)(url),
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
params = _a.params;
|
|
291
|
+
link = _a.link,
|
|
292
|
+
data = _a.data;
|
|
300
293
|
|
|
301
|
-
var
|
|
302
|
-
|
|
294
|
+
var params = data.params;
|
|
295
|
+
console.log('data', data);
|
|
296
|
+
console.log('link', link);
|
|
303
297
|
|
|
304
|
-
if (
|
|
305
|
-
getCoupon(data.couponId);
|
|
298
|
+
if (window.magicDesign.readOnly || window.magicDesign.mode !== 'renderer' || !url || window.magicDesign.outputType == 'html') {
|
|
306
299
|
return;
|
|
307
300
|
}
|
|
308
301
|
|
|
309
|
-
if (
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
(0, _commonUtil.navigateTo)(newUrl);
|
|
317
|
-
} else {
|
|
318
|
-
window.location.href = newUrl;
|
|
319
|
-
}
|
|
302
|
+
if ((0, _androidUtil.browserVersion)().isApp) {
|
|
303
|
+
(0, _androidUtil.sendToApp)(params);
|
|
304
|
+
} else {
|
|
305
|
+
// 领取优惠券
|
|
306
|
+
if (params.type === 'GET_COUPON') {
|
|
307
|
+
getCoupon(params.couponId);
|
|
308
|
+
return;
|
|
320
309
|
}
|
|
321
310
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
sendToAndroid({
|
|
327
|
-
type: 'jump',
|
|
328
|
-
params: {
|
|
329
|
-
url: h5Link
|
|
330
|
-
}
|
|
331
|
-
});
|
|
332
|
-
} else if ((0, _androidUtil.browserVersion)().ios) {
|
|
333
|
-
if (type === 'CUSTOMIZED') {
|
|
334
|
-
// 适配ios 从首页跳转自定义页面
|
|
335
|
-
_this.goH5Page(h5Link);
|
|
311
|
+
if (link.startsWith('/')) {
|
|
312
|
+
(0, _commonUtil.navigateTo)(newUrl);
|
|
313
|
+
} else {
|
|
314
|
+
window.location.href = newUrl;
|
|
336
315
|
}
|
|
337
|
-
|
|
338
|
-
sendToIos(params);
|
|
339
316
|
}
|
|
340
317
|
};
|
|
341
318
|
|