@fonixtree/magic-design 1.0.60 → 1.0.62

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", {
@@ -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
  }
@@ -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", {
@@ -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
  }
@@ -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.62",
5
5
  "description": "Magic Design",
6
6
  "license": "MIT",
7
7
  "module": "es/index.js",