dlt-for-react 1.1.2 → 1.1.4

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 (188) hide show
  1. package/README.md +9 -2
  2. package/lib/index.js +13 -1
  3. package/lib/layouts/LeftMenu/index.js +322 -296
  4. package/lib/layouts/Top/index.js +1 -1
  5. package/lib/layouts/layout/index.js +77 -31
  6. package/lib/layouts/mixTop/index.js +3 -3
  7. package/lib/utils/createUuid.js +31 -11
  8. package/lib/utils/getLoginUser.js +1 -1
  9. package/lib/utils/getSize.js +11 -2
  10. package/lib/utils/index.js +46 -2
  11. package/package.json +1 -1
  12. package/lib/components/Button/index.js +0 -79
  13. package/lib/components/NHAuditPanel/config/Axios.js +0 -263
  14. package/lib/components/NHAuditPanel/config/api.js +0 -479
  15. package/lib/components/NHAuditPanel/config/data.js +0 -156
  16. package/lib/components/NHAuditPanel/config/typeMap.js +0 -1234
  17. package/lib/components/NHAuditPanel/config/uiValidate.js +0 -92
  18. package/lib/components/NHAuditPanel/index.js +0 -413
  19. package/lib/components/NHAuditPanel/node.js +0 -619
  20. package/lib/components/NHCascader/index.js +0 -355
  21. package/lib/components/NHCheckboxGroup/index.js +0 -135
  22. package/lib/components/NHDynamicFormShow/baseInfo/index.js +0 -194
  23. package/lib/components/NHDynamicFormShow/custom/index.js +0 -553
  24. package/lib/components/NHDynamicFormShow/customModule/common/CommonMethod.js +0 -43
  25. package/lib/components/NHDynamicFormShow/customModule/czxy/qgzx/EditForm.js +0 -1113
  26. package/lib/components/NHDynamicFormShow/customModule/czxy/qgzx/index.js +0 -263
  27. package/lib/components/NHDynamicFormShow/customModule/czxy/xfjm/EditForm.js +0 -880
  28. package/lib/components/NHDynamicFormShow/customModule/czxy/xfjm/index.js +0 -171
  29. package/lib/components/NHDynamicFormShow/customModule/czxy/zxj/EditForm.js +0 -865
  30. package/lib/components/NHDynamicFormShow/customModule/czxy/zxj/index.js +0 -138
  31. package/lib/components/NHDynamicFormShow/customModule/eszy/zsxxhd/EditForm.js +0 -571
  32. package/lib/components/NHDynamicFormShow/customModule/eszy/zsxxhd/index.js +0 -147
  33. package/lib/components/NHDynamicFormShow/customModule/eszy/zybjtz/EditForm.js +0 -474
  34. package/lib/components/NHDynamicFormShow/customModule/eszy/zybjtz/index.js +0 -139
  35. package/lib/components/NHDynamicFormShow/customModule/gnyxy/cqzg/EditForm.js +0 -506
  36. package/lib/components/NHDynamicFormShow/customModule/gnyxy/cqzg/index.js +0 -143
  37. package/lib/components/NHDynamicFormShow/customModule/gnyxy/gwsb/EditForm.js +0 -1074
  38. package/lib/components/NHDynamicFormShow/customModule/gnyxy/gwsb/index.js +0 -172
  39. package/lib/components/NHDynamicFormShow/customModule/gnyxy/qjgl/EditForm.js +0 -927
  40. package/lib/components/NHDynamicFormShow/customModule/gnyxy/qjgl/index.js +0 -195
  41. package/lib/components/NHDynamicFormShow/customModule/gnyxy/sxsqj/EditForm.js +0 -1064
  42. package/lib/components/NHDynamicFormShow/customModule/gnyxy/sxsqj/index.js +0 -183
  43. package/lib/components/NHDynamicFormShow/customModule/hblgxy/jxj/EditForm.js +0 -763
  44. package/lib/components/NHDynamicFormShow/customModule/hblgxy/jxj/index.js +0 -137
  45. package/lib/components/NHDynamicFormShow/customModule/hblgxy/lzjxj/EditForm.js +0 -819
  46. package/lib/components/NHDynamicFormShow/customModule/hblgxy/lzjxj/index.js +0 -137
  47. package/lib/components/NHDynamicFormShow/customModule/hblgxy/qgzx/EditForm.js +0 -700
  48. package/lib/components/NHDynamicFormShow/customModule/hblgxy/qgzx/index.js +0 -162
  49. package/lib/components/NHDynamicFormShow/customModule/hblgxy/xsqj/EditForm.js +0 -743
  50. package/lib/components/NHDynamicFormShow/customModule/hblgxy/xsqj/index.js +0 -177
  51. package/lib/components/NHDynamicFormShow/customModule/hblgxy/zxj/EditForm.js +0 -848
  52. package/lib/components/NHDynamicFormShow/customModule/hblgxy/zxj/index.js +0 -138
  53. package/lib/components/NHDynamicFormShow/customModule/hljwgy/qjgl/EditForm.js +0 -777
  54. package/lib/components/NHDynamicFormShow/customModule/hljwgy/qjgl/index.js +0 -161
  55. package/lib/components/NHDynamicFormShow/customModule/hljwgy/xjgl/EditForm.js +0 -706
  56. package/lib/components/NHDynamicFormShow/customModule/hljwgy/xjgl/index.js +0 -130
  57. package/lib/components/NHDynamicFormShow/customModule/jhysxy/cfjcsq/cfjcEditForm.js +0 -413
  58. package/lib/components/NHDynamicFormShow/customModule/jhysxy/cfjcsq/index.js +0 -135
  59. package/lib/components/NHDynamicFormShow/customModule/jhysxy/xsqj/EditForm.js +0 -1013
  60. package/lib/components/NHDynamicFormShow/customModule/jhysxy/xsqj/index.js +0 -175
  61. package/lib/components/NHDynamicFormShow/customModule/jjrlx/EditForm.js +0 -1345
  62. package/lib/components/NHDynamicFormShow/customModule/jjrlx/index.js +0 -274
  63. package/lib/components/NHDynamicFormShow/customModule/jxj/EditForm.js +0 -669
  64. package/lib/components/NHDynamicFormShow/customModule/jxj/index.js +0 -134
  65. package/lib/components/NHDynamicFormShow/customModule/jxsl/fqkns/EditForm.js +0 -378
  66. package/lib/components/NHDynamicFormShow/customModule/jxsl/fqkns/index.js +0 -120
  67. package/lib/components/NHDynamicFormShow/customModule/jxsl/xwryfjjd/EditForm.js +0 -638
  68. package/lib/components/NHDynamicFormShow/customModule/jxsl/xwryfjjd/index.js +0 -133
  69. package/lib/components/NHDynamicFormShow/customModule/qgzx/EditForm.js +0 -965
  70. package/lib/components/NHDynamicFormShow/customModule/qgzx/index.js +0 -237
  71. package/lib/components/NHDynamicFormShow/customModule/qjgl/EditForm.js +0 -823
  72. package/lib/components/NHDynamicFormShow/customModule/qjgl/index.js +0 -188
  73. package/lib/components/NHDynamicFormShow/customModule/rcgl/jqlssq/EditForm.js +0 -401
  74. package/lib/components/NHDynamicFormShow/customModule/rcgl/jqlssq/index.js +0 -472
  75. package/lib/components/NHDynamicFormShow/customModule/rcgl/tssq/EditForm.js +0 -304
  76. package/lib/components/NHDynamicFormShow/customModule/rcgl/tssq/NHCascader/index.js +0 -375
  77. package/lib/components/NHDynamicFormShow/customModule/rcgl/tssq/NHInputPicker/RadioGroup.js +0 -118
  78. package/lib/components/NHDynamicFormShow/customModule/rcgl/tssq/NHInputPicker/index.js +0 -62
  79. package/lib/components/NHDynamicFormShow/customModule/rcgl/tssq/NHInputPicker/input-const.js +0 -55
  80. package/lib/components/NHDynamicFormShow/customModule/rcgl/tssq/NHInputPicker/render.js +0 -1238
  81. package/lib/components/NHDynamicFormShow/customModule/rcgl/tssq/index.js +0 -375
  82. package/lib/components/NHDynamicFormShow/customModule/rych/collective/EditForm.js +0 -554
  83. package/lib/components/NHDynamicFormShow/customModule/rych/collective/index.js +0 -130
  84. package/lib/components/NHDynamicFormShow/customModule/rych/personal/EditForm.js +0 -542
  85. package/lib/components/NHDynamicFormShow/customModule/rych/personal/index.js +0 -133
  86. package/lib/components/NHDynamicFormShow/customModule/sxgy/rych/collective/EditForm.js +0 -575
  87. package/lib/components/NHDynamicFormShow/customModule/sxgy/rych/collective/index.js +0 -130
  88. package/lib/components/NHDynamicFormShow/customModule/sxgy/rych/personal/EditForm.js +0 -563
  89. package/lib/components/NHDynamicFormShow/customModule/sxgy/rych/personal/index.js +0 -133
  90. package/lib/components/NHDynamicFormShow/customModule/whcz/qjgl/EditForm.js +0 -745
  91. package/lib/components/NHDynamicFormShow/customModule/whcz/qjgl/index.js +0 -164
  92. package/lib/components/NHDynamicFormShow/customModule/whcz/rccrxy/EditForm.js +0 -587
  93. package/lib/components/NHDynamicFormShow/customModule/whcz/rccrxy/index.js +0 -143
  94. package/lib/components/NHDynamicFormShow/customModule/whdlqjgl/EditForm.js +0 -743
  95. package/lib/components/NHDynamicFormShow/customModule/whdlqjgl/index.js +0 -172
  96. package/lib/components/NHDynamicFormShow/customModule/whgc/jjrlx/EditForm.js +0 -1410
  97. package/lib/components/NHDynamicFormShow/customModule/whgc/jjrlx/index.js +0 -274
  98. package/lib/components/NHDynamicFormShow/customModule/whgc/jxj/EditForm.js +0 -755
  99. package/lib/components/NHDynamicFormShow/customModule/whgc/jxj/index.js +0 -130
  100. package/lib/components/NHDynamicFormShow/customModule/whgc/qjgl/EditForm.js +0 -814
  101. package/lib/components/NHDynamicFormShow/customModule/whgc/qjgl/index.js +0 -188
  102. package/lib/components/NHDynamicFormShow/customModule/whgc/zxj/EditForm.js +0 -769
  103. package/lib/components/NHDynamicFormShow/customModule/whgc/zxj/index.js +0 -130
  104. package/lib/components/NHDynamicFormShow/customModule/whgcrych/EditForm.js +0 -1004
  105. package/lib/components/NHDynamicFormShow/customModule/whgcrych/index.js +0 -126
  106. package/lib/components/NHDynamicFormShow/customModule/whtl/jsrzsq/EditForm.js +0 -503
  107. package/lib/components/NHDynamicFormShow/customModule/whtl/jsrzsq/index.js +0 -149
  108. package/lib/components/NHDynamicFormShow/customModule/whtlyhk/EditForm.js +0 -379
  109. package/lib/components/NHDynamicFormShow/customModule/whtlyhk/index.js +0 -148
  110. package/lib/components/NHDynamicFormShow/customModule/whtlzxj/EditForm.js +0 -748
  111. package/lib/components/NHDynamicFormShow/customModule/whtlzxj/index.js +0 -135
  112. package/lib/components/NHDynamicFormShow/customModule/whtlzy/jxj/EditForm.js +0 -762
  113. package/lib/components/NHDynamicFormShow/customModule/whtlzy/jxj/index.js +0 -134
  114. package/lib/components/NHDynamicFormShow/customModule/wjcf/cfjc/cfjcEditForm.js +0 -682
  115. package/lib/components/NHDynamicFormShow/customModule/wjcf/cfjc/index.js +0 -135
  116. package/lib/components/NHDynamicFormShow/customModule/wjcf/wjsb/index.js +0 -152
  117. package/lib/components/NHDynamicFormShow/customModule/wjcf/wjsb/wjsbEditForm.js +0 -783
  118. package/lib/components/NHDynamicFormShow/customModule/zxj/EditForm.js +0 -764
  119. package/lib/components/NHDynamicFormShow/customModule/zxj/index.js +0 -138
  120. package/lib/components/NHDynamicFormShow/customModule/zzsd/cfjcsq/cfjcEditForm.js +0 -677
  121. package/lib/components/NHDynamicFormShow/customModule/zzsd/cfjcsq/index.js +0 -138
  122. package/lib/components/NHDynamicFormShow/customModule/zzsd/qjgl/EditForm.js +0 -1173
  123. package/lib/components/NHDynamicFormShow/customModule/zzsd/qjgl/index.js +0 -242
  124. package/lib/components/NHDynamicFormShow/customModule/zzsd/rcgl/rcxwgrdj/IndividualRegistForm.js +0 -862
  125. package/lib/components/NHDynamicFormShow/customModule/zzsd/rcgl/rcxwgrdj/IndividualRegistIndex.js +0 -201
  126. package/lib/components/NHDynamicFormShow/customModule/zzsd/stuinfo/messageInfo.js +0 -196
  127. package/lib/components/NHDynamicFormShow/customModule/zzsd/wjsb/index.js +0 -167
  128. package/lib/components/NHDynamicFormShow/customModule/zzsd/wjsb/wjsbEditForm.js +0 -1096
  129. package/lib/components/NHDynamicFormShow/index.js +0 -647
  130. package/lib/components/NHDynamicFormShow/oneOnMany/cardForm/cardItem/index.js +0 -279
  131. package/lib/components/NHDynamicFormShow/oneOnMany/cardForm/index.js +0 -206
  132. package/lib/components/NHDynamicFormShow/oneOnMany/index.js +0 -419
  133. package/lib/components/NHDynamicFormShow/oneOnOne/EditForm.js +0 -401
  134. package/lib/components/NHDynamicFormShow/oneOnOne/index.js +0 -271
  135. package/lib/components/NHImagePicker/index.js +0 -554
  136. package/lib/components/NHInputPicker/RadioGroup.js +0 -118
  137. package/lib/components/NHInputPicker/index.js +0 -62
  138. package/lib/components/NHInputPicker/input-const.js +0 -55
  139. package/lib/components/NHInputPicker/render.js +0 -1271
  140. package/lib/components/NHListView/index.js +0 -374
  141. package/lib/components/NHMapGeolocation/index.js +0 -537
  142. package/lib/components/NHMapGeolocation/initMap/initGdMap.js +0 -104
  143. package/lib/components/NHMapGeolocation/initMap/initTencentMap.js +0 -138
  144. package/lib/components/NHMapGeolocation/style.js +0 -51
  145. package/lib/components/NHMultiSelect/index.js +0 -272
  146. package/lib/components/NHRadioGroup/index.js +0 -118
  147. package/lib/components/NHSelect/index.js +0 -364
  148. package/lib/components/NHTreeMenu/index.js +0 -126
  149. package/lib/components/NHTreeMenu/treeNode.js +0 -164
  150. package/lib/components/StuSelector/index.js +0 -611
  151. package/lib/layouts/KyInputPicker/edit-page.js +0 -585
  152. package/lib/layouts/KyInputPicker/index.js +0 -220
  153. package/lib/layouts/KyInputPicker/input-const.js +0 -134
  154. package/lib/layouts/KyInputPicker/render.js +0 -2477
  155. package/lib/layouts/KyInputPicker/setting-checkbox.js +0 -850
  156. package/lib/layouts/KyInputPicker/setting-datepicker.js +0 -430
  157. package/lib/layouts/KyInputPicker/setting-datetimepicker.js +0 -443
  158. package/lib/layouts/KyInputPicker/setting-input.js +0 -555
  159. package/lib/layouts/KyInputPicker/setting-inputNumber.js +0 -612
  160. package/lib/layouts/KyInputPicker/setting-monthpicker.js +0 -434
  161. package/lib/layouts/KyInputPicker/setting-multiSelect.js +0 -532
  162. package/lib/layouts/KyInputPicker/setting-nhcascader.js +0 -584
  163. package/lib/layouts/KyInputPicker/setting-old-upload.js +0 -428
  164. package/lib/layouts/KyInputPicker/setting-radio.js +0 -468
  165. package/lib/layouts/KyInputPicker/setting-rangepicker.js +0 -466
  166. package/lib/layouts/KyInputPicker/setting-select.js +0 -534
  167. package/lib/layouts/KyInputPicker/setting-stu-selector.js +0 -507
  168. package/lib/layouts/KyInputPicker/setting-switch.js +0 -274
  169. package/lib/layouts/KyInputPicker/setting-tea-selector.js +0 -507
  170. package/lib/layouts/KyInputPicker/setting-textarea.js +0 -619
  171. package/lib/layouts/KyInputPicker/setting-timepicker.js +0 -437
  172. package/lib/layouts/KyInputPicker/setting-upload.js +0 -766
  173. package/lib/layouts/KyModal/buildTitle.js +0 -81
  174. package/lib/layouts/KyModal/dragM.js +0 -127
  175. package/lib/layouts/KyModal/index.js +0 -321
  176. package/lib/layouts/KyPreview/index.js +0 -219
  177. package/lib/layouts/KyUpload/index.js +0 -1155
  178. package/lib/utils/browserJudge.js +0 -33
  179. package/lib/utils/dynamicLoadCss.js +0 -14
  180. package/lib/utils/dynamicLoadJs.js +0 -21
  181. package/lib/utils/getStyle.js +0 -26
  182. package/lib/utils/getSuitHeight.js +0 -49
  183. package/lib/utils/hasAuth.js +0 -11
  184. package/lib/utils/loadJS.js +0 -40
  185. /package/lib/layouts/{login → Login}/index-pre.js +0 -0
  186. /package/lib/layouts/{login → Login}/index.js +0 -0
  187. /package/lib/layouts/{login → Login}/login.js +0 -0
  188. /package/lib/layouts/{login → Login}/lyPassword.js +0 -0
