@fonixtree/magic-design 1.0.166 → 1.0.168

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 (173) hide show
  1. package/es/assets/fonts/AvenirNext-Bold.ttf +0 -0
  2. package/es/assets/fonts/AvenirNext-DemiBold.ttf +0 -0
  3. package/es/assets/fonts/AvenirNext-Medium.ttf +0 -0
  4. package/es/assets/fonts/AvenirNext-Regular.ttf +0 -0
  5. package/es/assets/fonts/magic-box-iconfont.css +11 -3
  6. package/es/assets/fonts/magic-box-iconfont.js +1 -1
  7. package/es/assets/fonts/magic-box-iconfont.ttf +0 -0
  8. package/es/assets/fonts/magic-box-iconfont.woff +0 -0
  9. package/es/assets/fonts/magic-box-iconfont.woff2 +0 -0
  10. package/es/assets/images/layout-icon/campaignLayout1.png +0 -0
  11. package/es/assets/images/layout-icon/imageGalleryLayout3.png +0 -0
  12. package/es/assets/images/layout-icon/imageGalleryLayout4.png +0 -0
  13. package/es/assets/less/font.less +29 -0
  14. package/es/common/Collapse/index.js +3 -1
  15. package/es/common/CountDown/index.js +29 -2
  16. package/es/common/CountDown/index.less +38 -5
  17. package/es/common/Field/index.js +2 -1
  18. package/es/common/Field/index.less +4 -0
  19. package/es/common/Iconfont/index.js +4 -2
  20. package/es/composite-comp/bol/components/ImageGallery/mobile/index.js +18 -1
  21. package/es/composite-comp/bol/components/ImageGallery/mobile/index.less +9 -0
  22. package/es/composite-comp/bol/config-panels/NewsletterConfig/InputField/index.js +14 -10
  23. package/es/composite-comp/common/config-panels/BackgroundConfig/index.js +15 -73
  24. package/es/composite-comp/dito/components/Campaign/defaultJSON.js +112 -0
  25. package/es/composite-comp/dito/components/Campaign/index.js +88 -0
  26. package/es/composite-comp/dito/components/Campaign/mobile/components/Bargain/index.js +320 -0
  27. package/es/composite-comp/dito/components/Campaign/mobile/components/Bargain/index.less +20 -0
  28. package/es/composite-comp/dito/components/Campaign/mobile/components/CountDown/index.js +180 -0
  29. package/es/composite-comp/dito/components/Campaign/mobile/components/CountDown/index.less +26 -0
  30. package/es/composite-comp/dito/components/Campaign/mobile/components/FlashSale/index.js +434 -0
  31. package/es/composite-comp/dito/components/Campaign/mobile/components/FlashSale/index.less +20 -0
  32. package/es/composite-comp/dito/components/Campaign/mobile/components/GroupBuy/index.js +317 -0
  33. package/es/composite-comp/dito/components/Campaign/mobile/components/GroupBuy/index.less +20 -0
  34. package/es/composite-comp/dito/components/Campaign/mobile/components/ProductItem/index.js +115 -0
  35. package/es/composite-comp/dito/components/Campaign/mobile/components/ProductItem/index.less +14 -0
  36. package/es/composite-comp/dito/components/Campaign/mobile/imgs/defImg.png +0 -0
  37. package/es/composite-comp/dito/components/Campaign/mobile/index.js +125 -0
  38. package/es/composite-comp/dito/components/Campaign/mobile/index.less +57 -0
  39. package/es/composite-comp/dito/components/FlashDeal/defaultJSON.js +25 -11
  40. package/es/composite-comp/dito/components/FlashDeal/mobile/index.js +15 -14
  41. package/es/composite-comp/dito/components/FlashDeal/pc/ProductItem/index.js +197 -0
  42. package/es/composite-comp/dito/components/FlashDeal/pc/ProductItem/index.less +100 -0
  43. package/es/composite-comp/dito/components/FlashDeal/pc/index.js +18 -22
  44. package/es/composite-comp/dito/components/FlashDeal/pc/index.less +19 -30
  45. package/es/composite-comp/dito/components/GroupedCarousel/defaultJSON.js +0 -7
  46. package/es/composite-comp/dito/components/News/defaultJSON.js +0 -4
  47. package/es/composite-comp/dito/components/SearchDITO/defaultJSON.js +7 -2
  48. package/es/composite-comp/dito/components/SearchDITO/pc/components/ConfirmModal/index.less +69 -0
  49. package/es/composite-comp/dito/components/SearchDITO/pc/components/Header/index.js +602 -0
  50. package/es/composite-comp/dito/components/SearchDITO/pc/components/Header/index.less +184 -0
  51. package/es/composite-comp/dito/components/SearchDITO/pc/index.js +12 -579
  52. package/es/composite-comp/dito/components/SearchDITO/pc/index.less +1 -185
  53. package/es/composite-comp/dito/components/SlideImage/defaultJSON.js +29 -9
  54. package/es/composite-comp/dito/components/SlideImage/pc/components/CardItem/index.js +3 -1
  55. package/es/composite-comp/dito/components/SlideImage/pc/components/ParallaxScroll/index.js +5 -1
  56. package/es/composite-comp/dito/components/SlideImage/pc/components/VideoItem/index.js +20 -13
  57. package/es/composite-comp/dito/components/SlideImage/pc/components/VideoItem/index.less +4 -11
  58. package/es/composite-comp/dito/components/SlideImage/pc/index.js +2 -0
  59. package/es/composite-comp/dito/config-panels/CampaignConfig/ConfigContent/index.js +143 -0
  60. package/es/composite-comp/dito/config-panels/CampaignConfig/ConfigTitle/index.js +93 -0
  61. package/es/composite-comp/dito/config-panels/CampaignConfig/index.js +69 -0
  62. package/es/composite-comp/dito/config-panels/FlashDealConfig/FlashDealConfigTitle/index.js +7 -20
  63. package/es/composite-comp/dito/config-panels/FlashDealConfig/index.js +15 -1
  64. package/es/composite-comp/dito/config-panels/PcNavigationConfig/TextOnlyFontConfig/index.js +14 -10
  65. package/es/composite-comp/dito/config-panels/RecommendConfig/index.js +10 -4
  66. package/es/composite-comp/dito/config-panels/SearchDITOConfig/ConfigContent/index.js +11 -2
  67. package/es/composite-comp/dito/config-panels/SearchDITOConfig/ConfigContent/index.less +6 -6
  68. package/es/composite-comp/dito/config-panels/SlideImageConfig/index.js +26 -0
  69. package/es/composite-comp/dito/second-config-panels/CampaignSecondConfig/index.js +109 -0
  70. package/es/composite-comp/dito/second-config-panels/SlideImageSecondConfig/index.js +11 -0
  71. package/es/constants/component-types.js +9 -3
  72. package/es/constants/index.js +38 -1
  73. package/es/constants/layout.js +16 -2
  74. package/es/core/Designer/ConfigPanel/index.js +4 -0
  75. package/es/core/Designer/ToolBarModal/index.js +5 -39
  76. package/es/decorator/compositeDecorator.js +5 -2
  77. package/es/locale/en/en.json +6 -1
  78. package/es/locale/es/es.json +6 -1
  79. package/es/locale/id/id.json +6 -1
  80. package/es/meta-comp/components/Button/index.js +4 -1
  81. package/es/meta-comp/components/Button/index.less +8 -1
  82. package/es/meta-comp/config-panels/ButtonConfig/index.js +15 -11
  83. package/es/meta-comp/config-panels/TextConfig/index.js +33 -16
  84. package/lib/assets/fonts/AvenirNext-Bold.ttf +0 -0
  85. package/lib/assets/fonts/AvenirNext-DemiBold.ttf +0 -0
  86. package/lib/assets/fonts/AvenirNext-Medium.ttf +0 -0
  87. package/lib/assets/fonts/AvenirNext-Regular.ttf +0 -0
  88. package/lib/assets/fonts/magic-box-iconfont.css +11 -3
  89. package/lib/assets/fonts/magic-box-iconfont.js +1 -1
  90. package/lib/assets/fonts/magic-box-iconfont.ttf +0 -0
  91. package/lib/assets/fonts/magic-box-iconfont.woff +0 -0
  92. package/lib/assets/fonts/magic-box-iconfont.woff2 +0 -0
  93. package/lib/assets/images/layout-icon/campaignLayout1.png +0 -0
  94. package/lib/assets/images/layout-icon/imageGalleryLayout3.png +0 -0
  95. package/lib/assets/images/layout-icon/imageGalleryLayout4.png +0 -0
  96. package/lib/assets/less/font.less +29 -0
  97. package/lib/common/Collapse/index.js +3 -1
  98. package/lib/common/CountDown/index.js +29 -2
  99. package/lib/common/CountDown/index.less +38 -5
  100. package/lib/common/Field/index.js +2 -1
  101. package/lib/common/Field/index.less +4 -0
  102. package/lib/common/Iconfont/index.js +4 -2
  103. package/lib/composite-comp/bol/components/ImageGallery/mobile/index.js +18 -1
  104. package/lib/composite-comp/bol/components/ImageGallery/mobile/index.less +9 -0
  105. package/lib/composite-comp/bol/config-panels/NewsletterConfig/InputField/index.js +14 -10
  106. package/lib/composite-comp/common/config-panels/BackgroundConfig/index.js +15 -73
  107. package/lib/composite-comp/dito/components/Campaign/defaultJSON.js +112 -0
  108. package/lib/composite-comp/dito/components/Campaign/index.js +88 -0
  109. package/lib/composite-comp/dito/components/Campaign/mobile/components/Bargain/index.js +320 -0
  110. package/lib/composite-comp/dito/components/Campaign/mobile/components/Bargain/index.less +20 -0
  111. package/lib/composite-comp/dito/components/Campaign/mobile/components/CountDown/index.js +180 -0
  112. package/lib/composite-comp/dito/components/Campaign/mobile/components/CountDown/index.less +26 -0
  113. package/lib/composite-comp/dito/components/Campaign/mobile/components/FlashSale/index.js +434 -0
  114. package/lib/composite-comp/dito/components/Campaign/mobile/components/FlashSale/index.less +20 -0
  115. package/lib/composite-comp/dito/components/Campaign/mobile/components/GroupBuy/index.js +317 -0
  116. package/lib/composite-comp/dito/components/Campaign/mobile/components/GroupBuy/index.less +20 -0
  117. package/lib/composite-comp/dito/components/Campaign/mobile/components/ProductItem/index.js +115 -0
  118. package/lib/composite-comp/dito/components/Campaign/mobile/components/ProductItem/index.less +14 -0
  119. package/lib/composite-comp/dito/components/Campaign/mobile/imgs/defImg.png +0 -0
  120. package/lib/composite-comp/dito/components/Campaign/mobile/index.js +125 -0
  121. package/lib/composite-comp/dito/components/Campaign/mobile/index.less +57 -0
  122. package/lib/composite-comp/dito/components/FlashDeal/defaultJSON.js +25 -11
  123. package/lib/composite-comp/dito/components/FlashDeal/mobile/index.js +15 -14
  124. package/lib/composite-comp/dito/components/FlashDeal/pc/ProductItem/index.js +197 -0
  125. package/lib/composite-comp/dito/components/FlashDeal/pc/ProductItem/index.less +100 -0
  126. package/lib/composite-comp/dito/components/FlashDeal/pc/index.js +18 -22
  127. package/lib/composite-comp/dito/components/FlashDeal/pc/index.less +19 -30
  128. package/lib/composite-comp/dito/components/GroupedCarousel/defaultJSON.js +0 -7
  129. package/lib/composite-comp/dito/components/News/defaultJSON.js +0 -4
  130. package/lib/composite-comp/dito/components/SearchDITO/defaultJSON.js +7 -2
  131. package/lib/composite-comp/dito/components/SearchDITO/pc/components/ConfirmModal/index.less +69 -0
  132. package/lib/composite-comp/dito/components/SearchDITO/pc/components/Header/index.js +602 -0
  133. package/lib/composite-comp/dito/components/SearchDITO/pc/components/Header/index.less +184 -0
  134. package/lib/composite-comp/dito/components/SearchDITO/pc/index.js +12 -579
  135. package/lib/composite-comp/dito/components/SearchDITO/pc/index.less +1 -185
  136. package/lib/composite-comp/dito/components/SlideImage/defaultJSON.js +29 -9
  137. package/lib/composite-comp/dito/components/SlideImage/pc/components/CardItem/index.js +3 -1
  138. package/lib/composite-comp/dito/components/SlideImage/pc/components/ParallaxScroll/index.js +5 -1
  139. package/lib/composite-comp/dito/components/SlideImage/pc/components/VideoItem/index.js +20 -13
  140. package/lib/composite-comp/dito/components/SlideImage/pc/components/VideoItem/index.less +4 -11
  141. package/lib/composite-comp/dito/components/SlideImage/pc/index.js +2 -0
  142. package/lib/composite-comp/dito/config-panels/CampaignConfig/ConfigContent/index.js +143 -0
  143. package/lib/composite-comp/dito/config-panels/CampaignConfig/ConfigTitle/index.js +93 -0
  144. package/lib/composite-comp/dito/config-panels/CampaignConfig/index.js +69 -0
  145. package/lib/composite-comp/dito/config-panels/FlashDealConfig/FlashDealConfigTitle/index.js +7 -20
  146. package/lib/composite-comp/dito/config-panels/FlashDealConfig/index.js +15 -1
  147. package/lib/composite-comp/dito/config-panels/PcNavigationConfig/TextOnlyFontConfig/index.js +14 -10
  148. package/lib/composite-comp/dito/config-panels/RecommendConfig/index.js +10 -4
  149. package/lib/composite-comp/dito/config-panels/SearchDITOConfig/ConfigContent/index.js +11 -2
  150. package/lib/composite-comp/dito/config-panels/SearchDITOConfig/ConfigContent/index.less +6 -6
  151. package/lib/composite-comp/dito/config-panels/SlideImageConfig/index.js +26 -0
  152. package/lib/composite-comp/dito/second-config-panels/CampaignSecondConfig/index.js +109 -0
  153. package/lib/composite-comp/dito/second-config-panels/SlideImageSecondConfig/index.js +11 -0
  154. package/lib/constants/component-types.js +9 -3
  155. package/lib/constants/index.js +38 -1
  156. package/lib/constants/layout.js +16 -2
  157. package/lib/core/Designer/ConfigPanel/index.js +4 -0
  158. package/lib/core/Designer/ToolBarModal/index.js +5 -39
  159. package/lib/decorator/compositeDecorator.js +5 -2
  160. package/lib/locale/en/en.json +6 -1
  161. package/lib/locale/es/es.json +6 -1
  162. package/lib/locale/id/id.json +6 -1
  163. package/lib/meta-comp/components/Button/index.js +4 -1
  164. package/lib/meta-comp/components/Button/index.less +8 -1
  165. package/lib/meta-comp/config-panels/ButtonConfig/index.js +15 -11
  166. package/lib/meta-comp/config-panels/TextConfig/index.js +33 -16
  167. package/package.json +1 -1
  168. package/es/composite-comp/dito/components/FlashDeal/pc/imgs/defImg1.png +0 -0
  169. package/es/composite-comp/dito/components/FlashDeal/pc/imgs/defImg2.png +0 -0
  170. package/es/composite-comp/dito/components/FlashDeal/pc/imgs/defImg3.png +0 -0
  171. package/lib/composite-comp/dito/components/FlashDeal/pc/imgs/defImg1.png +0 -0
  172. package/lib/composite-comp/dito/components/FlashDeal/pc/imgs/defImg2.png +0 -0
  173. package/lib/composite-comp/dito/components/FlashDeal/pc/imgs/defImg3.png +0 -0
