@fonixtree/magic-design 2.0.84 → 2.0.86

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 (65) hide show
  1. package/es/common/CountDown/index.js +20 -11
  2. package/es/common/CropperModal/index.js +126 -0
  3. package/es/common/CropperModal/index.less +29 -0
  4. package/es/common/GroupList/index.js +2 -0
  5. package/es/common/LinkModal/AffiliateStore/index.js +332 -0
  6. package/es/common/LinkModal/index.js +6 -0
  7. package/es/common/UrlPicker/index.js +1 -10
  8. package/es/common/index.js +8 -0
  9. package/es/composite-comp/dito/components/CommonFunctions/defaultJSON.js +8 -4
  10. package/es/composite-comp/dito/components/CommonFunctions/mobile/index.js +6 -4
  11. package/es/composite-comp/dito/components/CommonFunctions/mobile/index.less +2 -2
  12. package/es/composite-comp/dito/components/Orders/defaultJSON.js +2 -2
  13. package/es/composite-comp/dito/components/Orders/mobile/index.js +17 -8
  14. package/es/composite-comp/dito/components/Orders/mobile/index.less +2 -6
  15. package/es/composite-comp/dito/components/PersonalInformation/defaultJSON.js +1 -1
  16. package/es/composite-comp/dito/components/PersonalInformation/mobile/index.js +147 -11
  17. package/es/composite-comp/dito/components/PersonalInformation/mobile/index.less +26 -20
  18. package/es/composite-comp/dito/config-panels/OrdersConfig/ConfigGroup/index.js +4 -1
  19. package/es/composite-comp/dito/second-config-panels/CommonFunctionsSecondConfig/index.js +1 -2
  20. package/es/composite-comp/dito/second-config-panels/OrdersSecondConfig/index.js +4 -4
  21. package/es/composite-comp/dito/second-config-panels/PersonalInformationSecondConfig/index.js +2 -2
  22. package/es/constants/index.js +3 -3
  23. package/es/core/Designer/ToolBarModal/index.js +5 -1
  24. package/es/core/Renderer/index.js +3 -1
  25. package/es/decorator/compositeDecorator.js +9 -5
  26. package/es/locale/en/en.json +5 -5
  27. package/es/locale/es/es.json +5 -5
  28. package/es/locale/id/id.json +5 -5
  29. package/es/meta-comp/config-panels/TextConfig/index.js +1 -1
  30. package/es/utils/commonUtil.js +12 -5
  31. package/es/utils/coreUtil.js +3 -2
  32. package/lib/common/CountDown/index.js +20 -11
  33. package/lib/common/CropperModal/index.js +126 -0
  34. package/lib/common/CropperModal/index.less +29 -0
  35. package/lib/common/GroupList/index.js +2 -0
  36. package/lib/common/LinkModal/AffiliateStore/index.js +332 -0
  37. package/lib/common/LinkModal/index.js +6 -0
  38. package/lib/common/UrlPicker/index.js +1 -10
  39. package/lib/common/index.js +8 -0
  40. package/lib/composite-comp/dito/components/CommonFunctions/defaultJSON.js +8 -4
  41. package/lib/composite-comp/dito/components/CommonFunctions/mobile/index.js +6 -4
  42. package/lib/composite-comp/dito/components/CommonFunctions/mobile/index.less +2 -2
  43. package/lib/composite-comp/dito/components/Orders/defaultJSON.js +2 -2
  44. package/lib/composite-comp/dito/components/Orders/mobile/index.js +17 -8
  45. package/lib/composite-comp/dito/components/Orders/mobile/index.less +2 -6
  46. package/lib/composite-comp/dito/components/PersonalInformation/defaultJSON.js +1 -1
  47. package/lib/composite-comp/dito/components/PersonalInformation/mobile/index.js +147 -11
  48. package/lib/composite-comp/dito/components/PersonalInformation/mobile/index.less +26 -20
  49. package/lib/composite-comp/dito/config-panels/OrdersConfig/ConfigGroup/index.js +4 -1
  50. package/lib/composite-comp/dito/second-config-panels/CommonFunctionsSecondConfig/index.js +1 -2
  51. package/lib/composite-comp/dito/second-config-panels/OrdersSecondConfig/index.js +4 -4
  52. package/lib/composite-comp/dito/second-config-panels/PersonalInformationSecondConfig/index.js +2 -2
  53. package/lib/constants/index.js +3 -3
  54. package/lib/core/Designer/ToolBarModal/index.js +5 -1
  55. package/lib/core/Renderer/index.js +3 -1
  56. package/lib/decorator/compositeDecorator.js +9 -5
  57. package/lib/locale/en/en.json +5 -5
  58. package/lib/locale/es/es.json +5 -5
  59. package/lib/locale/id/id.json +5 -5
  60. package/lib/meta-comp/config-panels/TextConfig/index.js +1 -1
  61. package/lib/utils/commonUtil.js +12 -5
  62. package/lib/utils/coreUtil.js +3 -2
  63. package/package.json +2 -1
  64. package/es/composite-comp/dito/second-config-panels/CommonFunctionsSecondConfig/index.less +0 -1
  65. package/lib/composite-comp/dito/second-config-panels/CommonFunctionsSecondConfig/index.less +0 -1
