@fonixtree/magic-design 2.0.194 → 2.0.197

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.
@@ -19,10 +19,10 @@ var _common = require("../../../../../common");
19
19
 
20
20
  var _locale = require("../../../../../locale");
21
21
 
22
- var _storeUtil = require("../../../../../utils/storeUtil");
23
-
24
22
  var _coreUtil = require("../../../../../utils/coreUtil");
25
23
 
24
+ var _mobx = require("../../../../../mobx");
25
+
26
26
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
27
27
 
28
28
  var __extends = void 0 && (void 0).__extends || function () {
@@ -75,24 +75,34 @@ function (_super) {
75
75
  function LocationMobile() {
76
76
  var _this = _super !== null && _super.apply(this, arguments) || this;
77
77
 
78
- _this.state = {};
78
+ _this.state = {
79
+ locationInfo: {}
80
+ };
79
81
  return _this;
80
82
  }
81
83
 
82
- LocationMobile.prototype.componentDidMount = function () {};
84
+ LocationMobile.prototype.componentDidMount = function () {
85
+ var _this = this;
86
+
87
+ this.distroy = (0, _mobx.autorun)(function () {
88
+ _this.setState({
89
+ locationInfo: _mobx.store.locationInfo
90
+ });
91
+ });
92
+ };
83
93
 
84
94
  LocationMobile.prototype.render = function () {
85
95
  var _a;
86
96
 
87
97
  var panelProps = this.props.panelProps;
88
- var info = (0, _storeUtil.getStore)('USER_ADDRESS_INFO') || {};
89
- var customerInfo = info.customer ? info.customer + " " + info.tel : (0, _locale.i18n)('CAN_BE_ADDED_AS_YOUR_ADDRESS');
98
+ var locationInfo = this.state.locationInfo;
99
+ var customerInfo = locationInfo.customer ? locationInfo.customer + " " + locationInfo.tel : (0, _locale.i18n)('CAN_BE_ADDED_AS_YOUR_ADDRESS');
90
100
  return /*#__PURE__*/_react["default"].createElement("div", {
91
101
  className: (0, _classnames["default"])('m-location-mobile', (_a = {}, _a['reversed-layout'] = (0, _commonUtil.needReverse)(), _a))
92
102
  }, /*#__PURE__*/_react["default"].createElement("div", {
93
103
  className: "address-wrap",
94
104
  onClick: function onClick() {
95
- return (0, _coreUtil.clickUrl)('/location');
105
+ return (0, _coreUtil.clickUrl)(locationInfo.address ? '/location' : '/add-location');
96
106
  }
97
107
  }, /*#__PURE__*/_react["default"].createElement("div", {
98
108
  className: "address-bg",
@@ -108,7 +118,7 @@ function (_super) {
108
118
  }, panelProps.content.address.open && /*#__PURE__*/_react["default"].createElement(_components.MetaText, {
109
119
  className: "address one_row",
110
120
  data: __assign(__assign({}, panelProps.content.address), {
111
- text: (0, _coreUtil.isDesignMode)() ? (0, _locale.i18n)('DISPLAY_LOCATION_ADDRESS') : info.address
121
+ text: (0, _coreUtil.isDesignMode)() ? (0, _locale.i18n)('DISPLAY_LOCATION_ADDRESS') : locationInfo.address
112
122
  })
113
123
  }), panelProps.content.customer.open && /*#__PURE__*/_react["default"].createElement(_components.MetaText, {
114
124
  className: "customer one_row",
@@ -19,7 +19,7 @@ var _commonUtil = require("../../../../../utils/commonUtil");
19
19
 
20
20
  var _coreUtil = require("../../../../../utils/coreUtil");
21
21
 
22
- var _storeUtil = require("../../../../../utils/storeUtil");
22
+ var _mobx = require("../../../../../mobx");
23
23
 
24
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
25
25
 
@@ -239,7 +239,8 @@ function (_super) {
239
239
  var _this = _super !== null && _super.apply(this, arguments) || this;
240
240
 
241
241
  _this.state = {
242
- list: []
242
+ list: [],
243
+ locationInfo: {}
243
244
  };
244
245
  _this.sourceType = '1';
245
246
  _this.maxProdNum = 5;
@@ -247,7 +248,7 @@ function (_super) {
247
248
 
248
249
  _this.getData = function () {
249
250
  return __awaiter(_this, void 0, void 0, function () {
250
- var _a, maxProdNum, sourceType, storeIds, params, info, res, list;
251
+ var _a, maxProdNum, sourceType, storeIds, params, locationInfo, res, list;
251
252
 
252
253
  var _b;
253
254
 
@@ -271,11 +272,11 @@ function (_super) {
271
272
  }
272
273
 
273
274
  if ((0, _commonUtil.isLogin)()) {
274
- info = (0, _storeUtil.getStore)('USER_ADDRESS_INFO') || {};
275
+ locationInfo = this.state.locationInfo;
275
276
 
276
- if (info.longitude && info.latitude) {
277
- params.longitude = info.longitude;
278
- params.latitude = info.latitude;
277
+ if (locationInfo.longitude && locationInfo.latitude) {
278
+ params.longitude = locationInfo.longitude;
279
+ params.latitude = locationInfo.latitude;
279
280
  }
280
281
  }
281
282
 
@@ -301,7 +302,16 @@ function (_super) {
301
302
  }
302
303
 
303
304
  Mobile.prototype.componentDidMount = function () {
305
+ var _this = this;
306
+
304
307
  this.getData();
308
+ this.distroy = (0, _mobx.autorun)(function () {
309
+ _this.setState({
310
+ locationInfo: _mobx.store.locationInfo
311
+ }, function () {
312
+ _this.getData();
313
+ });
314
+ });
305
315
  };
306
316
 
307
317
  Mobile.prototype.componentWillReceiveProps = function (nextProps) {
@@ -89,21 +89,21 @@ function compositeDecorator(WrappedComponent) {
89
89
  };
90
90
 
91
91
  _this.switchLanguage = function (value) {
92
- alert(value); // const lang = 'ar';
93
-
94
- (0, _storeUtil.setStore)(_constants.STORAGE_KEY.LOCALE, value);
92
+ // const lang = 'ar';
93
+ (0, _storeUtil.setStore)(_constants.STORAGE_KEY.LOCALE, value); // 实时更新问题待优化;
95
94
  };
96
95
 
97
96
  _this.getUserAddress = function (value) {
98
- alert(value); // const info = {
97
+ // const info = {
99
98
  // address: '简短地址',
100
99
  // customer: '客户名称',
101
100
  // tel: '客户手机号',
102
101
  // longitude: '经度',
103
102
  // latitude: '纬度',
104
103
  // };
105
-
106
- (0, _storeUtil.setStore)('USER_ADDRESS_INFO', value);
104
+ _mobx.store.setState({
105
+ locationInfo: value || {}
106
+ });
107
107
  }; // 复合组件点击事件
108
108
 
109
109
 
package/es/mobx/Store.js CHANGED
@@ -12,7 +12,7 @@ var _storeUtil = require("../utils/storeUtil");
12
12
  var debug = require('debug')('worker:mobx');
13
13
 
14
14
  var CACHE_KEY = 'STORE';
15
- var whiteList = ['hoveredMeta', 'clickedMeta', 'clickedGroup', 'clickedFloor', 'hoveredFloor', 'textSelection', 'MPageData'];
15
+ var whiteList = ['hoveredMeta', 'clickedMeta', 'clickedGroup', 'clickedFloor', 'hoveredFloor', 'textSelection', 'MPageData', 'locationInfo'];
16
16
 
17
17
  var Store =
18
18
  /** @class */
@@ -36,6 +36,8 @@ function () {
36
36
 
37
37
  this.imgGenVisible = false; // 图片生成器是否可见
38
38
 
39
+ this.locationInfo = {}; // 地址组件暂存数据
40
+
39
41
  (0, _mobx.makeObservable)(this, {
40
42
  MPageData: _mobx.observable,
41
43
  hoveredMeta: _mobx.observable,
@@ -45,6 +47,7 @@ function () {
45
47
  hoveredFloor: _mobx.observable,
46
48
  CarouselStore: _mobx.observable,
47
49
  imgGenVisible: _mobx.observable,
50
+ locationInfo: _mobx.observable,
48
51
  setState: _mobx.action.bound
49
52
  });
50
53
  }
@@ -165,7 +165,7 @@ var newParseUrl = function newParseUrl(urlObj) {
165
165
  action: 'jump',
166
166
  params: {
167
167
  type: 'STORE',
168
- url: value
168
+ storeId: value
169
169
  }
170
170
  };
171
171
  break;
@@ -298,7 +298,8 @@ var newParseUrl = function newParseUrl(urlObj) {
298
298
  '/product/GroupBuy': 'GROUP',
299
299
  '/search-page': 'SEARCH_PAGE',
300
300
  '/commission': 'COMMISSION',
301
- '/location': 'ADD_ADDRESS_PAGE'
301
+ '/add-location': 'ADD_ADDRESS_PAGE',
302
+ '/location': 'ADDRESS_PAGE'
302
303
  };
303
304
  var typeTemp = map[link];
304
305
 
@@ -366,8 +367,8 @@ var parseUrl = function parseUrl(url) {
366
367
  action: 'jump',
367
368
  params: {
368
369
  type: 'PRODUCT_DETAIL',
369
- offerId: arg1,
370
- productId: arg2
370
+ offerId: Number(arg1),
371
+ productId: Number(arg2)
371
372
  }
372
373
  };
373
374
  break;
@@ -390,7 +391,7 @@ var parseUrl = function parseUrl(url) {
390
391
  action: 'jump',
391
392
  params: {
392
393
  type: 'STORE',
393
- storeId: arg1
394
+ storeId: Number(arg1)
394
395
  }
395
396
  };
396
397
  break;
@@ -476,7 +477,8 @@ var parseUrl = function parseUrl(url) {
476
477
  '/search-page': 'SEARCH_PAGE',
477
478
  '/main/my-commission': 'WALLET',
478
479
  '/commission': 'COMMISSION',
479
- '/location': 'ADD_ADDRESS_PAGE'
480
+ '/add-location': 'ADD_ADDRESS_PAGE',
481
+ '/location': 'ADDRESS_PAGE'
480
482
  };
481
483
  link = url;
482
484
  params = {
@@ -405,8 +405,8 @@ var clickUrl = function clickUrl(url, state) {
405
405
  (0, _commonUtil.navigateTo)(link, state);
406
406
  }
407
407
  } else if (((_b = window === null || window === void 0 ? void 0 : window.magicDesign) === null || _b === void 0 ? void 0 : _b.projectCode) === 'pto') {
408
- // 输入的是完整的跳转地址
409
- if (isUrl(link)) {
408
+ // 输入的是完整的跳转地址 排除掉‘https://www.baidu.com;mydito://BuyLoad’这种情况
409
+ if (isUrl(link) && !link.includes('mydito://')) {
410
410
  if (!link.includes(window.location.host)) {
411
411
  // 跳转外链 需要把token带上
412
412
  if (link.includes('?')) {
@@ -19,10 +19,10 @@ var _common = require("../../../../../common");
19
19
 
20
20
  var _locale = require("../../../../../locale");
21
21
 
22
- var _storeUtil = require("../../../../../utils/storeUtil");
23
-
24
22
  var _coreUtil = require("../../../../../utils/coreUtil");
25
23
 
24
+ var _mobx = require("../../../../../mobx");
25
+
26
26
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
27
27
 
28
28
  var __extends = void 0 && (void 0).__extends || function () {
@@ -75,24 +75,34 @@ function (_super) {
75
75
  function LocationMobile() {
76
76
  var _this = _super !== null && _super.apply(this, arguments) || this;
77
77
 
78
- _this.state = {};
78
+ _this.state = {
79
+ locationInfo: {}
80
+ };
79
81
  return _this;
80
82
  }
81
83
 
82
- LocationMobile.prototype.componentDidMount = function () {};
84
+ LocationMobile.prototype.componentDidMount = function () {
85
+ var _this = this;
86
+
87
+ this.distroy = (0, _mobx.autorun)(function () {
88
+ _this.setState({
89
+ locationInfo: _mobx.store.locationInfo
90
+ });
91
+ });
92
+ };
83
93
 
84
94
  LocationMobile.prototype.render = function () {
85
95
  var _a;
86
96
 
87
97
  var panelProps = this.props.panelProps;
88
- var info = (0, _storeUtil.getStore)('USER_ADDRESS_INFO') || {};
89
- var customerInfo = info.customer ? info.customer + " " + info.tel : (0, _locale.i18n)('CAN_BE_ADDED_AS_YOUR_ADDRESS');
98
+ var locationInfo = this.state.locationInfo;
99
+ var customerInfo = locationInfo.customer ? locationInfo.customer + " " + locationInfo.tel : (0, _locale.i18n)('CAN_BE_ADDED_AS_YOUR_ADDRESS');
90
100
  return /*#__PURE__*/_react["default"].createElement("div", {
91
101
  className: (0, _classnames["default"])('m-location-mobile', (_a = {}, _a['reversed-layout'] = (0, _commonUtil.needReverse)(), _a))
92
102
  }, /*#__PURE__*/_react["default"].createElement("div", {
93
103
  className: "address-wrap",
94
104
  onClick: function onClick() {
95
- return (0, _coreUtil.clickUrl)('/location');
105
+ return (0, _coreUtil.clickUrl)(locationInfo.address ? '/location' : '/add-location');
96
106
  }
97
107
  }, /*#__PURE__*/_react["default"].createElement("div", {
98
108
  className: "address-bg",
@@ -108,7 +118,7 @@ function (_super) {
108
118
  }, panelProps.content.address.open && /*#__PURE__*/_react["default"].createElement(_components.MetaText, {
109
119
  className: "address one_row",
110
120
  data: __assign(__assign({}, panelProps.content.address), {
111
- text: (0, _coreUtil.isDesignMode)() ? (0, _locale.i18n)('DISPLAY_LOCATION_ADDRESS') : info.address
121
+ text: (0, _coreUtil.isDesignMode)() ? (0, _locale.i18n)('DISPLAY_LOCATION_ADDRESS') : locationInfo.address
112
122
  })
113
123
  }), panelProps.content.customer.open && /*#__PURE__*/_react["default"].createElement(_components.MetaText, {
114
124
  className: "customer one_row",
@@ -19,7 +19,7 @@ var _commonUtil = require("../../../../../utils/commonUtil");
19
19
 
20
20
  var _coreUtil = require("../../../../../utils/coreUtil");
21
21
 
22
- var _storeUtil = require("../../../../../utils/storeUtil");
22
+ var _mobx = require("../../../../../mobx");
23
23
 
24
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
25
25
 
@@ -239,7 +239,8 @@ function (_super) {
239
239
  var _this = _super !== null && _super.apply(this, arguments) || this;
240
240
 
241
241
  _this.state = {
242
- list: []
242
+ list: [],
243
+ locationInfo: {}
243
244
  };
244
245
  _this.sourceType = '1';
245
246
  _this.maxProdNum = 5;
@@ -247,7 +248,7 @@ function (_super) {
247
248
 
248
249
  _this.getData = function () {
249
250
  return __awaiter(_this, void 0, void 0, function () {
250
- var _a, maxProdNum, sourceType, storeIds, params, info, res, list;
251
+ var _a, maxProdNum, sourceType, storeIds, params, locationInfo, res, list;
251
252
 
252
253
  var _b;
253
254
 
@@ -271,11 +272,11 @@ function (_super) {
271
272
  }
272
273
 
273
274
  if ((0, _commonUtil.isLogin)()) {
274
- info = (0, _storeUtil.getStore)('USER_ADDRESS_INFO') || {};
275
+ locationInfo = this.state.locationInfo;
275
276
 
276
- if (info.longitude && info.latitude) {
277
- params.longitude = info.longitude;
278
- params.latitude = info.latitude;
277
+ if (locationInfo.longitude && locationInfo.latitude) {
278
+ params.longitude = locationInfo.longitude;
279
+ params.latitude = locationInfo.latitude;
279
280
  }
280
281
  }
281
282
 
@@ -301,7 +302,16 @@ function (_super) {
301
302
  }
302
303
 
303
304
  Mobile.prototype.componentDidMount = function () {
305
+ var _this = this;
306
+
304
307
  this.getData();
308
+ this.distroy = (0, _mobx.autorun)(function () {
309
+ _this.setState({
310
+ locationInfo: _mobx.store.locationInfo
311
+ }, function () {
312
+ _this.getData();
313
+ });
314
+ });
305
315
  };
306
316
 
307
317
  Mobile.prototype.componentWillReceiveProps = function (nextProps) {
@@ -89,21 +89,21 @@ function compositeDecorator(WrappedComponent) {
89
89
  };
90
90
 
91
91
  _this.switchLanguage = function (value) {
92
- alert(value); // const lang = 'ar';
93
-
94
- (0, _storeUtil.setStore)(_constants.STORAGE_KEY.LOCALE, value);
92
+ // const lang = 'ar';
93
+ (0, _storeUtil.setStore)(_constants.STORAGE_KEY.LOCALE, value); // 实时更新问题待优化;
95
94
  };
96
95
 
97
96
  _this.getUserAddress = function (value) {
98
- alert(value); // const info = {
97
+ // const info = {
99
98
  // address: '简短地址',
100
99
  // customer: '客户名称',
101
100
  // tel: '客户手机号',
102
101
  // longitude: '经度',
103
102
  // latitude: '纬度',
104
103
  // };
105
-
106
- (0, _storeUtil.setStore)('USER_ADDRESS_INFO', value);
104
+ _mobx.store.setState({
105
+ locationInfo: value || {}
106
+ });
107
107
  }; // 复合组件点击事件
108
108
 
109
109
 
package/lib/mobx/Store.js CHANGED
@@ -12,7 +12,7 @@ var _storeUtil = require("../utils/storeUtil");
12
12
  var debug = require('debug')('worker:mobx');
13
13
 
14
14
  var CACHE_KEY = 'STORE';
15
- var whiteList = ['hoveredMeta', 'clickedMeta', 'clickedGroup', 'clickedFloor', 'hoveredFloor', 'textSelection', 'MPageData'];
15
+ var whiteList = ['hoveredMeta', 'clickedMeta', 'clickedGroup', 'clickedFloor', 'hoveredFloor', 'textSelection', 'MPageData', 'locationInfo'];
16
16
 
17
17
  var Store =
18
18
  /** @class */
@@ -36,6 +36,8 @@ function () {
36
36
 
37
37
  this.imgGenVisible = false; // 图片生成器是否可见
38
38
 
39
+ this.locationInfo = {}; // 地址组件暂存数据
40
+
39
41
  (0, _mobx.makeObservable)(this, {
40
42
  MPageData: _mobx.observable,
41
43
  hoveredMeta: _mobx.observable,
@@ -45,6 +47,7 @@ function () {
45
47
  hoveredFloor: _mobx.observable,
46
48
  CarouselStore: _mobx.observable,
47
49
  imgGenVisible: _mobx.observable,
50
+ locationInfo: _mobx.observable,
48
51
  setState: _mobx.action.bound
49
52
  });
50
53
  }
@@ -165,7 +165,7 @@ var newParseUrl = function newParseUrl(urlObj) {
165
165
  action: 'jump',
166
166
  params: {
167
167
  type: 'STORE',
168
- url: value
168
+ storeId: value
169
169
  }
170
170
  };
171
171
  break;
@@ -298,7 +298,8 @@ var newParseUrl = function newParseUrl(urlObj) {
298
298
  '/product/GroupBuy': 'GROUP',
299
299
  '/search-page': 'SEARCH_PAGE',
300
300
  '/commission': 'COMMISSION',
301
- '/location': 'ADD_ADDRESS_PAGE'
301
+ '/add-location': 'ADD_ADDRESS_PAGE',
302
+ '/location': 'ADDRESS_PAGE'
302
303
  };
303
304
  var typeTemp = map[link];
304
305
 
@@ -366,8 +367,8 @@ var parseUrl = function parseUrl(url) {
366
367
  action: 'jump',
367
368
  params: {
368
369
  type: 'PRODUCT_DETAIL',
369
- offerId: arg1,
370
- productId: arg2
370
+ offerId: Number(arg1),
371
+ productId: Number(arg2)
371
372
  }
372
373
  };
373
374
  break;
@@ -390,7 +391,7 @@ var parseUrl = function parseUrl(url) {
390
391
  action: 'jump',
391
392
  params: {
392
393
  type: 'STORE',
393
- storeId: arg1
394
+ storeId: Number(arg1)
394
395
  }
395
396
  };
396
397
  break;
@@ -476,7 +477,8 @@ var parseUrl = function parseUrl(url) {
476
477
  '/search-page': 'SEARCH_PAGE',
477
478
  '/main/my-commission': 'WALLET',
478
479
  '/commission': 'COMMISSION',
479
- '/location': 'ADD_ADDRESS_PAGE'
480
+ '/add-location': 'ADD_ADDRESS_PAGE',
481
+ '/location': 'ADDRESS_PAGE'
480
482
  };
481
483
  link = url;
482
484
  params = {
@@ -405,8 +405,8 @@ var clickUrl = function clickUrl(url, state) {
405
405
  (0, _commonUtil.navigateTo)(link, state);
406
406
  }
407
407
  } else if (((_b = window === null || window === void 0 ? void 0 : window.magicDesign) === null || _b === void 0 ? void 0 : _b.projectCode) === 'pto') {
408
- // 输入的是完整的跳转地址
409
- if (isUrl(link)) {
408
+ // 输入的是完整的跳转地址 排除掉‘https://www.baidu.com;mydito://BuyLoad’这种情况
409
+ if (isUrl(link) && !link.includes('mydito://')) {
410
410
  if (!link.includes(window.location.host)) {
411
411
  // 跳转外链 需要把token带上
412
412
  if (link.includes('?')) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fonixtree/magic-design",
3
3
  "author": "Cylon Team",
4
- "version": "2.0.194",
4
+ "version": "2.0.197",
5
5
  "description": "Magic Design",
6
6
  "license": "MIT",
7
7
  "module": "es/index.js",