공지사항 /홈 / 리스트 / 상세

This commit is contained in:
focp212@naver.com
2025-09-09 13:48:16 +09:00
parent 3cfc45a244
commit b760a69fef
12 changed files with 304 additions and 185 deletions

View File

@@ -1,14 +1,47 @@
import { useEffect, useState } from 'react';
import { useLocation } from 'react-router';
import { PATHS } from '@/shared/constants/paths';
import { useNoticeDetailMutation } from '@/entities/support/api/use-notice-detail-mutaion';
import { useNavigate } from '@/shared/lib/hooks/use-navigate';
import { HeaderType } from '@/entities/common/model/types';
import { NoticeItem } from '@/entities/support/model/types';
import {
useSetHeaderTitle,
useSetHeaderType,
useSetFooterMode
useSetFooterMode,
useSetOnBack
} from '@/widgets/sub-layout/use-sub-layout';
import moment from 'moment';
export const NoticeDetailPage = () => {
const { navigate } = useNavigate();
const location = useLocation();
const [result, setResult] = useState<NoticeItem>({});
useSetHeaderTitle('공지사항');
useSetHeaderType(HeaderType.RightClose);
useSetFooterMode(false);
useSetOnBack(() => {
navigate(PATHS.support.notice.list);
});
const { mutateAsync: noticeDetail } = useNoticeDetailMutation();
const callDetail = () => {
let detailParams = {
noticeId: location?.state.id,
};
noticeDetail(detailParams).then((rs) => {
console.log(rs);
setResult(rs);
});
};
useEffect(() => {
callDetail();
}, []);
return (
<>
@@ -17,27 +50,10 @@ export const NoticeDetailPage = () => {
<div className="tab-pane sub active">
<div className="option-list pb-120">
<div className="notice-detail">
<div className="notice-detail__title">[ ] 5 (4 ) ()</div>
<div className="notice-detail__meta">2025.08.19 | </div>
<div className="notice-detail__title">{ result.title }</div>
<div className="notice-detail__meta">{ moment(result.regDate).format('YYYY.MM.DD') } | { result.category }</div>
<div className="notice-detail__divider"></div>
<div className="notice-detail__body">. .
25 5 (4 ) .
5 .
, .
----------- -----------
기존 : 매월 15( )/*5 출금일 : 19일()
변경 : 5월 19()
발행일 : 5월 19(*19 )
-----------------------------
</div>
<div className="notice-detail__body">{ result.content }</div>
</div>
</div>
</div>

View File

@@ -1,5 +1,10 @@
import { ChangeEvent, useEffect, useState } from 'react';
import { PATHS } from '@/shared/constants/paths';
import { useNavigate } from '@/shared/lib/hooks/use-navigate';
import { useNoticeListMutation } from '@/entities/support/api/use-notice-list-mutation';
import { DEFAULT_PAGE_PARAM } from '@/entities/common/model/constants';
import { NoticeItem } from '@/entities/support/model/types';
import { SupportNoticeItem } from '@/entities/support/ui/notice-item';
import { HeaderType } from '@/entities/common/model/types';
import {
useSetHeaderTitle,
@@ -11,12 +16,57 @@ import {
export const NoticeListPage = () => {
const { navigate } = useNavigate();
const [pageParam, setPageParam] = useState(DEFAULT_PAGE_PARAM);
const [searchKeyword, setSearchKeyword] = useState<string>('');
const [resultList, setResultList] = useState<Array<NoticeItem>>([]);
useSetHeaderTitle('공지사항');
useSetHeaderType(HeaderType.LeftArrow);
useSetFooterMode(true);
useSetOnBack(() => {
navigate(PATHS.home);
});
const { mutateAsync: noticeList } = useNoticeListMutation();
const callList = () => {
let listParams = {
category: 'ALL',
searchKeyword: searchKeyword,
...{page: pageParam}
};
noticeList(listParams).then((rs) => {
console.log(rs)
setResultList(rs.content);
});
};
const onClickToAction = () => {
callList();
};
const getNoticeList = () => {
let rs = [];
for(let i=0;i<resultList.length;i++){
rs.push(
<SupportNoticeItem
key={ `key-support-notice-item-${i}` }
id={ resultList[i]?.id }
title={ resultList[i]?.title }
category={ resultList[i]?.category }
regDate={ resultList[i]?.regDate }
isNew={ resultList[i]?.isNew }
></SupportNoticeItem>
)
}
return rs;
};
useEffect(() => {
callList();
}, []);
return (
<>
<main>
@@ -25,8 +75,17 @@ export const NoticeListPage = () => {
<div className="notice114">
<div className="notice-controls">
<div className="notice-search">
<span className="ic16 search" aria-hidden="true"></span>
<input type="text" placeholder="검색어를 입력하세요" />
<span
className="ic16 search"
aria-hidden="true"
onClick={ () => onClickToAction() }
></span>
<input
type="text"
placeholder="검색어를 입력하세요"
value={ searchKeyword }
onChange={ (e: ChangeEvent<HTMLInputElement>) => setSearchKeyword(e.target.value) }
/>
</div>
<div className="notice-filter">
<select className="flex-1">
@@ -35,46 +94,7 @@ export const NoticeListPage = () => {
</div>
</div>
<div className="notice-list-114">
<div className="notice-row-114">
<div className="notice-txt">
<div className="notice-title-114"> <span className="blue"> </span> </div>
<div className="notice-meta-114">
<span className="blue"></span> <span>2025.06.01 10:00:00</span>
</div>
</div>
</div>
<div className="notice-row-114">
<div className="notice-txt">
<div className="notice-title-114">NICE페이먼츠 G2교체 </div>
<div className="notice-meta-114">
<span className="blue"></span> <span>2025.06.01 10:00:00</span>
</div>
</div>
</div>
<div className="notice-row-114">
<div className="notice-txt">
<div className="notice-title-114">N자금이체 G2 <span className="blue"> TLS </span> ...</div>
<div className="notice-meta-114">
<span className="blue"></span> <span>2025.06.01 10:00:00</span>
</div>
</div>
</div>
<div className="notice-row-114">
<div className="notice-txt">
<div className="notice-title-114">N자금이체 <span className="blue"> G2</span> TLS ...</div>
<div className="notice-meta-114">
<span className="blue"></span> <span>2025.06.01 10:00:00</span>
</div>
</div>
</div>
<div className="notice-row-114">
<div className="notice-txt">
<div className="notice-title-114">NICE페이먼츠 G2교체 </div>
<div className="notice-meta-114">
<span className="blue"></span> <span>2025.06.01 10:00:00</span>
</div>
</div>
</div>
{ getNoticeList() }
</div>
</div>
</div>