@@ -1,55 +1,55 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
- value: true
4
+ value: true
5
5
  });
6
6
  exports.default = undefined;
7
7
 
8
- var _extends2 = require('babel-runtime/helpers/extends');
8
+ var _icon = require("antd/lib/icon");
9
9
 
10
- var _extends3 = _interopRequireDefault(_extends2);
10
+ var _icon2 = _interopRequireDefault(_icon);
11
11
 
12
- var _icon = require('antd/lib/icon');
12
+ var _extends2 = require("babel-runtime/helpers/extends");
13
13
 
14
- var _icon2 = _interopRequireDefault(_icon);
14
+ var _extends3 = _interopRequireDefault(_extends2);
15
15
 
16
- var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');
16
+ var _getPrototypeOf = require("babel-runtime/core-js/object/get-prototype-of");
17
17
 
18
18
  var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
19
19
 
20
- var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
20
+ var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
21
21
 
22
22
  var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
23
23
 
24
- var _createClass2 = require('babel-runtime/helpers/createClass');
24
+ var _createClass2 = require("babel-runtime/helpers/createClass");
25
25
 
26
26
  var _createClass3 = _interopRequireDefault(_createClass2);
27
27
 
28
- var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
28
+ var _possibleConstructorReturn2 = require("babel-runtime/helpers/possibleConstructorReturn");
29
29
 
