@bit-sun/business-component 2.1.15 → 2.1.16
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.
|
@@ -11,3 +11,4 @@ export declare function handleUserPhone(): any;
|
|
|
11
11
|
export declare const setLoginOutPath: () => void;
|
|
12
12
|
export declare const getBreadcrumbNameMap: (menuData: any) => {};
|
|
13
13
|
export declare const ergodicMenuRoutes: (routes: any) => any[];
|
|
14
|
+
export declare const encodeUrlQuery: (pathStr: any) => string;
|
package/dist/index.esm.js
CHANGED
|
@@ -17557,6 +17557,27 @@ var ergodicMenuRoutes = function ergodicMenuRoutes(routes) {
|
|
|
17557
17557
|
ergodicRoutes(routes);
|
|
17558
17558
|
return codeArray;
|
|
17559
17559
|
};
|
|
17560
|
+
var encodeUrlQuery = function encodeUrlQuery(pathStr) {
|
|
17561
|
+
var newPathStr = '';
|
|
17562
|
+
|
|
17563
|
+
if (pathStr.indexOf('#') > -1) {
|
|
17564
|
+
var index = pathStr.indexOf('?');
|
|
17565
|
+
var str1 = pathStr.substr(0, index + 1);
|
|
17566
|
+
var str2 = pathStr.substr(index + 1, pathStr.length - index - 1);
|
|
17567
|
+
var queryArr = str2.split('&');
|
|
17568
|
+
var newArr = queryArr.map(function (item) {
|
|
17569
|
+
var index = item.indexOf('=');
|
|
17570
|
+
var s1 = item.substr(0, index);
|
|
17571
|
+
var s2 = item.substr(index + 1, item.length - index - 1);
|
|
17572
|
+
return "".concat(s1, "=").concat(encodeURIComponent(s2));
|
|
17573
|
+
});
|
|
17574
|
+
newPathStr = "".concat(str1).concat(newArr.join('&'));
|
|
17575
|
+
} else {
|
|
17576
|
+
newPathStr = pathStr;
|
|
17577
|
+
}
|
|
17578
|
+
|
|
17579
|
+
return newPathStr;
|
|
17580
|
+
};
|
|
17560
17581
|
|
|
17561
17582
|
var AllFunc = function AllFunc(props) {
|
|
17562
17583
|
var _useState = useState(''),
|
|
@@ -19934,7 +19955,8 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
19934
19955
|
});
|
|
19935
19956
|
|
|
19936
19957
|
localStorage.setItem('isTabChange', '1');
|
|
19937
|
-
|
|
19958
|
+
var newKey = encodeUrlQuery(key);
|
|
19959
|
+
history.push(newKey);
|
|
19938
19960
|
}
|
|
19939
19961
|
};
|
|
19940
19962
|
|
|
@@ -20011,8 +20033,9 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
20011
20033
|
listenRouterState: newListenRouterState,
|
|
20012
20034
|
listenRouterKey: newListenRouterKey
|
|
20013
20035
|
}, function () {
|
|
20036
|
+
var newKey = encodeUrlQuery(newActiveKey);
|
|
20014
20037
|
history.push({
|
|
20015
|
-
pathname:
|
|
20038
|
+
pathname: newKey
|
|
20016
20039
|
});
|
|
20017
20040
|
|
|
20018
20041
|
_this.checkisNavSlide();
|
|
@@ -20047,8 +20070,9 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
20047
20070
|
|
|
20048
20071
|
_this.handleMenuClick = function (item) {
|
|
20049
20072
|
if (item.children || !item.component) return;
|
|
20073
|
+
var newKey = encodeUrlQuery(item.path);
|
|
20050
20074
|
history.push({
|
|
20051
|
-
pathname:
|
|
20075
|
+
pathname: newKey
|
|
20052
20076
|
});
|
|
20053
20077
|
|
|
20054
20078
|
_this.setShowMenu(false);
|
|
@@ -20166,8 +20190,9 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
20166
20190
|
|
|
20167
20191
|
_this.updateState(newlistenRouterState, newlistenRouterKey, function () {
|
|
20168
20192
|
if (deleteKey === activeKey) {
|
|
20193
|
+
var newKey = encodeUrlQuery(newActiveKey);
|
|
20169
20194
|
history.push({
|
|
20170
|
-
pathname:
|
|
20195
|
+
pathname: newKey
|
|
20171
20196
|
});
|
|
20172
20197
|
}
|
|
20173
20198
|
});
|
|
@@ -20190,8 +20215,9 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
20190
20215
|
})) {
|
|
20191
20216
|
return;
|
|
20192
20217
|
} else {
|
|
20218
|
+
var newKey = encodeUrlQuery(key);
|
|
20193
20219
|
history.push({
|
|
20194
|
-
pathname:
|
|
20220
|
+
pathname: newKey
|
|
20195
20221
|
});
|
|
20196
20222
|
}
|
|
20197
20223
|
});
|
|
@@ -20219,8 +20245,9 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
20219
20245
|
})) {
|
|
20220
20246
|
return;
|
|
20221
20247
|
} else {
|
|
20248
|
+
var newKey = encodeUrlQuery(key);
|
|
20222
20249
|
history.push({
|
|
20223
|
-
pathname:
|
|
20250
|
+
pathname: newKey
|
|
20224
20251
|
});
|
|
20225
20252
|
}
|
|
20226
20253
|
});
|
|
@@ -20245,8 +20272,9 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
20245
20272
|
return item === key || item === '/';
|
|
20246
20273
|
}), function () {
|
|
20247
20274
|
if (key !== activeKey) {
|
|
20275
|
+
var newKey = encodeUrlQuery(key);
|
|
20248
20276
|
history.push({
|
|
20249
|
-
pathname:
|
|
20277
|
+
pathname: newKey
|
|
20250
20278
|
});
|
|
20251
20279
|
}
|
|
20252
20280
|
});
|
|
@@ -20317,7 +20345,8 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
20317
20345
|
}
|
|
20318
20346
|
|
|
20319
20347
|
if (typeof e.data === 'string') {
|
|
20320
|
-
|
|
20348
|
+
var newKey = encodeUrlQuery(e.data.replace(/^\/\w+\//, '/'));
|
|
20349
|
+
history.push(newKey);
|
|
20321
20350
|
} else {
|
|
20322
20351
|
var info = e.data;
|
|
20323
20352
|
|
|
@@ -20568,8 +20597,9 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
20568
20597
|
}), listenRouterKey.filter(function (d) {
|
|
20569
20598
|
return d !== activeKey;
|
|
20570
20599
|
}), function () {
|
|
20600
|
+
var newKey = encodeUrlQuery(newActiveKey);
|
|
20571
20601
|
history.push({
|
|
20572
|
-
pathname:
|
|
20602
|
+
pathname: newKey
|
|
20573
20603
|
});
|
|
20574
20604
|
});
|
|
20575
20605
|
}
|
package/dist/index.js
CHANGED
|
@@ -17571,6 +17571,27 @@ var ergodicMenuRoutes = function ergodicMenuRoutes(routes) {
|
|
|
17571
17571
|
ergodicRoutes(routes);
|
|
17572
17572
|
return codeArray;
|
|
17573
17573
|
};
|
|
17574
|
+
var encodeUrlQuery = function encodeUrlQuery(pathStr) {
|
|
17575
|
+
var newPathStr = '';
|
|
17576
|
+
|
|
17577
|
+
if (pathStr.indexOf('#') > -1) {
|
|
17578
|
+
var index = pathStr.indexOf('?');
|
|
17579
|
+
var str1 = pathStr.substr(0, index + 1);
|
|
17580
|
+
var str2 = pathStr.substr(index + 1, pathStr.length - index - 1);
|
|
17581
|
+
var queryArr = str2.split('&');
|
|
17582
|
+
var newArr = queryArr.map(function (item) {
|
|
17583
|
+
var index = item.indexOf('=');
|
|
17584
|
+
var s1 = item.substr(0, index);
|
|
17585
|
+
var s2 = item.substr(index + 1, item.length - index - 1);
|
|
17586
|
+
return "".concat(s1, "=").concat(encodeURIComponent(s2));
|
|
17587
|
+
});
|
|
17588
|
+
newPathStr = "".concat(str1).concat(newArr.join('&'));
|
|
17589
|
+
} else {
|
|
17590
|
+
newPathStr = pathStr;
|
|
17591
|
+
}
|
|
17592
|
+
|
|
17593
|
+
return newPathStr;
|
|
17594
|
+
};
|
|
17574
17595
|
|
|
17575
17596
|
var AllFunc = function AllFunc(props) {
|
|
17576
17597
|
var _useState = React.useState(''),
|
|
@@ -19948,7 +19969,8 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
19948
19969
|
});
|
|
19949
19970
|
|
|
19950
19971
|
localStorage.setItem('isTabChange', '1');
|
|
19951
|
-
|
|
19972
|
+
var newKey = encodeUrlQuery(key);
|
|
19973
|
+
umi.history.push(newKey);
|
|
19952
19974
|
}
|
|
19953
19975
|
};
|
|
19954
19976
|
|
|
@@ -20025,8 +20047,9 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
20025
20047
|
listenRouterState: newListenRouterState,
|
|
20026
20048
|
listenRouterKey: newListenRouterKey
|
|
20027
20049
|
}, function () {
|
|
20050
|
+
var newKey = encodeUrlQuery(newActiveKey);
|
|
20028
20051
|
umi.history.push({
|
|
20029
|
-
pathname:
|
|
20052
|
+
pathname: newKey
|
|
20030
20053
|
});
|
|
20031
20054
|
|
|
20032
20055
|
_this.checkisNavSlide();
|
|
@@ -20061,8 +20084,9 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
20061
20084
|
|
|
20062
20085
|
_this.handleMenuClick = function (item) {
|
|
20063
20086
|
if (item.children || !item.component) return;
|
|
20087
|
+
var newKey = encodeUrlQuery(item.path);
|
|
20064
20088
|
umi.history.push({
|
|
20065
|
-
pathname:
|
|
20089
|
+
pathname: newKey
|
|
20066
20090
|
});
|
|
20067
20091
|
|
|
20068
20092
|
_this.setShowMenu(false);
|
|
@@ -20180,8 +20204,9 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
20180
20204
|
|
|
20181
20205
|
_this.updateState(newlistenRouterState, newlistenRouterKey, function () {
|
|
20182
20206
|
if (deleteKey === activeKey) {
|
|
20207
|
+
var newKey = encodeUrlQuery(newActiveKey);
|
|
20183
20208
|
umi.history.push({
|
|
20184
|
-
pathname:
|
|
20209
|
+
pathname: newKey
|
|
20185
20210
|
});
|
|
20186
20211
|
}
|
|
20187
20212
|
});
|
|
@@ -20204,8 +20229,9 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
20204
20229
|
})) {
|
|
20205
20230
|
return;
|
|
20206
20231
|
} else {
|
|
20232
|
+
var newKey = encodeUrlQuery(key);
|
|
20207
20233
|
umi.history.push({
|
|
20208
|
-
pathname:
|
|
20234
|
+
pathname: newKey
|
|
20209
20235
|
});
|
|
20210
20236
|
}
|
|
20211
20237
|
});
|
|
@@ -20233,8 +20259,9 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
20233
20259
|
})) {
|
|
20234
20260
|
return;
|
|
20235
20261
|
} else {
|
|
20262
|
+
var newKey = encodeUrlQuery(key);
|
|
20236
20263
|
umi.history.push({
|
|
20237
|
-
pathname:
|
|
20264
|
+
pathname: newKey
|
|
20238
20265
|
});
|
|
20239
20266
|
}
|
|
20240
20267
|
});
|
|
@@ -20259,8 +20286,9 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
20259
20286
|
return item === key || item === '/';
|
|
20260
20287
|
}), function () {
|
|
20261
20288
|
if (key !== activeKey) {
|
|
20289
|
+
var newKey = encodeUrlQuery(key);
|
|
20262
20290
|
umi.history.push({
|
|
20263
|
-
pathname:
|
|
20291
|
+
pathname: newKey
|
|
20264
20292
|
});
|
|
20265
20293
|
}
|
|
20266
20294
|
});
|
|
@@ -20331,7 +20359,8 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
20331
20359
|
}
|
|
20332
20360
|
|
|
20333
20361
|
if (typeof e.data === 'string') {
|
|
20334
|
-
|
|
20362
|
+
var newKey = encodeUrlQuery(e.data.replace(/^\/\w+\//, '/'));
|
|
20363
|
+
history.push(newKey);
|
|
20335
20364
|
} else {
|
|
20336
20365
|
var info = e.data;
|
|
20337
20366
|
|
|
@@ -20582,8 +20611,9 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
20582
20611
|
}), listenRouterKey.filter(function (d) {
|
|
20583
20612
|
return d !== activeKey;
|
|
20584
20613
|
}), function () {
|
|
20614
|
+
var newKey = encodeUrlQuery(newActiveKey);
|
|
20585
20615
|
umi.history.push({
|
|
20586
|
-
pathname:
|
|
20616
|
+
pathname: newKey
|
|
20587
20617
|
});
|
|
20588
20618
|
});
|
|
20589
20619
|
}
|
package/package.json
CHANGED
|
@@ -33,6 +33,7 @@ import {
|
|
|
33
33
|
getBreadcrumbNameMap,
|
|
34
34
|
ergodicMenuRoutes,
|
|
35
35
|
matchPath,
|
|
36
|
+
encodeUrlQuery,
|
|
36
37
|
} from './utils';
|
|
37
38
|
import moment from 'moment';
|
|
38
39
|
import GlobalHeaderCom from './Components/GlobalHeader';
|
|
@@ -347,7 +348,8 @@ class BasicLayout extends React.PureComponent {
|
|
|
347
348
|
}
|
|
348
349
|
|
|
349
350
|
if (typeof e.data === 'string') {
|
|
350
|
-
|
|
351
|
+
let newKey = encodeUrlQuery(e.data.replace(/^\/\w+\//, '/'));
|
|
352
|
+
history.push(newKey);
|
|
351
353
|
} else {
|
|
352
354
|
const info = e.data;
|
|
353
355
|
if (info.type === 'remove') {
|
|
@@ -638,7 +640,8 @@ class BasicLayout extends React.PureComponent {
|
|
|
638
640
|
activeKey: key,
|
|
639
641
|
});
|
|
640
642
|
localStorage.setItem('isTabChange', '1');
|
|
641
|
-
|
|
643
|
+
let newKey = encodeUrlQuery(key);
|
|
644
|
+
history.push(newKey);
|
|
642
645
|
}
|
|
643
646
|
};
|
|
644
647
|
|
|
@@ -718,8 +721,9 @@ class BasicLayout extends React.PureComponent {
|
|
|
718
721
|
listenRouterKey: newListenRouterKey,
|
|
719
722
|
},
|
|
720
723
|
() => {
|
|
724
|
+
let newKey = encodeUrlQuery(newActiveKey);
|
|
721
725
|
history.push({
|
|
722
|
-
pathname:
|
|
726
|
+
pathname: newKey,
|
|
723
727
|
});
|
|
724
728
|
this.checkisNavSlide();
|
|
725
729
|
},
|
|
@@ -754,8 +758,9 @@ class BasicLayout extends React.PureComponent {
|
|
|
754
758
|
|
|
755
759
|
handleMenuClick = (item: any) => {
|
|
756
760
|
if (item.children || !item.component) return;
|
|
761
|
+
let newKey = encodeUrlQuery(item.path);
|
|
757
762
|
history.push({
|
|
758
|
-
pathname:
|
|
763
|
+
pathname: newKey,
|
|
759
764
|
});
|
|
760
765
|
this.setShowMenu(false);
|
|
761
766
|
};
|
|
@@ -868,8 +873,9 @@ class BasicLayout extends React.PureComponent {
|
|
|
868
873
|
newlistenRouterKey = listenRouterKey.filter((d) => d !== key);
|
|
869
874
|
this.updateState(newlistenRouterState, newlistenRouterKey, () => {
|
|
870
875
|
if (deleteKey === activeKey) {
|
|
876
|
+
let newKey = encodeUrlQuery(newActiveKey);
|
|
871
877
|
history.push({
|
|
872
|
-
pathname:
|
|
878
|
+
pathname: newKey,
|
|
873
879
|
});
|
|
874
880
|
}
|
|
875
881
|
});
|
|
@@ -886,8 +892,9 @@ class BasicLayout extends React.PureComponent {
|
|
|
886
892
|
if (newlistenRouterKey.find((item) => item === activeKey)) {
|
|
887
893
|
return;
|
|
888
894
|
} else {
|
|
895
|
+
let newKey = encodeUrlQuery(key);
|
|
889
896
|
history.push({
|
|
890
|
-
pathname:
|
|
897
|
+
pathname: newKey,
|
|
891
898
|
});
|
|
892
899
|
}
|
|
893
900
|
});
|
|
@@ -909,8 +916,9 @@ class BasicLayout extends React.PureComponent {
|
|
|
909
916
|
if (newlistenRouterKey.find((item) => item === activeKey)) {
|
|
910
917
|
return;
|
|
911
918
|
} else {
|
|
919
|
+
let newKey = encodeUrlQuery(key);
|
|
912
920
|
history.push({
|
|
913
|
-
pathname:
|
|
921
|
+
pathname: newKey,
|
|
914
922
|
});
|
|
915
923
|
}
|
|
916
924
|
},
|
|
@@ -935,8 +943,9 @@ class BasicLayout extends React.PureComponent {
|
|
|
935
943
|
listenRouterKey.filter((item) => item === key || item === '/'),
|
|
936
944
|
() => {
|
|
937
945
|
if (key !== activeKey) {
|
|
946
|
+
let newKey = encodeUrlQuery(key);
|
|
938
947
|
history.push({
|
|
939
|
-
pathname:
|
|
948
|
+
pathname: newKey,
|
|
940
949
|
});
|
|
941
950
|
}
|
|
942
951
|
},
|
|
@@ -1036,8 +1045,9 @@ class BasicLayout extends React.PureComponent {
|
|
|
1036
1045
|
listenRouterState.filter((d) => d.key !== activeKey),
|
|
1037
1046
|
listenRouterKey.filter((d) => d !== activeKey),
|
|
1038
1047
|
() => {
|
|
1048
|
+
let newKey = encodeUrlQuery(newActiveKey);
|
|
1039
1049
|
history.push({
|
|
1040
|
-
pathname:
|
|
1050
|
+
pathname: newKey,
|
|
1041
1051
|
});
|
|
1042
1052
|
},
|
|
1043
1053
|
);
|
|
@@ -208,4 +208,24 @@ export const ergodicMenuRoutes = (routes) => {
|
|
|
208
208
|
ergodicRoutes(routes);
|
|
209
209
|
|
|
210
210
|
return codeArray;
|
|
211
|
-
};
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
export const encodeUrlQuery = (pathStr: any) => {
|
|
214
|
+
let newPathStr='';
|
|
215
|
+
if (pathStr.indexOf('#') > -1) {
|
|
216
|
+
let index = pathStr.indexOf('?');
|
|
217
|
+
let str1 = pathStr.substr(0, index+1);
|
|
218
|
+
let str2 = pathStr.substr(index+1, pathStr.length - index -1);
|
|
219
|
+
let queryArr = str2.split('&');
|
|
220
|
+
let newArr = queryArr.map(item => {
|
|
221
|
+
let index = item.indexOf('=');
|
|
222
|
+
let s1 = item.substr(0, index);
|
|
223
|
+
let s2 = item.substr(index+1, item.length - index -1);
|
|
224
|
+
return `${s1}=${encodeURIComponent(s2)}`;
|
|
225
|
+
})
|
|
226
|
+
newPathStr = `${str1}${newArr.join('&')}`;
|
|
227
|
+
} else {
|
|
228
|
+
newPathStr = pathStr;
|
|
229
|
+
}
|
|
230
|
+
return newPathStr;
|
|
231
|
+
}
|