Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #143

Merged
merged 3 commits into from
Nov 12, 2024
Merged

Dev #143

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions src/component/admin/EditPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ export default function EditPage() {
const [isErrorModalOpen, setIsErrorModalOpen] = useState(false);
const [modalMessage, setModalMessage] = useState('');
const [extension, setExtension] = useState('');
// const [cIntroduction, setcIntroduction] = useState('');
const [imgType, setImageType] = useState('0');
//->이미지 파일 선택 μ‹œ imaType=1, 둜고 μ‚­μ œ μ‹œ, imgType=2, λ―Έλ³€κ²½μ‹œ imgType=0

// console.log('bb', baseLogoUrl);
const closeModal = () => {
Expand Down Expand Up @@ -96,7 +97,7 @@ export default function EditPage() {
const handleFileChange = async (event) => {
const file = event.target.files[0];
if (!file) return; // 파일이 없을 경우 처리 μ’…λ£Œ

setImageType('1');
setImageFile(file);
setImagePreview(URL.createObjectURL(file));

Expand All @@ -106,8 +107,9 @@ export default function EditPage() {
const deleteImage = async () => {
if (!imageUrl) return;
try {
setImageUrl(`http://dev.ssuclubber.com/${baseLogoUrl}`);
setImagePreview(`http://dev.ssuclubber.com/${baseLogoUrl}`);
setImageType('2');
setImageUrl(`common/logo/soongsil_default.png `);
setImagePreview(`https://image.ssuclubber.com/common/logo/soongsil_default.png `);
} catch (error) {
console.error('이미지 μ‚­μ œ μ‹€νŒ¨:', error);
alert('이미지 μ‚­μ œμ— μ‹€νŒ¨ν–ˆμŠ΅λ‹ˆλ‹€.');
Expand All @@ -123,9 +125,10 @@ export default function EditPage() {
setIsErrorModalOpen(true);
setModalMessage("'πŸ“Œ μ†Œκ°œ ' λŠ” μ΅œλŒ€ 100μžκΉŒμ§€ μž‘μ„± κ°€λŠ₯ν•©λ‹ˆλ‹€. ");
} else {
if (imagePreview) {
if (imgType === '1') {
try {
// presigned URL을 κ°€μ Έμ˜€λŠ” API 호좜

const { data } = await customAxios.post(
'/v1/images/club/logo',

Expand All @@ -141,7 +144,7 @@ export default function EditPage() {
},
}
);
console.log(data.data);
// console.log(data.data);
setImageUrl(data.data.imageKey);

// 이미지 νŒŒμΌμ„ presigned URL둜 μ—…λ‘œλ“œ
Expand Down
23 changes: 17 additions & 6 deletions src/component/admin/pending/PendingList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,26 @@ export default function PendingList() {
}, [accessToken]);

const onClickApprove = () => {
setIsModalOpen(true);
setModalMessage('μŠΉμΈν•˜μ‹œκ² μŠ΅λ‹ˆκΉŒ?');
setAction('APPROVED');
if (checkedList.length > 0) {
console.log('check', checkedList);
setIsModalOpen(true);
setModalMessage('μŠΉμΈν•˜μ‹œκ² μŠ΅λ‹ˆκΉŒ?');
setAction('APPROVED');
} else {
setIsErrorModalOpen(true);
setErrorModalMessage('리뷰λ₯Ό μ„ νƒν•΄μ£Όμ„Έμš”.');
}
};

const onClickReject = () => {
setIsModalOpen(true);
setModalMessage('κ±°μ ˆν•˜μ‹œκ² μŠ΅λ‹ˆκΉŒ?');
setAction('REJECTED');
if (checkedList.length > 0) {
setIsModalOpen(true);
setModalMessage('승인 κ±°μ ˆν•˜μ‹œκ² μŠ΅λ‹ˆκΉŒ?');
setAction('REJECTED');
} else {
setIsErrorModalOpen(true);
setErrorModalMessage('리뷰λ₯Ό μ„ νƒν•΄μ£Όμ„Έμš”.');
}
};

const onClickOk = () => {
Expand Down
9 changes: 5 additions & 4 deletions src/component/admin/recruit/AdminRecruitList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function AdminRecruitList() {
const [currentPage, setCurrentPage] = useState(1);
const [totalPages, setTotalPages] = useState(0);
const [pageSize, setPageSize] = useState(5); // ν•œ νŽ˜μ΄μ§€μ— ν‘œμ‹œν•  ν•­λͺ© 수
const [sort, setSort] = useState(['string']); // μ •λ ¬ κΈ°μ€€
const [sort, setSort] = useState('desc'); // μ •λ ¬ κΈ°μ€€

useEffect(() => {
getPromoteData(currentPage);
Expand All @@ -28,10 +28,11 @@ export default function AdminRecruitList() {
params: {
page: page,
size: pageSize,
sort: sort,
},
});
if (res.data.success) {
// console.log(res.data);
console.log(res.data);
setPromoteData(res.data.data.content);
setTotalPages(res.data.data.totalPages);
console.log(res.data.data.content);
Expand All @@ -41,8 +42,8 @@ export default function AdminRecruitList() {
}
};

const handlePageChange = (newPage) => {
setCurrentPage(newPage);
const handlePageChange = ({ selected }) => {
setCurrentPage(selected + 1);
};

const onClickRecruit = (recruitId) => {
Expand Down
10 changes: 5 additions & 5 deletions src/component/recruit/RecruitList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ export default function RecruitList() {
const [currentPage, setCurrentPage] = useState(1);
const [totalPages, setTotalPages] = useState(0);
const [pageSize, setPageSize] = useState(5); // ν•œ νŽ˜μ΄μ§€μ— ν‘œμ‹œν•  ν•­λͺ© 수
const [sort, setSort] = useState(['string']); // μ •λ ¬ κΈ°μ€€
const [sort, setSort] = useState('desc'); // μ •λ ¬ κΈ°μ€€

const getPromoteData = async (page) => {
try {
const res = await customAxios.get(`/v1/recruits`, {
params: {
page: page,
size: pageSize,
//sort: sort,
sort: sort,
},
});
if (res.data.success) {
setPromoteData(res.data.data.content);
setTotalPages(res.data.data.totalPages);
console.log(res.data.data.content);
console.log(res.data.data);
}
} catch (error) {
console.error('Error fetching data : ', error);
Expand All @@ -37,8 +37,8 @@ export default function RecruitList() {
getPromoteData(currentPage);
}, [currentPage]);

const handlePageChange = (newPage) => {
setCurrentPage(newPage);
const handlePageChange = ({ selected }) => {
setCurrentPage(selected + 1);
};

const onClickRecruit = (recruitId) => {
Expand Down
Loading