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); + }} + /> ); }