@@ -0,0 +1,602 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _classnames = _interopRequireDefault(require("classnames"));
11
+
12
+ var _ConfirmModal = _interopRequireDefault(require("../ConfirmModal"));
13
+
14
+ var _locale = require("../../../../../../../locale");
15
+
16
+ var _avatar = _interopRequireDefault(require("../../imgs/avatar.png"));
17
+
18
+ var _common = require("../../../../../../../common");
19
+
20
+ var _commonUtil = require("../../../../../../../utils/commonUtil");
21
+
22
+ var _coreUtil = require("../../../../../../../utils/coreUtil");
23
+
24
+ var _components = require("../../../../../../../meta-comp/components");
25
+
26
+ var _businessUtil = require("../../../../../../../utils/businessUtil");
27
+
28
+ require("slick-carousel/slick/slick.css");
29
+
30
+ require("slick-carousel/slick/slick-theme.css");
31
+
32
+ require("./index.less");
33
+
34
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
35
+
36
+ var __extends = void 0 && (void 0).__extends || function () {
37
+ var _extendStatics = function extendStatics(d, b) {
38
+ _extendStatics = Object.setPrototypeOf || {
39
+ __proto__: []
40
+ } instanceof Array && function (d, b) {
41
+ d.__proto__ = b;
42
+ } || function (d, b) {
43
+ for (var p in b) {
44
+ if (b.hasOwnProperty(p)) d[p] = b[p];
45
+ }
46
+ };
47
+
48
+ return _extendStatics(d, b);
49
+ };
50
+
51
+ return function (d, b) {
52
+ _extendStatics(d, b);
53
+
54
+ function __() {
55
+ this.constructor = d;
56
+ }
57
+
58
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
59
+ };
60
+ }();
61
+
62
+ var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
63
+ function adopt(value) {
64
+ return value instanceof P ? value : new P(function (resolve) {
65
+ resolve(value);
66
+ });
67
+ }
68
+
69
+ return new (P || (P = Promise))(function (resolve, reject) {
70
+ function fulfilled(value) {
71
+ try {
72
+ step(generator.next(value));
73
+ } catch (e) {
74
+ reject(e);
75
+ }
76
+ }
77
+
78
+ function rejected(value) {
79
+ try {
80
+ step(generator["throw"](value));
81
+ } catch (e) {
82
+ reject(e);
83
+ }
84
+ }
85
+
86
+ function step(result) {
87
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
88
+ }
89
+
90
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
91
+ });
92
+ };
93
+
94
+ var __generator = void 0 && (void 0).__generator || function (thisArg, body) {
95
+ var _ = {
96
+ label: 0,
97
+ sent: function sent() {
98
+ if (t[0] & 1) throw t[1];
99
+ return t[1];
100
+ },
101
+ trys: [],
102
+ ops: []
103
+ },
104
+ f,
105
+ y,
106
+ t,
107
+ g;
108
+ return g = {
109
+ next: verb(0),
110
+ "throw": verb(1),
111
+ "return": verb(2)
112
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
113
+ return this;
114
+ }), g;
115
+
116
+ function verb(n) {
117
+ return function (v) {
118
+ return step([n, v]);
119
+ };
120
+ }
121
+
122
+ function step(op) {
123
+ if (f) throw new TypeError("Generator is already executing.");
124
+
125
+ while (_) {
126
+ try {
127
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
128
+ if (y = 0, t) op = [op[0] & 2, t.value];
129
+
130
+ switch (op[0]) {
131
+ case 0:
132
+ case 1:
133
+ t = op;
134
+ break;
135
+
136
+ case 4:
137
+ _.label++;
138
+ return {
139
+ value: op[1],
140
+ done: false
141
+ };
142
+
143
+ case 5:
144
+ _.label++;
145
+ y = op[1];
146
+ op = [0];
147
+ continue;
148
+
149
+ case 7:
150
+ op = _.ops.pop();
151
+
152
+ _.trys.pop();
153
+
154
+ continue;
155
+
156
+ default:
157
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
158
+ _ = 0;
159
+ continue;
160
+ }
161
+
162
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
163
+ _.label = op[1];
164
+ break;
165
+ }
166
+
167
+ if (op[0] === 6 && _.label < t[1]) {
168
+ _.label = t[1];
169
+ t = op;
170
+ break;
171
+ }
172
+
173
+ if (t && _.label < t[2]) {
174
+ _.label = t[2];
175
+
176
+ _.ops.push(op);
177
+
178
+ break;
179
+ }
180
+
181
+ if (t[2]) _.ops.pop();
182
+
183
+ _.trys.pop();
184
+
185
+ continue;
186
+ }
187
+
188
+ op = body.call(thisArg, _);
189
+ } catch (e) {
190
+ op = [6, e];
191
+ y = 0;
192
+ } finally {
193
+ f = t = 0;
194
+ }
195
+ }
196
+
197
+ if (op[0] & 5) throw op[1];
198
+ return {
199
+ value: op[0] ? op[1] : void 0,
200
+ done: true
201
+ };
202
+ }
203
+ };
204
+
205
+ var Header =
206
+ /** @class */
207
+ function (_super) {
208
+ __extends(Header, _super);
209
+
210
+ function Header() {
211
+ var _this = _super !== null && _super.apply(this, arguments) || this;
212
+
213
+ _this.state = {
214
+ catgList: [],
215
+ catgChildList: [],
216
+ activeCatgImg: '',
217
+ relativeLeft: 0,
218
+ visible: false,
219
+ modalVisible: false,
220
+ logVisible: false,
221
+ userInfo: {},
222
+ cartNum: 0
223
+ };
224
+
225
+ _this.getCategory = function () {
226
+ return __awaiter(_this, void 0, void 0, function () {
227
+ var res;
228
+
229
+ var _this = this;
230
+
231
+ return __generator(this, function (_a) {
232
+ switch (_a.label) {
233
+ case 0:
234
+ return [4
235
+ /*yield*/
236
+ , (0, _commonUtil.commonFetch)('/designer/v1/h5/pages/buyer/displaycatgs', {
237
+ catgLevel: 1
238
+ }, 'GET')];
239
+
240
+ case 1:
241
+ res = _a.sent();
242
+ res.forEach(function (item) {
243
+ return __awaiter(_this, void 0, void 0, function () {
244
+ var childRes;
245
+ return __generator(this, function (_a) {
246
+ switch (_a.label) {
247
+ case 0:
248
+ if (!item.model.hasChildren) return [3
249
+ /*break*/
250
+ , 2];
251
+ return [4
252
+ /*yield*/
253
+ , (0, _commonUtil.commonFetch)('/designer/v1/h5/pages/buyer/displaycatgs', {
254
+ parentCatgId: item.model.catgId
255
+ }, 'GET')];
256
+
257
+ case 1:
258
+ childRes = _a.sent();
259
+ item.children = childRes;
260
+ _a.label = 2;
261
+
262
+ case 2:
263
+ return [2
264
+ /*return*/
265
+ ];
266
+ }
267
+ });
268
+ });
269
+ });
270
+ this.setState({
271
+ catgList: res
272
+ });
273
+ return [2
274
+ /*return*/
275
+ ];
276
+ }
277
+ });
278
+ });
279
+ };
280
+
281
+ _this.onMouseEnter = function (childDom, m) {
282
+ return __awaiter(_this, void 0, void 0, function () {
283
+ var parentElement, parentRect, childRect, relativeLeft;
284
+ return __generator(this, function (_a) {
285
+ if (m.model.hasChildren) {
286
+ parentElement = document.querySelector('.nav-list');
287
+ parentRect = parentElement.getBoundingClientRect();
288
+ childRect = childDom.getBoundingClientRect();
289
+ relativeLeft = childRect.left - parentRect.left;
290
+ this.setState({
291
+ catgChildList: m.children,
292
+ activeCatgImg: m.model.imgUrl,
293
+ visible: true,
294
+ relativeLeft: relativeLeft
295
+ });
296
+ }
297
+
298
+ return [2
299
+ /*return*/
300
+ ];
301
+ });
302
+ });
303
+ };
304
+
305
+ _this.onMouseLeave = function () {
306
+ _this.setState({
307
+ catgChildList: [],
308
+ activeCatgImg: '',
309
+ visible: false,
310
+ relativeLeft: 0
311
+ });
312
+ };
313
+
314
+ _this.getUserInfo = function () {
315
+ return __awaiter(_this, void 0, void 0, function () {
316
+ var info;
317
+ return __generator(this, function (_a) {
318
+ switch (_a.label) {
319
+ case 0:
320
+ return [4
321
+ /*yield*/
322
+ , (0, _commonUtil.commonFetch)('/designer/v1/h5/users', {}, 'GET')];
323
+
324
+ case 1:
325
+ info = _a.sent();
326
+ this.setState({
327
+ userInfo: info
328
+ });
329
+ return [2
330
+ /*return*/
331
+ ];
332
+ }
333
+ });
334
+ });
335
+ };
336
+
337
+ _this.getCartCount = function () {
338
+ return __awaiter(_this, void 0, void 0, function () {
339
+ var num, res;
340
+ return __generator(this, function (_a) {
341
+ switch (_a.label) {
342
+ case 0:
343
+ num = 0;
344
+ if (!(0, _commonUtil.isLogin)()) return [3
345
+ /*break*/
346
+ , 2];
347
+ return [4
348
+ /*yield*/
349
+ , (0, _commonUtil.commonFetch)('/designer/v1/h5/carts/num', {}, 'GET')];
350
+
351
+ case 1:
352
+ res = _a.sent();
353
+ num = res.num;
354
+ return [3
355
+ /*break*/
356
+ , 3];
357
+
358
+ case 2:
359
+ num = (0, _businessUtil.getTempCartCount)();
360
+ _a.label = 3;
361
+
362
+ case 3:
363
+ if (num > 99) {
364
+ num = '99+';
365
+ }
366
+
367
+ this.setState({
368
+ cartNum: num
369
+ });
370
+ return [2
371
+ /*return*/
372
+ ];
373
+ }
374
+ });
375
+ });
376
+ };
377
+
378
+ _this.onLogOut = function () {
379
+ return __awaiter(_this, void 0, void 0, function () {
380
+ return __generator(this, function (_a) {
381
+ switch (_a.label) {
382
+ case 0:
383
+ this.setState({
384
+ modalVisible: false
385
+ });
386
+ return [4
387
+ /*yield*/
388
+ , (0, _commonUtil.commonFetch)('/designer/v1/h5/users/logout', {}, 'POST')];
389
+
390
+ case 1:
391
+ _a.sent();
392
+
393
+ (0, _commonUtil.afterLogOut)();
394
+ (0, _coreUtil.clickUrl)('/sign-in');
395
+ return [2
396
+ /*return*/
397
+ ];
398
+ }
399
+ });
400
+ });
401
+ };
402
+
403
+ _this.conFirmLogout = function (e) {
404
+ return __awaiter(_this, void 0, void 0, function () {
405
+ return __generator(this, function (_a) {
406
+ e.stopPropagation();
407
+ this.setState({
408
+ modalVisible: true
409
+ });
410
+ return [2
411
+ /*return*/
412
+ ];
413
+ });
414
+ });
415
+ };
416
+
417
+ return _this;
418
+ }
419
+
420
+ Header.prototype.componentDidMount = function () {
421
+ var _this = this;
422
+
423
+ if ((0, _commonUtil.isLogin)()) {
424
+ this.getUserInfo();
425
+ }
426
+
427
+ this.getCartCount();
428
+ this.getCategory();
429
+ var navCardDom = document.querySelector('.navigation');
430
+
431
+ if (navCardDom) {
432
+ document.addEventListener('click', function (event) {
433
+ if (!navCardDom.contains(event.target)) {
434
+ _this.setState({
435
+ visible: false,
436
+ relativeLeft: 0
437
+ });
438
+ }
439
+ });
440
+ }
441
+ };
442
+
443
+ Header.prototype.render = function () {
444
+ var _this = this;
445
+
446
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
447
+
448
+ var data = this.props.data;
449
+ var _t = this.state,
450
+ catgList = _t.catgList,
451
+ catgChildList = _t.catgChildList,
452
+ visible = _t.visible,
453
+ relativeLeft = _t.relativeLeft,
454
+ activeCatgImg = _t.activeCatgImg,
455
+ logVisible = _t.logVisible,
456
+ userInfo = _t.userInfo,
457
+ cartNum = _t.cartNum,
458
+ modalVisible = _t.modalVisible;
459
+ var background = data.content.searchBarBg;
460
+ var bgStyle = {};
461
+
462
+ if (background) {
463
+ if (background.bgType === 'color') {
464
+ bgStyle.backgroundColor = background.color;
465
+ bgStyle.opacity = background.opacity ? background.opacity : 1;
466
+ } else {
467
+ bgStyle.backgroundImage = "url(" + background.image + ")";
468
+ bgStyle.backgroundPosition = 'center center';
469
+ bgStyle.backgroundSize = 'cover';
470
+ bgStyle.backgroundRepeat = 'no-repeat';
471
+ }
472
+ }
473
+
474
+ return /*#__PURE__*/_react["default"].createElement("div", {
475
+ className: "search-dito-header",
476
+ style: bgStyle
477
+ }, ((_b = (_a = data.content) === null || _a === void 0 ? void 0 : _a.logo) === null || _b === void 0 ? void 0 : _b.open) && /*#__PURE__*/_react["default"].createElement(_components.MetaImage, {
478
+ className: "logo",
479
+ data: data.content.logo
480
+ }), ((_d = (_c = data.content) === null || _c === void 0 ? void 0 : _c.navigation) === null || _d === void 0 ? void 0 : _d.open) && /*#__PURE__*/_react["default"].createElement("div", {
481
+ className: "navigation"
482
+ }, /*#__PURE__*/_react["default"].createElement("ul", {
483
+ className: "nav-list",
484
+ onMouseLeave: this.onMouseLeave
485
+ }, catgList.map(function (m) {
486
+ return /*#__PURE__*/_react["default"].createElement("li", {
487
+ key: m.model.catgId,
488
+ onClick: function onClick() {
489
+ return (0, _commonUtil.jumpUrlConfig)(m.model.catgRela);
490
+ },
491
+ onMouseEnter: function onMouseEnter(e) {
492
+ return _this.onMouseEnter(e.target, m);
493
+ }
494
+ }, m.model.catgName, m.model.hasChildren && /*#__PURE__*/_react["default"].createElement(_common.Iconfont, {
495
+ className: "icon_down",
496
+ color: "#2c2c2c",
497
+ size: 16,
498
+ type: "icon-outlined-down"
499
+ }));
500
+ }), visible && /*#__PURE__*/_react["default"].createElement("div", {
501
+ className: "nav-card",
502
+ style: {
503
+ left: relativeLeft
504
+ }
505
+ }, /*#__PURE__*/_react["default"].createElement("ul", null, catgChildList.map(function (m) {
506
+ return /*#__PURE__*/_react["default"].createElement("li", {
507
+ key: m.model.catgId,
508
+ onClick: function onClick() {
509
+ return (0, _commonUtil.jumpUrlConfig)(m.model.catgRela);
510
+ }
511
+ }, /*#__PURE__*/_react["default"].createElement("div", null, m.model.catgName), /*#__PURE__*/_react["default"].createElement(_common.Iconfont, {
512
+ className: "icon_right",
513
+ color: "#CE1126",
514
+ size: 18,
515
+ type: "icon-arrow-right"
516
+ }));
517
+ })), /*#__PURE__*/_react["default"].createElement("img", {
518
+ alt: "",
519
+ src: activeCatgImg
520
+ })))), /*#__PURE__*/_react["default"].createElement("div", {
521
+ className: "right"
522
+ }, ((_g = (_f = (_e = data.content) === null || _e === void 0 ? void 0 : _e.icon) === null || _f === void 0 ? void 0 : _f.searchIcon) === null || _g === void 0 ? void 0 : _g.pc) && /*#__PURE__*/_react["default"].createElement("div", {
523
+ className: "icon-wrap"
524
+ }, /*#__PURE__*/_react["default"].createElement(_common.Iconfont, {
525
+ bold: true,
526
+ color: (_j = (_h = data.content.icon) === null || _h === void 0 ? void 0 : _h.color) === null || _j === void 0 ? void 0 : _j.pc,
527
+ onClick: function onClick() {
528
+ return (0, _coreUtil.clickUrl)('/search-page?from=home');
529
+ },
530
+ size: 24,
531
+ type: "icon-search-short"
532
+ })), ((_m = (_l = (_k = data.content) === null || _k === void 0 ? void 0 : _k.icon) === null || _l === void 0 ? void 0 : _l.cartIcon) === null || _m === void 0 ? void 0 : _m.pc) && /*#__PURE__*/_react["default"].createElement("div", {
533
+ className: "icon-wrap"
534
+ }, /*#__PURE__*/_react["default"].createElement(_common.Iconfont, {
535
+ bold: true,
536
+ color: (_p = (_o = data.content.icon) === null || _o === void 0 ? void 0 : _o.color) === null || _p === void 0 ? void 0 : _p.pc,
537
+ onClick: function onClick() {
538
+ return (0, _coreUtil.clickUrl)('/main/cart');
539
+ },
540
+ size: 24,
541
+ type: "icon-ShoppingCartSimple1"
542
+ }), cartNum > 0 && /*#__PURE__*/_react["default"].createElement("span", {
543
+ className: "cart-num"
544
+ }, cartNum)), ((_r = (_q = data.content) === null || _q === void 0 ? void 0 : _q.login) === null || _r === void 0 ? void 0 : _r.open) && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, (0, _commonUtil.isLogin)() ? /*#__PURE__*/_react["default"].createElement("div", {
545
+ className: (0, _classnames["default"])('personal-info', {
546
+ showLogOut: logVisible
547
+ }),
548
+ onClick: function onClick() {
549
+ return (0, _coreUtil.clickUrl)('/main/account/order/list/0');
550
+ },
551
+ onMouseEnter: function onMouseEnter() {
552
+ return _this.setState({
553
+ logVisible: true
554
+ });
555
+ },
556
+ onMouseLeave: function onMouseLeave() {
557
+ return _this.setState({
558
+ logVisible: false
559
+ });
560
+ }
561
+ }, /*#__PURE__*/_react["default"].createElement("img", {
562
+ alt: "",
563
+ className: "avatar-img",
564
+ src: userInfo.photo || _avatar["default"]
565
+ }), /*#__PURE__*/_react["default"].createElement("div", null, "Hi, ", userInfo.firstName || 'user'), logVisible && /*#__PURE__*/_react["default"].createElement("div", {
566
+ className: "log-out-wrap"
567
+ }, /*#__PURE__*/_react["default"].createElement("div", {
568
+ className: "item"
569
+ }, /*#__PURE__*/_react["default"].createElement(_common.Iconfont, {
570
+ color: "#2c2c2c",
571
+ size: 23,
572
+ type: "icon-my-account"
573
+ }), (0, _locale.i18n)('MY_ACCOUNT')), /*#__PURE__*/_react["default"].createElement("div", {
574
+ className: "item",
575
+ onClick: function onClick(e) {
576
+ _this.conFirmLogout(e);
577
+ }
578
+ }, /*#__PURE__*/_react["default"].createElement(_common.Iconfont, {
579
+ className: "icon-log-out",
580
+ color: "#2c2c2c",
581
+ size: 22,
582
+ type: "icon-upload"
583
+ }), (0, _locale.i18n)('LOG_OUT')))) : /*#__PURE__*/_react["default"].createElement(_components.MetaButton, {
584
+ data: (_s = data.content) === null || _s === void 0 ? void 0 : _s.login
585
+ }))), modalVisible && /*#__PURE__*/_react["default"].createElement(_ConfirmModal["default"], {
586
+ confirmText: (0, _locale.i18n)('LOG_OUT'),
587
+ onClose: function onClose() {
588
+ _this.setState({
589
+ modalVisible: false
590
+ });
591
+ },
592
+ onConfirm: this.onLogOut,
593
+ title: (0, _locale.i18n)('CONFIRM_TO_LOGOUT')
594
+ }));
595
+ };
596
+
597
+ Header.defaultProps = {};
598
+ return Header;
599
+ }(_react["default"].Component);
600
+
601
+ var _default = Header;
602
+ exports["default"] = _default;