@daeryun/dr_components 0.9.34 → 0.9.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -1
- package/dist/components/page/Login/LoginComp/SignContainer.jsx +1 -1
- package/dist/components/page/Login/LoginComp/SignContainer.tsx +10 -8
- package/dist/components/page/Login/StepOne.jsx +3 -0
- package/dist/components/page/Login/StepOne.tsx +4 -0
- package/dist/components/page/Login/StepTwo.jsx +118 -33
- package/dist/components/page/Login/StepTwo.tsx +110 -15
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -152,7 +152,6 @@ const Box = ({ type_idx, tag_title, selected, selectedList, setSelectedList, act
|
|
|
152
152
|
</div>);
|
|
153
153
|
};
|
|
154
154
|
const StepTwo = () => {
|
|
155
|
-
var _a, _b, _c, _d, _e, _f;
|
|
156
155
|
const [selectedList, setSelectedList] = useState([]);
|
|
157
156
|
const [activeTooltipId, setActiveTooltipId] = useState(null);
|
|
158
157
|
const tooltipTimeoutRef = useRef(null);
|
|
@@ -162,6 +161,8 @@ const StepTwo = () => {
|
|
|
162
161
|
title: '',
|
|
163
162
|
subTitle: ''
|
|
164
163
|
});
|
|
164
|
+
const [centerCodes, setCenterCodes] = useState([]);
|
|
165
|
+
const [fieldData, setFieldData] = useState({});
|
|
165
166
|
const center_code = 'CT0001';
|
|
166
167
|
const center_code2 = 'CT0025';
|
|
167
168
|
const categories = [
|
|
@@ -191,6 +192,21 @@ const StepTwo = () => {
|
|
|
191
192
|
{ code: 'CT0029', code_name: '디지털포렌식' },
|
|
192
193
|
{ code: 'CT0030', code_name: '경호' }
|
|
193
194
|
];
|
|
195
|
+
// API 호출 함수
|
|
196
|
+
const fetchFieldData = (centerCode) => __awaiter(void 0, void 0, void 0, function* () {
|
|
197
|
+
try {
|
|
198
|
+
const response = yield fetch(`https://mng.daeryunlaw.com/api/app/seo-template/field/list-by-center?center_code=${centerCode}`);
|
|
199
|
+
if (!response.ok) {
|
|
200
|
+
throw new Error(`API 호출 실패: ${response.status}`);
|
|
201
|
+
}
|
|
202
|
+
const data = yield response.json();
|
|
203
|
+
return data;
|
|
204
|
+
}
|
|
205
|
+
catch (error) {
|
|
206
|
+
console.error(`Center code ${centerCode} API 호출 실패:`, error);
|
|
207
|
+
return { result: false, data: [] };
|
|
208
|
+
}
|
|
209
|
+
});
|
|
194
210
|
const data1 = {
|
|
195
211
|
result: true,
|
|
196
212
|
data: [
|
|
@@ -524,6 +540,9 @@ const StepTwo = () => {
|
|
|
524
540
|
window.location.href = '/login/sign/step_one';
|
|
525
541
|
};
|
|
526
542
|
const handleDone = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
543
|
+
if (selectedList.length === 0) {
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
527
546
|
try {
|
|
528
547
|
// session storage에서 login 정보 가져오기
|
|
529
548
|
const existingLogin = sessionStorage.getItem('login');
|
|
@@ -552,22 +571,42 @@ const StepTwo = () => {
|
|
|
552
571
|
console.error('Session storage parsing error:', error);
|
|
553
572
|
}
|
|
554
573
|
});
|
|
555
|
-
// 페이지 로드 시
|
|
574
|
+
// 페이지 로드 시 sessionStorage에서 선택된 카테고리를 읽어서 API 호출
|
|
556
575
|
useEffect(() => {
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
//
|
|
563
|
-
|
|
564
|
-
|
|
576
|
+
const initializeData = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
577
|
+
try {
|
|
578
|
+
const existingLogin = sessionStorage.getItem('login');
|
|
579
|
+
if (existingLogin) {
|
|
580
|
+
const loginData = JSON.parse(existingLogin);
|
|
581
|
+
// 선택된 필드 복원
|
|
582
|
+
if (loginData.selectedFields && Array.isArray(loginData.selectedFields)) {
|
|
583
|
+
const restoredList = loginData.selectedFields.map((field) => parseInt(field, 10));
|
|
584
|
+
setSelectedList(restoredList);
|
|
585
|
+
}
|
|
586
|
+
// 선택된 카테고리에서 center_code 가져오기
|
|
587
|
+
if (loginData.selectedCategories && Array.isArray(loginData.selectedCategories)) {
|
|
588
|
+
const codes = loginData.selectedCategories;
|
|
589
|
+
setCenterCodes(codes);
|
|
590
|
+
// 각 center_code별로 API 호출
|
|
591
|
+
const fieldDataPromises = codes.map((centerCode) => __awaiter(void 0, void 0, void 0, function* () {
|
|
592
|
+
const data = yield fetchFieldData(centerCode);
|
|
593
|
+
return { centerCode, data };
|
|
594
|
+
}));
|
|
595
|
+
const results = yield Promise.all(fieldDataPromises);
|
|
596
|
+
// 결과를 fieldData state에 저장
|
|
597
|
+
const newFieldData = {};
|
|
598
|
+
results.forEach(({ centerCode, data }) => {
|
|
599
|
+
newFieldData[centerCode] = data;
|
|
600
|
+
});
|
|
601
|
+
setFieldData(newFieldData);
|
|
602
|
+
}
|
|
565
603
|
}
|
|
566
604
|
}
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
}
|
|
605
|
+
catch (error) {
|
|
606
|
+
console.error('데이터 초기화 실패:', error);
|
|
607
|
+
}
|
|
608
|
+
});
|
|
609
|
+
initializeData();
|
|
571
610
|
}, []);
|
|
572
611
|
return (<>
|
|
573
612
|
<div className="relative mx-[200px] mt-[150px] max-[1498px]:mx-[120px] max-lg:mx-[60px] max-sm:mx-[20px] sm:mt-[240px] lg:mt-[200px] ">
|
|
@@ -593,26 +632,72 @@ const StepTwo = () => {
|
|
|
593
632
|
</div>
|
|
594
633
|
|
|
595
634
|
<div className="mt-[28px] flex flex-col gap-[40px] sm:mt-[61px] lg:mt-[66px] ">
|
|
596
|
-
{
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
635
|
+
{/* {data1?.data?.length > 0 && (
|
|
636
|
+
<div className="sm:flex sm:flex-row sm:rounded-[16px] sm:border sm:border-solid sm:border-grayScale5 sm:p-[40px] lg:rounded-[20px]">
|
|
637
|
+
<p className="body_large1_mo sm:body_large1_tb lg:body_large1 sm:w-[150px] sm:sm:flex-shrink-0">
|
|
638
|
+
{categories.find(item => item.code === center_code)?.code_name}
|
|
639
|
+
</p>
|
|
640
|
+
<div className="my-[12px] w-full bg-grayScale5 max-sm:h-[1px] sm:mx-[44px] sm:my-0 sm:h-auto sm:w-[1px] sm:flex-shrink-0 lg:gap-[80px]" />
|
|
601
641
|
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
642
|
+
<div className="flex flex-row flex-wrap gap-x-[8px] gap-y-[12px] sm:gap-[20px] lg:gap-x-[24px] lg:gap-y-[24px]">
|
|
643
|
+
{data1?.data?.map(item => (
|
|
644
|
+
<Box
|
|
645
|
+
key={item.type_idx}
|
|
646
|
+
type_idx={item.type_idx}
|
|
647
|
+
tag_title={item.tag_title}
|
|
648
|
+
selected={selectedList.includes(item.type_idx)}
|
|
649
|
+
selectedList={selectedList}
|
|
650
|
+
setSelectedList={setSelectedList}
|
|
651
|
+
activeTooltipId={activeTooltipId}
|
|
652
|
+
setActiveTooltipId={setActiveTooltipId}
|
|
653
|
+
tooltipTimeoutRef={tooltipTimeoutRef}
|
|
654
|
+
/>
|
|
655
|
+
))}
|
|
656
|
+
</div>
|
|
657
|
+
</div>
|
|
658
|
+
)}
|
|
659
|
+
{data2?.data?.length > 0 && (
|
|
660
|
+
<div className="sm:flex sm:flex-row sm:rounded-[16px] sm:border sm:border-solid sm:border-grayScale5 sm:p-[40px] lg:rounded-[20px]">
|
|
661
|
+
<p className="body_large1_mo sm:body_large1_tb lg:body_large1 sm:w-[150px] sm:sm:flex-shrink-0">
|
|
662
|
+
{categories.find(item => item.code === center_code2)?.code_name}
|
|
663
|
+
</p>
|
|
664
|
+
<div className="my-[12px] w-full bg-grayScale5 max-sm:h-[1px] sm:mx-[44px] sm:my-0 sm:h-auto sm:w-[1px] sm:flex-shrink-0 lg:gap-[80px]" />
|
|
611
665
|
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
666
|
+
<div className="flex flex-row flex-wrap gap-x-[8px] gap-y-[12px] sm:gap-[20px] lg:gap-x-[24px] lg:gap-y-[32px]">
|
|
667
|
+
{data2?.data?.map(item => (
|
|
668
|
+
<Box
|
|
669
|
+
key={item.type_idx}
|
|
670
|
+
type_idx={item.type_idx}
|
|
671
|
+
tag_title={item.tag_title}
|
|
672
|
+
selected={selectedList.includes(item.type_idx)}
|
|
673
|
+
selectedList={selectedList}
|
|
674
|
+
setSelectedList={setSelectedList}
|
|
675
|
+
activeTooltipId={activeTooltipId}
|
|
676
|
+
setActiveTooltipId={setActiveTooltipId}
|
|
677
|
+
tooltipTimeoutRef={tooltipTimeoutRef}
|
|
678
|
+
/>
|
|
679
|
+
))}
|
|
680
|
+
</div>
|
|
681
|
+
</div>
|
|
682
|
+
)} */}
|
|
683
|
+
{centerCodes.map((centerCode, index) => {
|
|
684
|
+
var _a, _b;
|
|
685
|
+
const currentFieldData = fieldData[centerCode];
|
|
686
|
+
const categoryName = (_a = categories.find(item => item.code === centerCode)) === null || _a === void 0 ? void 0 : _a.code_name;
|
|
687
|
+
if (!((_b = currentFieldData === null || currentFieldData === void 0 ? void 0 : currentFieldData.data) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
688
|
+
return null;
|
|
689
|
+
}
|
|
690
|
+
return (<div key={centerCode} className="sm:flex sm:flex-row sm:rounded-[16px] sm:border sm:border-solid sm:border-grayScale5 sm:p-[40px] lg:rounded-[20px]">
|
|
691
|
+
<p className="body_large1_mo sm:body_large1_tb lg:body_large1 sm:w-[150px] sm:flex-shrink-0">
|
|
692
|
+
{categoryName}
|
|
693
|
+
</p>
|
|
694
|
+
<div className="my-[12px] w-full bg-grayScale5 max-sm:h-[1px] sm:mx-[44px] sm:my-0 sm:h-auto sm:w-[1px] sm:flex-shrink-0 lg:gap-[80px]"/>
|
|
695
|
+
|
|
696
|
+
<div className={`flex flex-row flex-wrap gap-x-[8px] gap-y-[12px] sm:gap-[20px] lg:gap-x-[24px] ${index === 1 ? 'lg:gap-y-[32px]' : 'lg:gap-y-[24px]'}`}>
|
|
697
|
+
{currentFieldData.data.map(item => (<Box key={item.type_idx} type_idx={item.type_idx} tag_title={item.tag_title} selected={selectedList.includes(item.type_idx)} selectedList={selectedList} setSelectedList={setSelectedList} activeTooltipId={activeTooltipId} setActiveTooltipId={setActiveTooltipId} tooltipTimeoutRef={tooltipTimeoutRef}/>))}
|
|
698
|
+
</div>
|
|
699
|
+
</div>);
|
|
700
|
+
})}
|
|
616
701
|
</div>
|
|
617
702
|
<div className="mb-[56px] mt-[40px] flex flex-col items-center justify-center sm:mt-[60px] lg:mt-[79px]">
|
|
618
703
|
<div className="flex w-full flex-row items-center justify-center gap-[8px]">
|
|
@@ -623,7 +708,7 @@ const StepTwo = () => {
|
|
|
623
708
|
이전
|
|
624
709
|
</button>
|
|
625
710
|
<button type={'button'} onClick={handleDone} className={` ${selectedList.length > 0 ? ' bg-[#AE0E36] text-white ' : ' bg-[#EDEDED] text-grayScale3 '} ` +
|
|
626
|
-
' title_small h-[72px] w-[740px]
|
|
711
|
+
' title_small h-[72px] w-[740px] rounded-[36px] ' +
|
|
627
712
|
' max-lg:body_medium2 max-lg:h-[60px] max-lg:w-[620px] ' +
|
|
628
713
|
' max-sm:body_large2_mo max-sm:h-[48px] max-sm:w-full '}>
|
|
629
714
|
완료
|
|
@@ -210,6 +210,11 @@ const StepTwo = () => {
|
|
|
210
210
|
subTitle: ''
|
|
211
211
|
});
|
|
212
212
|
|
|
213
|
+
const [centerCodes, setCenterCodes] = useState<string[]>([]);
|
|
214
|
+
const [fieldData, setFieldData] = useState<{
|
|
215
|
+
[key: string]: { result: boolean; data: { type_idx: number; tag_title: string }[] };
|
|
216
|
+
}>({});
|
|
217
|
+
|
|
213
218
|
const center_code = 'CT0001';
|
|
214
219
|
const center_code2 = 'CT0025';
|
|
215
220
|
const categories = [
|
|
@@ -239,6 +244,26 @@ const StepTwo = () => {
|
|
|
239
244
|
{ code: 'CT0029', code_name: '디지털포렌식' },
|
|
240
245
|
{ code: 'CT0030', code_name: '경호' }
|
|
241
246
|
];
|
|
247
|
+
|
|
248
|
+
// API 호출 함수
|
|
249
|
+
const fetchFieldData = async (centerCode: string) => {
|
|
250
|
+
try {
|
|
251
|
+
const response = await fetch(
|
|
252
|
+
`https://mng.daeryunlaw.com/api/app/seo-template/field/list-by-center?center_code=${centerCode}`
|
|
253
|
+
);
|
|
254
|
+
|
|
255
|
+
if (!response.ok) {
|
|
256
|
+
throw new Error(`API 호출 실패: ${response.status}`);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
const data = await response.json();
|
|
260
|
+
return data;
|
|
261
|
+
} catch (error) {
|
|
262
|
+
console.error(`Center code ${centerCode} API 호출 실패:`, error);
|
|
263
|
+
return { result: false, data: [] };
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
|
|
242
267
|
const data1 = {
|
|
243
268
|
result: true,
|
|
244
269
|
data: [
|
|
@@ -588,6 +613,10 @@ const StepTwo = () => {
|
|
|
588
613
|
};
|
|
589
614
|
|
|
590
615
|
const handleDone = async () => {
|
|
616
|
+
if (selectedList.length === 0) {
|
|
617
|
+
return;
|
|
618
|
+
}
|
|
619
|
+
|
|
591
620
|
try {
|
|
592
621
|
// session storage에서 login 정보 가져오기
|
|
593
622
|
const existingLogin = sessionStorage.getItem('login');
|
|
@@ -621,21 +650,49 @@ const StepTwo = () => {
|
|
|
621
650
|
}
|
|
622
651
|
};
|
|
623
652
|
|
|
624
|
-
// 페이지 로드 시
|
|
653
|
+
// 페이지 로드 시 sessionStorage에서 선택된 카테고리를 읽어서 API 호출
|
|
625
654
|
useEffect(() => {
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
if (
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
655
|
+
const initializeData = async () => {
|
|
656
|
+
try {
|
|
657
|
+
const existingLogin = sessionStorage.getItem('login');
|
|
658
|
+
|
|
659
|
+
if (existingLogin) {
|
|
660
|
+
const loginData = JSON.parse(existingLogin);
|
|
661
|
+
|
|
662
|
+
// 선택된 필드 복원
|
|
663
|
+
if (loginData.selectedFields && Array.isArray(loginData.selectedFields)) {
|
|
664
|
+
const restoredList = loginData.selectedFields.map((field: string) => parseInt(field, 10));
|
|
665
|
+
setSelectedList(restoredList);
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
// 선택된 카테고리에서 center_code 가져오기
|
|
669
|
+
if (loginData.selectedCategories && Array.isArray(loginData.selectedCategories)) {
|
|
670
|
+
const codes = loginData.selectedCategories;
|
|
671
|
+
setCenterCodes(codes);
|
|
672
|
+
|
|
673
|
+
// 각 center_code별로 API 호출
|
|
674
|
+
const fieldDataPromises = codes.map(async (centerCode: string) => {
|
|
675
|
+
const data = await fetchFieldData(centerCode);
|
|
676
|
+
return { centerCode, data };
|
|
677
|
+
});
|
|
678
|
+
|
|
679
|
+
const results = await Promise.all(fieldDataPromises);
|
|
680
|
+
|
|
681
|
+
// 결과를 fieldData state에 저장
|
|
682
|
+
const newFieldData: { [key: string]: any } = {};
|
|
683
|
+
results.forEach(({ centerCode, data }) => {
|
|
684
|
+
newFieldData[centerCode] = data;
|
|
685
|
+
});
|
|
686
|
+
|
|
687
|
+
setFieldData(newFieldData);
|
|
688
|
+
}
|
|
634
689
|
}
|
|
690
|
+
} catch (error) {
|
|
691
|
+
console.error('데이터 초기화 실패:', error);
|
|
635
692
|
}
|
|
636
|
-
}
|
|
637
|
-
|
|
638
|
-
|
|
693
|
+
};
|
|
694
|
+
|
|
695
|
+
initializeData();
|
|
639
696
|
}, []);
|
|
640
697
|
|
|
641
698
|
return (
|
|
@@ -669,7 +726,7 @@ const StepTwo = () => {
|
|
|
669
726
|
</div>
|
|
670
727
|
|
|
671
728
|
<div className="mt-[28px] flex flex-col gap-[40px] sm:mt-[61px] lg:mt-[66px] ">
|
|
672
|
-
{data1?.data?.length > 0 && (
|
|
729
|
+
{/* {data1?.data?.length > 0 && (
|
|
673
730
|
<div className="sm:flex sm:flex-row sm:rounded-[16px] sm:border sm:border-solid sm:border-grayScale5 sm:p-[40px] lg:rounded-[20px]">
|
|
674
731
|
<p className="body_large1_mo sm:body_large1_tb lg:body_large1 sm:w-[150px] sm:sm:flex-shrink-0">
|
|
675
732
|
{categories.find(item => item.code === center_code)?.code_name}
|
|
@@ -716,7 +773,45 @@ const StepTwo = () => {
|
|
|
716
773
|
))}
|
|
717
774
|
</div>
|
|
718
775
|
</div>
|
|
719
|
-
)}
|
|
776
|
+
)} */}
|
|
777
|
+
{centerCodes.map((centerCode, index) => {
|
|
778
|
+
const currentFieldData = fieldData[centerCode];
|
|
779
|
+
const categoryName = categories.find(item => item.code === centerCode)?.code_name;
|
|
780
|
+
|
|
781
|
+
if (!currentFieldData?.data?.length) {
|
|
782
|
+
return null;
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
return (
|
|
786
|
+
<div
|
|
787
|
+
key={centerCode}
|
|
788
|
+
className="sm:flex sm:flex-row sm:rounded-[16px] sm:border sm:border-solid sm:border-grayScale5 sm:p-[40px] lg:rounded-[20px]"
|
|
789
|
+
>
|
|
790
|
+
<p className="body_large1_mo sm:body_large1_tb lg:body_large1 sm:w-[150px] sm:flex-shrink-0">
|
|
791
|
+
{categoryName}
|
|
792
|
+
</p>
|
|
793
|
+
<div className="my-[12px] w-full bg-grayScale5 max-sm:h-[1px] sm:mx-[44px] sm:my-0 sm:h-auto sm:w-[1px] sm:flex-shrink-0 lg:gap-[80px]" />
|
|
794
|
+
|
|
795
|
+
<div
|
|
796
|
+
className={`flex flex-row flex-wrap gap-x-[8px] gap-y-[12px] sm:gap-[20px] lg:gap-x-[24px] ${index === 1 ? 'lg:gap-y-[32px]' : 'lg:gap-y-[24px]'}`}
|
|
797
|
+
>
|
|
798
|
+
{currentFieldData.data.map(item => (
|
|
799
|
+
<Box
|
|
800
|
+
key={item.type_idx}
|
|
801
|
+
type_idx={item.type_idx}
|
|
802
|
+
tag_title={item.tag_title}
|
|
803
|
+
selected={selectedList.includes(item.type_idx)}
|
|
804
|
+
selectedList={selectedList}
|
|
805
|
+
setSelectedList={setSelectedList}
|
|
806
|
+
activeTooltipId={activeTooltipId}
|
|
807
|
+
setActiveTooltipId={setActiveTooltipId}
|
|
808
|
+
tooltipTimeoutRef={tooltipTimeoutRef}
|
|
809
|
+
/>
|
|
810
|
+
))}
|
|
811
|
+
</div>
|
|
812
|
+
</div>
|
|
813
|
+
);
|
|
814
|
+
})}
|
|
720
815
|
</div>
|
|
721
816
|
<div className="mb-[56px] mt-[40px] flex flex-col items-center justify-center sm:mt-[60px] lg:mt-[79px]">
|
|
722
817
|
<div className="flex w-full flex-row items-center justify-center gap-[8px]">
|
|
@@ -737,7 +832,7 @@ const StepTwo = () => {
|
|
|
737
832
|
onClick={handleDone}
|
|
738
833
|
className={
|
|
739
834
|
` ${selectedList.length > 0 ? ' bg-[#AE0E36] text-white ' : ' bg-[#EDEDED] text-grayScale3 '} ` +
|
|
740
|
-
' title_small h-[72px] w-[740px]
|
|
835
|
+
' title_small h-[72px] w-[740px] rounded-[36px] ' +
|
|
741
836
|
' max-lg:body_medium2 max-lg:h-[60px] max-lg:w-[620px] ' +
|
|
742
837
|
' max-sm:body_large2_mo max-sm:h-[48px] max-sm:w-full '
|
|
743
838
|
}
|