@fonixtree/magic-design 0.1.28 → 0.1.29

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',
@@ -45,6 +45,149 @@ var __extends = void 0 && (void 0).__extends || function () {
45
45
  };
46
46
  }();
47
47
 
48
+ var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
49
+ function adopt(value) {
50
+ return value instanceof P ? value : new P(function (resolve) {
51
+ resolve(value);
52
+ });
53
+ }
54
+
55
+ return new (P || (P = Promise))(function (resolve, reject) {
56
+ function fulfilled(value) {
57
+ try {
58
+ step(generator.next(value));
59
+ } catch (e) {
60
+ reject(e);
61
+ }
62
+ }
63
+
64
+ function rejected(value) {
65
+ try {
66
+ step(generator["throw"](value));
67
+ } catch (e) {
68
+ reject(e);
69
+ }
70
+ }
71
+
72
+ function step(result) {
73
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
74
+ }
75
+
76
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
77
+ });
78
+ };
79
+
80
+ var __generator = void 0 && (void 0).__generator || function (thisArg, body) {
81
+ var _ = {
82
+ label: 0,
83
+ sent: function sent() {
84
+ if (t[0] & 1) throw t[1];
85
+ return t[1];
86
+ },
87
+ trys: [],
88
+ ops: []
89
+ },
90
+ f,
91
+ y,
92
+ t,
93
+ g;
94
+ return g = {
95
+ next: verb(0),
96
+ "throw": verb(1),
97
+ "return": verb(2)
98
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
99
+ return this;
100
+ }), g;
101
+
102
+ function verb(n) {
103
+ return function (v) {
104
+ return step([n, v]);
105
+ };
106
+ }
107
+
108
+ function step(op) {
109
+ if (f) throw new TypeError("Generator is already executing.");
110
+
111
+ while (_) {
112
+ try {
113
+ 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;
114
+ if (y = 0, t) op = [op[0] & 2, t.value];
115
+
116
+ switch (op[0]) {
117
+ case 0:
118
+ case 1:
119
+ t = op;
120
+ break;
121
+
122
+ case 4:
123
+ _.label++;
124
+ return {
125
+ value: op[1],
126
+ done: false
127
+ };
128
+
129
+ case 5:
130
+ _.label++;
131
+ y = op[1];
132
+ op = [0];
133
+ continue;
134
+
135
+ case 7:
136
+ op = _.ops.pop();
137
+
138
+ _.trys.pop();
139
+
140
+ continue;
141
+
142
+ default:
143
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
144
+ _ = 0;
145
+ continue;
146
+ }
147
+
148
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
149
+ _.label = op[1];
150
+ break;
151
+ }
152
+
153
+ if (op[0] === 6 && _.label < t[1]) {
154
+ _.label = t[1];
155
+ t = op;
156
+ break;
157
+ }
158
+
159
+ if (t && _.label < t[2]) {
160
+ _.label = t[2];
161
+
162
+ _.ops.push(op);
163
+
164
+ break;
165
+ }
166
+
167
+ if (t[2]) _.ops.pop();
168
+
169
+ _.trys.pop();
170
+
171
+ continue;
172
+ }
173
+
174
+ op = body.call(thisArg, _);
175
+ } catch (e) {
176
+ op = [6, e];
177
+ y = 0;
178
+ } finally {
179
+ f = t = 0;
180
+ }
181
+ }
182
+
183
+ if (op[0] & 5) throw op[1];
184
+ return {
185
+ value: op[0] ? op[1] : void 0,
186
+ done: true
187
+ };
188
+ }
189
+ };
190
+
48
191
  var SignBoardMobile =
49
192
  /** @class */
