@fonixtree/magic-design 1.0.60 → 1.0.64

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.
@@ -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
 
@@ -13,7 +13,7 @@ var _reactCropper = _interopRequireDefault(require("react-cropper"));
13
13
 
14
14
  require("cropperjs/dist/cropper.css");
15
15
 
16
- var _indexModule = _interopRequireDefault(require("./index.module.less"));
16
+ require("./index.less");
17
17
 
18
18
  var _locale = require("../../locale");
19
19
 
@@ -99,7 +99,7 @@ function (_super) {
99
99
  var _this = this;
100
100
 
101
101
  return /*#__PURE__*/_react["default"].createElement("div", {
102
- className: _indexModule["default"].cropperModalWrap
102
+ className: "cropperModalWrap"
103
103
  }, /*#__PURE__*/_react["default"].createElement(_reactCropper["default"], {
104
104
  aspectRatio: 1,
105
105
  className: "company-logo-cropper",
@@ -111,7 +111,7 @@ function (_super) {
111
111
  viewMode: 1,
112
112
  zoomable: false
113
113
  }), /*#__PURE__*/_react["default"].createElement("div", {
114
- className: _indexModule["default"].btnWrap
114
+ className: "btnWrap"
115
115
  }, /*#__PURE__*/_react["default"].createElement("span", {
116
116
  onClick: this.props.onClose
117
117
  }, (0, _locale.i18n)('CANCEL')), /*#__PURE__*/_react["default"].createElement("span", {
@@ -3,7 +3,7 @@
3
3
  position: fixed;
4
4
  z-index: 1000;
5
5
  top: 0;
6
- bottom: 0;
6
+ bottom: 60px;
7
7
  left: 0;
8
8
  right: 0;
9
9
  display: flex;
@@ -16,9 +16,11 @@
16
16
  font-size: 18px;
17
17
  position: absolute;
18
18
  bottom: 10px;
19
+
19
20
  &:first-child {
20
21
  left: 12px;
21
22
  }
23
+
22
24
  &:last-child {
23
25
  right: 12px;
24
26
  }
@@ -255,7 +255,10 @@ function (_super) {
255
255
 
256
256
  _this.state = {
257
257
  messageNum: '',
258
- userInfo: currentUser
258
+ userInfo: currentUser,
259
+ loading: false,
260
+ selectedImgFile: {},
261
+ editImgModalVisible: false
259
262
  };
260
263
 
261
264
  _this.getNum = function (v) {
@@ -385,7 +388,9 @@ function (_super) {
385
388
  return {
386
389
  userInfo: __assign(__assign({}, preState.userInfo), {
387
390
  photo: params.photo
388
- })
391
+ }),
392
+ loading: false,
393
+ editImgModalVisible: false
389
394
  };
390
395
  });
391
396
  return [2
@@ -397,6 +402,12 @@ function (_super) {
397
402
  };
398
403
 
399
404
  _this.onUploadImg = function (formData) {
405
+ if (_this.state.loading) return;
406
+
407
+ _this.setState({
408
+ loading: true
409
+ });
410
+
400
411
  fetch('/designer/v1/h5/image', {
401
412
  method: 'POST',
402
413
  body: formData
@@ -415,10 +426,6 @@ function (_super) {
415
426
  return;
416
427
  }
417
428
 
418
- _this.setState({
419
- editImgModalVisible: false
420
- });
421
-
422
429
  _this.modifyPhoto({
423
430
  photo: responseData.fileUrl
424
431
  });
@@ -428,6 +435,10 @@ function (_super) {
428
435
  message: err === null || err === void 0 ? void 0 : err.data,
429
436
  duration: 5000
430
437
  });
438
+
439
+ _this.setState({
440
+ loading: false
441
+ });
431
442
  });
432
443
  };
433
444
 
@@ -548,10 +559,7 @@ function (_super) {
548
559
  };
549
560
 
550
561
  PersonalInfoMobile.defaultProps = {
551
- data: {
552
- selectedImgFile: {},
553
- editImgModalVisible: false
554
- }
562
+ data: {}
555
563
  };
556
564
  return PersonalInfoMobile;
557
565
  }(_react["default"].Component);
@@ -305,16 +305,19 @@ var navigateTo = function navigateTo(url, state) {
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);
315
318
  window.magicDesign.history.push({
316
- pathname: url,
317
- state: __assign({}, state)
319
+ pathname: h5Url,
320
+ state: state
318
321
  });
319
322
  } else if (window.magicDesign.navigatePreUrl) {
320
323
  // 预览模式跳转
@@ -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
 
@@ -13,7 +13,7 @@ var _reactCropper = _interopRequireDefault(require("react-cropper"));
13
13
 
14
14
  require("cropperjs/dist/cropper.css");
15
15
 
16
- var _indexModule = _interopRequireDefault(require("./index.module.less"));
16
+ require("./index.less");
17
17
 
18
18
  var _locale = require("../../locale");
19
19
 
@@ -99,7 +99,7 @@ function (_super) {
99
99
  var _this = this;
100
100
 
101
101
  return /*#__PURE__*/_react["default"].createElement("div", {
102
- className: _indexModule["default"].cropperModalWrap
102
+ className: "cropperModalWrap"
103
103
  }, /*#__PURE__*/_react["default"].createElement(_reactCropper["default"], {
104
104
  aspectRatio: 1,
105
105
  className: "company-logo-cropper",
@@ -111,7 +111,7 @@ function (_super) {
111
111
  viewMode: 1,
112
112
  zoomable: false
113
113
  }), /*#__PURE__*/_react["default"].createElement("div", {
114
- className: _indexModule["default"].btnWrap
114
+ className: "btnWrap"
115
115
  }, /*#__PURE__*/_react["default"].createElement("span", {
116
116
  onClick: this.props.onClose
117
117
  }, (0, _locale.i18n)('CANCEL')), /*#__PURE__*/_react["default"].createElement("span", {
@@ -3,7 +3,7 @@
3
3
  position: fixed;
4
4
  z-index: 1000;
5
5
  top: 0;
6
- bottom: 0;
6
+ bottom: 60px;
7
7
  left: 0;
8
8
  right: 0;
9
9
  display: flex;
@@ -16,9 +16,11 @@
16
16
  font-size: 18px;
17
17
  position: absolute;
18
18
  bottom: 10px;
19
+
19
20
  &:first-child {
20
21
  left: 12px;
21
22
  }
23
+
22
24
  &:last-child {
23
25
  right: 12px;
24
26
  }
@@ -255,7 +255,10 @@ function (_super) {
255
255
 
256
256
  _this.state = {
257
257
  messageNum: '',
258
- userInfo: currentUser
258
+ userInfo: currentUser,
259
+ loading: false,
260
+ selectedImgFile: {},
261
+ editImgModalVisible: false
259
262
  };
260
263
 
261
264
  _this.getNum = function (v) {
@@ -385,7 +388,9 @@ function (_super) {
385
388
  return {
386
389
  userInfo: __assign(__assign({}, preState.userInfo), {
387
390
  photo: params.photo
388
- })
391
+ }),
392
+ loading: false,
393
+ editImgModalVisible: false
389
394
  };
390
395
  });
391
396
  return [2
@@ -397,6 +402,12 @@ function (_super) {
397
402
  };
398
403
 
399
404
  _this.onUploadImg = function (formData) {
405
+ if (_this.state.loading) return;
406
+
407
+ _this.setState({
408
+ loading: true
409
+ });
410
+
400
411
  fetch('/designer/v1/h5/image', {
401
412
  method: 'POST',
402
413
  body: formData
@@ -415,10 +426,6 @@ function (_super) {
415
426
  return;
416
427
  }
417
428
 
418
- _this.setState({
419
- editImgModalVisible: false
420
- });
421
-
422
429
  _this.modifyPhoto({
423
430
  photo: responseData.fileUrl
424
431
  });
@@ -428,6 +435,10 @@ function (_super) {
428
435
  message: err === null || err === void 0 ? void 0 : err.data,
429
436
  duration: 5000
430
437
  });
438
+
439
+ _this.setState({
440
+ loading: false
441
+ });
431
442
  });
432
443
  };
433
444
 
@@ -548,10 +559,7 @@ function (_super) {
548
559
  };
549
560
 
550
561
  PersonalInfoMobile.defaultProps = {
551
- data: {
552
- selectedImgFile: {},
553
- editImgModalVisible: false
554
- }
562
+ data: {}
555
563
  };
556
564
  return PersonalInfoMobile;
557
565
  }(_react["default"].Component);
@@ -305,16 +305,19 @@ var navigateTo = function navigateTo(url, state) {
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);
315
318
  window.magicDesign.history.push({
316
- pathname: url,
317
- state: __assign({}, state)
319
+ pathname: h5Url,
320
+ state: state
318
321
  });
319
322
  } else if (window.magicDesign.navigatePreUrl) {
320
323
  // 预览模式跳转
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fonixtree/magic-design",
3
3
  "author": "Cylon Team",
4
- "version": "1.0.60",
4
+ "version": "1.0.64",
5
5
  "description": "Magic Design",
6
6
  "license": "MIT",
7
7
  "module": "es/index.js",