@fonixtree/magic-design 0.1.28 → 0.1.30

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.
Binary file
@@ -11,43 +11,43 @@ var getDefaultJSON = function getDefaultJSON() {
11
11
  return {
12
12
  id: (0, _uuid.v4)(),
13
13
  type: 'SIGN_BOARD',
14
- content: {
15
- logo: {
16
- id: (0, _uuid.v4)(),
17
- open: true,
18
- type: 'IMAGE',
19
- content: {
20
- h5Name: 'name2',
21
- pcName: 'name2',
22
- h5ImgSrc: '',
23
- pcImgSrc: '',
24
- clickUrl: ''
25
- },
26
- hover: {
27
- open: false,
28
- backgroundType: 'enlarge',
29
- magnification: 1.5,
30
- pcImgHoverUrl: '',
31
- h5ImgHoverUrl: ''
32
- }
33
- },
34
- box: {
35
- id: (0, _uuid.v4)(),
36
- open: true,
37
- color: {
38
- pc: '#D92929',
39
- mobile: '#8493AF'
40
- }
41
- },
42
- icon: {
43
- id: (0, _uuid.v4)(),
44
- open: true,
45
- color: {
46
- pc: '#D92929',
47
- mobile: '#232F46'
48
- }
49
- }
50
- },
14
+ // content: {
15
+ // logo: {
16
+ // id: uuidv4(),
17
+ // open: true,
18
+ // type: 'IMAGE',
19
+ // content: {
20
+ // h5Name: 'name2',
21
+ // pcName: 'name2',
22
+ // h5ImgSrc: '',
23
+ // pcImgSrc: '',
24
+ // clickUrl: '',
25
+ // },
26
+ // hover: {
27
+ // open: false,
28
+ // backgroundType: 'enlarge',
29
+ // magnification: 1.5,
30
+ // pcImgHoverUrl: '',
31
+ // h5ImgHoverUrl: '',
32
+ // },
33
+ // },
34
+ // box: {
35
+ // id: uuidv4(),
36
+ // open: true,
37
+ // color: {
38
+ // pc: '#D92929',
39
+ // mobile: '#8493AF',
40
+ // },
41
+ // },
42
+ // icon: {
43
+ // id: uuidv4(),
44
+ // open: true,
45
+ // color: {
46
+ // pc: '#D92929',
47
+ // mobile: '#232F46',
48
+ // },
49
+ // },
50
+ // },
51
51
  spacing: {
52
52
  pc: {
53
53
  paddingTop: 20,
@@ -63,10 +63,10 @@ var getDefaultJSON = function getDefaultJSON() {
63
63
  marginBottom: window.magicDesign.compSpacing
64
64
  }
65
65
  },
66
- customize: {
67
- layout: 'left',
68
- align: 'left'
69
- },
66
+ // customize: {
67
+ // layout: 'left',
68
+ // align: 'left',
69
+ // },
70
70
  background: {
71
71
  opacity: 100,
72
72
  color: '#fff',
@@ -17,6 +17,8 @@ var _defaultImg = _interopRequireDefault(require("../../../../../common/GroupLis
17
17
 
18
18
  var _commonUtil = require("../../../../../utils/commonUtil");
19
19
 
20
+ var _locale = require("../../../../../locale");
21
+
20
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
21
23
 
22
24
  var __extends = void 0 && (void 0).__extends || function () {
@@ -45,6 +47,149 @@ var __extends = void 0 && (void 0).__extends || function () {
45
47
  };
46
48
  }();
47
49
 
50
+ var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
51
+ function adopt(value) {
52
+ return value instanceof P ? value : new P(function (resolve) {
53
+ resolve(value);
54
+ });
55
+ }
56
+
57
+ return new (P || (P = Promise))(function (resolve, reject) {
58
+ function fulfilled(value) {
59
+ try {
60
+ step(generator.next(value));
61
+ } catch (e) {
62
+ reject(e);
63
+ }
64
+ }
65
+
66
+ function rejected(value) {
67
+ try {
68
+ step(generator["throw"](value));
69
+ } catch (e) {
70
+ reject(e);
71
+ }
72
+ }
73
+
74
+ function step(result) {
75
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
76
+ }
77
+
78
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
79
+ });
80
+ };
81
+
82
+ var __generator = void 0 && (void 0).__generator || function (thisArg, body) {
83
+ var _ = {
84
+ label: 0,
85
+ sent: function sent() {
86
+ if (t[0] & 1) throw t[1];
87
+ return t[1];
88
+ },
89
+ trys: [],
90
+ ops: []
91
+ },
92
+ f,
93
+ y,
94
+ t,
95
+ g;
96
+ return g = {
97
+ next: verb(0),
98
+ "throw": verb(1),
99
+ "return": verb(2)
100
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
101
+ return this;
102
+ }), g;
103
+
104
+ function verb(n) {
105
+ return function (v) {
106
+ return step([n, v]);
107
+ };
108
+ }
109
+
110
+ function step(op) {
111
+ if (f) throw new TypeError("Generator is already executing.");
112
+
113
+ while (_) {
114
+ try {
115
+ 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;
116
+ if (y = 0, t) op = [op[0] & 2, t.value];
117
+
118
+ switch (op[0]) {
119
+ case 0:
120
+ case 1:
121
+ t = op;
122
+ break;
123
+
124
+ case 4:
125
+ _.label++;
126
+ return {
127
+ value: op[1],
128
+ done: false
129
+ };
130
+
131
+ case 5:
132
+ _.label++;
133
+ y = op[1];
134
+ op = [0];
135
+ continue;
136
+
137
+ case 7:
138
+ op = _.ops.pop();
139
+
140
+ _.trys.pop();
141
+
142
+ continue;
143
+
144
+ default:
145
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
146
+ _ = 0;
147
+ continue;
148
+ }
149
+
150
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
151
+ _.label = op[1];
152
+ break;
153
+ }
154
+
155
+ if (op[0] === 6 && _.label < t[1]) {
156
+ _.label = t[1];
157
+ t = op;
158
+ break;
159
+ }
160
+
161
+ if (t && _.label < t[2]) {
162
+ _.label = t[2];
163
+
164
+ _.ops.push(op);
165
+
166
+ break;
167
+ }
168
+
169
+ if (t[2]) _.ops.pop();
170
+
171
+ _.trys.pop();
172
+
173
+ continue;
174
+ }
175
+
176
+ op = body.call(thisArg, _);
177
+ } catch (e) {
178
+ op = [6, e];
179
+ y = 0;
180
+ } finally {
181
+ f = t = 0;
182
+ }
183
+ }
184
+
185
+ if (op[0] & 5) throw op[1];
186
+ return {
187
+ value: op[0] ? op[1] : void 0,
188
+ done: true
189
+ };
190
+ }
191
+ };
192
+
48
193
  var SignBoardMobile =
49
194
  /** @class */
50
195
  function (_super) {
@@ -53,52 +198,175 @@ function (_super) {
53
198
  function SignBoardMobile() {
54
199
  var _this = _super !== null && _super.apply(this, arguments) || this;
55
200
 
56
- _this.state = {};
201
+ _this.state = {
202
+ storeInfo: null,
203
+ isFollow: false,
204
+ inputVal: ''
205
+ };
206
+
207
+ _this.getStoreInfo = function () {
208
+ return __awaiter(_this, void 0, void 0, function () {
209
+ var storeId, res, isFollow;
210
+ return __generator(this, function (_a) {
211
+ switch (_a.label) {
212
+ case 0:
213
+ storeId = window.magicDesign.storeId;
214
+ if (!storeId) return [3
215
+ /*break*/
216
+ , 3];
217
+ return [4
218
+ /*yield*/
219
+ , (0, _commonUtil.commonFetch)("/designer/v1/h5/store/detail/" + storeId, {}, 'GET')];
220
+
221
+ case 1:
222
+ res = _a.sent();
223
+ return [4
224
+ /*yield*/
225
+ , (0, _commonUtil.commonFetch)('/designer/v1/h5/collection/store/check', {
226
+ storeId: storeId
227
+ })];
228
+
229
+ case 2:
230
+ isFollow = _a.sent();
231
+ this.setState({
232
+ storeInfo: res,
233
+ isFollow: isFollow
234
+ });
235
+ _a.label = 3;
236
+
237
+ case 3:
238
+ return [2
239
+ /*return*/
240
+ ];
241
+ }
242
+ });
243
+ });
244
+ };
245
+
246
+ _this.searchProduct = function () {
247
+ var storeId = window.magicDesign.storeId;
248
+ clickUrl("/product/list?q=" + _this.state.inputVal + "&storeId=" + storeId);
249
+ };
250
+
251
+ _this.clickCollect = function () {
252
+ return __awaiter(_this, void 0, void 0, function () {
253
+ var storeId, isFollow, error_1;
254
+ return __generator(this, function (_a) {
255
+ switch (_a.label) {
256
+ case 0:
257
+ storeId = window.magicDesign.storeId;
258
+ isFollow = this.state.isFollow;
259
+ if (!storeId) return [3
260
+ /*break*/
261
+ , 4];
262
+ _a.label = 1;
263
+
264
+ case 1:
265
+ _a.trys.push([1, 3,, 4]);
57
266
 
58
- _this.clickCollect = function () {};
267
+ return [4
268
+ /*yield*/
269
+ , (0, _commonUtil.commonFetch)('/h5/collection/store', {
270
+ storeId: storeId,
271
+ operationType: !isFollow ? 'D' : 'A'
272
+ }, 'post')];
273
+
274
+ case 2:
275
+ _a.sent();
276
+
277
+ this.setState({
278
+ isFollow: !isFollow
279
+ });
280
+ return [3
281
+ /*break*/
282
+ , 4];
283
+
284
+ case 3:
285
+ error_1 = _a.sent();
286
+ console.log(error_1);
287
+ return [3
288
+ /*break*/
289
+ , 4];
290
+
291
+ case 4:
292
+ return [2
293
+ /*return*/
294
+ ];
295
+ }
296
+ });
297
+ });
298
+ };
299
+
300
+ _this.onChangeVal = function (val) {
301
+ _this.setState({
302
+ inputVal: val
303
+ });
304
+ };
305
+
306
+ _this.keyUp = function (e) {
307
+ if (e.keyCode === 13) {
308
+ _this.searchProduct();
309
+ }
310
+ };
59
311
 
60
312
  return _this;
61
313
  }
62
314
 
63
- SignBoardMobile.prototype.componentDidMount = function () {};
315
+ SignBoardMobile.prototype.componentDidMount = function () {
316
+ this.getStoreInfo();
317
+ };
64
318
 
65
319
  SignBoardMobile.prototype.render = function () {
320
+ var _this = this;
321
+
66
322
  var data = this.props.data;
67
- console.log('----SignBoard ', data);
323
+ console.log('--SignBoard', data);
324
+ var _a = this.state,
325
+ storeInfo = _a.storeInfo,
326
+ isFollow = _a.isFollow,
327
+ inputVal = _a.inputVal;
68
328
  return /*#__PURE__*/_react["default"].createElement("div", {
69
329
  className: "m-sign-board-bar"
70
330
  }, /*#__PURE__*/_react["default"].createElement("div", {
71
331
  className: "search"
72
332
  }, /*#__PURE__*/_react["default"].createElement(_antd.Input, {
73
333
  className: "search-input",
74
- placeholder: "Search in shop"
75
- }), /*#__PURE__*/_react["default"].createElement(_common.Iconfont, {
334
+ onChange: function onChange(e) {
335
+ return _this.onChangeVal(e.target.value);
336
+ },
337
+ onKeyUp: this.keyUp,
338
+ placeholder: (0, _locale.i18n)('SEARCH_IN_SHOP'),
339
+ value: inputVal
340
+ }), /*#__PURE__*/_react["default"].createElement("div", {
341
+ className: "search-icon",
342
+ onClick: this.searchProduct
343
+ }, /*#__PURE__*/_react["default"].createElement(_common.Iconfont, {
76
344
  color: "#696973",
77
345
  size: (0, _commonUtil.convertToRem)(20),
78
346
  style: {
79
347
  display: 'flex'
80
348
  },
81
349
  type: "icon-search2"
82
- })), /*#__PURE__*/_react["default"].createElement("div", {
350
+ }))), /*#__PURE__*/_react["default"].createElement("div", {
83
351
  className: "store-info-wrap"
84
352
  }, /*#__PURE__*/_react["default"].createElement("img", {
85
353
  className: "store-logo",
86
- src: _defaultImg["default"]
354
+ src: (storeInfo === null || storeInfo === void 0 ? void 0 : storeInfo.storeLogoUrl) || _defaultImg["default"]
87
355
  }), /*#__PURE__*/_react["default"].createElement("div", {
88
356
  className: "store-name"
89
- }, "dsd"), /*#__PURE__*/_react["default"].createElement("div", {
357
+ }, (storeInfo === null || storeInfo === void 0 ? void 0 : storeInfo.storeName) || 'Whale Store'), /*#__PURE__*/_react["default"].createElement("div", {
90
358
  onClick: this.clickCollect
91
359
  }, /*#__PURE__*/_react["default"].createElement(_common.Iconfont, {
92
- color: "#333333",
360
+ color: isFollow ? '#F1600F' : '#333333',
93
361
  size: (0, _commonUtil.convertToRem)(24),
94
- type: "icon-HeartStraight"
362
+ type: isFollow ? 'icon-HeartStraight_fill' : 'icon-HeartStraight'
95
363
  }))), /*#__PURE__*/_react["default"].createElement("div", {
96
364
  className: "store-info-wrap"
97
365
  }, /*#__PURE__*/_react["default"].createElement("div", {
98
366
  className: "number"
99
- }, /*#__PURE__*/_react["default"].createElement("span", null, "98% "), " Positive"), /*#__PURE__*/_react["default"].createElement("div", {
367
+ }, /*#__PURE__*/_react["default"].createElement("span", null, (storeInfo === null || storeInfo === void 0 ? void 0 : storeInfo.storeEvalValue) || '98%', " "), " Positive"), /*#__PURE__*/_react["default"].createElement("div", {
100
368
  className: "number"
101
- }, /*#__PURE__*/_react["default"].createElement("span", null, "1000+ "), " Followers"), /*#__PURE__*/_react["default"].createElement("div", {
369
+ }, /*#__PURE__*/_react["default"].createElement("span", null, (storeInfo === null || storeInfo === void 0 ? void 0 : storeInfo.userCollectionNum) || '1000+', " "), " Followers"), /*#__PURE__*/_react["default"].createElement("div", {
102
370
  className: "chat-btn"
103
371
  }, "CHAT")));
104
372
  };