@fonixtree/magic-design 0.1.7 → 0.1.8

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.
Files changed (59) hide show
  1. package/es/assets/images/layout-icon/carouselLayout3.png +0 -0
  2. package/es/common/LinkModal/BundleCampaign/index.js +22 -5
  3. package/es/common/LinkModal/BundleCampaign/index.less +6 -4
  4. package/es/common/LinkModal/CatgTable/index.js +11 -4
  5. package/es/common/LinkModal/CouponTable/index.js +7 -2
  6. package/es/common/LinkModal/CustomTable/index.js +11 -4
  7. package/es/common/LinkModal/FilteredProductModal/index.js +5 -1
  8. package/es/common/LinkModal/FilteredProductModal/index.less +1 -0
  9. package/es/common/LinkModal/FunctionTable/index.js +10 -3
  10. package/es/common/LinkModal/ProductDetailPage/index.js +6 -3
  11. package/es/common/LinkModal/ProductDetailPage/index.less +1 -3
  12. package/es/common/LinkModal/SelectVideoModal/index.js +10 -3
  13. package/es/common/LinkModal/SelectVideoModal/index.less +3 -3
  14. package/es/common/LinkModal/ShareUrl/index.js +33 -0
  15. package/es/common/LinkModal/ShareUrl/index.less +3 -0
  16. package/es/common/LinkModal/index.js +79 -79
  17. package/es/common/LinkModal/index.less +31 -30
  18. package/es/common/UrlPicker/index.js +14 -4
  19. package/es/common/UrlPicker/index.less +3 -0
  20. package/es/common/VideoUpload/index.js +1 -1
  21. package/es/common/VideoUpload/index.less +1 -0
  22. package/es/composite-comp/bol/components/Carousel/mobile/index.js +17 -6
  23. package/es/composite-comp/bol/components/Carousel/mobile/index.less +2 -2
  24. package/es/composite-comp/bol/components/Carousel/pc/index.js +20 -9
  25. package/es/constants/index.js +13 -1
  26. package/es/constants/layout.js +6 -0
  27. package/es/utils/businessUtil.js +133 -1
  28. package/es/utils/commonUtil.js +3 -1
  29. package/es/utils/coreUtil.js +10 -1
  30. package/lib/assets/images/layout-icon/carouselLayout3.png +0 -0
  31. package/lib/common/LinkModal/BundleCampaign/index.js +22 -5
  32. package/lib/common/LinkModal/BundleCampaign/index.less +6 -4
  33. package/lib/common/LinkModal/CatgTable/index.js +11 -4
  34. package/lib/common/LinkModal/CouponTable/index.js +7 -2
  35. package/lib/common/LinkModal/CustomTable/index.js +11 -4
  36. package/lib/common/LinkModal/FilteredProductModal/index.js +5 -1
  37. package/lib/common/LinkModal/FilteredProductModal/index.less +1 -0
  38. package/lib/common/LinkModal/FunctionTable/index.js +10 -3
  39. package/lib/common/LinkModal/ProductDetailPage/index.js +6 -3
  40. package/lib/common/LinkModal/ProductDetailPage/index.less +1 -3
  41. package/lib/common/LinkModal/SelectVideoModal/index.js +10 -3
  42. package/lib/common/LinkModal/SelectVideoModal/index.less +3 -3
  43. package/lib/common/LinkModal/ShareUrl/index.js +33 -0
  44. package/lib/common/LinkModal/ShareUrl/index.less +3 -0
  45. package/lib/common/LinkModal/index.js +79 -79
  46. package/lib/common/LinkModal/index.less +31 -30
  47. package/lib/common/UrlPicker/index.js +14 -4
  48. package/lib/common/UrlPicker/index.less +3 -0
  49. package/lib/common/VideoUpload/index.js +1 -1
  50. package/lib/common/VideoUpload/index.less +1 -0
  51. package/lib/composite-comp/bol/components/Carousel/mobile/index.js +17 -6
  52. package/lib/composite-comp/bol/components/Carousel/mobile/index.less +2 -2
  53. package/lib/composite-comp/bol/components/Carousel/pc/index.js +20 -9
  54. package/lib/constants/index.js +13 -1
  55. package/lib/constants/layout.js +6 -0
  56. package/lib/utils/businessUtil.js +133 -1
  57. package/lib/utils/commonUtil.js +3 -1
  58. package/lib/utils/coreUtil.js +10 -1
  59. package/package.json +1 -1