30
30
  var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
31
31
 
32
- var _inherits2 = require('babel-runtime/helpers/inherits');
32
+ var _inherits2 = require("babel-runtime/helpers/inherits");
33
33
 
34
34
  var _inherits3 = _interopRequireDefault(_inherits2);
35
35
 
36
- var _menu = require('antd/lib/menu');
36
+ var _menu = require("antd/lib/menu");
37
37
 
38
38
  var _menu2 = _interopRequireDefault(_menu);
39
39
 
40
- require('antd/lib/icon/style');
40
+ require("antd/lib/icon/style");
41
41
 
42
- require('antd/lib/menu/style');
42
+ require("antd/lib/menu/style");
43
43
 
44
- var _react = require('react');
44
+ var _react = require("react");
45
45
 
46
46
  var _react2 = _interopRequireDefault(_react);
47
47
 
48
- var _router = require('dva/router');
48
+ var _router = require("dva/router");
49
49
 
50
- var _xguiForReact = require('xgui-for-react');
50
+ var _xguiForReact = require("xgui-for-react");
51
51
 
52
- var _reactCustomScrollbars = require('react-custom-scrollbars');
52
+ var _reactCustomScrollbars = require("react-custom-scrollbars");
53
53
 
54
54
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
55
55
 
@@ -57,296 +57,322 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
57
57
  var SubMenu = _menu2.default.SubMenu;
