-
{moment(item.updatedAt).fromNow()}
-
-
- {
- item.members.map((member, i) => (
-
- ))
- }
-
-
+
}
+ >
+
+
+
{moment(item.updatedAt).fromNow()}
+
+
+ {
+ item.members.map((member, i) => (
+
+ ))
+ }
+
-
-
+
+
)}
/>
diff --git a/src/utils/utils.js b/src/utils/utils.js
index 18b3284d25984f27e25d1249fb3d45a274f9b93b..014b4d5af680c0e174e8a33a5f1c05a9605ef9d1 100644
--- a/src/utils/utils.js
+++ b/src/utils/utils.js
@@ -1,4 +1,7 @@
import moment from 'moment';
+import cloneDeep from 'lodash/cloneDeep';
+import navData from '../common/nav';
+
export function fixedZero(val) {
return val * 1 < 10 ? `0${val}` : val;
@@ -48,3 +51,31 @@ export function getTimeDistance(type) {
return [moment(`${year}-01-01 00:00:00`), moment(`${year}-12-31 23:59:59`)];
}
}
+
+function getPlainNode(nodeList, parentPath = '') {
+ const arr = [];
+ nodeList.forEach((node) => {
+ const item = node;
+ item.path = `${parentPath}/${item.path || ''}`.replace(/\/+/g, '/');
+ item.exact = true;
+ if (item.children && !item.component) {
+ arr.push(...getPlainNode(item.children, item.path));
+ } else {
+ if (item.children && item.component) {
+ item.exact = false;
+ }
+ arr.push(item);
+ }
+ });
+ return arr;
+}
+
+export function getRouteData(path) {
+ if (!navData.some(item => item.layout === path) ||
+ !(navData.filter(item => item.layout === path)[0].children)) {
+ return null;
+ }
+ const dataList = cloneDeep(navData.filter(item => item.layout === path)[0]);
+ const nodeList = getPlainNode(dataList.children);
+ return nodeList;
+}