@titaui/pc 1.16.30 → 1.16.31
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.
|
@@ -48,7 +48,9 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
48
48
|
function SurveyMenus(props) {
|
|
49
49
|
var _props$onSelect = props.onSelect,
|
|
50
50
|
onSelect = _props$onSelect === void 0 ? function () {} : _props$onSelect,
|
|
51
|
-
history = props.history
|
|
51
|
+
history = props.history,
|
|
52
|
+
_props$defaultMenus = props.defaultMenus,
|
|
53
|
+
defaultMenus = _props$defaultMenus === void 0 ? [] : _props$defaultMenus;
|
|
52
54
|
|
|
53
55
|
var _useState = (0, _react.useState)({}),
|
|
54
56
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -108,7 +110,8 @@ function SurveyMenus(props) {
|
|
|
108
110
|
}, /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_surveyFrontMenus["default"], {
|
|
109
111
|
ref: surveyFrontMenu,
|
|
110
112
|
onSelect: onSelect,
|
|
111
|
-
history: history
|
|
113
|
+
history: history,
|
|
114
|
+
defaultMenus: defaultMenus
|
|
112
115
|
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
113
116
|
className: (0, _classnames["default"])("tita-bootstrap__scrollbar")
|
|
114
117
|
}))));
|
|
@@ -29,14 +29,19 @@ var surveyMenus = /*#__PURE__*/function () {
|
|
|
29
29
|
function surveyMenus(props) {
|
|
30
30
|
_classCallCheck(this, surveyMenus);
|
|
31
31
|
|
|
32
|
-
this.menus = [
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
32
|
+
// this.menus = [
|
|
33
|
+
// {
|
|
34
|
+
// icon: 'survey-involved',
|
|
35
|
+
// label: '活跃度统计',
|
|
36
|
+
// key: PAGE_SURVEY_MY_INVOLVED,
|
|
37
|
+
// type: MENU_ITEM_NOE,
|
|
38
|
+
// href: '#/skynet-dashboard',
|
|
39
|
+
// isShow: true,
|
|
40
|
+
// },
|
|
41
|
+
// ]
|
|
42
|
+
var _props$defaultMenus = props.defaultMenus,
|
|
43
|
+
defaultMenus = _props$defaultMenus === void 0 ? [] : _props$defaultMenus;
|
|
44
|
+
this.menus = defaultMenus;
|
|
40
45
|
}
|
|
41
46
|
|
|
42
47
|
_createClass(surveyMenus, [{
|
|
@@ -19,8 +19,6 @@ var _menus = _interopRequireWildcard(require("./menus"));
|
|
|
19
19
|
|
|
20
20
|
var _menuHighlight = _interopRequireDefault(require("./menu-highlight"));
|
|
21
21
|
|
|
22
|
-
var _auth = require("../../../../utils/auth");
|
|
23
|
-
|
|
24
22
|
require("../../index.css");
|
|
25
23
|
|
|
26
24
|
require("./index.css");
|
|
@@ -48,9 +46,9 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
48
46
|
var _default = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
49
47
|
var _props$onSelect = props.onSelect,
|
|
50
48
|
onSelect = _props$onSelect === void 0 ? function () {} : _props$onSelect,
|
|
51
|
-
history = props.history
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
history = props.history,
|
|
50
|
+
_props$defaultMenus = props.defaultMenus,
|
|
51
|
+
defaultMenus = _props$defaultMenus === void 0 ? [] : _props$defaultMenus;
|
|
54
52
|
|
|
55
53
|
var _useState = (0, _react.useState)(function () {
|
|
56
54
|
return document.body.offsetHeight - 198;
|
|
@@ -77,7 +75,7 @@ var _default = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
77
75
|
|
|
78
76
|
var _useState7 = (0, _react.useState)(function () {
|
|
79
77
|
surveyMenusData.current = new _menus["default"]({
|
|
80
|
-
|
|
78
|
+
defaultMenus: defaultMenus
|
|
81
79
|
});
|
|
82
80
|
return surveyMenusData.current.getMenus();
|
|
83
81
|
}),
|
|
@@ -93,22 +91,24 @@ var _default = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
93
91
|
});
|
|
94
92
|
var pathname = history.location.pathname;
|
|
95
93
|
var firstMenuHref = menus[0].data.href;
|
|
96
|
-
if (firstMenuHref.split('#')[1] === pathname) return;
|
|
94
|
+
if (firstMenuHref.split('#')[1] === pathname) return; // 当前路由与二级菜单第一项相同时直接return
|
|
97
95
|
|
|
98
96
|
var menusHrefArr = ['/survey/manage', '/survey/my-involved'];
|
|
99
97
|
var isIncludeMenu = menusHrefArr.find(function (item) {
|
|
100
|
-
|
|
101
|
-
|
|
98
|
+
return (// 表示当前路由是否是左侧二级菜单的选项
|
|
99
|
+
item.includes(pathname)
|
|
100
|
+
);
|
|
102
101
|
});
|
|
103
|
-
if (!isIncludeMenu) return;
|
|
102
|
+
if (!isIncludeMenu) return; // 如果不是二级菜单选项直接return
|
|
104
103
|
|
|
105
104
|
var isShowMenuItem = menus.find(function (item) {
|
|
106
|
-
|
|
107
|
-
|
|
105
|
+
return (// 判断当前路由是否有权限被展示
|
|
106
|
+
item.data.href.split('#')[1].includes(pathname)
|
|
107
|
+
);
|
|
108
108
|
});
|
|
109
109
|
|
|
110
110
|
if (!isShowMenuItem) {
|
|
111
|
-
|
|
111
|
+
// 如果当前路由没有权限展示的话,则跳转到有权限二级路由的第一项
|
|
112
112
|
window.location.href = firstMenuHref;
|
|
113
113
|
}
|
|
114
114
|
}, [history.location.pathname, history.location.search]);
|
|
@@ -122,9 +122,7 @@ var _default = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
122
122
|
var node = _ref.node;
|
|
123
123
|
onSelect(node); // 处理菜单选中
|
|
124
124
|
|
|
125
|
-
if (!selectedKyes.length) {
|
|
126
|
-
return;
|
|
127
|
-
} else {
|
|
125
|
+
if (!selectedKyes.length) {} else {
|
|
128
126
|
setSelectedMenuKeys(selectedKyes);
|
|
129
127
|
}
|
|
130
128
|
};
|