
--- client/views/pages/main/MyPlan.vue
+++ client/views/pages/main/MyPlan.vue
... | ... | @@ -26,11 +26,11 @@ |
26 | 26 |
<!-- <p class="title2">wirte a</p> --> |
27 | 27 |
</div> |
28 | 28 |
<button v-if="schedule.finish == 'T'" type="button" title="바로가기" class="yellow-btn" |
29 |
- @click="goToPage('Dashboard')"> |
|
29 |
+ @click="goToPage('Dashboard', schedule.schdl_id)"> |
|
30 | 30 |
학습완료 |
31 | 31 |
</button> |
32 | 32 |
<button v-else type="button" title="바로가기" class="yellow-btn" |
33 |
- @click="goToPage('Dashboard')"> |
|
33 |
+ @click="goToPage('Dashboard', schedule.schdl_id)"> |
|
34 | 34 |
바로가기 |
35 | 35 |
</button> |
36 | 36 |
<div><img src="../../../resources/img/img214_19s.png" alt=""></div> |
... | ... | @@ -49,7 +49,7 @@ |
49 | 49 |
<p class="title">오늘 공부를 계획해봅시다.</p> |
50 | 50 |
<p class="title1 mt20"> 스스로 학습 일정을 바꿔볼까요?</p> |
51 | 51 |
</div> |
52 |
- <button type="button" title="바로가기" class="yellow-btn" @click="goToPage('MyPlan2')"> |
|
52 |
+ <button type="button" title="바로가기" class="yellow-btn" @click="goToPage2('MyPlan2')"> |
|
53 | 53 |
바로가기 |
54 | 54 |
</button> |
55 | 55 |
</div> |
... | ... | @@ -102,7 +102,49 @@ |
102 | 102 |
} |
103 | 103 |
}, |
104 | 104 |
methods: { |
105 |
- goToPage(page) { |
|
105 |
+ goToPage(page, scheduleId) { |
|
106 |
+ const startScheduleIndex = this.schedules.findIndex(schedule => schedule.schdl_id === scheduleId); |
|
107 |
+ |
|
108 |
+ if (startScheduleIndex === -1) { |
|
109 |
+ console.error("해당 스케줄을 찾을 수 없습니다."); |
|
110 |
+ return; |
|
111 |
+ } |
|
112 |
+ |
|
113 |
+ const updates = []; |
|
114 |
+ const currentSchedule = this.schedules[startScheduleIndex]; |
|
115 |
+ if (currentSchedule.finish === null || currentSchedule.finish === "T") { |
|
116 |
+ updates.push( |
|
117 |
+ axios.post("/schedule/scheduleUpdate.json", { scheduleId: currentSchedule.schdl_id, finish: "F" }, { |
|
118 |
+ headers: { |
|
119 |
+ "Content-Type": "application/json; charset=UTF-8", |
|
120 |
+ } |
|
121 |
+ }) |
|
122 |
+ ); |
|
123 |
+ } |
|
124 |
+ |
|
125 |
+ for (let i = startScheduleIndex + 1; i < this.schedules.length; i++) { |
|
126 |
+ const nextSchedule = this.schedules[i]; |
|
127 |
+ if (nextSchedule.finish === "T") { |
|
128 |
+ updates.push( |
|
129 |
+ axios.post("/schedule/scheduleUpdate.json", { scheduleId: nextSchedule.schdl_id, finish: "F" }, { |
|
130 |
+ headers: { |
|
131 |
+ "Content-Type": "application/json; charset=UTF-8", |
|
132 |
+ } |
|
133 |
+ }) |
|
134 |
+ ); |
|
135 |
+ } |
|
136 |
+ } |
|
137 |
+ |
|
138 |
+ Promise.all(updates) |
|
139 |
+ .then(() => { |
|
140 |
+ this.$router.push({ name: page }); |
|
141 |
+ }) |
|
142 |
+ .catch(error => { |
|
143 |
+ console.error("Error updating schedules:", error); |
|
144 |
+ alert("학습 계획을 업데이트하는 중 오류가 발생했습니다."); |
|
145 |
+ }); |
|
146 |
+ }, |
|
147 |
+ goToPage2(page) { |
|
106 | 148 |
this.$router.push({ name: page }); |
107 | 149 |
}, |
108 | 150 |
showConfirm(type) { |
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?