From 06e9017072e85c41562b3692a3228fa0f8ce3208 Mon Sep 17 00:00:00 2001 From: lu <2478382412@qq.com> Date: Tue, 21 Mar 2023 19:58:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9D=83=E9=99=90=E6=9B=B4=E6=96=B01.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/MyLayout.tsx | 16 +- src/grants/menuData.ts | 143 ++++++++++++++++++ src/mock/Login.js | 6 +- src/views/Login/login.tsx | 5 +- .../BannerManagement/AddBan.tsx | 2 +- .../SystemSettings/DrugManagement/PubDrug.tsx | 2 +- .../InformationManagement/PubText.tsx | 2 +- .../SystemSettings/RoleManagement/AddMan.tsx | 45 +++++- 8 files changed, 204 insertions(+), 17 deletions(-) create mode 100644 src/grants/menuData.ts diff --git a/src/components/MyLayout.tsx b/src/components/MyLayout.tsx index 5c5a18e..1dbf832 100644 --- a/src/components/MyLayout.tsx +++ b/src/components/MyLayout.tsx @@ -13,7 +13,7 @@ import { MenuUnfoldOutlined, } from '@ant-design/icons'; import type { MenuProps } from 'antd'; -import {Breadcrumb, Layout, Menu, theme, Dropdown, Space } from 'antd'; +import { Breadcrumb, Layout, Menu, theme, Dropdown, Space } from 'antd'; // 导入logo import logo from "../assets/logo.jpg" import { Outlet, useNavigate } from 'react-router-dom'; @@ -38,28 +38,28 @@ function getItem( const items1: MenuItem[] = [ getItem('工作台', '/MyLayout/WorkBench', ), - getItem('签约管理', 'sub1', , [ + getItem('签约管理', 'sign', , [ getItem('待处理签约', '/MyLayout/PendingContract'), getItem('签约记录', '/MyLayout/SigningRecord'), ]), - getItem('服务管理', 'sub2', , [ + getItem('服务管理', 'serve', , [ getItem('待处理服务', '/MyLayout/PendingService'), getItem('服务记录', '/MyLayout/ServiceRecord'), ]), getItem('居民管理', '/MyLayout/ResidentManagement', ), - getItem('资料管理', 'sub3', , [ + getItem('资料管理', 'data', , [ getItem('机构管理', '/MyLayout/Organizational'), getItem('团队管理', '/MyLayout/Team'), getItem('医生管理', '/MyLayout/Doctor'), getItem('服务包管理', '/MyLayout/ServicePackage'), getItem('服务项目管理', '/MyLayout/ServiceProject'), ]), - getItem('数据统计', 'sub4', , [ + getItem('数据统计', 'stat', , [ getItem('数据概况', '/MyLayout/DataProfile'), getItem('签约业绩统计', '/MyLayout/SigningPerformance'), getItem('服务业绩统计', '/MyLayout/ServicePerformance'), ]), - getItem('系统设置', 'sub5', , [ + getItem('系统设置', 'sys', , [ getItem('标签管理', '/MyLayout/LabelManagement'), getItem('角色管理', '/MyLayout/RoleManagement'), getItem('咨讯管理', '/MyLayout/InformationManagement'), @@ -89,10 +89,10 @@ const MyLayout: React.FC = () => { } const items: MenuProps['items'] = [ { - label:

{push('/Login')}}>退出登录

, + label:

{ push('/Login') }}>退出登录

