

240822 권민수 단어장 콘텐츠 인덱스 설정 추가
@554cc5f67a17705030885a864d754dc979f5eb28
--- client/views/pages/AppStore.js
+++ client/views/pages/AppStore.js
... | ... | @@ -17,6 +17,7 @@ |
17 | 17 |
currentProblemIndex: 0, |
18 | 18 |
textId: null, |
19 | 19 |
wdBookIdList: [], |
20 |
+ currentWdBkIndex: 0, |
|
20 | 21 |
}, |
21 | 22 |
getters: { |
22 | 23 |
isLoggedIn(state) { |
... | ... | @@ -56,6 +57,7 @@ |
56 | 57 |
getWdBookIdList(state) { |
57 | 58 |
return state.wdBookIdList; |
58 | 59 |
}, |
60 |
+ getCurrentWdBkIndex: (state) => state.currentWdBkIndex, |
|
59 | 61 |
}, |
60 | 62 |
mutations: { |
61 | 63 |
setToken(state, token) { |
... | ... | @@ -117,6 +119,9 @@ |
117 | 119 |
}, |
118 | 120 |
setWdBookIdList(state, wdBookIdList) { |
119 | 121 |
state.wdBookIdList = wdBookIdList; |
122 |
+ }, |
|
123 |
+ setCurrentWdBkIndex(state, currentWdBkIndex) { |
|
124 |
+ state.currentWdBkIndex = currentWdBkIndex; |
|
120 | 125 |
} |
121 | 126 |
}, |
122 | 127 |
actions: { |
... | ... | @@ -170,5 +175,8 @@ |
170 | 175 |
updateWdBookIdList({ commit }, wdBookIdList) { |
171 | 176 |
commit('setWdBookIdList', wdBookIdList); |
172 | 177 |
}, |
178 |
+ updateCurrentWdBkIndex({ commit }, currentWdBkIndex) { |
|
179 |
+ commit('setCurrentWdBkIndex', currentWdBkIndex); |
|
180 |
+ } |
|
173 | 181 |
}, |
174 | 182 |
}); |
--- client/views/pages/main/Chapter/Chapter2_2.vue
+++ client/views/pages/main/Chapter/Chapter2_2.vue
... | ... | @@ -104,9 +104,17 @@ |
104 | 104 |
timer: 0, |
105 | 105 |
intervalId: null, |
106 | 106 |
currentIndex: 0, |
107 |
+ wdBookId: "", |
|
108 |
+ currentWdBkIndex: 0, |
|
107 | 109 |
}; |
108 | 110 |
}, |
109 | 111 |
methods: { |
112 |
+ async fetchWordList() { |
|
113 |
+ console.log("현재 단어장 콘텐츠 인덱스: ", this.$store.getters.getCurrentWdBkIndex); |
|
114 |
+ this.currentWdBkIndex = this.$store.getters.getCurrentWdBkIndex; |
|
115 |
+ console.log("현재 단어장 콘텐츠 인덱스에 대한 단어장 id: ", this.$store.getters.getWdBookIdList[this.currentWdBkIndex]); |
|
116 |
+ }, |
|
117 |
+ |
|
110 | 118 |
complete() { |
111 | 119 |
const { unit_id, book_id } = this.$route.query; |
112 | 120 |
this.$router.push({ name: 'Dashboard', query: { value: 2, unit_id, book_id } }); |
... | ... | @@ -157,6 +165,7 @@ |
157 | 165 |
}, |
158 | 166 |
}, |
159 | 167 |
mounted() { |
168 |
+ this.fetchWordList(); |
|
160 | 169 |
this.startTimer(); |
161 | 170 |
}, |
162 | 171 |
}; |
--- client/views/pages/main/Dashboard.vue
+++ client/views/pages/main/Dashboard.vue
... | ... | @@ -564,6 +564,7 @@ |
564 | 564 |
this.wordContentList = response.data; |
565 | 565 |
|
566 | 566 |
this.$store.dispatch('updateWdBookIdList', this.wordContentList.map(content => content.wd_book_id)); |
567 |
+ this.$store.dispatch('updateCurrentWdBkIndex', 0); |
|
567 | 568 |
console.log("저장한 단어장 id 리스트: ", this.$store.getters.getWdBookIdList); |
568 | 569 |
|
569 | 570 |
// 단어장 ID 리스트에서 첫 번째 단어장 ID를 사용 |
... | ... | @@ -576,7 +577,6 @@ |
576 | 577 |
}) |
577 | 578 |
.then((response) => { |
578 | 579 |
const wordbookData = response.data; |
579 |
- console.log("wordbookData: ", wordbookData); // 응답 데이터 확인 |
|
580 | 580 |
|
581 | 581 |
// 단어장 타입에 따라 페이지 설정 |
582 | 582 |
if (wordbookData && wordbookData.wdBookTypeId) { |
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?