@bit-sun/business-component 2.3.10 → 2.3.11

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.
package/dist/index.esm.js CHANGED
@@ -15692,10 +15692,6 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
15692
15692
  _this.allFunc = /*#__PURE__*/createRef('');
15693
15693
  _this.customerMenuRef = /*#__PURE__*/createRef('');
15694
15694
  _this.actionRef = /*#__PURE__*/createRef();
15695
- _this.handleBeforeUnload = function () {
15696
- // 储存当前router信息
15697
- sessionStorage.setItem('@listenRouterState', JSON.stringify(_this.state.listenRouterState));
15698
- };
15699
15695
  _this.parseQueryString = function (queryString) {
15700
15696
  if (!queryString) {
15701
15697
  return '';
@@ -16099,49 +16095,15 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16099
16095
  },
16100
16096
  currentSubMenuData: [],
16101
16097
  showSubMenu: false,
16102
- isSlider: false,
16103
- _routerArray: routerArray
16098
+ isSlider: false
16104
16099
  };
16105
16100
  return _this;
16106
16101
  }
16107
16102
  _createClass(BasicLayout, [{
16108
- key: "componentWillMount",
16109
- value: function componentWillMount() {
16110
- var _this2 = this;
16111
- // 检查页面是否为刷新之后的
16112
- if (sessionStorage.getItem('@listenRouterState')) {
16113
- var lastListenRouterState = JSON.parse(sessionStorage.getItem('@listenRouterState')),
16114
- showListenRouterState = [],
16115
- nowItem = {};
16116
- if (lastListenRouterState.length === 1) {
16117
- sessionStorage.removeItem('@listenRouterState');
16118
- return;
16119
- }
16120
- lastListenRouterState.forEach(function (item) {
16121
- var _this2$state;
16122
- nowItem = _this2 === null || _this2 === void 0 ? void 0 : (_this2$state = _this2.state) === null || _this2$state === void 0 ? void 0 : _this2$state._routerArray.find(function (i) {
16123
- var _item$match;
16124
- return item.key === i.key || (item === null || item === void 0 ? void 0 : item.match) && (item === null || item === void 0 ? void 0 : (_item$match = item.match) === null || _item$match === void 0 ? void 0 : _item$match.path) === i.key;
16125
- });
16126
- // 详情页保留问题尚未解决
16127
- if (nowItem) {
16128
- showListenRouterState.push(_objectSpread2(_objectSpread2({}, item), {}, {
16129
- content: nowItem.content,
16130
- tab: item.tab || _this2.getPageTitle(nowItem.key)
16131
- }));
16132
- }
16133
- });
16134
- this.setState({
16135
- listenRouterState: [].concat(showListenRouterState)
16136
- });
16137
- sessionStorage.removeItem('@listenRouterState');
16138
- }
16139
- }
16140
- }, {
16141
16103
  key: "componentDidMount",
16142
16104
  value: function componentDidMount() {
16143
16105
  var _window$$wujie,
16144
- _this3 = this,
16106
+ _this2 = this,
16145
16107
  _localStorage$getItem,
16146
16108
  _localStorage$getItem2;
16147
16109
  var _this$props = this.props,
@@ -16191,11 +16153,11 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16191
16153
  // if (window.location.href.indexOf(`/${itemPath}`) === -1) return;
16192
16154
  // }
16193
16155
  if (route.pathname.startsWith("/".concat(itemPath, "/"))) return;
16194
- var _this3$state = _this3.state,
16195
- listenRouterState = _this3$state.listenRouterState,
16196
- listenRouterKey = _this3$state.listenRouterKey,
16197
- customerMatchs = _this3$state.customerMatchs,
16198
- hideMenuArray = _this3$state.hideMenuArray;
16156
+ var _this2$state = _this2.state,
16157
+ listenRouterState = _this2$state.listenRouterState,
16158
+ listenRouterKey = _this2$state.listenRouterKey,
16159
+ customerMatchs = _this2$state.customerMatchs,
16160
+ hideMenuArray = _this2$state.hideMenuArray;
16199
16161
  var newListenRouterState = _toConsumableArray(listenRouterState);
16200
16162
  var newListenRouterKey = _toConsumableArray(listenRouterKey);
16201
16163
  var replaceRouter = routerArray.filter(function (itemRoute) {
@@ -16206,7 +16168,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16206
16168
  // 处理中英文和特殊字符
16207
16169
  currentKey = decodeURIComponent(route.pathname);
16208
16170
  } else {
16209
- currentKey = decodeURIComponent(route.pathname + _this3.parseQueryString(route.search));
16171
+ currentKey = decodeURIComponent(route.pathname + _this2.parseQueryString(route.search));
16210
16172
  }
16211
16173
  if (!istParent) {
16212
16174
  var _window$$wujie2;
@@ -16226,7 +16188,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16226
16188
  replaceRouter = (_routerArray$filter = routerArray.filter(function (itemroute) {
16227
16189
  return itemroute.key === '/404';
16228
16190
  })) === null || _routerArray$filter === void 0 ? void 0 : _routerArray$filter[0];
16229
- _this3.setState({
16191
+ _this2.setState({
16230
16192
  listenRouterState: [].concat(_toConsumableArray(listenRouterState), [_objectSpread2(_objectSpread2({}, replaceRouter), {}, {
16231
16193
  key: currentKey,
16232
16194
  tab: '404'
@@ -16234,7 +16196,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16234
16196
  activeKey: currentKey,
16235
16197
  listenRouterKey: [].concat(_toConsumableArray(listenRouterKey), [currentKey])
16236
16198
  }, function () {
16237
- _this3.checkisNavSlide();
16199
+ _this2.checkisNavSlide();
16238
16200
  });
16239
16201
  } else {
16240
16202
  var match = matchPath(route.pathname, {
@@ -16244,7 +16206,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16244
16206
  query: route.query,
16245
16207
  match: match,
16246
16208
  key: currentKey,
16247
- tab: _this3.getPageTitle(route.pathname) + ''
16209
+ tab: _this2.getPageTitle(route.pathname) + ''
16248
16210
  })]);
16249
16211
  newListenRouterKey = [].concat(_toConsumableArray(listenRouterKey), [currentKey]);
16250
16212
  }
@@ -16282,13 +16244,13 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16282
16244
  localStorage.removeItem('isMenuClick');
16283
16245
  }, 0);
16284
16246
  }
16285
- _this3.setState({
16247
+ _this2.setState({
16286
16248
  //路由监听函数最后执行setState,避免处理hideMenu类型页面自动关闭的逻辑块内获取不到最新state的listenRouterState和listenRouterKey
16287
16249
  activeKey: currentKey,
16288
16250
  listenRouterState: newListenRouterState,
16289
16251
  listenRouterKey: newListenRouterKey
16290
16252
  }, function () {
16291
- _this3.checkisNavSlide();
16253
+ _this2.checkisNavSlide();
16292
16254
  });
16293
16255
  istParent = 0;
16294
16256
  });
@@ -16303,35 +16265,17 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16303
16265
  } else {
16304
16266
  history.push(location);
16305
16267
  }
16306
- try {
16307
- window.addEventListener('beforeunload', this.handleBeforeUnload);
16308
- } catch (error) {
16309
- console.log("\uD83D\uDE80 => componentDidMount => error:", error);
16310
- }
16311
16268
  }
16312
16269
  }, {
16313
16270
  key: "componentWillUnmount",
16314
16271
  value: function componentWillUnmount() {
16315
- window.removeEventListener('beforeunload', this.handleBeforeUnload);
16316
16272
  // eslint-disable-next-line no-unused-expressions
16317
16273
  UN_LISTTEN_DRP && UN_LISTTEN_DRP();
16318
16274
  }
16319
- }, {
16320
- key: "getWelcomePage",
16321
- value: function getWelcomePage() {
16322
- var homeRouter = routerArray.filter(function (itemroute) {
16323
- return itemroute.key === '/';
16324
- })[0];
16325
- return _objectSpread2(_objectSpread2({}, homeRouter), {}, {
16326
- key: '/',
16327
- tab: '欢迎',
16328
- closable: false
16329
- });
16330
- }
16331
16275
  }, {
16332
16276
  key: "render",
16333
16277
  value: function render() {
16334
- var _this4 = this;
16278
+ var _this3 = this;
16335
16279
  var _this$state4 = this.state,
16336
16280
  listenRouterState = _this$state4.listenRouterState,
16337
16281
  activeKey = _this$state4.activeKey,
@@ -16355,7 +16299,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16355
16299
  className: "tab_title_content"
16356
16300
  }, item.tab, item.key !== '/' && /*#__PURE__*/React.createElement(ItemMenu, {
16357
16301
  info: item,
16358
- operateFun: _this4.operateFun,
16302
+ operateFun: _this3.operateFun,
16359
16303
  listenRouterState: listenRouterState
16360
16304
  }));
16361
16305
  };
@@ -16389,7 +16333,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16389
16333
  }, /*#__PURE__*/React.createElement("a", {
16390
16334
  onClick: function onClick() {
16391
16335
  // 关闭全部
16392
- _this4.updateState([_objectSpread2(_objectSpread2({}, _this4.state.homeRouter), {}, {
16336
+ _this3.updateState([_objectSpread2(_objectSpread2({}, _this3.state.homeRouter), {}, {
16393
16337
  key: '/',
16394
16338
  tab: '欢迎',
16395
16339
  closable: false
@@ -16415,7 +16359,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16415
16359
  } else {
16416
16360
  newActiveKey = listenRouterState[1].key;
16417
16361
  }
16418
- _this4.updateState(listenRouterState.filter(function (d) {
16362
+ _this3.updateState(listenRouterState.filter(function (d) {
16419
16363
  return d.key !== activeKey;
16420
16364
  }), listenRouterKey.filter(function (d) {
16421
16365
  return d !== activeKey;
@@ -16442,7 +16386,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16442
16386
  // message.warning('首页不可关闭。');
16443
16387
  // return;
16444
16388
  // }
16445
- _this4.updateState(listenRouterState.filter(function (d, i) {
16389
+ _this3.updateState(listenRouterState.filter(function (d, i) {
16446
16390
  return i >= index || d.key === '/';
16447
16391
  }), listenRouterKey.filter(function (d, i) {
16448
16392
  return i >= index || d === '/';
@@ -16459,7 +16403,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16459
16403
  var index = listenRouterState.findIndex(function (item) {
16460
16404
  return item.key === activeKey;
16461
16405
  });
16462
- _this4.updateState(listenRouterState.filter(function (d, i) {
16406
+ _this3.updateState(listenRouterState.filter(function (d, i) {
16463
16407
  return i <= index || d.key === '/';
16464
16408
  }), listenRouterKey.filter(function (d, i) {
16465
16409
  return i <= index || d === '/';
@@ -16502,7 +16446,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16502
16446
  opacity: this.state.isSlider ? 1 : 0.5
16503
16447
  },
16504
16448
  onClick: function onClick() {
16505
- _this4.setTabNavTransLate(-100);
16449
+ _this3.setTabNavTransLate(-100);
16506
16450
  }
16507
16451
  }, /*#__PURE__*/React.createElement(DoubleLeftOutlined, null))),
16508
16452
  right: /*#__PURE__*/React.createElement("div", {
@@ -16511,7 +16455,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16511
16455
  },
16512
16456
  className: 'tab_right_operate',
16513
16457
  onClick: function onClick() {
16514
- _this4.setTabNavTransLate(100);
16458
+ _this3.setTabNavTransLate(100);
16515
16459
  }
16516
16460
  }, /*#__PURE__*/React.createElement(DoubleRightOutlined, null))
16517
16461
  };
@@ -16525,7 +16469,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16525
16469
  return /*#__PURE__*/React.createElement(CustomerMenuHeader, {
16526
16470
  originRoutes: originRoutes,
16527
16471
  itemPath: itemPath,
16528
- handleClose: _this4.handleClose,
16472
+ handleClose: _this3.handleClose,
16529
16473
  collapsed: collapse
16530
16474
  });
16531
16475
  },
@@ -16534,10 +16478,10 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16534
16478
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CustomerMenu, {
16535
16479
  originRoutes: originRoutes,
16536
16480
  itemPath: itemPath,
16537
- ref: _this4.customerMenuRef,
16538
- actionRef: _this4.actionRef,
16539
- handleClose: _this4.handleClose,
16540
- isCollapse: _this4.state.collapse
16481
+ ref: _this3.customerMenuRef,
16482
+ actionRef: _this3.actionRef,
16483
+ handleClose: _this3.handleClose,
16484
+ isCollapse: _this3.state.collapse
16541
16485
  }));
16542
16486
  }
16543
16487
  return /*#__PURE__*/React.createElement("div", {
@@ -16545,7 +16489,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16545
16489
  }, /*#__PURE__*/React.createElement("span", {
16546
16490
  className: "collapse_icon",
16547
16491
  onClick: function onClick() {
16548
- _this4.setState({
16492
+ _this3.setState({
16549
16493
  collapse: !collapse
16550
16494
  });
16551
16495
  }
@@ -16558,7 +16502,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16558
16502
  },
16559
16503
  collapsed: collapse,
16560
16504
  onCollapse: function onCollapse(boo) {
16561
- _this4.setState({
16505
+ _this3.setState({
16562
16506
  collapse: boo
16563
16507
  });
16564
16508
  },
@@ -16594,14 +16538,14 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16594
16538
  },
16595
16539
  onMouseEnter: function onMouseEnter() {
16596
16540
  if (menuItemProps.pro_layout_parentKeys && menuItemProps.pro_layout_parentKeys.length) return;
16597
- _this4.setState({
16541
+ _this3.setState({
16598
16542
  currentSubMenuData: menuItemProps.children,
16599
16543
  currentSubPath: menuItemProps.path
16600
16544
  });
16601
- _this4.setShowMenu(true);
16545
+ _this3.setShowMenu(true);
16602
16546
  },
16603
16547
  onMouseLeave: function onMouseLeave() {
16604
- _this4.setShowMenu(false);
16548
+ _this3.setShowMenu(false);
16605
16549
  }
16606
16550
  }, defaultDom, showSubMenu && currentSubPath === menuItemProps.path && !collapse && /*#__PURE__*/React.createElement(CaretLeftOutlined, {
16607
16551
  style: {
@@ -16620,7 +16564,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16620
16564
  }, '');
16621
16565
  },
16622
16566
  postMenuData: function postMenuData(menus) {
16623
- return _toConsumableArray(filterByMenuDate(menus || [], _this4.state.keyWord));
16567
+ return _toConsumableArray(filterByMenuDate(menus || [], _this3.state.keyWord));
16624
16568
  },
16625
16569
  links: [!this.state.collapse ? /*#__PURE__*/React.createElement(AllFunc$1, {
16626
16570
  ref: this.allFunc,
@@ -16694,7 +16638,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16694
16638
  tab: /*#__PURE__*/React.createElement(TabTitle, {
16695
16639
  item: item,
16696
16640
  index: index,
16697
- updateState: _this4.updateState
16641
+ updateState: _this3.updateState
16698
16642
  }),
16699
16643
  style: {
16700
16644
  marginTop: isWeiqianduan ? 0 : 30
@@ -16706,10 +16650,10 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16706
16650
  })
16707
16651
  }, /*#__PURE__*/React.createElement(WrapperComponent, {
16708
16652
  item: item,
16709
- routerProps: _this4.props,
16710
- getDictionarySource: _this4.getDictionarySource,
16711
- getDictionaryTextByValue: _this4.getDictionaryTextByValue,
16712
- timeFormat: _this4.timeFormat,
16653
+ routerProps: _this3.props,
16654
+ getDictionarySource: _this3.getDictionarySource,
16655
+ getDictionaryTextByValue: _this3.getDictionaryTextByValue,
16656
+ timeFormat: _this3.timeFormat,
16713
16657
  transparentProps: transparentProps
16714
16658
  }));
16715
16659
  })), /*#__PURE__*/React.createElement("div", {
@@ -16734,10 +16678,10 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16734
16678
  itemPath: itemPath
16735
16679
  }, drawerLeftParams)), /*#__PURE__*/React.createElement("div", {
16736
16680
  onMouseEnter: function onMouseEnter() {
16737
- _this4.setShowMenu(true);
16681
+ _this3.setShowMenu(true);
16738
16682
  },
16739
16683
  onMouseLeave: function onMouseLeave() {
16740
- _this4.setShowMenu(false);
16684
+ _this3.setShowMenu(false);
16741
16685
  },
16742
16686
  className: 'sub_menu_content',
16743
16687
  style: {
package/dist/index.js CHANGED
@@ -15711,10 +15711,6 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
15711
15711
  _this.allFunc = /*#__PURE__*/React.createRef('');
15712
15712
  _this.customerMenuRef = /*#__PURE__*/React.createRef('');
15713
15713
  _this.actionRef = /*#__PURE__*/React.createRef();
15714
- _this.handleBeforeUnload = function () {
15715
- // 储存当前router信息
15716
- sessionStorage.setItem('@listenRouterState', JSON.stringify(_this.state.listenRouterState));
15717
- };
15718
15714
  _this.parseQueryString = function (queryString) {
15719
15715
  if (!queryString) {
15720
15716
  return '';
@@ -16118,49 +16114,15 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16118
16114
  },
16119
16115
  currentSubMenuData: [],
16120
16116
  showSubMenu: false,
16121
- isSlider: false,
16122
- _routerArray: routerArray
16117
+ isSlider: false
16123
16118
  };
16124
16119
  return _this;
16125
16120
  }
16126
16121
  _createClass(BasicLayout, [{
16127
- key: "componentWillMount",
16128
- value: function componentWillMount() {
16129
- var _this2 = this;
16130
- // 检查页面是否为刷新之后的
16131
- if (sessionStorage.getItem('@listenRouterState')) {
16132
- var lastListenRouterState = JSON.parse(sessionStorage.getItem('@listenRouterState')),
16133
- showListenRouterState = [],
16134
- nowItem = {};
16135
- if (lastListenRouterState.length === 1) {
16136
- sessionStorage.removeItem('@listenRouterState');
16137
- return;
16138
- }
16139
- lastListenRouterState.forEach(function (item) {
16140
- var _this2$state;
16141
- nowItem = _this2 === null || _this2 === void 0 ? void 0 : (_this2$state = _this2.state) === null || _this2$state === void 0 ? void 0 : _this2$state._routerArray.find(function (i) {
16142
- var _item$match;
16143
- return item.key === i.key || (item === null || item === void 0 ? void 0 : item.match) && (item === null || item === void 0 ? void 0 : (_item$match = item.match) === null || _item$match === void 0 ? void 0 : _item$match.path) === i.key;
16144
- });
16145
- // 详情页保留问题尚未解决
16146
- if (nowItem) {
16147
- showListenRouterState.push(_objectSpread2(_objectSpread2({}, item), {}, {
16148
- content: nowItem.content,
16149
- tab: item.tab || _this2.getPageTitle(nowItem.key)
16150
- }));
16151
- }
16152
- });
16153
- this.setState({
16154
- listenRouterState: [].concat(showListenRouterState)
16155
- });
16156
- sessionStorage.removeItem('@listenRouterState');
16157
- }
16158
- }
16159
- }, {
16160
16122
  key: "componentDidMount",
16161
16123
  value: function componentDidMount() {
16162
16124
  var _window$$wujie,
16163
- _this3 = this,
16125
+ _this2 = this,
16164
16126
  _localStorage$getItem,
16165
16127
  _localStorage$getItem2;
16166
16128
  var _this$props = this.props,
@@ -16210,11 +16172,11 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16210
16172
  // if (window.location.href.indexOf(`/${itemPath}`) === -1) return;
16211
16173
  // }
16212
16174
  if (route.pathname.startsWith("/".concat(itemPath, "/"))) return;
16213
- var _this3$state = _this3.state,
16214
- listenRouterState = _this3$state.listenRouterState,
16215
- listenRouterKey = _this3$state.listenRouterKey,
16216
- customerMatchs = _this3$state.customerMatchs,
16217
- hideMenuArray = _this3$state.hideMenuArray;
16175
+ var _this2$state = _this2.state,
16176
+ listenRouterState = _this2$state.listenRouterState,
16177
+ listenRouterKey = _this2$state.listenRouterKey,
16178
+ customerMatchs = _this2$state.customerMatchs,
16179
+ hideMenuArray = _this2$state.hideMenuArray;
16218
16180
  var newListenRouterState = _toConsumableArray(listenRouterState);
16219
16181
  var newListenRouterKey = _toConsumableArray(listenRouterKey);
16220
16182
  var replaceRouter = routerArray.filter(function (itemRoute) {
@@ -16225,7 +16187,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16225
16187
  // 处理中英文和特殊字符
16226
16188
  currentKey = decodeURIComponent(route.pathname);
16227
16189
  } else {
16228
- currentKey = decodeURIComponent(route.pathname + _this3.parseQueryString(route.search));
16190
+ currentKey = decodeURIComponent(route.pathname + _this2.parseQueryString(route.search));
16229
16191
  }
16230
16192
  if (!istParent) {
16231
16193
  var _window$$wujie2;
@@ -16245,7 +16207,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16245
16207
  replaceRouter = (_routerArray$filter = routerArray.filter(function (itemroute) {
16246
16208
  return itemroute.key === '/404';
16247
16209
  })) === null || _routerArray$filter === void 0 ? void 0 : _routerArray$filter[0];
16248
- _this3.setState({
16210
+ _this2.setState({
16249
16211
  listenRouterState: [].concat(_toConsumableArray(listenRouterState), [_objectSpread2(_objectSpread2({}, replaceRouter), {}, {
16250
16212
  key: currentKey,
16251
16213
  tab: '404'
@@ -16253,7 +16215,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16253
16215
  activeKey: currentKey,
16254
16216
  listenRouterKey: [].concat(_toConsumableArray(listenRouterKey), [currentKey])
16255
16217
  }, function () {
16256
- _this3.checkisNavSlide();
16218
+ _this2.checkisNavSlide();
16257
16219
  });
16258
16220
  } else {
16259
16221
  var match = matchPath(route.pathname, {
@@ -16263,7 +16225,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16263
16225
  query: route.query,
16264
16226
  match: match,
16265
16227
  key: currentKey,
16266
- tab: _this3.getPageTitle(route.pathname) + ''
16228
+ tab: _this2.getPageTitle(route.pathname) + ''
16267
16229
  })]);
16268
16230
  newListenRouterKey = [].concat(_toConsumableArray(listenRouterKey), [currentKey]);
16269
16231
  }
@@ -16301,13 +16263,13 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16301
16263
  localStorage.removeItem('isMenuClick');
16302
16264
  }, 0);
16303
16265
  }
16304
- _this3.setState({
16266
+ _this2.setState({
16305
16267
  //路由监听函数最后执行setState,避免处理hideMenu类型页面自动关闭的逻辑块内获取不到最新state的listenRouterState和listenRouterKey
16306
16268
  activeKey: currentKey,
16307
16269
  listenRouterState: newListenRouterState,
16308
16270
  listenRouterKey: newListenRouterKey
16309
16271
  }, function () {
16310
- _this3.checkisNavSlide();
16272
+ _this2.checkisNavSlide();
16311
16273
  });
16312
16274
  istParent = 0;
16313
16275
  });
@@ -16322,35 +16284,17 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16322
16284
  } else {
16323
16285
  history.push(location);
16324
16286
  }
16325
- try {
16326
- window.addEventListener('beforeunload', this.handleBeforeUnload);
16327
- } catch (error) {
16328
- console.log("\uD83D\uDE80 => componentDidMount => error:", error);
16329
- }
16330
16287
  }
16331
16288
  }, {
16332
16289
  key: "componentWillUnmount",
16333
16290
  value: function componentWillUnmount() {
16334
- window.removeEventListener('beforeunload', this.handleBeforeUnload);
16335
16291
  // eslint-disable-next-line no-unused-expressions
16336
16292
  UN_LISTTEN_DRP && UN_LISTTEN_DRP();
16337
16293
  }
16338
- }, {
16339
- key: "getWelcomePage",
16340
- value: function getWelcomePage() {
16341
- var homeRouter = routerArray.filter(function (itemroute) {
16342
- return itemroute.key === '/';
16343
- })[0];
16344
- return _objectSpread2(_objectSpread2({}, homeRouter), {}, {
16345
- key: '/',
16346
- tab: '欢迎',
16347
- closable: false
16348
- });
16349
- }
16350
16294
  }, {
16351
16295
  key: "render",
16352
16296
  value: function render() {
16353
- var _this4 = this;
16297
+ var _this3 = this;
16354
16298
  var _this$state4 = this.state,
16355
16299
  listenRouterState = _this$state4.listenRouterState,
16356
16300
  activeKey = _this$state4.activeKey,
@@ -16374,7 +16318,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16374
16318
  className: "tab_title_content"
16375
16319
  }, item.tab, item.key !== '/' && /*#__PURE__*/React__default['default'].createElement(ItemMenu, {
16376
16320
  info: item,
16377
- operateFun: _this4.operateFun,
16321
+ operateFun: _this3.operateFun,
16378
16322
  listenRouterState: listenRouterState
16379
16323
  }));
16380
16324
  };
@@ -16408,7 +16352,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16408
16352
  }, /*#__PURE__*/React__default['default'].createElement("a", {
16409
16353
  onClick: function onClick() {
16410
16354
  // 关闭全部
16411
- _this4.updateState([_objectSpread2(_objectSpread2({}, _this4.state.homeRouter), {}, {
16355
+ _this3.updateState([_objectSpread2(_objectSpread2({}, _this3.state.homeRouter), {}, {
16412
16356
  key: '/',
16413
16357
  tab: '欢迎',
16414
16358
  closable: false
@@ -16434,7 +16378,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16434
16378
  } else {
16435
16379
  newActiveKey = listenRouterState[1].key;
16436
16380
  }
16437
- _this4.updateState(listenRouterState.filter(function (d) {
16381
+ _this3.updateState(listenRouterState.filter(function (d) {
16438
16382
  return d.key !== activeKey;
16439
16383
  }), listenRouterKey.filter(function (d) {
16440
16384
  return d !== activeKey;
@@ -16461,7 +16405,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16461
16405
  // message.warning('首页不可关闭。');
16462
16406
  // return;
16463
16407
  // }
16464
- _this4.updateState(listenRouterState.filter(function (d, i) {
16408
+ _this3.updateState(listenRouterState.filter(function (d, i) {
16465
16409
  return i >= index || d.key === '/';
16466
16410
  }), listenRouterKey.filter(function (d, i) {
16467
16411
  return i >= index || d === '/';
@@ -16478,7 +16422,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16478
16422
  var index = listenRouterState.findIndex(function (item) {
16479
16423
  return item.key === activeKey;
16480
16424
  });
16481
- _this4.updateState(listenRouterState.filter(function (d, i) {
16425
+ _this3.updateState(listenRouterState.filter(function (d, i) {
16482
16426
  return i <= index || d.key === '/';
16483
16427
  }), listenRouterKey.filter(function (d, i) {
16484
16428
  return i <= index || d === '/';
@@ -16521,7 +16465,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16521
16465
  opacity: this.state.isSlider ? 1 : 0.5
16522
16466
  },
16523
16467
  onClick: function onClick() {
16524
- _this4.setTabNavTransLate(-100);
16468
+ _this3.setTabNavTransLate(-100);
16525
16469
  }
16526
16470
  }, /*#__PURE__*/React__default['default'].createElement(icons.DoubleLeftOutlined, null))),
16527
16471
  right: /*#__PURE__*/React__default['default'].createElement("div", {
@@ -16530,7 +16474,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16530
16474
  },
16531
16475
  className: 'tab_right_operate',
16532
16476
  onClick: function onClick() {
16533
- _this4.setTabNavTransLate(100);
16477
+ _this3.setTabNavTransLate(100);
16534
16478
  }
16535
16479
  }, /*#__PURE__*/React__default['default'].createElement(icons.DoubleRightOutlined, null))
16536
16480
  };
@@ -16544,7 +16488,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16544
16488
  return /*#__PURE__*/React__default['default'].createElement(CustomerMenuHeader, {
16545
16489
  originRoutes: originRoutes,
16546
16490
  itemPath: itemPath,
16547
- handleClose: _this4.handleClose,
16491
+ handleClose: _this3.handleClose,
16548
16492
  collapsed: collapse
16549
16493
  });
16550
16494
  },
@@ -16553,10 +16497,10 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16553
16497
  return /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(CustomerMenu, {
16554
16498
  originRoutes: originRoutes,
16555
16499
  itemPath: itemPath,
16556
- ref: _this4.customerMenuRef,
16557
- actionRef: _this4.actionRef,
16558
- handleClose: _this4.handleClose,
16559
- isCollapse: _this4.state.collapse
16500
+ ref: _this3.customerMenuRef,
16501
+ actionRef: _this3.actionRef,
16502
+ handleClose: _this3.handleClose,
16503
+ isCollapse: _this3.state.collapse
16560
16504
  }));
16561
16505
  }
16562
16506
  return /*#__PURE__*/React__default['default'].createElement("div", {
@@ -16564,7 +16508,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16564
16508
  }, /*#__PURE__*/React__default['default'].createElement("span", {
16565
16509
  className: "collapse_icon",
16566
16510
  onClick: function onClick() {
16567
- _this4.setState({
16511
+ _this3.setState({
16568
16512
  collapse: !collapse
16569
16513
  });
16570
16514
  }
@@ -16577,7 +16521,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16577
16521
  },
16578
16522
  collapsed: collapse,
16579
16523
  onCollapse: function onCollapse(boo) {
16580
- _this4.setState({
16524
+ _this3.setState({
16581
16525
  collapse: boo
16582
16526
  });
16583
16527
  },
@@ -16613,14 +16557,14 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16613
16557
  },
16614
16558
  onMouseEnter: function onMouseEnter() {
16615
16559
  if (menuItemProps.pro_layout_parentKeys && menuItemProps.pro_layout_parentKeys.length) return;
16616
- _this4.setState({
16560
+ _this3.setState({
16617
16561
  currentSubMenuData: menuItemProps.children,
16618
16562
  currentSubPath: menuItemProps.path
16619
16563
  });
16620
- _this4.setShowMenu(true);
16564
+ _this3.setShowMenu(true);
16621
16565
  },
16622
16566
  onMouseLeave: function onMouseLeave() {
16623
- _this4.setShowMenu(false);
16567
+ _this3.setShowMenu(false);
16624
16568
  }
16625
16569
  }, defaultDom, showSubMenu && currentSubPath === menuItemProps.path && !collapse && /*#__PURE__*/React__default['default'].createElement(icons.CaretLeftOutlined, {
16626
16570
  style: {
@@ -16639,7 +16583,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16639
16583
  }, '');
16640
16584
  },
16641
16585
  postMenuData: function postMenuData(menus) {
16642
- return _toConsumableArray(filterByMenuDate(menus || [], _this4.state.keyWord));
16586
+ return _toConsumableArray(filterByMenuDate(menus || [], _this3.state.keyWord));
16643
16587
  },
16644
16588
  links: [!this.state.collapse ? /*#__PURE__*/React__default['default'].createElement(AllFunc$1, {
16645
16589
  ref: this.allFunc,
@@ -16713,7 +16657,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16713
16657
  tab: /*#__PURE__*/React__default['default'].createElement(TabTitle, {
16714
16658
  item: item,
16715
16659
  index: index,
16716
- updateState: _this4.updateState
16660
+ updateState: _this3.updateState
16717
16661
  }),
16718
16662
  style: {
16719
16663
  marginTop: isWeiqianduan ? 0 : 30
@@ -16725,10 +16669,10 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16725
16669
  })
16726
16670
  }, /*#__PURE__*/React__default['default'].createElement(WrapperComponent, {
16727
16671
  item: item,
16728
- routerProps: _this4.props,
16729
- getDictionarySource: _this4.getDictionarySource,
16730
- getDictionaryTextByValue: _this4.getDictionaryTextByValue,
16731
- timeFormat: _this4.timeFormat,
16672
+ routerProps: _this3.props,
16673
+ getDictionarySource: _this3.getDictionarySource,
16674
+ getDictionaryTextByValue: _this3.getDictionaryTextByValue,
16675
+ timeFormat: _this3.timeFormat,
16732
16676
  transparentProps: transparentProps
16733
16677
  }));
16734
16678
  })), /*#__PURE__*/React__default['default'].createElement("div", {
@@ -16753,10 +16697,10 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
16753
16697
  itemPath: itemPath
16754
16698
  }, drawerLeftParams)), /*#__PURE__*/React__default['default'].createElement("div", {
16755
16699
  onMouseEnter: function onMouseEnter() {
16756
- _this4.setShowMenu(true);
16700
+ _this3.setShowMenu(true);
16757
16701
  },
16758
16702
  onMouseLeave: function onMouseLeave() {
16759
- _this4.setShowMenu(false);
16703
+ _this3.setShowMenu(false);
16760
16704
  },
16761
16705
  className: 'sub_menu_content',
16762
16706
  style: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bit-sun/business-component",
3
- "version": "2.3.10",
3
+ "version": "2.3.11",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -324,41 +324,9 @@ class BasicLayout extends React.PureComponent {
324
324
  currentSubMenuData: [],
325
325
  showSubMenu: false,
326
326
  isSlider: false,
327
- _routerArray: routerArray
328
327
  };
329
328
  }
330
329
 
331
- componentWillMount() {
332
- // 检查页面是否为刷新之后的
333
- if (sessionStorage.getItem('@listenRouterState')) {
334
- let lastListenRouterState = JSON.parse(sessionStorage.getItem('@listenRouterState')),
335
- showListenRouterState = [],
336
- nowItem = {};
337
- if (lastListenRouterState.length === 1) {
338
- sessionStorage.removeItem('@listenRouterState');
339
- return
340
- }
341
- lastListenRouterState.forEach((item: any) => {
342
- nowItem = this?.state?._routerArray.find((i: any) =>
343
- item.key === i.key ||
344
- (item?.match && item?.match?.path === i.key)
345
- );
346
- // 详情页保留问题尚未解决
347
- if (nowItem) {
348
- showListenRouterState.push({
349
- ...item,
350
- content: nowItem.content,
351
- tab: item.tab || this.getPageTitle(nowItem.key)
352
- })
353
- }
354
- });
355
- this.setState({
356
- listenRouterState: [ ...showListenRouterState ]
357
- });
358
- sessionStorage.removeItem('@listenRouterState');
359
- }
360
- }
361
-
362
330
  componentDidMount() {
363
331
  const {
364
332
  history,
@@ -553,32 +521,13 @@ class BasicLayout extends React.PureComponent {
553
521
  } else {
554
522
  history.push(location);
555
523
  }
556
-
557
- try {
558
- window.addEventListener('beforeunload', this.handleBeforeUnload);
559
- } catch (error) {
560
- console.log(`🚀 => componentDidMount => error:`, error)
561
- }
562
524
  }
563
525
 
564
526
  componentWillUnmount() {
565
- window.removeEventListener('beforeunload', this.handleBeforeUnload);
566
527
  // eslint-disable-next-line no-unused-expressions
567
528
  UN_LISTTEN_DRP && UN_LISTTEN_DRP();
568
529
  }
569
530
 
570
- handleBeforeUnload = () => {
571
- // 储存当前router信息
572
- sessionStorage.setItem('@listenRouterState', JSON.stringify(this.state.listenRouterState))
573
- }
574
-
575
- getWelcomePage() {
576
- const homeRouter = routerArray.filter(
577
- (itemroute) => itemroute.key === '/',
578
- )[0];
579
- return { ...homeRouter, key: '/', tab: '欢迎', closable: false }
580
- }
581
-
582
531
  parseQueryString = (queryString) => {
583
532
  if (!queryString) {
584
533
  return '';