정다정
10-14
241014 정다정 시간입력 팝업 위치 수정
@0acb8f95d417d8f180413266b47b79f488ce4384
--- client/views/pages/main/MyPlan2.vue
+++ client/views/pages/main/MyPlan2.vue
... | ... | @@ -1,36 +1,42 @@ |
1 | 1 |
<template> |
2 |
- <div class=" main"> |
|
2 |
+ <div class="main"> |
|
3 | 3 |
<div class="myplan"> |
4 | 4 |
<div class="title-box flex justify-between mb40"> |
5 | 5 |
<p class="title">오늘 공부를 계획해봅시다.</p> |
6 | 6 |
</div> |
7 | 7 |
<div class="wrap"> |
8 |
- <p class="title1"> 학습 단원을 선택합시다.</p> |
|
8 |
+ <p class="title1">학습 단원을 선택합시다.</p> |
|
9 | 9 |
<div class="search-wrap flex justify-end mb20 mt20"> |
10 |
- <input class="data-wrap" type="text" placeholder="검색하세요." v-model="keyword"> |
|
10 |
+ <input class="data-wrap" type="text" placeholder="검색하세요." v-model="keyword" /> |
|
11 | 11 |
<button type="button" title="위원회 검색" @click="searchBook"> |
12 |
- <img src="../../../resources/img/look_t.png" alt=""> |
|
12 |
+ <img src="../../../resources/img/look_t.png" alt="" /> |
|
13 | 13 |
</button> |
14 | 14 |
</div> |
15 | 15 |
<div class="table-wrap"> |
16 | 16 |
<table> |
17 | 17 |
<colgroup> |
18 |
- <col style="width: 5%;"> |
|
19 |
- <col style="width: 10%;"> |
|
20 |
- <col style="width: 70%;"> |
|
21 |
- <col style="width: 15%;"> |
|
18 |
+ <col style="width: 5%" /> |
|
19 |
+ <col style="width: 10%" /> |
|
20 |
+ <col style="width: 70%" /> |
|
21 |
+ <col style="width: 15%" /> |
|
22 | 22 |
</colgroup> |
23 | 23 |
<tr v-for="(book, index) in books" :key="index"> |
24 |
- <td><input type="checkbox" class="ui-checkbox mr10" v-model="book.isSelected"></td> |
|
25 |
- <td><img src="../../../resources/img/img214_19s.png" alt=""></td> |
|
24 |
+ <td><input type="checkbox" class="ui-checkbox mr10" v-model="book.isSelected" /></td> |
|
25 |
+ <td><img src="../../../resources/img/img214_19s.png" alt="" /></td> |
|
26 | 26 |
<td class="text-lf"> |
27 | 27 |
<p class="title1">{{ book.bookName }}</p> |
28 | 28 |
<p class="title2">{{ book.unitName }}</p> |
29 | 29 |
</td> |
30 |
- <td> <button type="button" title="확인" class="new-btn" |
|
31 |
- @click="buttonSearch(book.bookName, book.bookId, book.unitId)"> |
|
30 |
+ <td> |
|
31 |
+ <button |
|
32 |
+ type="button" |
|
33 |
+ title="확인" |
|
34 |
+ class="new-btn" |
|
35 |
+ @click="buttonSearch(book.bookName, book.bookId, book.unitId)" |
|
36 |
+ > |
|
32 | 37 |
시간입력 |
33 |
- </button></td> |
|
38 |
+ </button> |
|
39 |
+ </td> |
|
34 | 40 |
</tr> |
35 | 41 |
</table> |
36 | 42 |
<div class="flex justify-end"> |
... | ... | @@ -42,21 +48,25 @@ |
42 | 48 |
</div> |
43 | 49 |
|
44 | 50 |
<div class="wrap mt30"> |
45 |
- <p class="title1 mb20">학습일정을 확인해봅시다. </p> |
|
46 |
- <div class="flex-column" style="gap: 20px;" v-for="(book, index) in DataArray" :key="index"> |
|
47 |
- <div class=" flex justify-between align-center " style="gap: 70px;"> |
|
48 |
- <div><img src="../../../resources/img/img217_22s.png" alt=""></div> |
|
49 |
- <div class="wrap cs-pt" :class="{ 'cs-pt-clicked': isClicked }" style="width: 100%;"> |
|
50 |
- <div class="text-lf flex justify-between align-center "> |
|
51 |
+ <p class="title1 mb20">학습일정을 확인해봅시다.</p> |
|
52 |
+ <div class="flex-column" style="gap: 20px" v-for="(book, index) in DataArray" :key="index"> |
|
53 |
+ <div class="flex justify-between align-center" style="gap: 70px"> |
|
54 |
+ <div><img src="../../../resources/img/img217_22s.png" alt="" /></div> |
|
55 |
+ <div class="wrap cs-pt" :class="{ 'cs-pt-clicked': isClicked }" style="width: 100%"> |
|
56 |
+ <div class="text-lf flex justify-between align-center"> |
|
51 | 57 |
<div> |
52 |
- <div class="flex align-center mb10" style="gap: 10px;"> |
|
53 |
- <p class="title2"><em class="gray-bd">{{ book.scheduleUnit }}교시</em></p> |
|
58 |
+ <div class="flex align-center mb10" style="gap: 10px"> |
|
59 |
+ <p class="title2"> |
|
60 |
+ <em class="gray-bd">{{ book.scheduleUnit }}교시</em> |
|
61 |
+ </p> |
|
54 | 62 |
<p class="title1">{{ book.scheduleTime }}</p> |
55 | 63 |
</div> |
56 |
- <div class="title-box mb10"> <span class="title">{{ book.bookNm }}</span></div> |
|
64 |
+ <div class="title-box mb10"> |
|
65 |
+ <span class="title">{{ book.bookNm }}</span> |
|
66 |
+ </div> |
|
57 | 67 |
<p class="title2">{{ book.unitNm }}</p> |
58 | 68 |
</div> |
59 |
- <div class=""> <img src="../../../resources/img/img214_19s.png" alt=""></div> |
|
69 |
+ <div class=""><img src="../../../resources/img/img214_19s.png" alt="" /></div> |
|
60 | 70 |
</div> |
61 | 71 |
</div> |
62 | 72 |
</div> |
... | ... | @@ -68,44 +78,45 @@ |
68 | 78 |
</div> |
69 | 79 |
</div> |
70 | 80 |
<div class="popup-wrap" v-show="searchOpen"> |
71 |
- <div class="popup-box "> |
|
72 |
- <div class="flex mb10 justify-between"> |
|
81 |
+ <div class="popup-box"> |
|
82 |
+ <div class="flex mb10 justify-between"> |
|
73 | 83 |
<p class="popup-title mb20">시간 선택</p> |
74 | 84 |
<button type="button" class="popup-close-btn" @click="closeBtn"> |
75 | 85 |
<svg-icon type="mdi" :path="mdiWindowClose" class="close-btn"></svg-icon> |
76 | 86 |
</button> |
77 | 87 |
</div> |
78 |
- <article class="mb20 flex-column" style="gap: 20px;"> |
|
79 |
- <div v-for="(item, index) in timeList" :key="item.value" class="flex justify-between bg-gray"> |
|
88 |
+ <article class="mb20 flex-column" style="gap: 20px"> |
|
89 |
+ <div v-for="item in timeList" :key="item.value" class="flex justify-between bg-gray"> |
|
80 | 90 |
<div class="flex items-center"> |
81 | 91 |
<div> |
82 |
- <input type="checkbox" class="ui-checkbox mr20" v-model="checkedItems" |
|
83 |
- :value="item" /> |
|
92 |
+ <input |
|
93 |
+ type="checkbox" |
|
94 |
+ class="ui-checkbox mr20" |
|
95 |
+ v-model="checkedItems" |
|
96 |
+ :value="item" |
|
97 |
+ /> |
|
84 | 98 |
</div> |
85 | 99 |
<div class="text-lg"> |
86 | 100 |
<p class="title1">{{ item.label }}</p> |
87 | 101 |
</div> |
88 | 102 |
</div> |
89 |
- <div class="flex align-center" style="gap: 10px;"> |
|
103 |
+ <div class="flex align-center" style="gap: 10px"> |
|
90 | 104 |
<img src="../../../resources/img/img215_20s.png" alt="" /> |
91 | 105 |
<p class="title1">{{ item.time }}</p> |
92 | 106 |
</div> |
93 | 107 |
</div> |
94 | 108 |
</article> |
95 | 109 |
<div class="flex justify-center mt20"> |
96 |
- <button type="button" title="선택" class="new-btn" @click="timePick"> |
|
97 |
- 선택 |
|
98 |
- </button> |
|
110 |
+ <button type="button" title="선택" class="new-btn" @click="timePick">선택</button> |
|
99 | 111 |
</div> |
100 | 112 |
</div> |
101 | 113 |
</div> |
102 | 114 |
</div> |
103 | 115 |
</div> |
104 |
- |
|
105 | 116 |
</template> |
106 | 117 |
|
107 | 118 |
<script> |
108 |
-import axios from "axios"; |
|
119 |
+import axios from 'axios'; |
|
109 | 120 |
import SvgIcon from '@jamescoyle/vue-icon'; |
110 | 121 |
import { mdiMagnify, mdiWindowClose } from '@mdi/js'; |
111 | 122 |
|
... | ... | @@ -119,21 +130,21 @@ |
119 | 130 |
searchOpen: false, |
120 | 131 |
books: [], |
121 | 132 |
timeList: [ |
122 |
- { label: "1교시", time: "08:00 ~ 09:00", value: "1" }, |
|
123 |
- { label: "2교시", time: "09:00 ~ 10:00", value: "2" }, |
|
124 |
- { label: "3교시", time: "10:00 ~ 11:00", value: "3" }, |
|
125 |
- { label: "4교시", time: "11:00 ~ 12:00", value: "4" }, |
|
126 |
- { label: "5교시", time: "13:00 ~ 14:00", value: "5" }, |
|
127 |
- { label: "6교시", time: "14:00 ~ 15:00", value: "6" }, |
|
133 |
+ { label: '1교시', time: '08:00 ~ 09:00', value: '1' }, |
|
134 |
+ { label: '2교시', time: '09:00 ~ 10:00', value: '2' }, |
|
135 |
+ { label: '3교시', time: '10:00 ~ 11:00', value: '3' }, |
|
136 |
+ { label: '4교시', time: '11:00 ~ 12:00', value: '4' }, |
|
137 |
+ { label: '5교시', time: '13:00 ~ 14:00', value: '5' }, |
|
138 |
+ { label: '6교시', time: '14:00 ~ 15:00', value: '6' }, |
|
128 | 139 |
], |
129 | 140 |
checkedItems: [], |
130 | 141 |
newDataArray: [], |
131 | 142 |
DataArray: [], |
132 |
- nowName: "", |
|
133 |
- nowID: "", |
|
134 |
- keyword: "", |
|
135 |
- unitList: [] |
|
136 |
- } |
|
143 |
+ nowName: '', |
|
144 |
+ nowID: '', |
|
145 |
+ keyword: '', |
|
146 |
+ unitList: [], |
|
147 |
+ }; |
|
137 | 148 |
}, |
138 | 149 |
methods: { |
139 | 150 |
toggleClicked() { |
... | ... | @@ -160,30 +171,30 @@ |
160 | 171 |
this.showModal = false; |
161 | 172 |
}, |
162 | 173 |
buttonSearch(book_nm, book_id, unit_id) { |
163 |
- this.nowID = book_id |
|
164 |
- this.nowName = book_nm |
|
165 |
- this.nowunitID = unit_id |
|
174 |
+ this.nowID = book_id; |
|
175 |
+ this.nowName = book_nm; |
|
176 |
+ this.nowunitID = unit_id; |
|
166 | 177 |
this.searchOpen = true; |
167 | 178 |
}, |
168 | 179 |
closeBtn() { |
169 | 180 |
this.searchOpen = false; |
170 | 181 |
}, |
171 | 182 |
timePick() { |
172 |
- const selectedBooks = this.books.filter(book => book.isSelected); |
|
183 |
+ const selectedBooks = this.books.filter((book) => book.isSelected); |
|
173 | 184 |
if (selectedBooks.length <= 0) { |
174 | 185 |
alert('교재를 선택해 주세요.'); |
175 | 186 |
} else { |
176 | 187 |
if (this.checkedItems.length === 1) { |
177 |
- if (this.unitList.find(item => item === this.checkedItems[0].value)) { |
|
188 |
+ if (this.unitList.find((item) => item === this.checkedItems[0].value)) { |
|
178 | 189 |
alert('이미 지정된 시간입니다.'); |
179 | 190 |
} else { |
180 | 191 |
this.addToNewDataArray(this.checkedItems[0]); |
181 | 192 |
this.searchOpen = false; |
182 |
- this.nowID = "" |
|
183 |
- this.nowunitID = "" |
|
184 |
- this.nowName = "" |
|
185 |
- this.unitList.push(this.checkedItems[0].value) |
|
186 |
- this.checkedItems = [] |
|
193 |
+ this.nowID = ''; |
|
194 |
+ this.nowunitID = ''; |
|
195 |
+ this.nowName = ''; |
|
196 |
+ this.unitList.push(this.checkedItems[0].value); |
|
197 |
+ this.checkedItems = []; |
|
187 | 198 |
} |
188 | 199 |
} else if (this.checkedItems.length > 1) { |
189 | 200 |
alert('시간은 하나만 선택할 수 있습니다.'); |
... | ... | @@ -202,28 +213,29 @@ |
202 | 213 |
scheduleUnit: selectedTime.value, |
203 | 214 |
bookId: this.nowID, |
204 | 215 |
unitId: this.nowunitID, |
205 |
- stdId: "2" |
|
216 |
+ stdId: '2', |
|
206 | 217 |
}; |
207 | 218 |
this.newDataArray.push(newEntry); |
208 | 219 |
}, |
209 | 220 |
async insertSchedule() { |
210 |
- this.newDataArray = this.DataArray.map(item => ({ |
|
221 |
+ this.newDataArray = this.DataArray.map((item) => ({ |
|
211 | 222 |
scheduleUnit: item.scheduleUnit, |
212 | 223 |
bookId: item.bookId, |
213 | 224 |
unitId: item.unitId, |
214 |
- stdId: item.stdId |
|
215 |
- })); |
|
225 |
+ stdId: item.stdId, |
|
226 |
+ })); |
|
216 | 227 |
try { |
217 | 228 |
for (let data of this.newDataArray) { |
218 | 229 |
await axios.post('/schedule/insertSchedule.json', data); |
219 | 230 |
} |
220 | 231 |
alert('학습 일정이 등록됐어요!'); |
221 |
- this.goToPage('MyPlan') |
|
232 |
+ this.goToPage('MyPlan'); |
|
222 | 233 |
} catch (error) { |
223 | 234 |
console.error('데이터 제출 중 오류 발생:', error); |
224 | 235 |
alert('데이터 제출 중 오류가 발생했습니다.'); |
225 | 236 |
} |
226 |
- }, checkSchedule() { |
|
237 |
+ }, |
|
238 |
+ checkSchedule() { |
|
227 | 239 |
const sortedArray = this.newDataArray.slice().sort((a, b) => { |
228 | 240 |
return a.scheduleUnit - b.scheduleUnit; |
229 | 241 |
}); |
... | ... | @@ -232,72 +244,90 @@ |
232 | 244 |
}, |
233 | 245 |
searchBook() { |
234 | 246 |
this.books = []; // books를 빈 배열로 초기화 |
235 |
- axios.post("/book/search.json", { book_nm: this.keyword }, { |
|
236 |
- headers: { |
|
237 |
- "Content-Type": "application/json; charset=UTF-8", |
|
238 |
- } |
|
239 |
- }) |
|
240 |
- .then(response => { |
|
247 |
+ axios |
|
248 |
+ .post( |
|
249 |
+ '/book/search.json', |
|
250 |
+ { book_nm: this.keyword }, |
|
251 |
+ { |
|
252 |
+ headers: { |
|
253 |
+ 'Content-Type': 'application/json; charset=UTF-8', |
|
254 |
+ }, |
|
255 |
+ } |
|
256 |
+ ) |
|
257 |
+ .then((response) => { |
|
241 | 258 |
this.books = response.data.list; |
242 |
- this.books.forEach(book => { |
|
259 |
+ this.books.forEach((book) => { |
|
243 | 260 |
this.searchUnits(book.book_id); |
244 | 261 |
}); |
245 | 262 |
}) |
246 |
- .catch(error => { |
|
247 |
- console.error("searchBook - error:", error); |
|
248 |
- alert("단원 목록을 불러오는 중 오류가 발생했습니다."); |
|
263 |
+ .catch((error) => { |
|
264 |
+ console.error('searchBook - error:', error); |
|
265 |
+ alert('단원 목록을 불러오는 중 오류가 발생했습니다.'); |
|
249 | 266 |
}); |
250 | 267 |
}, |
251 |
- searchUnits(bookId) { |
|
252 |
- |
|
253 |
- console.log(bookId) |
|
254 |
- axios.post("/unit/unitList.json", { bookId: bookId }, { |
|
255 |
- headers: { |
|
256 |
- "Content-Type": "application/json; charset=UTF-8", |
|
257 |
- } |
|
258 |
- }).then(response => { |
|
259 |
- this.books = response.data.map(book => ({ |
|
260 |
- ...book, |
|
261 |
- isSelected: false |
|
262 |
- })); |
|
263 |
- this.searchUnit() |
|
264 |
- }) |
|
265 |
- .catch(error => { |
|
266 |
- console.error("fetchUnits - error:", error); |
|
267 |
- alert("단원 목록을 불러오는 중 오류가 발생했습니다."); |
|
268 |
- }); |
|
269 |
- }, fetchUnits() { |
|
270 |
- axios.post("unit/findAll.json", { |
|
271 |
- headers: { |
|
272 |
- "Content-Type": "application/json; charset=UTF-8", |
|
273 |
- } |
|
274 |
- }) |
|
275 |
- .then(response => { |
|
276 |
- this.books = response.data.map(book => ({ |
|
268 |
+ searchUnits(bookId) { |
|
269 |
+ console.log(bookId); |
|
270 |
+ axios |
|
271 |
+ .post( |
|
272 |
+ '/unit/unitList.json', |
|
273 |
+ { bookId: bookId }, |
|
274 |
+ { |
|
275 |
+ headers: { |
|
276 |
+ 'Content-Type': 'application/json; charset=UTF-8', |
|
277 |
+ }, |
|
278 |
+ } |
|
279 |
+ ) |
|
280 |
+ .then((response) => { |
|
281 |
+ this.books = response.data.map((book) => ({ |
|
277 | 282 |
...book, |
278 |
- isSelected: false |
|
283 |
+ isSelected: false, |
|
279 | 284 |
})); |
280 |
- this.searchUnit() |
|
285 |
+ this.searchUnit(); |
|
281 | 286 |
}) |
282 |
- .catch(error => { |
|
283 |
- console.error("fetchBooks - error: ", error); |
|
284 |
- alert("교재 목록을 불러오는 중 오류가 발생했습니다."); |
|
287 |
+ .catch((error) => { |
|
288 |
+ console.error('fetchUnits - error:', error); |
|
289 |
+ alert('단원 목록을 불러오는 중 오류가 발생했습니다.'); |
|
285 | 290 |
}); |
286 |
- }, searchUnit() { |
|
287 |
- axios.post("schedule/selectSchedule.json", {stdId:"2"}, { |
|
288 |
- headers: { |
|
289 |
- "Content-Type": "application/json; charset=UTF-8", |
|
290 |
- } |
|
291 |
- }) |
|
292 |
- .then(response => { |
|
293 |
- const units = response.data.map(item => item.schdl_unit); |
|
294 |
- this.unitList.push(...units); |
|
291 |
+ }, |
|
292 |
+ fetchUnits() { |
|
293 |
+ axios |
|
294 |
+ .post('unit/findAll.json', { |
|
295 |
+ headers: { |
|
296 |
+ 'Content-Type': 'application/json; charset=UTF-8', |
|
297 |
+ }, |
|
295 | 298 |
}) |
296 |
- .catch(error => { |
|
297 |
- console.error("searchUnit - error: ", error); |
|
298 |
- alert("교재 목록을 불러오는 중 오류가 발생했습니다."); |
|
299 |
+ .then((response) => { |
|
300 |
+ this.books = response.data.map((book) => ({ |
|
301 |
+ ...book, |
|
302 |
+ isSelected: false, |
|
303 |
+ })); |
|
304 |
+ this.searchUnit(); |
|
305 |
+ }) |
|
306 |
+ .catch((error) => { |
|
307 |
+ console.error('fetchBooks - error: ', error); |
|
308 |
+ alert('교재 목록을 불러오는 중 오류가 발생했습니다.'); |
|
299 | 309 |
}); |
300 |
- } |
|
310 |
+ }, |
|
311 |
+ searchUnit() { |
|
312 |
+ axios |
|
313 |
+ .post( |
|
314 |
+ 'schedule/selectSchedule.json', |
|
315 |
+ { stdId: '2' }, |
|
316 |
+ { |
|
317 |
+ headers: { |
|
318 |
+ 'Content-Type': 'application/json; charset=UTF-8', |
|
319 |
+ }, |
|
320 |
+ } |
|
321 |
+ ) |
|
322 |
+ .then((response) => { |
|
323 |
+ const units = response.data.map((item) => item.schdl_unit); |
|
324 |
+ this.unitList.push(...units); |
|
325 |
+ }) |
|
326 |
+ .catch((error) => { |
|
327 |
+ console.error('searchUnit - error: ', error); |
|
328 |
+ alert('교재 목록을 불러오는 중 오류가 발생했습니다.'); |
|
329 |
+ }); |
|
330 |
+ }, |
|
301 | 331 |
}, |
302 | 332 |
watch: { |
303 | 333 |
// Watchers for reactivity (if needed) |
... | ... | @@ -306,17 +336,18 @@ |
306 | 336 |
// Computed properties (if needed) |
307 | 337 |
}, |
308 | 338 |
components: { |
309 |
- SvgIcon |
|
339 |
+ SvgIcon, |
|
310 | 340 |
}, |
311 | 341 |
mounted() { |
312 | 342 |
console.log('Main2 mounted'); |
313 | 343 |
this.fetchUnits(); |
314 |
- } |
|
315 |
-} |
|
344 |
+ }, |
|
345 |
+}; |
|
316 | 346 |
</script> |
317 | 347 |
|
318 | 348 |
<style scoped> |
319 | 349 |
.popup-box { |
320 | 350 |
width: 750px; |
351 |
+ left: 60rem; |
|
321 | 352 |
} |
322 |
-</style>(파일 끝에 줄바꿈 문자 없음) |
|
353 |
+</style> |
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?