From 4e0c4e9b285c6d579f33cbe65d230d1159b65025 Mon Sep 17 00:00:00 2001 From: bicochan Date: Mon, 2 Jun 2025 16:09:07 +0900 Subject: [PATCH] =?UTF-8?q?WIP:=20=EC=84=A4=EB=AC=B8=20=EB=B3=B4=EA=B8=B0?= =?UTF-8?q?=20=EC=9E=91=EC=97=85=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../survey-article/[srvySn]/page.tsx | 2 - .../user-survey-article/[srvySn]/page.tsx | 10 + .../cs/src/pages/survey/api/survey-service.ts | 8 + apps/cs/src/pages/survey/index.ts | 2 +- .../survey/model/question-table-columns.tsx | 2 +- .../pages/survey/model/survey-interface.ts | 8 +- .../survey/model/survey-table-columns.tsx | 2 +- apps/cs/src/pages/survey/ui/question-form.tsx | 4 +- .../cs/src/pages/survey/ui/survey-article.tsx | 146 ------------ .../pages/survey/ui/user-survey-article.tsx | 211 ++++++++++++++++++ 10 files changed, 241 insertions(+), 154 deletions(-) delete mode 100644 apps/cs/app/(without-base-layout)/survey-article/[srvySn]/page.tsx create mode 100644 apps/cs/app/(without-base-layout)/user-survey-article/[srvySn]/page.tsx delete mode 100644 apps/cs/src/pages/survey/ui/survey-article.tsx create mode 100644 apps/cs/src/pages/survey/ui/user-survey-article.tsx diff --git a/apps/cs/app/(without-base-layout)/survey-article/[srvySn]/page.tsx b/apps/cs/app/(without-base-layout)/survey-article/[srvySn]/page.tsx deleted file mode 100644 index a99cf686c..000000000 --- a/apps/cs/app/(without-base-layout)/survey-article/[srvySn]/page.tsx +++ /dev/null @@ -1,2 +0,0 @@ -import { SurveyArticle } from "@/pages/survey"; -export default SurveyArticle; diff --git a/apps/cs/app/(without-base-layout)/user-survey-article/[srvySn]/page.tsx b/apps/cs/app/(without-base-layout)/user-survey-article/[srvySn]/page.tsx new file mode 100644 index 000000000..f2488d4a2 --- /dev/null +++ b/apps/cs/app/(without-base-layout)/user-survey-article/[srvySn]/page.tsx @@ -0,0 +1,10 @@ +import { UserSurveyArticle } from "@/pages/survey"; + +export default async function UserSurveyArticlePage({ + params, +}: { + params: Promise<{ srvySn: string }>; +}) { + const { srvySn } = await params; + return ; +} diff --git a/apps/cs/src/pages/survey/api/survey-service.ts b/apps/cs/src/pages/survey/api/survey-service.ts index 1308e4154..e91b2202a 100644 --- a/apps/cs/src/pages/survey/api/survey-service.ts +++ b/apps/cs/src/pages/survey/api/survey-service.ts @@ -13,6 +13,7 @@ import type { Article, ArticleList, ArticleParams, + UserSurvey, } from "../model/survey-interface"; export class SurveyApiService implements SurveyService { @@ -89,6 +90,13 @@ export class SurveyApiService implements SurveyService { public async saveArticleList(data: Article[]): Promise { await client.post(ENDPOINT.CMS_SERVICE.SURVEY_ARTICLE, data); } + + public async getUserSurvey(srvySn: number): Promise { + const response = await client.get( + `${ENDPOINT.CMS_SERVICE.SURVEY}/user/${srvySn}`, + ); + return response.data; + } } export const SurveyApi = new SurveyApiService(); diff --git a/apps/cs/src/pages/survey/index.ts b/apps/cs/src/pages/survey/index.ts index 92d7c71d0..18297a746 100644 --- a/apps/cs/src/pages/survey/index.ts +++ b/apps/cs/src/pages/survey/index.ts @@ -2,4 +2,4 @@ export { SurveyPage } from "./ui/survey-page"; export { CreatePage } from "./ui/create-page"; export { DetailPage } from "./ui/detail-page"; export { ModifyPage } from "./ui/modify-page"; -export { SurveyArticle } from "./ui/survey-article"; +export { UserSurveyArticle } from "./ui/user-survey-article"; diff --git a/apps/cs/src/pages/survey/model/question-table-columns.tsx b/apps/cs/src/pages/survey/model/question-table-columns.tsx index 39cf4b902..357b25adb 100644 --- a/apps/cs/src/pages/survey/model/question-table-columns.tsx +++ b/apps/cs/src/pages/survey/model/question-table-columns.tsx @@ -12,7 +12,7 @@ import { ArticleManagementDialog } from "../ui/article-management-dialog"; const QUESTION_TYPE = { RADIO: "객관식", - CHECK: "다중응답", + CHECKBOX: "다중응답", INPUT: "주관식", } as const; diff --git a/apps/cs/src/pages/survey/model/survey-interface.ts b/apps/cs/src/pages/survey/model/survey-interface.ts index 83d13d474..c60c3523f 100644 --- a/apps/cs/src/pages/survey/model/survey-interface.ts +++ b/apps/cs/src/pages/survey/model/survey-interface.ts @@ -3,7 +3,7 @@ import type { PageableList, PageableParams } from "@/shared/model"; export const QUESTION_TYPE_CODE = { RADIO: "RADIO", - CHECK: "CHECK", + CHECKBOX: "CHECKBOX", INPUT: "INPUT", } as const; @@ -95,6 +95,11 @@ export type QuestionList = PageableList; export type QuestionFormData = z.infer; export type Article = z.infer; export type ArticleList = PageableList
; +export type UserSurvey = SurveyDetail & { + qitems: (Question & { + articles: Article[]; + })[]; +}; export interface SurveyService { getSurveyList(params: SurveyParams): Promise; @@ -108,4 +113,5 @@ export interface SurveyService { deleteQuestion(srvyQitemNo: number): Promise; getArticleList(params: ArticleParams): Promise; saveArticleList(data: Article[]): Promise; + getUserSurvey(srvySn: number): Promise; } diff --git a/apps/cs/src/pages/survey/model/survey-table-columns.tsx b/apps/cs/src/pages/survey/model/survey-table-columns.tsx index 14710edf2..08213020b 100644 --- a/apps/cs/src/pages/survey/model/survey-table-columns.tsx +++ b/apps/cs/src/pages/survey/model/survey-table-columns.tsx @@ -65,7 +65,7 @@ export const columns: ColumnDef[] = [ const left = window.screen.width / 2 - width / 2 + window.screenX; const top = window.screen.height / 2 - height / 2 + window.screenY; window.open( - `/survey-article/${row.original.srvySn}`, + `/user-survey-article/${row.original.srvySn}`, "", `width=${width},height=${height},left=${left},top=${top}`, ); diff --git a/apps/cs/src/pages/survey/ui/question-form.tsx b/apps/cs/src/pages/survey/ui/question-form.tsx index b722a4802..cb321fbe7 100644 --- a/apps/cs/src/pages/survey/ui/question-form.tsx +++ b/apps/cs/src/pages/survey/ui/question-form.tsx @@ -107,7 +107,7 @@ function QuestionForm({ form, actionSlot, handleSave }: QuestionFormProps) { /> - {qstnTypeCd === "CHECK" && ( + {qstnTypeCd === "CHECKBOX" && ( 최대선택갯수 @@ -134,7 +134,7 @@ function QuestionForm({ form, actionSlot, handleSave }: QuestionFormProps) { )} - {(qstnTypeCd === "RADIO" || qstnTypeCd === "CHECK") && ( + {(qstnTypeCd === "RADIO" || qstnTypeCd === "CHECKBOX") && ( 기타답변여부 diff --git a/apps/cs/src/pages/survey/ui/survey-article.tsx b/apps/cs/src/pages/survey/ui/survey-article.tsx deleted file mode 100644 index 768e0b182..000000000 --- a/apps/cs/src/pages/survey/ui/survey-article.tsx +++ /dev/null @@ -1,146 +0,0 @@ -"use client"; - -import { CodeSelect } from "@/entities/code"; -import { - Button, - Checkbox, - Input, - Label, - RadioGroup, - RadioGroupItem, - Textarea, -} from "@common/components"; - -function SurveyArticle() { - return ( -
-
-
-

설문 제목

-
- - -
-
-
-
-

- 설문 참여자 정보 -

-
-
- 응답자명 - -
-
- 직업 - -
-
- 생년월일 - -
-
- 성별 - -
- - -
-
- - -
-
-
-
-
-
-
- 답변 설명 -
-
-
- - 1 - - -
-
- - 2 - - -
-
- - 3 - - -
-
-
-
-
- ); -} - -function RadioArticle() { - return ( -
-

질문 1

- -
-
- - -
-
- - -
-
-
-
- ); -} - -function CheckboxArticle() { - return ( -
-

질문 2

-
-
- - -
-
- - -
-
-
- ); -} - -function TextareaArticle() { - return ( -
-

질문 3

-