diff --git a/src/App.vue b/src/App.vue index 8fd3ea1..24f3ce0 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,18 +1,14 @@ diff --git a/src/components/BlueFolder.vue b/src/components/BlueFolder.vue index ed254d8..6c4cac4 100644 --- a/src/components/BlueFolder.vue +++ b/src/components/BlueFolder.vue @@ -71,9 +71,6 @@ const filterAlgorithms = (algorithms: string[]) => { src="../assets//mainpage/programers.svg" class="mr-2 bg-[50%_50%] bg-cover bg-no-repeat w-[23px] h-[22px]" /> - {{ truncateString(problem.problemTitle, 17) }} @@ -127,25 +124,3 @@ const filterAlgorithms = (algorithms: string[]) => { - diff --git a/src/components/Editor.vue b/src/components/Editor.vue index 73ef8fd..efa4f55 100644 --- a/src/components/Editor.vue +++ b/src/components/Editor.vue @@ -24,11 +24,7 @@ export default { }; }, mounted() { - // 문제 데이터 가져오기 - // const problemStore = useProblemStore(); - // if (!problemStore.problems.length) { - // problemStore.fetchProblems(); - // } + const boardStore = useBoardStore(); const route = useRoute(); const boardId = Number(route.params.id); @@ -45,11 +41,6 @@ export default { previewStyle: 'vertical', plugins: [[codeSyntaxHighlight, { highlighter: Prism }], colorSyntax], }); - - // boardData의 content를 에디터에 설정 - // if (this.boardData?.solutions?.[0]?.content) { - // this.editor.setMarkdown(this.boardData.solutions[0].content); - // } }); // SUBMIT 버튼 클릭 이벤트 @@ -83,7 +74,6 @@ export default {
{{ boardData.solutions[0].language }}
-
@@ -121,9 +111,6 @@ export default { class="mb-[30px] p-[20px] border-[2px] bg-white border-gray-300 rounded-[10px] font-Pretendards text-[20px]" > {{ boardData.board.memo }} -
diff --git a/src/components/FilterBar.vue b/src/components/FilterBar.vue index 2c3d6d3..7926729 100644 --- a/src/components/FilterBar.vue +++ b/src/components/FilterBar.vue @@ -26,14 +26,13 @@ const filteredProblems = ref([]); // 필터링된 데이터를 저장 const problemAPI = async (offset = 0, limit = 30) => { try { - const response = await axios.get('http://localhost:8080/api/v1/boards', { + const response = await axios.get('http://localhost:8080/api/v2/boards', { headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${localStorage.getItem('accessToken')}`, }, params: { offset, limit }, }); - // console.log('전체 목록 조회 성공', response.data.data.content[0]); const content = response.data.data.content[0].reverse(); problems.value = content.map((item: any) => ({ diff --git a/src/components/Navbar.vue b/src/components/Navbar.vue index df6d631..adf810e 100644 --- a/src/components/Navbar.vue +++ b/src/components/Navbar.vue @@ -14,9 +14,7 @@ > - {{ nickname.valueOf() }} - @@ -31,7 +29,6 @@ export default defineComponent({ setup() { const userStore = useUserStore(); const router = useRouter(); - // const displayedUserName = computed(() => userStore.userName.valueOf); // 사용자 이름을 computed 속성으로 가져옴 const nickname = computed(() => userStore.userName); console.log(nickname.value); diff --git a/src/pages/DetailPage.vue b/src/pages/DetailPage.vue index 6095871..9f8f0dc 100644 --- a/src/pages/DetailPage.vue +++ b/src/pages/DetailPage.vue @@ -62,7 +62,7 @@ export default defineComponent({ const boardId = Number(route.params.id); // URL 파라미터에서 boardId 추출 console.log('boardId', boardId); try { - const response = await axios.get(`http://localhost:8080/api/v1/boards/${boardId}`); + const response = await axios.get(`http://localhost:8080/api/v2/boards/${boardId}`); console.log('게시글 조회 성공:', response.data.data); boardData.value = response.data.data; } catch (error) { @@ -84,12 +84,52 @@ export default defineComponent({ router.push({ name: 'edit', params: { id: boardId } }); // 'edit' 페이지로 이동하며 ID 전달 }; + // 마크다운 형식으로 클립보드에 복사하는 함수 + const copyToClipboard = () => { + if (boardData.value) { + const markdownContent = ` +# [[${boardData.value.problem.platform}] ${boardData.value.problem.number}. ${boardData.value.problem.title}](${boardData.value.problem.url}) + +## 문제 내용 +${boardData.value.problem.content} + +**알고리즘**: ${boardData.value.problem.algorithms.join(', ')} + +> **메모** +> ${boardData.value.board.memo} + +--- + +## 풀이 설명 +${boardData.value.solutions[0].description} + +### 코드 +\`\`\`${boardData.value.solutions[0].language} +${boardData.value.solutions[0].content + .replace(/
/g, '\n') //
을 줄바꿈으로 변환 + .replace(/</g, '<') // HTML 엔티티를 실제 문자로 변환 + .replace(/>/g, '>') + .replace(/ /g, ' ')} +\`\`\` + +--- + +> 이 게시물의 양식은 [Alchive](https://github.com/Alchive)를 통해 작성되었습니다.👍😎 + `; + + navigator.clipboard.writeText(markdownContent).then(() => { + alert('내용이 클립보드에 복사되었습니다.'); + }); + } + }; + return { isContentVisible, toggleContent, boardData, markdownToHtml, goToEditPage, + copyToClipboard, }; }, }); @@ -108,8 +148,6 @@ export default defineComponent({
{{ boardData.problem.number }}. {{ boardData.problem.title }}
-
@@ -127,6 +165,9 @@ export default defineComponent({ trash +
@@ -154,7 +195,6 @@ export default defineComponent({
{{ boardData.solutions[0].language }}
-
@@ -176,9 +216,6 @@ export default defineComponent({ class="mb-[30px] p-[20px] border-[2px] bg-white border-gray-300 rounded-[10px] font-Pretendards text-[20px]" >
-
@@ -191,47 +228,17 @@ export default defineComponent({ v-if="boardData" >
- - -
코드 -
- - - - - - - - - - - - - - - - - - - - - -
- + \ No newline at end of file diff --git a/src/pages/LoginPopUp.vue b/src/pages/LoginPopUp.vue index f3f0245..524f39c 100644 --- a/src/pages/LoginPopUp.vue +++ b/src/pages/LoginPopUp.vue @@ -8,11 +8,6 @@
나만의 알고리즘 저장소
-