@@ -195,8 +195,18 @@ function (_super) {
195
195
 
196
196
  var data = this.props.data;
197
197
  var sliderIndex = this.state.sliderIndex;
198
- var showText = data.customize.layout === 'layout2';
199
- var colNum = showText ? 1 : Math.min(data.customize.pcRowNum, data.groupSource.length);
198
+ var _a = data.customize,
199
+ layout = _a.layout,
200
+ pcRowNum = _a.pcRowNum;
201
+ var colNum = 1;
202
+
203
+ if (layout === 'layout1') {
204
+ colNum = Math.min(pcRowNum, data.groupSource.length);
205
+ } else if (layout === 'layout3') {
206
+ colNum = Math.min(pcRowNum + 0.2, data.groupSource.length);
207
+ }
208
+
209
+ var floorColNum = Math.floor(colNum);
200
210
  var GAData = {
201
211
  moduleId: data.id,
202
212
  moduleName: data.moduleIndex + '.' + data.type
@@ -222,7 +232,8 @@ function (_super) {
222
232
  _this.setState({
223
233
  sliderIndex: newIndex
224
234
  });
225
- }
235
+ },
236
+ variableWidth: true
226
237
  };
227
238
  var navStyle = {
228
239
  fontSize: data.setting.navigation.size,
@@ -235,7 +246,7 @@ function (_super) {
235
246
  }, /*#__PURE__*/_react["default"].createElement("div", {
236
247
  className: "content",
237
248
  style: {
238
- paddingBottom: data.setting.dots.open && data.groupSource.length / colNum > 1 ? dotsSpace : '0'
249
+ paddingBottom: data.setting.dots.open && data.groupSource.length / floorColNum > 1 ? dotsSpace : '0'
239
250
  }
240
251
  }, data.setting.navigation.open && /*#__PURE__*/_react["default"].createElement(_Iconfont["default"], {
241
252
  className: "carousel-icon-left",
@@ -267,10 +278,10 @@ function (_super) {
267
278
  groupId: item.id,
268
279
  groupName: (0, _ConfigPanel.getSecondConfigName)(data, item.id)
269
280
  }),
270
- maxHeight: item.image.content.pcImgSrc ? 'unset' : PC_IMG_SIZE[colNum].defH,
271
- minHeight: PC_IMG_SIZE[colNum].minH,
272
- minWidth: PC_IMG_SIZE[colNum].minW
273
- })), showText && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, item.title.open && !((0, _coreUtil.isPc)() && item.title.pcText === '') && /*#__PURE__*/_react["default"].createElement("div", {
281
+ maxHeight: item.image.content.pcImgSrc ? 'unset' : PC_IMG_SIZE[floorColNum].defH,
282
+ minHeight: PC_IMG_SIZE[floorColNum].minH,
283
+ minWidth: PC_IMG_SIZE[floorColNum].minW
284
+ })), layout === 'layout2' && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, item.title.open && !((0, _coreUtil.isPc)() && item.title.pcText === '') && /*#__PURE__*/_react["default"].createElement("div", {
274
285
  className: "title"
275
286
  }, /*#__PURE__*/_react["default"].createElement(_components.MetaText, {
276
287
  data: item.title,
@@ -308,7 +319,7 @@ function (_super) {
308
319
  groupName: (0, _ConfigPanel.getSecondConfigName)(data, item.id)
309
320
  })
310
321
  }))));