50
193
  function (_super) {
@@ -53,18 +196,113 @@ function (_super) {
53
196
  function SignBoardMobile() {
54
197
  var _this = _super !== null && _super.apply(this, arguments) || this;
55
198
 
56
- _this.state = {};
199
+ _this.state = {
200
+ storeInfo: null,
201
+ isFollow: false
202
+ };
203
+
204
+ _this.getStoreInfo = function () {
205
+ return __awaiter(_this, void 0, void 0, function () {
206
+ var storeId, res, isFollow;
207
+ return __generator(this, function (_a) {
208
+ switch (_a.label) {
209
+ case 0:
210
+ storeId = window.magicDesign.storeId;
211
+ if (!storeId) return [3
212
+ /*break*/
213
+ , 3];
214
+ return [4
215
+ /*yield*/
216
+ , (0, _commonUtil.commonFetch)("/designer/v1/h5/store/detail/" + storeId, {}, 'GET')];
217
+
218
+ case 1:
219
+ res = _a.sent();
220
+ return [4
221
+ /*yield*/
222
+ , (0, _commonUtil.commonFetch)('/designer/v1/h5/collection/store/check', {
223
+ storeId: storeId
224
+ })];
225
+
226
+ case 2:
227
+ isFollow = _a.sent();
228
+ console.log('---d', res);
229
+ this.setState({
230
+ storeInfo: res,
231
+ isFollow: isFollow
232
+ });
233
+ _a.label = 3;
234
+
235
+ case 3:
236
+ return [2
237
+ /*return*/
238
+ ];
239
+ }
240
+ });
241
+ });
242
+ };
243
+
244
+ _this.clickCollect = function () {
245
+ return __awaiter(_this, void 0, void 0, function () {
246
+ var storeId, isFollow, error_1;
247
+ return __generator(this, function (_a) {
248
+ switch (_a.label) {
249
+ case 0:
250
+ storeId = window.magicDesign.storeId;
251
+ isFollow = this.state.isFollow;
252
+ if (!storeId) return [3
253
+ /*break*/
254
+ , 4];
255
+ _a.label = 1;
256
+
257
+ case 1:
258
+ _a.trys.push([1, 3,, 4]);
57
259
 
58
- _this.clickCollect = function () {};
260
+ return [4
261
+ /*yield*/
262
+ , (0, _commonUtil.commonFetch)('/h5/collection/store', {
263
+ storeId: storeId,
264
+ operationType: !isFollow ? 'D' : 'A'
265
+ }, 'post')];
266
+
267
+ case 2:
268
+ _a.sent();
269
+
270
+ this.setState({
271
+ isFollow: !isFollow
272
+ });
273
+ return [3
274
+ /*break*/
275
+ , 4];
276
+
277
+ case 3:
278
+ error_1 = _a.sent();
279
+ console.log(error_1);
280
+ return [3
281
+ /*break*/
282
+ , 4];
283
+
284
+ case 4:
285
+ return [2
286
+ /*return*/
287
+ ];
288
+ }
289
+ });
290
+ });
291
+ };
59
292
 
60
293
  return _this;
61
294
  }
62
295
 
63
- SignBoardMobile.prototype.componentDidMount = function () {};
296
+ SignBoardMobile.prototype.componentDidMount = function () {
297
+ this.getStoreInfo();
298
+ };
64
299
 
65
300
  SignBoardMobile.prototype.render = function () {
66
301
  var data = this.props.data;
67
- console.log('----SignBoard ', data);
302
+ console.log('--SignBoard', data);
303
+ var _a = this.state,
304
+ storeInfo = _a.storeInfo,
305
+ isFollow = _a.isFollow;
68
306
  return /*#__PURE__*/_react["default"].createElement("div", {
69
307
  className: "m-sign-board-bar"
70
308
  }, /*#__PURE__*/_react["default"].createElement("div", {
@@ -83,22 +321,22 @@ function (_super) {
83
321
  className: "store-info-wrap"
84
322
  }, /*#__PURE__*/_react["default"].createElement("img", {
85
323
  className: "store-logo",
86
- src: _defaultImg["default"]
324
+ src: (storeInfo === null || storeInfo === void 0 ? void 0 : storeInfo.storeLogoUrl) || _defaultImg["default"]
87
325
  }), /*#__PURE__*/_react["default"].createElement("div", {
88
326
  className: "store-name"
89
- }, "dsd"), /*#__PURE__*/_react["default"].createElement("div", {
327
+ }, (storeInfo === null || storeInfo === void 0 ? void 0 : storeInfo.storeName) || 'Whale Store'), /*#__PURE__*/_react["default"].createElement("div", {
90
328
  onClick: this.clickCollect
91
329
  }, /*#__PURE__*/_react["default"].createElement(_common.Iconfont, {
92
- color: "#333333",
330
+ color: isFollow ? '#F1600F' : '#333333',
93
331
  size: (0, _commonUtil.convertToRem)(24),
94
- type: "icon-HeartStraight"
332
+ type: isFollow ? 'icon-HeartStraight_fill' : 'icon-HeartStraight'
95
333
  }))), /*#__PURE__*/_react["default"].createElement("div", {
96
334
  className: "store-info-wrap"
97
335
  }, /*#__PURE__*/_react["default"].createElement("div", {
98
336
  className: "number"
99
- }, /*#__PURE__*/_react["default"].createElement("span", null, "98% "), " Positive"), /*#__PURE__*/_react["default"].createElement("div", {
337
+ }, /*#__PURE__*/_react["default"].createElement("span", null, (storeInfo === null || storeInfo === void 0 ? void 0 : storeInfo.storeEvalValue) || '98%', " "), " Positive"), /*#__PURE__*/_react["default"].createElement("div", {
100
338
  className: "number"
101
- }, /*#__PURE__*/_react["default"].createElement("span", null, "1000+ "), " Followers"), /*#__PURE__*/_react["default"].createElement("div", {
339
+ }, /*#__PURE__*/_react["default"].createElement("span", null, (storeInfo === null || storeInfo === void 0 ? void 0 : storeInfo.userCollectionNum) || '1000+', " "), " Followers"), /*#__PURE__*/_react["default"].createElement("div", {
102
340
  className: "chat-btn"
103
341
  }, "CHAT")));
104
342
  };