

240822 권민수 일단 대시보드에서 단어 컨텐츠 설정된대로 페이지 이동되도록 설정
@2410d421635cc95fd8b39a9c7bcc5550c73f5f1e
--- client/views/pages/main/Chapter/Chapter2.vue
+++ client/views/pages/main/Chapter/Chapter2.vue
... | ... | @@ -110,7 +110,7 @@ |
110 | 110 |
}) |
111 | 111 |
.catch((error) => { |
112 | 112 |
console.error("단어 컨텐츠 목록을 불러오는 중 오류 발생:", error); |
113 |
- }) |
|
113 |
+ }); |
|
114 | 114 |
}, |
115 | 115 |
|
116 | 116 |
async fetchWordList() { |
--- client/views/pages/main/Dashboard.vue
+++ client/views/pages/main/Dashboard.vue
... | ... | @@ -27,7 +27,7 @@ |
27 | 27 |
</button> |
28 | 28 |
<p>{{ labeledItems[0].label }}</p> |
29 | 29 |
</div> |
30 |
- <div class="race-btn" @click="[goToPage('Chapter2'), storeLearningId(labeledItems[1])]"> |
|
30 |
+ <div class="race-btn" @click="[storeLearningId(labeledItems[1])]"> |
|
31 | 31 |
<div class="rabbit-running"><img src="../../../resources/img/img09_s.png" alt="" |
32 | 32 |
:style="{ display: rabbitPos[2] ? 'block' : 'none' }"></div> |
33 | 33 |
<button class="popTxt" v-for="(item, index) in items" :key="index" @click="toggleImage(index)" |
... | ... | @@ -341,6 +341,8 @@ |
341 | 341 |
isHeartFilled: false, // 하트가 채워졌는지 여부 |
342 | 342 |
|
343 | 343 |
problemType: null, |
344 |
+ wordBookType: null, |
|
345 |
+ wordContentList: [], |
|
344 | 346 |
} |
345 | 347 |
}, |
346 | 348 |
methods: { |
... | ... | @@ -588,13 +590,72 @@ |
588 | 590 |
this.$router.push({ name: page }); |
589 | 591 |
}, |
590 | 592 |
storeLearningId(labeledItems) { |
591 |
- this.$store.dispatch('updateLearningData', labeledItems) |
|
592 |
- console.log("레이블된 아이템이라매: ", labeledItems); |
|
593 |
+ this.$store.dispatch('updateLearningData', labeledItems); |
|
594 |
+ this.$store.dispatch('updateLearningId', labeledItems.learning_id) // 단어장에 사용중.. |
|
595 |
+ console.log("레이블된 아이템: ", labeledItems); |
|
593 | 596 |
if (labeledItems.label.startsWith('문제')) { |
594 | 597 |
this.handleProblemDetail(this.$store.getters.currentLearningId) |
595 | 598 |
this.goToPage(this.problemType) |
599 |
+ } else if (labeledItems.label.startsWith('단어장')) { |
|
600 |
+ this.handleWordBookContent(this.$store.getters.getLearningId); |
|
596 | 601 |
} |
597 | 602 |
}, |
603 |
+ handleWordBookContent(item) { |
|
604 |
+ console.log("처리할 단어장 콘텐츠 id: ", item); |
|
605 |
+ |
|
606 |
+ // 단어장 ID 가져오기 |
|
607 |
+ axios.post("/wordContent/selectWordContent.json", { |
|
608 |
+ wordContentId: item, |
|
609 |
+ }) |
|
610 |
+ .then((response) => { |
|
611 |
+ this.wordContentList = response.data; |
|
612 |
+ |
|
613 |
+ // 단어장 ID 리스트에서 첫 번째 단어장 ID를 사용 |
|
614 |
+ const wdBookId = this.wordContentList[0].wd_book_id; |
|
615 |
+ |
|
616 |
+ // 단어장 정보 가져오기 |
|
617 |
+ return axios.post("/wordbook/find.json", { |
|
618 |
+ wdBookId: wdBookId, |
|
619 |
+ }); |
|
620 |
+ }) |
|
621 |
+ .then((response) => { |
|
622 |
+ const wordbookData = response.data; |
|
623 |
+ console.log("wordbookData: ", wordbookData); // 응답 데이터 확인 |
|
624 |
+ |
|
625 |
+ // 단어장 타입에 따라 페이지 설정 |
|
626 |
+ if (wordbookData && wordbookData.wdBookTypeId) { |
|
627 |
+ switch (wordbookData.wdBookTypeId) { |
|
628 |
+ case "1": |
|
629 |
+ this.wordBookType = "Chapter2"; |
|
630 |
+ break; |
|
631 |
+ case "2": |
|
632 |
+ this.wordBookType = "Chapter2_3"; |
|
633 |
+ break; |
|
634 |
+ case "3": |
|
635 |
+ this.wordBookType = "Chapter2_2"; |
|
636 |
+ break; |
|
637 |
+ case "4": |
|
638 |
+ this.wordBookType = "Chapter2_9"; |
|
639 |
+ break; |
|
640 |
+ case "5": |
|
641 |
+ this.wordBookType = "Chapter2_4"; |
|
642 |
+ break; |
|
643 |
+ default: |
|
644 |
+ this.wordBookType = null; |
|
645 |
+ } |
|
646 |
+ } else { |
|
647 |
+ console.error("wdBookTypeId가 없습니다."); |
|
648 |
+ this.wordBookType = null; |
|
649 |
+ } |
|
650 |
+ |
|
651 |
+ console.log("현재 단어장 타입: ", this.wordBookType); |
|
652 |
+ this.goToPage(this.wordBookType); |
|
653 |
+ }) |
|
654 |
+ .catch((error) => { |
|
655 |
+ console.error("단어장 정보를 불러오는 중 오류 발생:", error); |
|
656 |
+ this.wordBookType = null; |
|
657 |
+ }); |
|
658 |
+ }, |
|
598 | 659 |
handleProblemDetail(item) { |
599 | 660 |
if (item.prblm_type_id === "prblm_type_001") { |
600 | 661 |
this.problemType = "Chapter3"; |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?