From c687d0d6cda53dead33865f6aa0e2b5413cdae95 Mon Sep 17 00:00:00 2001 From: NamKyeongMin Date: Sun, 18 May 2025 21:04:29 +0900 Subject: [PATCH 1/6] =?UTF-8?q?[fix]:=20ManageStudent.jsx=20=EA=B2=BD?= =?UTF-8?q?=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/App.jsx | 4 ++-- frontend/src/components/Header.jsx | 2 +- frontend/src/pages/admin/Admin.jsx | 2 +- frontend/src/pages/admin/ManageStudent.jsx | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index b11b9d0..0b549ed 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -6,7 +6,7 @@ import Assignment from "./pages/generation/Assignment"; import Deposit from "./pages/generation/Deposit"; import Intro from "./Intro"; import Admin from "./pages/admin/Admin"; -import MagageStudent from "./pages/admin/ManageStudent.jsx"; +import ManageStudent from "./pages/admin/ManageStudent.jsx"; import ManageTask from "./pages/admin/ManageTask.jsx"; import AttendanceCode from "./pages/admin/AttendanceCode"; import Attendance from "./pages/generation/Attendance"; @@ -22,7 +22,7 @@ function App() { } /> } /> } /> - } /> + } /> } /> } /> diff --git a/frontend/src/components/Header.jsx b/frontend/src/components/Header.jsx index 914c888..fe0403d 100644 --- a/frontend/src/components/Header.jsx +++ b/frontend/src/components/Header.jsx @@ -10,7 +10,7 @@ const Header = () => { if (path.includes("assignment")) title = "ASSIGNMENT\nCHECK"; else if (path.includes("deposit")) title = "DEPOSIT"; else if (path.includes("attendance")) title = "ATTENDANCE\nCHECK"; - else if (path.includes("magagestudent")) title = "수강생 관리"; + else if (path.includes("managestudent")) title = "수강생 관리"; else if (path.includes("magagetask")) title = "과제 관리"; else if (path.includes("attendancecode")) title = "출석코드 생성"; diff --git a/frontend/src/pages/admin/Admin.jsx b/frontend/src/pages/admin/Admin.jsx index fa42daf..6b9e4e9 100644 --- a/frontend/src/pages/admin/Admin.jsx +++ b/frontend/src/pages/admin/Admin.jsx @@ -9,7 +9,7 @@ const Admin = () => {

PIROCHECK

diff --git a/frontend/src/pages/admin/ManageStudent.jsx b/frontend/src/pages/admin/ManageStudent.jsx index eef36a7..e54018e 100644 --- a/frontend/src/pages/admin/ManageStudent.jsx +++ b/frontend/src/pages/admin/ManageStudent.jsx @@ -3,7 +3,7 @@ import Header from "../../components/Header"; import InputBlock from "../../components/InputBlock"; import style from "./ManageStudent.module.css"; -const MagageStudent = () => { +const ManageStudent = () => { const [studentName, setStudentName] = useState([""]); const handleChange = (index, value) => { @@ -28,4 +28,4 @@ const MagageStudent = () => { ); }; -export default MagageStudent; +export default ManageStudent; From 45ec23b402f383b16e97eba14d4d85ad03003457 Mon Sep 17 00:00:00 2001 From: NamKyeongMin Date: Sun, 18 May 2025 21:30:15 +0900 Subject: [PATCH 2/6] =?UTF-8?q?[add]:=20local=20data=EB=A1=9C=20=EC=88=98?= =?UTF-8?q?=EA=B0=95=EC=83=9D=20=EA=B2=80=EC=83=89=20=EA=B8=B0=EB=8A=A5+?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=EB=84=A4=EC=9D=B4=EC=85=98=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=ED=99=95=EC=9D=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/pages/admin/ManageStudent.jsx | 81 ++++++++++++++++--- .../src/pages/admin/ManageStudent.module.css | 41 ++++++++++ 2 files changed, 111 insertions(+), 11 deletions(-) diff --git a/frontend/src/pages/admin/ManageStudent.jsx b/frontend/src/pages/admin/ManageStudent.jsx index e54018e..e8ddc62 100644 --- a/frontend/src/pages/admin/ManageStudent.jsx +++ b/frontend/src/pages/admin/ManageStudent.jsx @@ -5,26 +5,85 @@ import style from "./ManageStudent.module.css"; const ManageStudent = () => { const [studentName, setStudentName] = useState([""]); - + const [page, setPage] = useState(1); + const studentsPerPage = 6; + const studentList = [ + "김피로그", + "박피로그", + "이피로그", + "최피로그", + "김피로그", + "박피로그", + "이피로그", + "최피로그", + "김피로그", + "박피로그", + "이피로그", + "최피로그", + "김피로그", + "박피로그", + "이피로그", + "최피로그", + "경민", + "경미니", + ]; + const filteredStudents = studentList.filter((name) => + name.includes(studentName[0]) + ); + const totalPages = Math.ceil(filteredStudents.length / studentsPerPage); + const paginatedStudents = filteredStudents.slice( + (page - 1) * studentsPerPage, + page * studentsPerPage + ); const handleChange = (index, value) => { const studentNames = [...studentName]; studentNames[index] = value; setStudentName(studentNames); + setPage(1); // 검색 시 페이지 초기화 }; return (
- +
+ +
+ {paginatedStudents.map((name, index) => ( + + ))} +
+ + {filteredStudents.length > studentsPerPage && ( +
+ + + {page} / {totalPages} + + +
+ )} +
); }; diff --git a/frontend/src/pages/admin/ManageStudent.module.css b/frontend/src/pages/admin/ManageStudent.module.css index 5e87c6a..014c39f 100644 --- a/frontend/src/pages/admin/ManageStudent.module.css +++ b/frontend/src/pages/admin/ManageStudent.module.css @@ -4,3 +4,44 @@ flex-direction: column; align-items: center; } +.student_list { + margin-top: 60px; + display: flex; + flex-direction: column; + gap: 20px; + width: 100%; +} +.under_header { + display: flex; + flex-direction: column; + align-items: center; +} +.student_button { + background-color: #333; + color: white; + padding: 15px; + border-radius: 8px; + border: 1px solid #39ff14; + text-align: left; + font-size: 16px; + width: 100%; +} +.pagination { + margin-top: 60px; + display: flex; + justify-content: center; + align-items: center; + gap: 12px; +} +.pagination button { + background-color: #111; + color: #39ff14; + padding: 8px 12px; + border: 1px solid #39ff14; + border-radius: 6px; + cursor: pointer; +} +.pagination button:disabled { + opacity: 0.5; + cursor: not-allowed; +} From 43a69606dc2408aed5189e3943645ee06165d2f9 Mon Sep 17 00:00:00 2001 From: NamKyeongMin Date: Sun, 18 May 2025 21:49:26 +0900 Subject: [PATCH 3/6] =?UTF-8?q?[add]:=20=EC=84=9C=EB=B2=84=EB=A1=9C?= =?UTF-8?q?=EB=B6=80=ED=84=B0=20=EC=A0=84=EC=B2=B4=20=EC=88=98=EA=B0=95?= =?UTF-8?q?=EC=83=9D=20=EC=A0=95=EB=B3=B4=20=EA=B0=80=EC=A0=B8=EC=98=A4?= =?UTF-8?q?=EB=8A=94=20api=20=ED=95=A8=EC=88=98=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/api/students.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 frontend/src/api/students.js diff --git a/frontend/src/api/students.js b/frontend/src/api/students.js new file mode 100644 index 0000000..eac3665 --- /dev/null +++ b/frontend/src/api/students.js @@ -0,0 +1,8 @@ +import api from "./api"; + +export const getStudentsByName = async (name) => { + const res = await api.get("/admin/managestudent", { + params: { name }, + }); + return res.data; // [{ id: ..., name: ... }] +}; From 61e9205230999dd99940dd2fc4ba9339c00f33b8 Mon Sep 17 00:00:00 2001 From: NamKyeongMin Date: Sun, 18 May 2025 21:50:47 +0900 Subject: [PATCH 4/6] =?UTF-8?q?[feat]:=20api.js=20baseURL=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=EC=97=AC=EB=B6=80=20=ED=99=95=EC=9D=B8=ED=95=84?= =?UTF-8?q?=EC=9A=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/api/api.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/api/api.js b/frontend/src/api/api.js index 2cd0305..330d870 100644 --- a/frontend/src/api/api.js +++ b/frontend/src/api/api.js @@ -1,7 +1,7 @@ import axios from "axios"; const api = axios.create({ - baseURL: "http://api.:8080/api", + baseURL: "http://api.:8080/api", // 수정 필요한지 재검 필요함 "http://api.pirocheck.org:8080/api" withCredentials: true, }); From 4e06f631bf82442bdd6ab1df3971d19ad83066f3 Mon Sep 17 00:00:00 2001 From: NamKyeongMin Date: Sun, 18 May 2025 22:01:14 +0900 Subject: [PATCH 5/6] =?UTF-8?q?[fix]:=20api.js=20baseURL=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/api/api.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/src/api/api.js b/frontend/src/api/api.js index 330d870..7dc75ea 100644 --- a/frontend/src/api/api.js +++ b/frontend/src/api/api.js @@ -1,7 +1,10 @@ import axios from "axios"; const api = axios.create({ - baseURL: "http://api.:8080/api", // 수정 필요한지 재검 필요함 "http://api.pirocheck.org:8080/api" + baseURL: "http://api.pirocheck.org:8080/api", + // 수정 필요한지 재검 필요함 + // "http://api.pirocheck.org:8080/api" + // 기존: "http://api.:8080/api" withCredentials: true, }); From c52bbbfdcd08cf9d9602fabc31aa13d675a0c9d5 Mon Sep 17 00:00:00 2001 From: NamKyeongMin Date: Sun, 18 May 2025 22:01:38 +0900 Subject: [PATCH 6/6] =?UTF-8?q?[fix]:=20=EC=84=9C=EB=B2=84=EB=A1=9C?= =?UTF-8?q?=EB=B6=80=ED=84=B0=20=EC=88=98=EA=B0=95=EC=83=9D=20=EC=A0=95?= =?UTF-8?q?=EB=B3=B4=20=EB=B6=88=EB=9F=AC=EC=98=A4=EB=8A=94=20api=20?= =?UTF-8?q?=ED=98=B8=EC=B6=9C=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/pages/admin/ManageStudent.jsx | 68 ++++++++++------------ 1 file changed, 32 insertions(+), 36 deletions(-) diff --git a/frontend/src/pages/admin/ManageStudent.jsx b/frontend/src/pages/admin/ManageStudent.jsx index e8ddc62..252175f 100644 --- a/frontend/src/pages/admin/ManageStudent.jsx +++ b/frontend/src/pages/admin/ManageStudent.jsx @@ -1,4 +1,5 @@ -import { useState } from "react"; +import { useEffect, useState } from "react"; +import { getStudentsByName } from "../../api/students"; import Header from "../../components/Header"; import InputBlock from "../../components/InputBlock"; import style from "./ManageStudent.module.css"; @@ -6,42 +7,37 @@ import style from "./ManageStudent.module.css"; const ManageStudent = () => { const [studentName, setStudentName] = useState([""]); const [page, setPage] = useState(1); + const [students, setStudents] = useState([]); // 서버 데이터 저장 + const studentsPerPage = 6; - const studentList = [ - "김피로그", - "박피로그", - "이피로그", - "최피로그", - "김피로그", - "박피로그", - "이피로그", - "최피로그", - "김피로그", - "박피로그", - "이피로그", - "최피로그", - "김피로그", - "박피로그", - "이피로그", - "최피로그", - "경민", - "경미니", - ]; - const filteredStudents = studentList.filter((name) => - name.includes(studentName[0]) - ); - const totalPages = Math.ceil(filteredStudents.length / studentsPerPage); - const paginatedStudents = filteredStudents.slice( - (page - 1) * studentsPerPage, - page * studentsPerPage - ); + + useEffect(() => { + const fetchStudents = async () => { + try { + const name = studentName[0] || ""; + const data = await getStudentsByName(name); + setStudents(data); + } catch (err) { + console.error("수강생 불러오기 실패:", err); + } + }; + + fetchStudents(); + }, [studentName]); + const handleChange = (index, value) => { - const studentNames = [...studentName]; - studentNames[index] = value; - setStudentName(studentNames); + const newNames = [...studentName]; + newNames[index] = value; + setStudentName(newNames); setPage(1); // 검색 시 페이지 초기화 }; + const totalPages = Math.ceil(students.length / studentsPerPage); + const paginatedStudents = students.slice( + (page - 1) * studentsPerPage, + page * studentsPerPage + ); + return (
@@ -57,14 +53,14 @@ const ManageStudent = () => { onChange={handleChange} />
- {paginatedStudents.map((name, index) => ( - ))}
- {filteredStudents.length > studentsPerPage && ( + {students.length > studentsPerPage && (