, key: '0', }, - + ]; // return ( diff --git a/src/grants/menuData.ts b/src/grants/menuData.ts new file mode 100644 index 0000000..028a077 --- /dev/null +++ b/src/grants/menuData.ts @@ -0,0 +1,143 @@ +import React from "react"; +import { DesktopOutlined, EditOutlined, UserOutlined, TeamOutlined, FileOutlined, PieChartOutlined, SettingOutlined } from '@ant-design/icons'; + +// 所有菜单数据 +export const menuData = [ + { + label: '工作台', + title: '工作台', + key: '/MyLayout/WorkBench', + icon: React.createElement(DesktopOutlined), + }, + { + label: '签约管理', + title: '签约管理', + key: 'sign', + icon: React.createElement(EditOutlined), + children: [ + { + label: "待处理签约", + title: '待处理签约', + key: '/MyLayout/PendingContract', + }, + { + label: "签约记录", + title: '签约记录', + key: '/MyLayout/SigningRecord', + }, + ], + }, + { + label: '服务管理', + title: '服务管理', + key: 'serve', + icon: React.createElement(UserOutlined), + children: [ + { + label: "待处理服务", + title: '待处理服务', + key: '/MyLayout/PendingService', + }, + { + label: "服务记录", + title: '服务记录', + key: '/MyLayout/ServiceRecord', + }, + ], + }, + { + label: '居民管理', + title: '居民管理', + key: '/MyLayout/ResidentManagement', + icon: React.createElement(TeamOutlined), + }, + { + label: '资料管理', + title: '资料管理', + key: 'data', + icon: React.createElement(FileOutlined), + children: [ + { + label: "机构管理", + title: '机构管理', + key: '/MyLayout/Organizational', + }, + { + label: "团队管理", + title: '团队管理', + key: '/MyLayout/Team', + }, + { + label: "医生管理", + title: '医生管理', + key: '/MyLayout/Doctor', + }, + { + label: "服务包管理", + title: '服务包管理', + key: '/MyLayout/ServicePackage', + }, + { + label: "服务项目管理", + title: '服务项目管理', + key: '/MyLayout/ServiceProject', + }, + ], + }, + { + label: '数据统计', + title: '数据统计', + key: 'stat', + icon: React.createElement(PieChartOutlined), + children: [ + { + label: "数据概况", + title: '数据概况', + key: '/MyLayout/DataProfile', + }, + { + label: "签约业绩统计", + title: '签约业绩统计', + key: '/MyLayout/SigningPerformance', + }, + { + label: "服务业绩统计", + title: '服务业绩统计', + key: '/MyLayout/ServicePerformance', + }, + ], + }, + { + label: '系统设置', + title: '系统设置', + key: 'sys', + icon: React.createElement(SettingOutlined), + children: [ + { + label: "标签管理", + title: '标签管理', + key: '/MyLayout/LabelManagement', + }, + { + label: "角色管理", + title: '角色管理', + key: '/MyLayout/RoleManagement', + }, + { + label: "咨讯管理", + title: '咨讯管理', + key: '/MyLayout/InformationManagement', + }, + { + label: "药品管理", + title: '药品管理', + key: '/MyLayout/DrugManagement', + }, + { + label: "轮播图管理", + title: '轮播图管理', + key: '/MyLayout/BannerManagement', + }, + ], + }, +] \ No newline at end of file diff --git a/src/mock/Login.js b/src/mock/Login.js index cf341e9..e84d8fd 100644 --- a/src/mock/Login.js +++ b/src/mock/Login.js @@ -13,9 +13,9 @@ if (localStorage.getItem("user_info")) { "id": '@increment()', 'phone|13000000000-19000000000': 1, // phone: 'admin', - name: '@name', + name: '@cname', pass: 123456, - roles: [] + roles: ['/MyLayout/WorkBench', 'sign', '/MyLayout/PendingContract', '/MyLayout/SigningRecord', 'serve', '/MyLayout/PendingService', '/MyLayout/ServiceRecord', '/MyLayout/ResidentManagement', 'data', '/MyLayout/Organizational', '/MyLayout/Team', '/MyLayout/Doctor', '/MyLayout/ServicePackage', '/MyLayout/ServiceProject', 'stat', '/MyLayout/DataProfile', '/MyLayout/SigningPerformance', '/MyLayout/ServicePerformance', 'sys', '/MyLayout/LabelManagement', '/MyLayout/RoleManagement', '/MyLayout/InformationManagement', '/MyLayout/DrugManagement', '/MyLayout/BannerManagement'] } ] }) @@ -48,7 +48,7 @@ Mock.mock('/api/user/login', "post", (req) => { } ] }) - return { code: 200, msg: "登录成功", token: tokendata.tokenarr[0].token,name:data.list[index].name }; + return { code: 200, msg: "登录成功", token: tokendata.tokenarr[0].token, name: data.list[index].name, roles: data.list[index].roles }; } else { diff --git a/src/views/Login/login.tsx b/src/views/Login/login.tsx index 9404fb1..f91e9c3 100644 --- a/src/views/Login/login.tsx +++ b/src/views/Login/login.tsx @@ -16,8 +16,11 @@ export default function User() { type: 'success', content: '登录成功', }); - console.log(res.data.name); + console.log('res.data.name', res.data.name); sessionStorage.setItem('name', res.data.name) + console.log('res.data.roles', res.data.roles) + sessionStorage.setItem('grants', JSON.stringify(res.data.roles)) + localStorage.setItem('token', res.data.token) push({ pathname: '/MyLayout/WorkBench', search: `?data=${res.data.name}` }) diff --git a/src/views/SystemSettings/BannerManagement/AddBan.tsx b/src/views/SystemSettings/BannerManagement/AddBan.tsx index 4c42b6b..80f6206 100644 --- a/src/views/SystemSettings/BannerManagement/AddBan.tsx +++ b/src/views/SystemSettings/BannerManagement/AddBan.tsx @@ -138,7 +138,7 @@ const PubText: React.FC = () => { - - - -