@@ -1,13 +1,14 @@
1
1
  {
2
- "RETURN": "Return",
3
- "RATING": "Rating",
2
+ "SUBMIT": "Submit",
3
+ "CANCELLED": "Cancelled",
4
+ "DONE": "Hecho",
4
5
  "TO_RECEIVE": "To Receive",
5
6
  "TO_SHIP": "To ship",
6
7
  "TO_PAY": "To Pay",
7
8
  "VIEW_ALL_ORDERS": "View All Orders",
8
- "ORDERS": "ORDERS",
9
+ "ORDERS": "Orders",
9
10
  "RECENTLY_VIEWED": "Recently Viewed",
10
- "COUPONS": "Coupons",
11
+ "VOUCHERS": "Vouchers",
11
12
  "STORES": "Stores",
12
13
  "WISHLIST": "Wishlist",
13
14
  "IMAGE_NAME_IS_TOO_LONG": "Image name is too long",
@@ -128,7 +129,6 @@
128
129
  "MOVE_DOWN": "Mover hacia abajo",
129
130
  "COPY": "Copiar",
130
131
  "DELETE": "Eliminar",
131
- "DONE": "Hecho",
132
132
  "ADD_COMPONENT": "Agregar Componente",
133
133
  "ALL": "TODO",
134
134
  "HOT": "Caliente",
@@ -1,13 +1,14 @@
1
1
  {
2
- "RETURN": "Return",
3
- "RATING": "Rating",
2
+ "SUBMIT": "Submit",
3
+ "CANCELLED": "Cancelled",
4
+ "DONE": "Done",
4
5
  "TO_RECEIVE": "To Receive",
5
6
  "TO_SHIP": "To ship",
6
7
  "TO_PAY": "To Pay",
7
8
  "VIEW_ALL_ORDERS": "View All Orders",
8
- "ORDERS": "ORDERS",
9
+ "ORDERS": "Orders",
9
10
  "RECENTLY_VIEWED": "Recently Viewed",
10
- "COUPONS": "Coupons",
11
+ "VOUCHERS": "Vouchers",
11
12
  "STORES": "Stores",
12
13
  "WISHLIST": "Wishlist",
13
14
  "IMAGE_NAME_IS_TOO_LONG": "Image name is too long",
@@ -128,7 +129,6 @@
128
129
  "MOVE_DOWN": "Move Down",
129
130
  "COPY": "Copy",
130
131
  "DELETE": "Delete",
131
- "DONE": "Done",
132
132
  "ADD_COMPONENT": "Add Component",
133
133
  "ALL": "ALL",
134
134
  "HOT": "Hot",
@@ -278,7 +278,7 @@ function (_super) {
278
278
  showBgColor: true,
279
279
  showTextAlign: true,
280
280
  value: textData
281
- })), /*#__PURE__*/_react["default"].createElement(_common.Field, {
281
+ })), window.magicDesign.outputType != 'html' && /*#__PURE__*/_react["default"].createElement(_common.Field, {
282
282
  split: true,
283
283
  title: "URL"
284
284
  }, /*#__PURE__*/_react["default"].createElement(_common.UrlPicker, {
@@ -296,7 +296,7 @@ function commonFetch(url, data, method) {
296
296
  });
297
297
  }
298
298
 
299
- var navigateTo = function navigateTo(url) {
299
+ var navigateTo = function navigateTo(url, state) {
300
300
  console.log(url);
301
301
 
302
302
  if (!url) {
@@ -305,13 +305,20 @@ var navigateTo = function navigateTo(url) {
305
305
 
306
306
  var _a = url.split(';'),
307
307
  h5Url = _a[0],
308
- appUrl = _a[1]; // 未配置App路径并且h5绝对路径时直接跳转,其他情况让业务层处理
308
+ appUrl = _a[1];
309
+
310
+ if (appUrl && (0, _androidUtil.browserVersion)().isApp) {
311
+ window.location.href = appUrl;
312
+ } // 未配置App路径并且h5绝对路径时直接跳转,其他情况让业务层处理
309
313
 
310
314
 
311
315
  if (!appUrl && !h5Url.startsWith('/')) {
312
316
  window.location.href = h5Url;
313
317
  } else if (window.magicDesign.history) {
314
- window.magicDesign.history.push(url);
318
+ window.magicDesign.history.push({
319
+ pathname: h5Url,
320
+ state: state
321
+ });
315
322
  } else if (window.magicDesign.navigatePreUrl) {
316
323
  // 预览模式跳转
317
324
  if (h5Url.startsWith('/')) {
@@ -349,7 +356,7 @@ function goLogin(state, replaceFlag) {
349
356
  var signUrl = isFromSf === 'Y' ? '/sign-in-opt' : '/sign-in';
350
357
 
351
358
  if (replaceFlag) {
352
- Fishx.history.replace({
359
+ window.magicDesign.history.replace({
353
360
  pathname: signUrl,
354
361
  state: state
355
362
  });
@@ -752,7 +759,7 @@ function pushGA(data, eventName) {
752
759
  elementName: data.elementName
753
760
  };
754
761
  console.log('GA push', eventName, eventData);
755
- window.gtag('event', eventName, eventData);
762
+ if (window.gtag) window.gtag('event', eventName, eventData);
756
763
  }
757
764
  } catch (error) {
758
765
  console.error(error);
@@ -341,11 +341,12 @@ var clickUrl = function clickUrl(url) {
341
341
  if ((0, _androidUtil.browserVersion)().isAshitaApp) {
342
342
  (0, _androidUtil.sendToApp)(data);
343
343
  } else if ((0, _androidUtil.browserVersion)().isApp && params.link && params.link.startsWith('http')) {
344
- // 兼容Nuri的 绝对路径跳转
344
+ var urlTemp = "" + params.link + (params.link.includes('?') ? '&' : '?') + "userToken=" + (localStorage.getItem('h5Token') || ''); // 兼容Nuri的 绝对路径跳转
345
+
345
346
  (0, _androidUtil.sendToAndroid)({
346
347
  type: 'jumpBrowser',
347
348
  params: {
348
- url: params.link
349
+ url: urlTemp
349
350
  }
350
351
  });
351
352
  } else {
@@ -57,9 +57,11 @@ function (_super) {
57
57
  hour: '00',
58
58
  min: '00',
59
59
  second: '00',
60
- nowTime: _this.props.now
60
+ nowTime: Number(_this.props.now),
61
+ now: _this.props.now
61
62
  };
62
63
  _this.timer = null;
64
+ _this.preTime = '';
63
65
 
64
66
  _this.componentWillUnmount = function () {
65
67
  _this.clearTimer();
@@ -112,19 +114,26 @@ function (_super) {
112
114
  return _this;
113
115
  }
114
116
 
115
- CountDown.prototype.componentWillReceiveProps = function (nextProps) {
116
- var _this = this;
117
-
118
- if (nextProps.now !== this.props.now) {
119
- this.setState({
117
+ CountDown.getDerivedStateFromProps = function (nextProps, prevState) {
118
+ // 检查是否需要更新sortType
119
+ if (nextProps.now !== prevState.now) {
120
+ return {
121
+ now: nextProps.now,
120
122
  nowTime: nextProps.now
121
- }, function () {
122
- _this.clearTimer();
123
+ };
124
+ }
125
+
126
+ return null;
127
+ };
123
128
 
124
- _this.calcLastTime();
129
+ CountDown.prototype.componentDidUpdate = function () {
130
+ var now = this.state.now;
125
131
 
126
- _this.timer = setInterval(_this.calcLastTime, 1000);
127
- });
132
+ if (this.preTime != now) {
133
+ this.preTime = now;
134
+ this.clearTimer();
135
+ this.calcLastTime();
136
+ this.timer = setInterval(this.calcLastTime, 1000);
128
137
  }
129
138
  };
130
139
 
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = void 0;
9
+
10
+ var _react = _interopRequireWildcard(require("react"));
11
+
12
+ var _reactCropper = _interopRequireDefault(require("react-cropper"));
13
+
14
+ require("cropperjs/dist/cropper.css");
15
+
16
+ require("./index.less");
17
+
18
+ var _locale = require("../../locale");
19
+
20
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
21
+
22
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
23
+
24
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
+
26
+ var __extends = void 0 && (void 0).__extends || function () {
27
+ var _extendStatics = function extendStatics(d, b) {
28
+ _extendStatics = Object.setPrototypeOf || {
29
+ __proto__: []
30
+ } instanceof Array && function (d, b) {
31
+ d.__proto__ = b;
32
+ } || function (d, b) {
33
+ for (var p in b) {
34
+ if (b.hasOwnProperty(p)) d[p] = b[p];
35
+ }
36
+ };
37
+
38
+ return _extendStatics(d, b);
39
+ };
40
+
41
+ return function (d, b) {
42
+ _extendStatics(d, b);
43
+
44
+ function __() {
45
+ this.constructor = d;
46
+ }
47
+
48
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
49
+ };
50
+ }();
51
+
52
+ var AComponent =
53
+ /** @class */
54
+ function (_super) {
55
+ __extends(AComponent, _super);
56
+
57
+ function AComponent() {
58
+ var _this = _super !== null && _super.apply(this, arguments) || this;
59
+
60
+ _this.state = {
61
+ src: ''
62
+ };
63
+
64
+ _this.onSubmit = function () {
65
+ _this.cropper.getCroppedCanvas().toBlob(function (blob) {
66
+ var fileName = _this.props.uploadedImageFile.name; // Vovi手机没有图片后缀
67
+
68
+ if (fileName && fileName.lastIndexOf('.') === -1) {
69
+ fileName = "file_" + new Date().getTime() + ".jpg";
70
+ }
71
+
72
+ var formData = new FormData();
73
+ formData.append('file', blob, fileName);
74
+
75
+ _this.props.onSubmit(formData);
76
+ });
77
+ };
78
+
79
+ return _this;
80
+ }
81
+
82
+ AComponent.prototype.componentDidMount = function () {
83
+ var _this = this;
84
+
85
+ var fileReader = new FileReader();
86
+
87
+ fileReader.onload = function (e) {
88
+ var dataURL = e.target.result;
89
+
90
+ _this.setState({
91
+ src: dataURL
92
+ });
93
+ };
94
+
95
+ fileReader.readAsDataURL(this.props.uploadedImageFile);
96
+ };
97
+
98
+ AComponent.prototype.render = function () {
99
+ var _this = this;
100
+
101
+ return /*#__PURE__*/_react["default"].createElement("div", {
102
+ className: "cropperModalWrap"
103
+ }, /*#__PURE__*/_react["default"].createElement(_reactCropper["default"], {
104
+ aspectRatio: 1,
105
+ className: "company-logo-cropper",
106
+ guides: false,
107
+ onInitialized: function onInitialized(cop) {
108
+ _this.cropper = cop;
109
+ },
110
+ src: this.state.src,
111
+ viewMode: 1,
112
+ zoomable: false
113
+ }), /*#__PURE__*/_react["default"].createElement("div", {
114
+ className: "btnWrap"
115
+ }, /*#__PURE__*/_react["default"].createElement("span", {
116
+ onClick: this.props.onClose
117
+ }, (0, _locale.i18n)('CANCEL')), /*#__PURE__*/_react["default"].createElement("span", {
118
+ onClick: this.onSubmit
119
+ }, (0, _locale.i18n)('SUBMIT'))));
120
+ };
121
+
122
+ return AComponent;
123
+ }(_react.Component);
124
+
125
+ var _default = AComponent;
126
+ exports["default"] = _default;
@@ -0,0 +1,29 @@
1
+ .cropperModalWrap {
2
+ background: #000;
3
+ position: fixed;
4
+ z-index: 1000;
5
+ top: 0;
6
+ bottom: 0;
7
+ left: 0;
8
+ right: 0;
9
+ display: flex;
10
+ justify-content: center;
11
+ align-items: center;
12
+
13
+ .btnWrap {
14
+ span {
15
+ color: #fff;
16
+ font-size: 18px;
17
+ position: absolute;
18
+ bottom: 10px;
19
+
20
+ &:first-child {
21
+ left: 12px;
22
+ }
23
+
24
+ &:last-child {
25
+ right: 12px;
26
+ }
27
+ }
28
+ }
29
+ }
@@ -121,6 +121,8 @@ function (_super) {
121
121
  _this.setState({});
122
122
 
123
123
  (0, _coreUtil.renderPreview)();
124
+
125
+ _this.props.reRender();
124
126
  };
125
127
 
126
128
  _this.deleteItem = function (e, item) {
@@ -0,0 +1,332 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = AffiliateStore;
9
+
10
+ var _react = _interopRequireWildcard(require("react"));
11
+
12
+ var _antd = require("antd");
13
+
14
+ var _commonUtil = require("../../../utils/commonUtil");
15
+
16
+ var _locale = require("../../../locale");
17
+
18
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
+
20
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
+
22
+ var __assign = void 0 && (void 0).__assign || function () {
23
+ __assign = Object.assign || function (t) {
24
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
25
+ s = arguments[i];
26
+
27
+ for (var p in s) {
28
+ if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
29
+ }
30
+ }
31
+
32
+ return t;
33
+ };
34
+
35
+ return __assign.apply(this, arguments);
36
+ };
37
+
38
+ var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
39
+ function adopt(value) {
40
+ return value instanceof P ? value : new P(function (resolve) {
41
+ resolve(value);
42
+ });
43
+ }
44
+
45
+ return new (P || (P = Promise))(function (resolve, reject) {
46
+ function fulfilled(value) {
47
+ try {
48
+ step(generator.next(value));
49
+ } catch (e) {
50
+ reject(e);
51
+ }
52
+ }
53
+
54
+ function rejected(value) {
55
+ try {
56
+ step(generator["throw"](value));
57
+ } catch (e) {
58
+ reject(e);
59
+ }
60
+ }
61
+
62
+ function step(result) {
63
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
64
+ }
65
+
66
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
67
+ });
68
+ };
69
+
70
+ var __generator = void 0 && (void 0).__generator || function (thisArg, body) {
71
+ var _ = {
72
+ label: 0,
73
+ sent: function sent() {
74
+ if (t[0] & 1) throw t[1];
75
+ return t[1];
76
+ },
77
+ trys: [],
78
+ ops: []
79
+ },
80
+ f,
81
+ y,
82
+ t,
83
+ g;
84
+ return g = {
85
+ next: verb(0),
86
+ "throw": verb(1),
87
+ "return": verb(2)
88
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
89
+ return this;
90
+ }), g;
91
+
92
+ function verb(n) {
93
+ return function (v) {
94
+ return step([n, v]);
95
+ };
96
+ }
97
+
98
+ function step(op) {
99
+ if (f) throw new TypeError("Generator is already executing.");
100
+
101
+ while (_) {
102
+ try {
103
+ 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;
104
+ if (y = 0, t) op = [op[0] & 2, t.value];
105
+
106
+ switch (op[0]) {
107
+ case 0:
108
+ case 1:
109
+ t = op;
110
+ break;
111
+
112
+ case 4:
113
+ _.label++;
114
+ return {
115
+ value: op[1],
116
+ done: false
117
+ };
118
+
119
+ case 5:
120
+ _.label++;
121
+ y = op[1];
122
+ op = [0];
123
+ continue;
124
+
125
+ case 7:
126
+ op = _.ops.pop();
127
+
128
+ _.trys.pop();
129
+
130
+ continue;
131
+
132
+ default:
133
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
134
+ _ = 0;
135
+ continue;
136
+ }
137
+
138
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
139
+ _.label = op[1];
140
+ break;
141
+ }
142
+
143
+ if (op[0] === 6 && _.label < t[1]) {
144
+ _.label = t[1];
145
+ t = op;
146
+ break;
147
+ }
148
+
149
+ if (t && _.label < t[2]) {
150
+ _.label = t[2];
151
+
152
+ _.ops.push(op);
153
+
154
+ break;
155
+ }
156
+
157
+ if (t[2]) _.ops.pop();
158
+
159
+ _.trys.pop();
160
+
161
+ continue;
162
+ }
163
+
164
+ op = body.call(thisArg, _);
165
+ } catch (e) {
166
+ op = [6, e];
167
+ y = 0;
168
+ } finally {
169
+ f = t = 0;
170
+ }
171
+ }
172
+
173
+ if (op[0] & 5) throw op[1];
174
+ return {
175
+ value: op[0] ? op[1] : void 0,
176
+ done: true
177
+ };
178
+ }
179
+ };
180
+
181
+ var paginationParams = {
182
+ pageSize: 20,
183
+ pageIndex: 1
184
+ };
185
+
186
+ function AffiliateStore(props) {
187
+ var _this = this;
188
+
189
+ var _onChange = props.onChange;
190
+
191
+ var _a = (0, _react.useState)([]),
192
+ storeList = _a[0],
193
+ setStoreList = _a[1];
194
+
195
+ var _b = (0, _react.useState)(false),
196
+ loading = _b[0],
197
+ setLoading = _b[1];
198
+
199
+ var _c = (0, _react.useState)(''),
200
+ storeName = _c[0],
201
+ setStoreName = _c[1];
202
+
203
+ var queryStore = function queryStore(params) {
204
+ return __awaiter(_this, void 0, void 0, function () {
205
+ var res;
206
+ return __generator(this, function (_a) {
207
+ switch (_a.label) {
208
+ case 0:
209
+ setLoading(true);
210
+ return [4
211
+ /*yield*/
212
+ , (0, _commonUtil.commonFetch)("/designer/v1/" + window.magicDesign.MBaseUrl + "/affiliate/store/query/page", params, 'GET')];
213
+
214
+ case 1:
215
+ res = _a.sent();
216
+ paginationParams.total = res.total;
217
+ setStoreList(res.list);
218
+ setLoading(false);
219
+ return [2
220
+ /*return*/
221
+ ];
222
+ }
223
+ });
224
+ });
225
+ };
226
+
227
+ (0, _react.useEffect)(function () {
228
+ queryStore(paginationParams);
229
+ }, []);
230
+ var columns = [{
231
+ title: 'Store ID',
232
+ dataIndex: 'affiliateStoreId'
233
+ }, {
234
+ title: 'Store Name',
235
+ dataIndex: 'storeName'
236
+ }, {
237
+ title: 'Logo',
238
+ dataIndex: 'logo',
239
+ render: function render(val) {
240
+ return /*#__PURE__*/_react["default"].createElement("img", {
241
+ alt: "",
242
+ src: val,
243
+ style: {
244
+ maxWidth: '50px',
245
+ maxHeight: '50px'
246
+ }
247
+ });
248
+ }
249
+ }, {
250
+ title: 'Channel',
251
+ dataIndex: 'bindChannel'
252
+ }];
253
+ var rowSelection = {
254
+ onChange: function onChange(selectedRowKeys, selectedRow) {
255
+ _onChange({
256
+ value: selectedRow[0].affiliateStoreId,
257
+ name: selectedRow[0].storeName
258
+ });
259
+ },
260
+ type: 'radio'
261
+ };
262
+
263
+ var reset = function reset() {
264
+ setStoreName('');
265
+ queryStore(__assign({
266
+ storeName: ''
267
+ }, paginationParams));
268
+ };
269
+
270
+ return /*#__PURE__*/_react["default"].createElement("div", {
271
+ style: {
272
+ height: 550
273
+ }
274
+ }, /*#__PURE__*/_react["default"].createElement(_antd.Form, {
275
+ labelCol: {
276
+ span: 6
277
+ },
278
+ layout: "horizontal"
279
+ }, /*#__PURE__*/_react["default"].createElement(_antd.Row, {
280
+ gutter: 24
281
+ }, /*#__PURE__*/_react["default"].createElement(_antd.Col, {
282
+ span: 12
283
+ }, /*#__PURE__*/_react["default"].createElement(_antd.Form.Item, {
284
+ label: "Store Name"
285
+ }, /*#__PURE__*/_react["default"].createElement(_antd.Input, {
286
+ onChange: function onChange(e) {
287
+ return setStoreName(e.target.value);
288
+ },
289
+ size: "small",
290
+ value: storeName
291
+ }))), /*#__PURE__*/_react["default"].createElement(_antd.Col, {
292
+ span: 6
293
+ }, /*#__PURE__*/_react["default"].createElement(_antd.Button, {
294
+ onClick: function onClick() {
295
+ setLoading(true);
296
+ paginationParams.pageIndex = 1;
297
+ queryStore(__assign({
298
+ storeName: storeName
299
+ }, paginationParams));
300
+ },
301
+ size: "small",
302
+ style: {
303
+ marginRight: 10
304
+ },
305
+ type: "primary"
306
+ }, (0, _locale.i18n)('QUERY')), /*#__PURE__*/_react["default"].createElement(_antd.Button, {
307
+ onClick: function onClick() {
308
+ reset();
309
+ },
310
+ size: "small"
311
+ }, (0, _locale.i18n)('CANCEL'))))), /*#__PURE__*/_react["default"].createElement(_antd.Table, {
312
+ bordered: false,
313
+ columns: columns,
314
+ dataSource: storeList,
315
+ defaultExpandAllRows: true,
316
+ loading: loading,
317
+ pagination: __assign(__assign({}, paginationParams), {
318
+ onChange: function onChange(page) {
319
+ paginationParams.pageIndex = page;
320
+ queryStore(__assign(__assign({}, paginationParams), {
321
+ storeName: storeName
322
+ }));
323
+ },
324
+ showSizeChanger: false
325
+ }),
326
+ rowKey: "affiliateStoreId",
327
+ rowSelection: rowSelection,
328
+ scroll: {
329
+ y: 400
330
+ }
331
+ }));
332
+ }