|
@@ -1,5 +1,6 @@
|
|
|
// BasicLayout.tsx
|
|
|
-import React, { useState } from 'react';
|
|
|
+import React from 'react';
|
|
|
+import { useSelector, useDispatch } from 'react-redux';
|
|
|
import { Layout, Row, Col, ConfigProvider, Image } from 'antd';
|
|
|
import { TabBar } from 'antd-mobile';
|
|
|
|
|
@@ -18,6 +19,8 @@ import PatientManagement from '@/pages/patient/PatientManagement';
|
|
|
import MeButton from '@/pages/security/components/MeButton';
|
|
|
import Profile from '@/pages/security/Profile';
|
|
|
import ExamPage from '@/pages/exam/ExamPage';
|
|
|
+import { RootState } from '@/states/store';
|
|
|
+import { setBusinessFlow } from '@/states/BusinessFlowSlice';
|
|
|
|
|
|
// import { Link } from 'react-router-dom';
|
|
|
// import { MenuOutlined } from '@ant-design/icons';
|
|
@@ -44,8 +47,10 @@ const BasicLayout: React.FC<BasicLayoutProps> = () => {
|
|
|
wifiStrength: 0,
|
|
|
heatCapacity: 0,
|
|
|
};
|
|
|
- //使用key state更新整个basic layout ,用于加载新的内容组件
|
|
|
- const [currentKey, setCurrentKey] = useState('register');
|
|
|
+ const dispatch = useDispatch();
|
|
|
+ const currentKey = useSelector(
|
|
|
+ (state: RootState) => state.BusinessFlow.currentKey
|
|
|
+ );
|
|
|
// key和内容组件的映射
|
|
|
const contentMap = {
|
|
|
exam: <ExamPage />,
|
|
@@ -61,7 +66,7 @@ const BasicLayout: React.FC<BasicLayoutProps> = () => {
|
|
|
};
|
|
|
//感知菜单项点击
|
|
|
const handleMenuClick = (key: string) => {
|
|
|
- setCurrentKey(key);
|
|
|
+ dispatch(setBusinessFlow(key));
|
|
|
};
|
|
|
|
|
|
return (
|
|
@@ -104,13 +109,13 @@ const BasicLayout: React.FC<BasicLayoutProps> = () => {
|
|
|
md={19}
|
|
|
sm={0}
|
|
|
xs={0}
|
|
|
- className="items-center
|
|
|
- justify-end xl:flex
|
|
|
- lg:flex
|
|
|
- md:flex
|
|
|
- sm:hidden
|
|
|
- xs:hidden
|
|
|
- h-full
|
|
|
+ className="items-center
|
|
|
+ justify-end xl:flex
|
|
|
+ lg:flex
|
|
|
+ md:flex
|
|
|
+ sm:hidden
|
|
|
+ xs:hidden
|
|
|
+ h-full
|
|
|
text-[100%]"
|
|
|
>
|
|
|
{/* text-[100%] 用于传导父元素的字体大小,最终影响图标大小 */}
|