
--- client/views/pages/main/MyPlan.vue
+++ client/views/pages/main/MyPlan.vue
... | ... | @@ -1,12 +1,13 @@ |
1 | 1 |
<template> |
2 |
+ |
|
2 | 3 |
<div class="main"> |
3 | 4 |
<div class="myplan"> |
4 | 5 |
<div class="title-box flex justify-between mb40"> |
5 | 6 |
<p class="title">오늘 공부할 내용을 확인해봅시다.</p> |
6 | 7 |
</div> |
7 |
- <div class="wrap" style="border-radius: 0; min-height: 197px;"> |
|
8 |
+ <div class="wrap" style="border-radius: 0; min-height: 197px;"> |
|
8 | 9 |
<p class="title1" v-if="!schedules || schedules.length === 0"> 오늘 학습할 내용이 없습니다.</p> |
9 |
- |
|
10 |
+ |
|
10 | 11 |
<div class="flex-column" style="gap: 20px;" v-else v-for="(schedule, index) in schedules" :key="index"> |
11 | 12 |
<div class="flex justify-between align-center" style="gap: 70px;"> |
12 | 13 |
<div><img src="../../../resources/img/img217_22s.png" alt=""></div> |
... | ... | @@ -16,17 +17,27 @@ |
16 | 17 |
<p class="title2">grade 3</p> |
17 | 18 |
<div class="flex align-center mb10" style="gap: 10px;"> |
18 | 19 |
<p class="title2"><em class="gray-bd">{{ schedule.schdl_unit }}교시</em></p> |
19 |
- <p class="title1">{{ schedule.schedule_time }}</p> |
|
20 |
+ <p class="title1">{{ schedule.schedule_time }}</p> |
|
20 | 21 |
</div> |
21 | 22 |
<div class="title-box mb10"> |
22 |
- <span class="title">{{schedule.unit_nm}}</span> |
|
23 |
+ <span class="title">{{ schedule.unit_nm }}</span> |
|
23 | 24 |
</div> |
24 | 25 |
<p class="title2">{{ schedule.book_nm }}</p> |
26 |
+ <!-- <p class="title2">wirte a</p> --> |
|
25 | 27 |
</div> |
26 |
- <div> |
|
27 |
- <p class="title" @click="goToPage('Dashboard', schedule.schdl_id)">바로가기</p> |
|
28 |
- <img src="../../../resources/img/img214_19s.png" alt=""></div> |
|
29 |
- </div> |
|
28 |
+ <button v-if="schedule.finish == 'T'" type="button" title="바로가기" class="yellow-btn" |
|
29 |
+ @click="goToPage('Dashboard')"> |
|
30 |
+ 학습완료 |
|
31 |
+ </button> |
|
32 |
+ <button v-else type="button" title="바로가기" class="yellow-btn" |
|
33 |
+ @click="goToPage('Dashboard')"> |
|
34 |
+ 바로가기 |
|
35 |
+ </button> |
|
36 |
+ <div><img src="../../../resources/img/img214_19s.png" alt=""></div> |
|
37 |
+ <button type="button" class="popup-close-btn" @click="deleteSchedule(schedule.schdl_id)"> |
|
38 |
+ <svg-icon type="mdi" :path="mdiWindowClose" class="close-btn"></svg-icon> |
|
39 |
+ </button> |
|
40 |
+ </div> |
|
30 | 41 |
</div> |
31 | 42 |
</div> |
32 | 43 |
</div> |
... | ... | @@ -38,7 +49,7 @@ |
38 | 49 |
<p class="title">오늘 공부를 계획해봅시다.</p> |
39 | 50 |
<p class="title1 mt20"> 스스로 학습 일정을 바꿔볼까요?</p> |
40 | 51 |
</div> |
41 |
- <button type="button" title="바로가기" class="yellow-btn" @click="goToPage2('MyPlan2')"> |
|
52 |
+ <button type="button" title="바로가기" class="yellow-btn" @click="goToPage('MyPlan2')"> |
|
42 | 53 |
바로가기 |
43 | 54 |
</button> |
44 | 55 |
</div> |
... | ... | @@ -62,6 +73,7 @@ |
62 | 73 |
</div> |
63 | 74 |
</div> |
64 | 75 |
</div> |
76 |
+ |
|
65 | 77 |
</template> |
66 | 78 |
|
67 | 79 |
<script> |
... | ... | @@ -87,51 +99,11 @@ |
87 | 99 |
{ label: "5교시", time: "13:00 ~ 14:00", value: "5" }, |
88 | 100 |
{ label: "6교시", time: "14:00 ~ 15:00", value: "6" }, |
89 | 101 |
], |
90 |
- |
|
91 | 102 |
} |
92 | 103 |
}, |
93 | 104 |
methods: { |
94 |
- goToPage(page, scheduleId) { |
|
95 |
- const startScheduleIndex = this.schedules.findIndex(schedule => schedule.schdl_id === scheduleId); |
|
96 |
- |
|
97 |
- if (startScheduleIndex === -1) { |
|
98 |
- console.error("해당 스케줄을 찾을 수 없습니다."); |
|
99 |
- return; |
|
100 |
- } |
|
101 |
- |
|
102 |
- const updates = []; |
|
103 |
- const currentSchedule = this.schedules[startScheduleIndex]; |
|
104 |
- if (currentSchedule.finish === null || currentSchedule.finish === "T") { |
|
105 |
- updates.push( |
|
106 |
- axios.post("/schedule/scheduleUpdate.json", { scheduleId: currentSchedule.schdl_id, finish: "F" }, { |
|
107 |
- headers: { |
|
108 |
- "Content-Type": "application/json; charset=UTF-8", |
|
109 |
- } |
|
110 |
- }) |
|
111 |
- ); |
|
112 |
- } |
|
113 |
- |
|
114 |
- for (let i = startScheduleIndex + 1; i < this.schedules.length; i++) { |
|
115 |
- const nextSchedule = this.schedules[i]; |
|
116 |
- if (nextSchedule.finish === "T") { |
|
117 |
- updates.push( |
|
118 |
- axios.post("/schedule/scheduleUpdate.json", { scheduleId: nextSchedule.schdl_id, finish: "F" }, { |
|
119 |
- headers: { |
|
120 |
- "Content-Type": "application/json; charset=UTF-8", |
|
121 |
- } |
|
122 |
- }) |
|
123 |
- ); |
|
124 |
- } |
|
125 |
- } |
|
126 |
- |
|
127 |
- Promise.all(updates) |
|
128 |
- .then(() => { |
|
129 |
- this.$router.push({ name: page }); |
|
130 |
- }) |
|
131 |
- .catch(error => { |
|
132 |
- console.error("Error updating schedules:", error); |
|
133 |
- alert("학습 계획을 업데이트하는 중 오류가 발생했습니다."); |
|
134 |
- }); |
|
105 |
+ goToPage(page) { |
|
106 |
+ this.$router.push({ name: page }); |
|
135 | 107 |
}, |
136 | 108 |
showConfirm(type) { |
137 | 109 |
let message = ''; |
... | ... | @@ -147,9 +119,6 @@ |
147 | 119 |
this.goBack(); |
148 | 120 |
} |
149 | 121 |
}, |
150 |
- goToPage2(page) { |
|
151 |
- this.$router.push({ name: page }); |
|
152 |
- }, |
|
153 | 122 |
closeModal() { |
154 | 123 |
this.showModal = false; |
155 | 124 |
}, |
... | ... | @@ -159,8 +128,7 @@ |
159 | 128 |
closeBtn() { |
160 | 129 |
this.searchOpen = false; |
161 | 130 |
|
162 |
- }, |
|
163 |
- fetchSchedules() { |
|
131 |
+ }, fetchSchedules() { |
|
164 | 132 |
axios.post("/schedule/selectSchedule.json", { stdId: this.stdId }, { |
165 | 133 |
headers: { |
166 | 134 |
"Content-Type": "application/json; charset=UTF-8", |
... | ... | @@ -180,6 +148,20 @@ |
180 | 148 |
console.error("fetchUnits - error:", error); |
181 | 149 |
alert("단원 목록을 불러오는 중 오류가 발생했습니다."); |
182 | 150 |
}); |
151 |
+ }, deleteSchedule(scheduleId){ |
|
152 |
+ axios.post("/schedule/scheduleDelete.json", { scheduleId: scheduleId }, { |
|
153 |
+ headers: { |
|
154 |
+ "Content-Type": "application/json; charset=UTF-8", |
|
155 |
+ } |
|
156 |
+ }) |
|
157 |
+ .then(response => { |
|
158 |
+ alert("학습일정이 삭제되었습니다.") |
|
159 |
+ window.location.reload(); |
|
160 |
+ }) |
|
161 |
+ .catch(error => { |
|
162 |
+ console.error("fetchUnits - error:", error); |
|
163 |
+ alert("단원 목록을 불러오는 중 오류가 발생했습니다."); |
|
164 |
+ }); |
|
183 | 165 |
} |
184 | 166 |
}, |
185 | 167 |
watch: { |
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?