Ver código fonte

feat: 新增页面

jihuaqiang 2 semanas atrás
pai
commit
410c39f6c9

+ 1 - 1
src/components/layout/index.tsx

@@ -21,7 +21,7 @@ const PageLayout: React.FC = () => {
         <PageBreadcrumb />
         <PageContent></PageContent>
         <Footer style={{ textAlign: 'center' }}>
-          React Admin Dashboard ©{new Date().getFullYear()} Created by Yujian Xue
+          {/* React Admin Dashboard ©{new Date().getFullYear()} Created by Yujian Xue */}
         </Footer>
       </Layout>
     </Layout>

+ 2 - 2
src/components/layout/sidebar.tsx

@@ -10,7 +10,7 @@ const getMenuItems = (routes: AdminRouterItem[]): any[] => {
     if (!itm.meta) return null
     let children: any[] = []
     if (itm.children) children = getMenuItems(itm.children)
-    return children ? {
+    return children.length > 0 ? {
       ...itm.meta,
       children
     } : {
@@ -23,7 +23,7 @@ const getMenuItems = (routes: AdminRouterItem[]): any[] => {
 /**
  * PageSidebar
  * @param props {autoCollapse?: boolean} automatic collapes menu when click another menu
- * @returns 
+ * @returns
  */
 const PageSidebar = (props: {
   autoCollapse?: boolean

+ 42 - 0
src/views/publishContent/publishContent.router.tsx

@@ -0,0 +1,42 @@
+import { DesktopOutlined } from '@ant-design/icons'
+import { AdminRouterItem } from "../../router";
+import WeCom from "./weCom";
+import WeGZH from "./weGZH";
+import { Outlet } from "react-router-dom";
+
+const demoRoutes: AdminRouterItem[] = [
+  {
+		path: 'publishContent',
+		element: <Outlet />,
+		meta: {
+			label: "发布内容管理",
+			title: "发布内容管理",
+			key: "/publishContent",
+			icon: <DesktopOutlined />,
+		},
+		children: [
+			{
+				path: 'wegzh',
+				element: <WeGZH />,
+				meta: {
+					label: "公众号",
+					title: "公众号",
+					key: "/publishContent/wegzh",
+					icon: <DesktopOutlined />,
+				}
+			},
+			{
+				path: 'wecom',
+				element: <WeCom />,
+				meta: {
+					label: "企微",
+					title: "企微",
+					key: "/publishContent/wecom",
+					icon: <DesktopOutlined />,
+				}
+			},
+		]
+	}
+]
+
+export default demoRoutes

+ 81 - 0
src/views/publishContent/weCom/index.tsx

@@ -0,0 +1,81 @@
+import React from 'react';
+import { Space, Table, Tag } from 'antd';
+import type { TableProps } from 'antd';
+
+interface DataType {
+  key: string;
+  name: string;
+  age: number;
+  address: string;
+  tags: string[];
+}
+
+const columns: TableProps<DataType>['columns'] = [
+  {
+    title: 'Name',
+    dataIndex: 'name',
+    key: 'name',
+    render: (text) => <a>{text}</a>,
+  },
+  {
+    title: 'Age',
+    dataIndex: 'age',
+    key: 'age',
+  },
+  {
+    title: 'Address',
+    dataIndex: 'address',
+    key: 'address',
+  },
+  {
+    title: 'Tags',
+    key: 'tags',
+    dataIndex: 'tags',
+    render: (_, { tags }) => (
+      <>
+        {tags.map((tag) => {
+          let color = tag.length > 5 ? 'geekblue' : 'green';
+          if (tag === 'loser') {
+            color = 'volcano';
+          }
+          return (
+            <Tag color={color} key={tag}>
+              {tag.toUpperCase()}
+            </Tag>
+          );
+        })}
+      </>
+    ),
+  },
+  {
+    title: 'Action',
+    key: 'action',
+    render: (_, record) => (
+      <Space size="middle">
+        <a>Invite {record.name}</a>
+        <a>Delete</a>
+      </Space>
+    ),
+  },
+];
+
+const data: DataType[] = [
+  {
+    key: '1',
+    name: 'John Brown1111',
+    age: 32,
+    address: 'New York No. 1 Lake Park',
+    tags: ['nice', 'developer'],
+  },
+  {
+    key: '2',
+    name: 'Jim Green 1111',
+    age: 42,
+    address: 'London No. 1 Lake Park',
+    tags: ['loser'],
+  },
+];
+
+const DemoTable: React.FC = () => <Table columns={columns} dataSource={data} />;
+
+export default DemoTable;

+ 88 - 0
src/views/publishContent/weGZH/index.tsx

@@ -0,0 +1,88 @@
+import React from 'react';
+import { Space, Table, Tag } from 'antd';
+import type { TableProps } from 'antd';
+
+interface DataType {
+  key: string;
+  name: string;
+  age: number;
+  address: string;
+  tags: string[];
+}
+
+const columns: TableProps<DataType>['columns'] = [
+  {
+    title: 'Name',
+    dataIndex: 'name',
+    key: 'name',
+    render: (text) => <a>{text}</a>,
+  },
+  {
+    title: 'Age',
+    dataIndex: 'age',
+    key: 'age',
+  },
+  {
+    title: 'Address',
+    dataIndex: 'address',
+    key: 'address',
+  },
+  {
+    title: 'Tags',
+    key: 'tags',
+    dataIndex: 'tags',
+    render: (_, { tags }) => (
+      <>
+        {tags.map((tag) => {
+          let color = tag.length > 5 ? 'geekblue' : 'green';
+          if (tag === 'loser') {
+            color = 'volcano';
+          }
+          return (
+            <Tag color={color} key={tag}>
+              {tag.toUpperCase()}
+            </Tag>
+          );
+        })}
+      </>
+    ),
+  },
+  {
+    title: 'Action',
+    key: 'action',
+    render: (_, record) => (
+      <Space size="middle">
+        <a>Invite {record.name}</a>
+        <a>Delete</a>
+      </Space>
+    ),
+  },
+];
+
+const data: DataType[] = [
+  {
+    key: '1',
+    name: 'John Brown',
+    age: 32,
+    address: 'New York No. 1 Lake Park',
+    tags: ['nice', 'developer'],
+  },
+  {
+    key: '2',
+    name: 'Jim Green',
+    age: 42,
+    address: 'London No. 1 Lake Park',
+    tags: ['loser'],
+  },
+  {
+    key: '3',
+    name: 'Joe Black',
+    age: 32,
+    address: 'Sydney No. 1 Lake Park',
+    tags: ['cool', 'teacher'],
+  },
+];
+
+const DemoTable: React.FC = () => <Table columns={columns} dataSource={data} />;
+
+export default DemoTable;