From 4c554401a9a29525fa2871eec191f321ebd1bc74 Mon Sep 17 00:00:00 2001 From: BenjaminNH <1249376374@qq.com> Date: Mon, 21 Jul 2025 11:46:39 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=9E=E7=8E=B0=E6=9F=A5=E7=9C=8B?= =?UTF-8?q?=E5=9B=A2=E9=98=9F=E6=88=90=E5=91=98=E6=A8=A1=E6=80=81=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/admin/TeamDetailModal.jsx | 33 +++++++++++++++++++++++++++++ src/pages/admin/TeamManage.jsx | 20 +++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 src/pages/admin/TeamDetailModal.jsx diff --git a/src/pages/admin/TeamDetailModal.jsx b/src/pages/admin/TeamDetailModal.jsx new file mode 100644 index 0000000..905a30a --- /dev/null +++ b/src/pages/admin/TeamDetailModal.jsx @@ -0,0 +1,33 @@ +import { List, Modal, Typography } from "antd"; +import { useEffect, useState } from "react"; +import axiosInstance from "../../api/axios"; + +export default function TeamDetailModal({ open, team, onclose }) { + const [data, setData] = useState([]); + + const fetchData = async () => { + const data = await axiosInstance.get(`/user-team/${team.id}`); + setData(data); + }; + + useEffect(() => { + if (open) { + fetchData(); + } + }, [open, team]); + + return ( + { + onclose(); + }} + > + {team?.name}} + dataSource={data} + renderItem={(item) => {item}} + /> + + ); +} diff --git a/src/pages/admin/TeamManage.jsx b/src/pages/admin/TeamManage.jsx index 0639fde..2d6bdab 100644 --- a/src/pages/admin/TeamManage.jsx +++ b/src/pages/admin/TeamManage.jsx @@ -3,6 +3,7 @@ import Column from "antd/es/table/Column"; import { useEffect, useState } from "react"; import axiosInstance from "../../api/axios"; import TeamDeleteButton from "../../components/TeamDeleteButton"; +import TeamDetailModal from "./TeamDetailModal"; export default function TeamManage() { const [teams, setTeams] = useState([]); @@ -11,6 +12,8 @@ export default function TeamManage() { const [editingId, setEditingId] = useState(); const [editingName, setEditingName] = useState(""); const [newTeamName, setNewTeamName] = useState(); + const [open, setOpen] = useState(false); + const [selectedTeam, setSelectedTeam] = useState(null); const fetchData = async () => { const data = await axiosInstance.get("/teams"); @@ -124,6 +127,15 @@ export default function TeamManage() { 编辑 )} + handleDelete(record)} @@ -133,6 +145,14 @@ export default function TeamManage() { }} /> + { + setOpen(false); + setSelectedTeam(null); + }} + /> ); }