311
- }))), data.setting.dots.open && Math.ceil(data.groupSource.length / colNum) > 1 && /*#__PURE__*/_react["default"].createElement("div", {
322
+ }))), data.setting.dots.open && Math.ceil(data.groupSource.length / floorColNum) > 1 && /*#__PURE__*/_react["default"].createElement("div", {
312
323
  className: "swiper-ban"
313
324
  }, data.groupSource.length > 1 && data.groupSource.map(function (item, i) {
314
325
  return /*#__PURE__*/_react["default"].createElement("div", {
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.urlType = exports.respCodeMap = exports.quickMenuCode = exports.metaType = exports.metaInst = exports.metaInsType = exports.magicMode = exports.eventType = exports.deviceTypeWidthMap = exports.deviceTypeMap = exports.compInfoMap = exports.STORAGE_KEY = exports.CREDIT_STATE = void 0;
6
+ exports.urlTypeMap = exports.urlType = exports.respCodeMap = exports.quickMenuCode = exports.metaType = exports.metaInst = exports.metaInsType = exports.magicMode = exports.eventType = exports.deviceTypeWidthMap = exports.deviceTypeMap = exports.compInfoMap = exports.STORAGE_KEY = exports.CREDIT_STATE = void 0;
7
7
  var STORAGE_KEY = {
8
8
  LOCALE: 'magicLocale',
9
9
  MAGIC_RENDER_HTML: 'MAGIC_RENDER_HTML',
@@ -45,6 +45,18 @@ var urlType = {
45
45
  VIDEO: 'video'
46
46
  };
47
47
  exports.urlType = urlType;
48
+ var urlTypeMap = {
49
+ CATEGORY: 'Category',
50
+ CUSTOMIZED_PAGE: 'CustomizedPage',
51
+ PRODUCT_DETAIL_PAGE: 'ProductDetailPage',
52
+ FILTERED_PRODUCT: 'FilteredProduct',
53
+ FUNCTION_PAGE: 'FunctionPage',
54
+ COUPONS: 'Coupons',
55
+ BUNDLE_CAMPAIGN: 'BundleCampaign',
56
+ VIDEO: 'Video',
57
+ SHARE_URL: 'ShareURL'
58
+ };
59
+ exports.urlTypeMap = urlTypeMap;
48
60
  var respCodeMap = {
49
61
  NOT_LOGGED_IN: 'BUYER-WEB-06003'
50
62
  };
@@ -29,6 +29,8 @@ var _carouselLayout = _interopRequireDefault(require("../assets/images/layout-ic
29
29
 
30
30
  var _carouselLayout2 = _interopRequireDefault(require("../assets/images/layout-icon/carouselLayout2.png"));
31
31
 
32
+ var _carouselLayout3 = _interopRequireDefault(require("../assets/images/layout-icon/carouselLayout3.png"));
33
+
32
34
  var _layoutImagetextP = _interopRequireDefault(require("../assets/images/layout-icon/layout-imagetext-p1.png"));
33
35
 
34
36
  var _layoutImagetextP2 = _interopRequireDefault(require("../assets/images/layout-icon/layout-imagetext-p2.png"));
@@ -108,6 +110,10 @@ var carouselLayout = [{
108
110
  id: 'layout2',
109
111
  name: 'layout2',
110
112
  image: _carouselLayout2["default"]
113
+ }, {
114
+ id: 'layout3',
115
+ name: 'layout3',
116
+ image: _carouselLayout3["default"]
111
117
  }];
112
118
  exports.carouselLayout = carouselLayout;
113
119
  var imageTextLayoutPc = [{
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.renderPreview = exports.parseUrl = exports.listToTree = exports.getPromotionList = exports.computeStyle = exports.canNumber = void 0;
6
+ exports.renderPreview = exports.parseUrl = exports.newParseUrl = exports.listToTree = exports.getPromotionList = exports.computeStyle = exports.canNumber = void 0;
7
7
 
8
8
  var _qs = _interopRequireDefault(require("qs"));
9
9
 
@@ -16,6 +16,138 @@ var _constants = require("../constants");
16
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
17
17
 
18
18
  /* eslint-disable import/no-cycle */
19
+ var newParseUrl = function newParseUrl(urlObj) {
20
+ var link = urlObj.value;
21
+ var params;
22
+ var type = urlObj.type,
23
+ value = urlObj.value,
24
+ offerId = urlObj.offerId,
25
+ productId = urlObj.productId;
26
+
27
+ switch (type) {
28
+ // 商品详情
29
+ case _constants.urlTypeMap.PRODUCT_DETAIL_PAGE:
30
+ link = "/product/detail/" + offerId + "?productId=" + (productId !== null && productId !== void 0 ? productId : '');
31
+ params = {
32
+ action: 'jump',
33
+ params: {
34
+ type: 'PRODUCT_DETAIL',
35
+ offerId: offerId,
36
+ productId: productId
37
+ }
38
+ };
39
+ break;
40
+
41
+ case _constants.urlTypeMap.CATEGORY:
42
+ // 商品列表
43
+ link = "/product/list/" + value;
44
+ params = {
45
+ action: 'jump',
46
+ params: {
47
+ type: 'PRODUCT_LIST',
48
+ catgId: arg1
49
+ }
50
+ };
51
+ break;
52
+ // 海报页面
53
+
54
+ case _constants.urlTypeMap.CUSTOMIZED_PAGE:
55
+ link = "/poster/" + value;
56
+ params = {
57
+ action: 'jump',
58
+ data: {
59
+ type: 'NAVIGATE',
60
+ url: link
61
+ }
62
+ };
63
+ break;
64
+ // 商品列表
65
+
66
+ case _constants.urlTypeMap.FILTERED_PRODUCT:
67
+ link = "/product/list?" + value;
68
+ params = {
69
+ action: 'jump',
70
+ params: {
71
+ type: 'PRODUCT_LIST',
72
+ params: (0, _lodash.pickBy)(_qs["default"].parse(value), function (value) {
73
+ return value;
74
+ })
75
+ }
76
+ };
77
+ break;
78
+
79
+ case _constants.urlTypeMap.COUPONS:
80
+ // 领取优惠券
81
+ params = {
82
+ action: 'operation',
83
+ params: {
84
+ type: 'GET_COUPON',
85
+ couponId: value
86
+ }
87
+ };
88
+ break;
89
+
90
+ case _constants.urlTypeMap.VIDEO:
91
+ // 播放视频
92
+ params = {
93
+ action: 'operation',
94
+ params: {
95
+ type: 'VIDEO',
96
+ data: (0, _commonUtil.ensure)(function () {
97
+ return JSON.parse(value);
98
+ }, {})
99
+ }
100
+ };
101
+ break;
102
+
103
+ case _constants.urlTypeMap.SHARE_URL:
104
+ // 播放视频
105
+ params = {
106
+ action: 'operation',
107
+ params: {
108
+ type: 'SHARE_URL',
109
+ url: value
110
+ }
111
+ };
112
+ break;
113
+
114
+ default:
115
+ var map = {
116
+ '/main/cart': 'CART',
117
+ '/main/account': 'ACCOUNT',
118
+ '/my-coupon': 'MY_COUPON',
119
+ '/coupon-center': 'COUPON_CENTER',
120
+ '/main/community': 'COMMUNITY',
121
+ '/message-center': 'MESSAGE',
122
+ '/spike': 'FLASH',
123
+ '/check-in-gift': 'CHECK_IN',
124
+ '/invite': 'INVITE',
125
+ '/special-mission': 'SOCIAL_COMMERCE',
126
+ '/main/category': 'CATEGORY',
127
+ '/main/social-commerce': 'SOCIAL_COMMERCE',
128
+ '/social-commerce/my-cashback': 'CASHBACK',
129
+ '/account/wallet': 'WALLET',
130
+ '/product/GroupBuy': 'GROUP',
131
+ '/search-page': 'SEARCH_PAGE'
132
+ };
133
+ link = url;
134
+ params = {
135
+ action: 'jump',
136
+ params: {
137
+ type: map[url],
138
+ link: link
139
+ }
140
+ };
141
+ }
142
+
143
+ return {
144
+ link: link,
145
+ data: params
146
+ };
147
+ };
148
+
149
+ exports.newParseUrl = newParseUrl;
150
+
19
151
  var parseUrl = function parseUrl(url) {
20
152
  var link = url;
21
153
  var params;
@@ -208,8 +208,10 @@ function commonFetch(url, data, method) {
208
208
  var _a, _b;
209
209
 
210
210
  var isLoginUrl = url.includes('portal/login');
211
+ var credentials = localStorage.getItem('credentials');
211
212
  var headers = {
212
- 'Content-Type': isLoginUrl ? 'application/x-www-form-urlencoded' : 'application/json; charset=UTF-8'
213
+ 'Content-Type': isLoginUrl ? 'application/x-www-form-urlencoded' : 'application/json; charset=UTF-8',
214
+ credentials: credentials
213
215
  };
214
216
 
215
217
  if (_method === 'GET') {
@@ -298,7 +298,7 @@ var clickUrl = function clickUrl(url) {
298
298
  return;
299
299
  }
300
300
 
301
- var _a = (0, _businessUtil.parseUrl)(url),
301
+ var _a = _typeof(url) === 'object' ? (0, _businessUtil.newParseUrl)(url) : (0, _businessUtil.parseUrl)(url),
302
302
  link = _a.link,
303
303
  data = _a.data;
304
304
 
@@ -323,6 +323,15 @@ var clickUrl = function clickUrl(url) {
323
323
 
324
324
  if (params.type === 'GET_COUPON') {
325
325
  getCoupon(params.couponId);
326
+ return;
327
+ } // 分享
328
+
329
+
330
+ if (params.type === 'SHARE_URL') {
331
+ if (window.magicDesign.handleAction) {
332
+ window.magicDesign.handleAction(params);
333
+ }
334
+
326
335
  return;
327
336
  }
328
337
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fonixtree/magic-design",
3
3
  "author": "Cylon Team",
4
- "version": "0.1.7",
4
+ "version": "0.1.8",
5
5
  "description": "Magic Design",
6
6
  "license": "MIT",
7
7
  "module": "es/index.js",