58
58
 
59
59
  var Home = function (_React$Component) {
60
- (0, _inherits3.default)(Home, _React$Component);
61
-
62
- function Home(props) {
63
- (0, _classCallCheck3.default)(this, Home);
64
-
65
- var _this = (0, _possibleConstructorReturn3.default)(this, (Home.__proto__ || (0, _getPrototypeOf2.default)(Home)).call(this, props));
66
-
67
- _this.loginSkip = function () {
68
- var leftMenu = (0, _xguiForReact.getLoginUser)().menus ? (0, _xguiForReact.getLoginUser)().menus : [];
69
- // 如果不需要登录的服务就取props的菜单
70
- leftMenu = _this.props.config.noNeedLogin ? _this.props.allMenu : leftMenu;
71
- var curUrl = window.location.href.split('#')[1] + "/";
72
- var addRootSubmenuKeys = [];
73
- for (var i = 0; i < leftMenu.length; i++) {
74
- addRootSubmenuKeys.push(leftMenu[i].key);
75
- if (leftMenu[i].children) {
76
- for (var j = 0; j < leftMenu[i].children.length; j++) {
77
- if (leftMenu[i].children[j].children) {
78
- for (var k = 0; k < leftMenu[i].children[j].children.length; k++) {
79
- if (curUrl.startsWith(leftMenu[i].children[j].children[k].url + "/")) {
80
- _this.setState({
81
- selectedKeys: leftMenu[i].children[j].children[k].key,
82
- openKeys: [leftMenu[i].key]
83
- });
84
- }
85
- }
86
- } else {
87
- if (curUrl.startsWith(leftMenu[i].children[j].url + "/")) {
88
- _this.setState({
89
- selectedKeys: leftMenu[i].children[j].key,
90
- openKeys: [leftMenu[i].key]
91
- });
92
- }
93
- }
94
- }
95
- } else {
96
- if (curUrl.startsWith(leftMenu[i].url + "/")) {
97
- _this.setState({
98
- selectedKeys: leftMenu[i].key,
99
- openKeys: []
100
- });
101
- }
60
+ (0, _inherits3.default)(Home, _React$Component);
61
+
62
+ function Home(props) {
63
+ (0, _classCallCheck3.default)(this, Home);
64
+
65
+ var _this = (0, _possibleConstructorReturn3.default)(this, (Home.__proto__ || (0, _getPrototypeOf2.default)(Home)).call(this, props));
66
+
67
+ _this.loginSkip = function () {
68
+ var leftMenu = (0, _xguiForReact.getLoginUser)().menus ? (0, _xguiForReact.getLoginUser)().menus : [];
69
+ // 如果不需要登录的服务就取props的菜单
70
+ leftMenu = _this.props.config.noNeedLogin ? _this.props.allMenu : leftMenu;
71
+ var curUrl = window.location.href.split("#")[1] + "/";
72
+ var addRootSubmenuKeys = [];
73
+ for (var i = 0; i < leftMenu.length; i++) {
74
+ addRootSubmenuKeys.push(leftMenu[i].key);
75
+ if (leftMenu[i].children) {
76
+ for (var j = 0; j < leftMenu[i].children.length; j++) {
77
+ if (leftMenu[i].children[j].children) {
78
+ for (var k = 0; k < leftMenu[i].children[j].children.length; k++) {
79
+ if (curUrl.startsWith(leftMenu[i].children[j].children[k].url + "/")) {
80
+ _this.setState({
81
+ selectedKeys: leftMenu[i].children[j].children[k].key,
82
+ openKeys: [leftMenu[i].key]
83
+ });
102
84
  }
103
- }
104
-
105
- _this.setState({
106
- rootSubmenuKeys: addRootSubmenuKeys
107
- });
108
- };
109
-
110
- _this.onOpenChange = function (openKeys) {
111
- /*const state = this.state;
112
- const latestOpenKey = openKeys.find(key => !(state.openKeys.indexOf(key) > -1));
113
- const latestCloseKey = state.openKeys.find(key => !(openKeys.indexOf(key) > -1));
114
- let nextOpenKeys = [];
115
- if (latestOpenKey) {
116
- nextOpenKeys = this.getAncestorKeys(latestOpenKey).concat(latestOpenKey);
117
- }
118
- if (latestCloseKey) {
119
- nextOpenKeys = this.getAncestorKeys(latestCloseKey);
120
- }
121
- this.setState({ openKeys: nextOpenKeys });*/
122
- var latestOpenKey = openKeys.find(function (key) {
123
- return _this.state.openKeys.indexOf(key) === -1;
124
- });
125
- if (_this.state.rootSubmenuKeys.indexOf(latestOpenKey) === -1) {
126
- _this.setState({ openKeys: openKeys });
85
+ }
127
86
  } else {
87
+ if (curUrl.startsWith(leftMenu[i].children[j].url + "/")) {
128
88
  _this.setState({
129
- openKeys: latestOpenKey ? [latestOpenKey] : []
89
+ selectedKeys: leftMenu[i].children[j].key,
90
+ openKeys: [leftMenu[i].key]
130
91
  });
92
+ }
131
93
  }
132
- };
133
-
134
- _this.getAncestorKeys = function (key) {
135
- var map = { key: key };
136
- return map[key] || [];
137
- };
138
-
139
- _this.onClick = function (e) {
94
+ }
95
+ } else {
96
+ if (curUrl.startsWith(leftMenu[i].url + "/")) {
140
97
  _this.setState({
141
- selectedKeys: e.key
98
+ selectedKeys: leftMenu[i].key,
99
+ openKeys: []
142
100
  });
143
- };
144
-
145
- _this.renderIcon = function (menuIcons, icon, curUrl) {
146
- if (!icon) {
147
- // 占位元素
148
- return _react2.default.createElement('i', { className: 'anticon' });
149
- }
150
- var customIcon = menuIcons[icon];
151
- if (typeof customIcon === "string") {
152
- // 兼容旧版本
153
- return _react2.default.createElement(
154
- 'div',
155
- {
156
- className: 'anticon',
157
- style: {
158
- display: 'inline-block',
159
- verticalAlign: '-0.046296rem',
160
- width: '0.259195rem',
161
- height: '0.259195rem',
162
- marginRight: '0.135rem',
163
- '-webkit-mask-image': 'url(' + (curUrl + customIcon) + ')',
164
- '-webkit-mask-size': 'contain',
165
- 'mask-image': 'url(' + (curUrl + customIcon) + ')',
166
- 'mask-size': 'contain',
167
- fontSize: 100,
168
- overflow: 'hidden'
169
- }
170
- },
171
- '\u2588'
172
- );
173
- }
174
- return customIcon ? _react2.default.createElement(_icon2.default, { component: customIcon }) : _react2.default.createElement(_icon2.default, { type: icon });
175
- };
176
-
177
- _this.getBaseMenu = function (leftMenu, menuIcons, curUrl, defaultProps) {
178
- var navTheme = _this.props.setting.navTheme;
179
-
180
- return _react2.default.createElement(
181
- _menu2.default,
182
- (0, _extends3.default)({ theme: navTheme,
183
- mode: 'inline'
184
- // openKeys={this.state.openKeys}
185
- }, defaultProps, {
186
- selectedKeys: [_this.state.selectedKeys],
187
- onOpenChange: _this.onOpenChange,
188
- onClick: _this.onClick
189
- }),
190
- leftMenu.map(function (item, index) {
191
- if (item.children && item.children !== '' && item.children.length > 0) {
192
- var htmlct = [];
193
- var menuItem = item.children.map(function (itemM, index) {
194
- if (itemM.children && itemM.children !== '' && itemM.children.length > 0) {
195
- var menuItemC = itemM.children.map(function (itemC, index) {
196
- return _react2.default.createElement(
197
- _menu2.default.Item,
198
- { key: itemC.key },
199
- _react2.default.createElement(
200
- _router.Link,
201
- { key: 1, to: itemC.url },
202
- _this.renderIcon(menuIcons, itemC.icon, curUrl),
203
- _react2.default.createElement(
204
- 'span',
205
- null,
206
- itemC.name
207
- )
208
- )
209
- );
210
- });
211
- return _react2.default.createElement(
212
- SubMenu,
213
- { key: itemM.key, title: _react2.default.createElement(
214
- 'span',
215
- null,
216
- _this.renderIcon(menuIcons, itemM.icon, curUrl),
217
- _react2.default.createElement(
218
- 'span',
219
- null,
220
- itemM.name
221
- )
222
- ) },
223
- menuItemC
224
- );
225
- } else {
226
- return _react2.default.createElement(
227
- _menu2.default.Item,
228
- { key: itemM.key },
229
- _react2.default.createElement(
230
- _router.Link,
231
- { key: 1, to: itemM.url },
232
- _this.renderIcon(menuIcons, itemM.icon, curUrl),
233
- _react2.default.createElement(
234
- 'span',
235
- null,
236
- itemM.name
237
- )
238
- )
239
- );
240
- }
241
- });
242
- htmlct.push(_react2.default.createElement(
243
- SubMenu,
244
- { key: item.key, title: _react2.default.createElement(
245
- 'span',
246
- null,
247
- _this.renderIcon(menuIcons, item.icon, curUrl),
248
- _react2.default.createElement(
249
- 'span',
250
- null,
251
- item.name
252
- )
253
- ) },
254
- menuItem
255
- ));
256
- return htmlct;
257
- } else {
258
- return _react2.default.createElement(
259
- _menu2.default.Item,
260
- { key: item.key },
261
- _react2.default.createElement(
262
- _router.Link,
263
- { key: 1, to: item.url },
264
- _this.renderIcon(menuIcons, item.icon, curUrl),
265
- _react2.default.createElement(
266
- 'span',
267
- null,
268
- item.name
269
- )
270
- )
271
- );
272
- }
273
- })
274
- );
275
- };
276
-
277
- _this.state = {
278
- expandedKeys: [],
279
- openKeys: [],
280
- selectedKeys: undefined,
281
- rootSubmenuKeys: []
282
- };
283
- return _this;
284
- }
285
-
286
- (0, _createClass3.default)(Home, [{
287
- key: 'componentDidMount',
288
- value: function componentDidMount() {
289
- this.loginSkip();
290
- // 监听页面地址变化,防止手动点击浏览器前进后退按钮导致导航栏选中值错误
291
- window.addEventListener("hashchange", this.loginSkip);
101
+ }
292
102
  }
293
- }, {
294
- key: 'componentWillUnmount',
295
- value: function componentWillUnmount() {
296
- window.removeEventListener("hashchange", this.loginSkip);
103
+ }
104
+
105
+ _this.setState({
106
+ rootSubmenuKeys: addRootSubmenuKeys
107
+ });
108
+ };
109
+
110
+ _this.onOpenChange = function (openKeys) {
111
+ /*const state = this.state;
112
+ const latestOpenKey = openKeys.find(key => !(state.openKeys.indexOf(key) > -1));
113
+ const latestCloseKey = state.openKeys.find(key => !(openKeys.indexOf(key) > -1));
114
+ let nextOpenKeys = [];
115
+ if (latestOpenKey) {
116
+ nextOpenKeys = this.getAncestorKeys(latestOpenKey).concat(latestOpenKey);
117
+ }
118
+ if (latestCloseKey) {
119
+ nextOpenKeys = this.getAncestorKeys(latestCloseKey);
120
+ }
121
+ this.setState({ openKeys: nextOpenKeys });*/
122
+ var latestOpenKey = openKeys.find(function (key) {
123
+ return _this.state.openKeys.indexOf(key) === -1;
124
+ });
125
+ if (_this.state.rootSubmenuKeys.indexOf(latestOpenKey) === -1) {
126
+ _this.setState({ openKeys: openKeys });
127
+ } else {
128
+ _this.setState({
129
+ openKeys: latestOpenKey ? [latestOpenKey] : []
130
+ });
131
+ }
132
+ };
133
+
134
+ _this.getAncestorKeys = function (key) {
135
+ var map = { key: key };
136
+ return map[key] || [];
137
+ };
138
+
139
+ _this.onClick = function (e) {
140
+ _this.setState({
141
+ selectedKeys: e.key
142
+ });
143
+ };
144
+
145
+ _this.renderIcon = function (menuIcons, icon, curUrl) {
146
+ if (!icon) {
147
+ // 占位元素
148
+ return _react2.default.createElement("i", { className: "anticon" });
149
+ }
150
+ var customIcon = menuIcons[icon];
151
+ if (typeof customIcon === "string") {
152
+ var data = ["data:image/jpeg;base64", "data:image/png;base64"];
153
+ var rs = data.filter(function (item) {
154
+ return customIcon.startsWith(item);
155
+ });
156
+ var url = void 0;
157
+ var obj = void 0;
158
+ if (!rs || !rs.length) {
159
+ url = curUrl + customIcon;
160
+ obj = {
161
+ width: "0.259195rem",
162
+ height: "0.259195rem"
163
+ };
164
+ } else {
165
+ url = customIcon;
166
+ obj = {
167
+ width: "14px",
168
+ height: "14px"
169
+ };
297
170
  }
298
- }, {
299
- key: 'UNSAFE_componentWillReceiveProps',
300
- value: function UNSAFE_componentWillReceiveProps() {
301
- //this.loginSkip();
302
- }
303
- // 渲染菜单图标
304
-
305
- }, {
306
- key: 'render',
307
- value: function render() {
308
- var leftMenu = (0, _xguiForReact.getLoginUser)().menus ? (0, _xguiForReact.getLoginUser)().menus : [];
309
- // 如果不需要登录的服务就取props的菜单
310
- leftMenu = this.props.config.noNeedLogin ? this.props.allMenu : leftMenu;
311
- var menuIcons = this.props.menuIcons ? this.props.menuIcons : {};
312
- var curUrl = window.location.href.split('#')[0];
313
- // console.info(curUrl);
314
- // console.info(menuIcons);
315
- // 判断menu收缩时不设置值openKeys,解决收缩时二级菜单不跟随问题
316
- var defaultProps = this.props.collapsed ? {} : { openKeys: this.state.openKeys };
317
- var _props$setting = this.props.setting,
318
- title = _props$setting.title,
319
- navTheme = _props$setting.navTheme,
320
- layout = _props$setting.layout,
321
- contentWidth = _props$setting.contentWidth,
322
- fixedHeader = _props$setting.fixedHeader,
323
- fixSiderbar = _props$setting.fixSiderbar,
324
- autoHideHeader = _props$setting.autoHideHeader;
325
-
326
- return _react2.default.createElement(
327
- _react2.default.Fragment,
328
- null,
329
- fixSiderbar ? _react2.default.createElement(
330
- _reactCustomScrollbars.Scrollbars,
331
- { onScroll: this.onScroll,
332
- autoHide: true,
333
- style: { width: '100%' },
334
- autoHeight: true,
335
- autoHeightMin: 0,
336
- autoHeightMax: (0, _xguiForReact.getSize)().windowH - 64,
337
- thumbMinSize: 30,
338
- universal: true
339
- },
340
- this.getBaseMenu(leftMenu, menuIcons, curUrl, defaultProps)
341
- ) : _react2.default.createElement(
342
- _react2.default.Fragment,
171
+ // 兼容旧版本
172
+ return _react2.default.createElement(
173
+ "div",
174
+ {
175
+ className: "anticon",
176
+ style: (0, _extends3.default)({
177
+ display: "inline-block",
178
+ verticalAlign: "-0.046296rem"
179
+ }, obj, {
180
+ marginRight: "0.135rem",
181
+ "-webkit-mask-image": "url(" + url + ")",
182
+ "-webkit-mask-size": "contain",
183
+ "mask-image": "url(" + url + ")",
184
+ "mask-size": "contain",
185
+ fontSize: 100,
186
+ overflow: "hidden"
187
+ })
188
+ },
189
+ "\u2588"
190
+ );
191
+ }
192
+ return customIcon ? _react2.default.createElement(_icon2.default, { component: customIcon }) : _react2.default.createElement(_icon2.default, { type: icon });
193
+ };
194
+
195
+ _this.getBaseMenu = function (leftMenu, menuIcons, curUrl, defaultProps) {
196
+ var navTheme = _this.props.setting.navTheme;
197
+
198
+ return _react2.default.createElement(
199
+ _menu2.default,
200
+ (0, _extends3.default)({
201
+ theme: navTheme,
202
+ mode: "inline"
203
+ // openKeys={this.state.openKeys}
204
+ }, defaultProps, {
205
+ selectedKeys: [_this.state.selectedKeys],
206
+ onOpenChange: _this.onOpenChange,
207
+ onClick: _this.onClick
208
+ }),
209
+ leftMenu.map(function (item, index) {
210
+ if (item.children && item.children !== "" && item.children.length > 0) {
211
+ var htmlct = [];
212
+ var menuItem = item.children.map(function (itemM, index) {
213
+ if (itemM.children && itemM.children !== "" && itemM.children.length > 0) {
214
+ var menuItemC = itemM.children.map(function (itemC, index) {
215
+ return _react2.default.createElement(
216
+ _menu2.default.Item,
217
+ { key: itemC.key },
218
+ _react2.default.createElement(
219
+ _router.Link,
220
+ { key: 1, to: itemC.url },
221
+ _this.renderIcon(menuIcons, itemC.icon, curUrl),
222
+ _react2.default.createElement(
223
+ "span",
224
+ null,
225
+ itemC.name
226
+ )
227
+ )
228
+ );
229
+ });
230
+ return _react2.default.createElement(
231
+ SubMenu,
232
+ {
233
+ key: itemM.key,
234
+ title: _react2.default.createElement(
235
+ "span",
236
+ null,
237
+ _this.renderIcon(menuIcons, itemM.icon, curUrl),
238
+ _react2.default.createElement(
239
+ "span",
240
+ null,
241
+ itemM.name
242
+ )
243
+ )
244
+ },
245
+ menuItemC
246
+ );
247
+ } else {
248
+ return _react2.default.createElement(
249
+ _menu2.default.Item,
250
+ { key: itemM.key },
251
+ _react2.default.createElement(
252
+ _router.Link,
253
+ { key: 1, to: itemM.url },
254
+ _this.renderIcon(menuIcons, itemM.icon, curUrl),
255
+ _react2.default.createElement(
256
+ "span",
257
+ null,
258
+ itemM.name
259
+ )
260
+ )
261
+ );
262
+ }
263
+ });
264
+ htmlct.push(_react2.default.createElement(
265
+ SubMenu,
266
+ {
267
+ key: item.key,
268
+ title: _react2.default.createElement(
269
+ "span",
270
+ null,
271
+ _this.renderIcon(menuIcons, item.icon, curUrl),
272
+ _react2.default.createElement(
273
+ "span",
343
274
  null,
344
- this.getBaseMenu(leftMenu, menuIcons, curUrl, defaultProps)
275
+ item.name
276
+ )
345
277
  )
278
+ },
279
+ menuItem
280
+ ));
281
+ return htmlct;
282
+ } else {
283
+ return _react2.default.createElement(
284
+ _menu2.default.Item,
285
+ { key: item.key },
286
+ _react2.default.createElement(
287
+ _router.Link,
288
+ { key: 1, to: item.url },
289
+ _this.renderIcon(menuIcons, item.icon, curUrl),
290
+ _react2.default.createElement(
291
+ "span",
292
+ null,
293
+ item.name
294
+ )
295
+ )
346
296
  );
347
- }
348
- }]);
349
- return Home;
297
+ }
298
+ })
299
+ );
300
+ };
301
+
302
+ _this.state = {
303
+ expandedKeys: [],
304
+ openKeys: [],
305
+ selectedKeys: undefined,
306
+ rootSubmenuKeys: []
307
+ };
308
+ return _this;
309
+ }
310
+
311
+ (0, _createClass3.default)(Home, [{
312
+ key: "componentDidMount",
313
+ value: function componentDidMount() {
314
+ this.loginSkip();
315
+ // 监听页面地址变化,防止手动点击浏览器前进后退按钮导致导航栏选中值错误
316
+ window.addEventListener("hashchange", this.loginSkip);
317
+ }
318
+ }, {
319
+ key: "componentWillUnmount",
320
+ value: function componentWillUnmount() {
321
+ window.removeEventListener("hashchange", this.loginSkip);
322
+ }
323
+ }, {
324
+ key: "UNSAFE_componentWillReceiveProps",
325
+ value: function UNSAFE_componentWillReceiveProps() {
326
+ //this.loginSkip();
327
+ }
328
+ // 渲染菜单图标
329
+
330
+ }, {
331
+ key: "render",
332
+ value: function render() {
333
+ var leftMenu = (0, _xguiForReact.getLoginUser)().menus ? (0, _xguiForReact.getLoginUser)().menus : [];
334
+ // 如果不需要登录的服务就取props的菜单
335
+ leftMenu = this.props.config.noNeedLogin ? this.props.allMenu : leftMenu;
336
+ var menuIcons = this.props.menuIcons ? this.props.menuIcons : {};
337
+ var curUrl = window.location.href.split("#")[0];
338
+ // console.info(curUrl);
339
+ // console.info(menuIcons);
340
+ // 判断menu收缩时不设置值openKeys,解决收缩时二级菜单不跟随问题
341
+ var defaultProps = this.props.collapsed ? {} : { openKeys: this.state.openKeys };
342
+ var _props$setting = this.props.setting,
343
+ title = _props$setting.title,
344
+ navTheme = _props$setting.navTheme,
345
+ layout = _props$setting.layout,
346
+ contentWidth = _props$setting.contentWidth,
347
+ fixedHeader = _props$setting.fixedHeader,
348
+ fixSiderbar = _props$setting.fixSiderbar,
349
+ autoHideHeader = _props$setting.autoHideHeader;
350
+
351
+ return _react2.default.createElement(
352
+ _react2.default.Fragment,
353
+ null,
354
+ fixSiderbar ? _react2.default.createElement(
355
+ _reactCustomScrollbars.Scrollbars,
356
+ {
357
+ onScroll: this.onScroll,
358
+ autoHide: true,
359
+ style: { width: "100%" },
360
+ autoHeight: true,
361
+ autoHeightMin: 0,
362
+ autoHeightMax: (0, _xguiForReact.getSize)().windowH - 64,
363
+ thumbMinSize: 30,
364
+ universal: true
365
+ },
366
+ this.getBaseMenu(leftMenu, menuIcons, curUrl, defaultProps)
367
+ ) : _react2.default.createElement(
368
+ _react2.default.Fragment,
369
+ null,
370
+ this.getBaseMenu(leftMenu, menuIcons, curUrl, defaultProps)
371
+ )
372
+ );
373
+ }
374
+ }]);
375
+ return Home;
350
376
  }(_react2.default.Component);
351
377
 
352
378
  exports.default = Home;