diff --git a/src/main.scss b/src/main.scss index faf74ed..61c5d0d 100644 --- a/src/main.scss +++ b/src/main.scss @@ -124,3 +124,14 @@ code { display: none; } } + +.adm-radio-content { + font-size: 16px; + font-weight: 500; + color: rgba(0, 0, 0, 0.88); + line-height: 16px; + padding-left: 15px !important; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} diff --git a/src/pages/change-department/index.module.scss b/src/pages/change-department/index.module.scss index e69de29..7b3f4cd 100644 --- a/src/pages/change-department/index.module.scss +++ b/src/pages/change-department/index.module.scss @@ -0,0 +1,29 @@ +.info { + width: 100%; + float: left; + height: 54px; + font-size: 16px; + font-weight: 400; + color: rgba(0, 0, 0, 0.3); + line-height: 54px; + margin-top: 20px; +} + +.radio-box { + width: 100%; + float: left; + height: auto; + display: flex; + flex-direction: column; + box-sizing: border-box; + padding: 20px; + .radio-item { + width: 100%; + height: 76px; + background: #fafafa; + border-radius: 7px; + margin-bottom: 20px; + box-sizing: border-box; + padding: 30px 20px; + } +} diff --git a/src/pages/change-department/index.tsx b/src/pages/change-department/index.tsx index e69de29..34700e7 100644 --- a/src/pages/change-department/index.tsx +++ b/src/pages/change-department/index.tsx @@ -0,0 +1,61 @@ +import { useState } from "react"; +import { Radio, Image } from "antd-mobile"; +import styles from "./index.module.scss"; +import { useNavigate } from "react-router-dom"; +import { useDispatch, useSelector } from "react-redux"; +import { saveCurrentDepId } from "../../store/user/loginUserSlice"; +import { setDepKey, setDepName } from "../../utils/index"; +import backIcon from "../../assets/images/commen/icon-back.png"; + +const ChangeDepartmentPage = () => { + const dispatch = useDispatch(); + const navigate = useNavigate(); + const [loading, setLoading] = useState(false); + const departments = useSelector( + (state: any) => state.loginUser.value.departments + ); + const currentDepId = useSelector( + (state: any) => state.loginUser.value.currentDepId + ); + console.log(currentDepId); + + const onDepClick = (value: any) => { + let it = departments.find((o: any) => o.id === value); + if (it) { + dispatch(saveCurrentDepId(Number(value))); + setDepKey(value); + setDepName(it.name); + navigate("/", { replace: true }); + } + }; + + return ( +
+
+ navigate(-1)} + /> +
切换部门
+
+
点击部门名称切换部门
+
+ + {departments.map((item: any) => ( + + {item.name} + + ))} + +
+
+ ); +}; + +export default ChangeDepartmentPage; diff --git a/src/routes/index.tsx b/src/routes/index.tsx index 082c3c4..4fc40af 100644 --- a/src/routes/index.tsx +++ b/src/routes/index.tsx @@ -8,6 +8,7 @@ import IndexPage from "../pages/index/index"; import LoginPage from "../pages/login"; import MemberPage from "../pages/member/index"; import ChangePasswordPage from "../pages/change-password/index"; +import ChangeDepartmentPage from "../pages/change-department/index"; import StudyPage from "../pages/study/index"; import PrivateRoute from "../components/private-route"; @@ -57,6 +58,10 @@ const routes: RouteObject[] = [ path: "/study", element: } />, }, + { + path: "/change-department", + element: } />, + }, ], }, ];