Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…nto feat
  • Loading branch information
naraeng committed Feb 17, 2025
2 parents 864e458 + ae0e4e0 commit 1d6ad81
Show file tree
Hide file tree
Showing 13 changed files with 180 additions and 54 deletions.
3 changes: 1 addition & 2 deletions src/component/QnA/QnAMain.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
padding: 10%;
padding-top: 30px;
background-color: #f1f1f1;
margin-bottom: 0;
padding-bottom: 5px;
}

Expand Down Expand Up @@ -181,7 +180,7 @@

@media screen and (max-width: 768px) {
.qna_div {
padding: 10% 5%;
padding: 2% 5%;
background-color: #f1f1f1;
margin-bottom: 0;
display: flex;
Expand Down
6 changes: 6 additions & 0 deletions src/component/admin/recruit/AdminRecruitContent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ export default function AdminRecruitContent() {
<div className={styles.horizontal_line}></div>

<div className={styles.content_div}>
<div className={styles.everytime_div}>
<img src="/recruit/everytime.png" alt="ET" className={styles.everyTime_img} />
<a href={contentData?.everytimeUrl}>
<p className={styles.everyTime_p}>{contentData?.everytimeUrl}</p>
</a>
</div>
<p className={styles.content_content}>{contentData?.content}</p>
</div>

Expand Down
66 changes: 50 additions & 16 deletions src/component/admin/recruit/AdminRecruitWrite.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default function AdminRecruitWrite() {
const inputFileRef = useRef(null);
const [title, setTitle] = useState('');
const [content, setContent] = useState('');
const [everytimeUrl, setEverytimeUrl] = useState('');
const [selectedImages, setSelectedImages] = useState([]);
const [selectedFiles, setSelectedFiles] = useState([]);
const [isModalOpen, setIsModalOpen] = useState(false);
Expand Down Expand Up @@ -40,12 +41,14 @@ export default function AdminRecruitWrite() {
try {
const res = await customAxios.get(`/v1/admins/recruits/${recruitId}`);
if (res.data.success) {
console.log('edit content', res.data);
// console.log('edit content', res.data);
setTitle(res.data.data.title);
setTitleCount(res.data.data.title.length);
setContent(res.data.data.content);
setContentCount(res.data.data.content.length);
setSelectedImages(res.data.data.imageUrls);
setRemainedImages(res.data.data.imageUrls);
setEverytimeUrl(res.data.data.everytimeUrl);
}
} catch (error) {
console.error(error);
Expand All @@ -57,6 +60,7 @@ export default function AdminRecruitWrite() {
getRecruitData();
}
}, []);
// console.log('Selected Images', remainedImages);

const closeModal = () => {
setIsModalOpen(false);
Expand All @@ -77,6 +81,11 @@ export default function AdminRecruitWrite() {
setContentCount(e.target.value.length);
};

const handleEveryTimeUrlChange = (e) => {
setEverytimeUrl(e.target.value);
console.log(e.target.value);
};

// 파일 선택 핸들러
const handleFileChange = async (event) => {
if (selectedImages.length >= 10) {
Expand All @@ -98,6 +107,8 @@ export default function AdminRecruitWrite() {
//모집글 수정 시
if (recruitId) {
// 새로 추가된 파일과 이미지 URL 상태 업데이트
setRemainedImages(selectedImages);

setNewAddedFiles(newImageFiles);
setNewAddedImages(newImageURLs);
}
Expand Down Expand Up @@ -133,8 +144,9 @@ export default function AdminRecruitWrite() {
});
};

// console.log('Ss', selectedImages);

const uploadImages = async () => {
// console.log('Ff', selectedFiles);
//선택된 파일 배열 확정
const filesToUpload = recruitId ? newAddedFiles.flat() : selectedFiles.flat();

Expand Down Expand Up @@ -192,6 +204,7 @@ export default function AdminRecruitWrite() {

updateImages.splice(index, 0, movedImage);
setSelectedImages(updateImages);
setRemainedImages(updateImages);
};

const onDragOver = (e) => {
Expand Down Expand Up @@ -220,29 +233,32 @@ export default function AdminRecruitWrite() {
} else {
try {
const imageUrls = await uploadImages();
console.log(
'title:',
title,
'content:',
content,
'deletedImageUrls:',
deletedFiles,
'newImageKeys:',
imageUrls,
'remainImageUrls:',
remainedImages
);

// console.log(
// 'title:',
// title,
// 'content:',
// content,
// 'deletedImageUrls:',
// deletedFiles,
// 'newImageKeys:',
// imageUrls,
// 'remainImageUrls:',
// remainedImages
// );
console.log('every', everytimeUrl);
if (recruitId) {
const combinedImages = [...remainedImages, ...imageUrls];
console.log('combined', combinedImages);

const res = await customAxios.patch(
`/v1/admins/recruits/${recruitId}`,
{
title: title,
content: content,
everytimeUrl: everytimeUrl,
deletedImageUrls: deletedFiles,
newImageKeys: imageUrls,
remainImageUrls: remainedImages,
remainImageUrls: remainedImages ? remainedImages : selectedImages,
images: combinedImages,
},
{
Expand All @@ -253,13 +269,15 @@ export default function AdminRecruitWrite() {
);
if (res.data.success) {
setIsModalOpen(true);
console.log(res.data);
}
} else {
const res = await customAxios.post(
`/v1/admins/recruits`,
{
title: title,
content: content,
everytimeUrl: everytimeUrl,
imageKey: imageUrls,
},
{
Expand Down Expand Up @@ -295,6 +313,22 @@ export default function AdminRecruitWrite() {
/>
<p className={styles.write_title_font}>제목을 입력해주세요.</p>
</div>

<p className={styles.write_title}>
에브리타임 URL
{/* <p className={styles.write_title_sub}>({titleCount}/100) </p> */}
</p>
<div className={styles.write_backgroud}>
<input
type="text"
className={styles.write_title_input}
value={everytimeUrl}
onChange={handleEveryTimeUrlChange}
placeholder="주소를 입력해주세요."
/>
<p className={styles.write_title_font}>주소를 입력해주세요.</p>
</div>

<p className={styles.write_title}>
내용 <p className={styles.write_title_sub}>({contentCount}/2000)</p>
</p>
Expand Down
37 changes: 37 additions & 0 deletions src/component/admin/recruit/adminRecruitContent.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,24 @@
margin: 0 8% 95px;
}

.everytime_div {
display: flex;
flex-direction: row;
align-items: center;
}

.everyTime_img {
width: 59px;
height: 49px;
margin-top: 26px;
margin-left: -7px;
}

.everyTime_p {
margin-top: 20px;
font-size: 16px;
}

.img_div {
text-align: center;
margin-top: 20px;
Expand Down Expand Up @@ -278,6 +296,25 @@
margin: 0 30px 50px;
}

.everytime_div {
display: flex;
flex-direction: row;
align-items: center;
}

.everyTime_img {
width: 49px;
height: 39px;
margin-top: 24px;
margin-left: -7px;
}

.everyTime_p {
margin-top: 20px;
font-family: Noto Sans KR;
font-size: 13px;
}

.img_div {
text-align: center;
/* margin-top: 10px; */
Expand Down
12 changes: 9 additions & 3 deletions src/component/admin/recruit/adminRecruitList.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,14 @@
border-radius: 12px;
border: 1px solid #9c9c9c4d;
box-shadow: 0px 0px 2px 1px #0000000d;
cursor: pointer;
display: flex;
justify-content: space-between;
}
.recruit_logo {
width: 42%;
aspect-ratio: auto 1/1;
max-width: 42%;
aspect-ratio: 1/1;
object-fit: cover;
margin: 19px 20px 19px 10px;
}

Expand Down Expand Up @@ -181,7 +185,9 @@
margin-bottom: 20px;
}
.recruit_logo {
width: 130px;
width: 32%;
object-fit: cover;
aspect-ratio: 1/1;
margin: 20px 17px 20px 10px;
}

Expand Down
11 changes: 8 additions & 3 deletions src/component/layout/Footer.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,13 @@
color: #7bc8e0;
}
.footer {
background-color: #9c9c9c26;
background-color: #f1f1f1;
position: relative;
transform: translateY(100%);
transform: translateY(0%);
/* transform: translateY(100%); */
height: 110px;
width: 100%;
border-top: 1px solid #9c9c9c26;
border-top: 1px solid #f1f1f1;
text-align: center;
padding: 0px;
}
Expand Down Expand Up @@ -200,6 +201,10 @@
margin-top: 8px;
}

.font_set a {
text-decoration: none;
}

.p {
font-family: Noto Sans KR;
font-size: 11px;
Expand Down
7 changes: 6 additions & 1 deletion src/component/recruit/RecruitContent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,12 @@ export default function RecruitContent() {
<div className={styles.horizontal_line}></div>

<div className={styles.content_div}>
<img src="/recruit/everytime.png" alt="ET" className={styles.everyTime_img} />
<div className={styles.everytime_div}>
<img src="/recruit/everytime.png" alt="ET" className={styles.everyTime_img} />
<a href={contentData?.everytimeUrl}>
<p className={styles.everyTime_p}>{contentData?.everytimeUrl}</p>
</a>
</div>
<p className={styles.content_content}>{contentData?.content}</p>
</div>

Expand Down
23 changes: 23 additions & 0 deletions src/component/recruit/recruitContent.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,24 @@
margin: 0 8% 95px;
}

.everytime_div {
display: flex;
flex-direction: row;
align-items: center;
}

.everyTime_img {
width: 59px;
height: 49px;
margin-top: 26px;
margin-left: -7px;
}

.everyTime_p {
margin-top: 20px;
font-size: 16px;
}

.img_div {
text-align: center;
margin-top: 20px;
Expand Down Expand Up @@ -353,13 +364,25 @@
margin: 0 30px 50px;
}

.everytime_div {
display: flex;
flex-direction: row;
align-items: center;
}

.everyTime_img {
width: 49px;
height: 39px;
margin-top: 24px;
margin-left: -7px;
}

.everyTime_p {
margin-top: 20px;
font-family: Noto Sans KR;
font-size: 13px;
}

.img_div {
text-align: center;
/* margin-top: 10px; */
Expand Down
12 changes: 6 additions & 6 deletions src/component/recruit/recruitList.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@
justify-content: space-between;
}
.recruit_logo {
width: 42%;
/* height: 80%; */
max-width: 42%;
aspect-ratio: 1/1;
object-fit: cover;
margin: 19px 20px 19px 10px;
/* justify-items: flex-end; */
}
Expand Down Expand Up @@ -104,10 +105,9 @@
align-items: center;
}
.recruit_logo {
width: 90px;
height: 90px;
/* margin-top: 30px; */
/* margin-left: 13px; */
width: 32%;
object-fit: cover;
aspect-ratio: 1/1;
background-color: #f9f9f9;
margin-right: 10px;
margin-left: 5px;
Expand Down
Loading

0 comments on commit 1d6ad81

Please sign in to comment.