정다정
10-21
241021 정다정 오늘의뉴스 API 연결
@82a6d2738f49ad524500831fee55d091c89f2c51
--- client/views/pages/main/MyPlan.vue
+++ client/views/pages/main/MyPlan.vue
... | ... | @@ -170,13 +170,16 @@ |
170 | 170 |
</div> |
171 | 171 |
<div class="green-scroll" style="overflow: auto; height: 73%; margin: 5px"> |
172 | 172 |
<div style="padding: 10px"> |
173 |
- <div v-for="(news, index) in schedules" :key="index"> |
|
174 |
- <div style="display: flex"> |
|
173 |
+ <div v-for="(student, index) in news" :key="index"> |
|
174 |
+ <div class="flex align-center"> |
|
175 | 175 |
<div> |
176 | 176 |
<img src="../../../resources/img/img16_s.png" alt="" /> |
177 | 177 |
</div> |
178 |
- <p style="margin-left: 5px; font-size: 18px"> |
|
179 |
- {{ name }}님이 {{ unit }}을 다 끝냈습니다. |
|
178 |
+ <p class="news_font"> |
|
179 |
+ <span>{{ student.user_nm }}</span |
|
180 |
+ >님이<br /> |
|
181 |
+ <span> {{ student.unit_nm }}</span |
|
182 |
+ >을 다 끝냈습니다. |
|
180 | 183 |
</p> |
181 | 184 |
</div> |
182 | 185 |
<hr style="margin: 10px 0" /> |
... | ... | @@ -267,7 +270,25 @@ |
267 | 270 |
methods: { |
268 | 271 |
...mapActions(['updateSchdlId', 'updateBookId', 'updateUnitId']), |
269 | 272 |
|
270 |
- fetchNews() {}, |
|
273 |
+ // 오늘의 뉴스 |
|
274 |
+ fetchNews() { |
|
275 |
+ // const userId = this.getUserInfo.userId; |
|
276 |
+ // console.log('오늘의 뉴스 아이디 : ', userId); |
|
277 |
+ axios({ |
|
278 |
+ url: '/photo/selectPhotoInfo.json', |
|
279 |
+ method: 'post', |
|
280 |
+ hedaers: { |
|
281 |
+ 'Content-Type': 'application/json; charset=UTF-8', |
|
282 |
+ }, |
|
283 |
+ data: { |
|
284 |
+ // userId: userId, |
|
285 |
+ userId: '1', |
|
286 |
+ }, |
|
287 |
+ }).then((res) => { |
|
288 |
+ console.log('오늘의 뉴스 - response : ', res.data); |
|
289 |
+ this.news = res.data; |
|
290 |
+ }); |
|
291 |
+ }, |
|
271 | 292 |
goToPage(page, scheduleId) { |
272 | 293 |
const startScheduleIndex = this.schedules.findIndex((schedule) => schedule.schdl_id === scheduleId); |
273 | 294 |
|
... | ... | @@ -498,7 +519,7 @@ |
498 | 519 |
}, |
499 | 520 |
watch: {}, |
500 | 521 |
computed: { |
501 |
- ...mapGetters(['getBookId', 'getUnitId']), |
|
522 |
+ ...mapGetters(['getBookId', 'getUnitId', 'getUserInfo']), |
|
502 | 523 |
}, |
503 | 524 |
components: { |
504 | 525 |
SvgIcon, |
... | ... | @@ -508,6 +529,7 @@ |
508 | 529 |
console.log('Main2 mounted'); |
509 | 530 |
this.fetchSchedules(); |
510 | 531 |
this.selectAiLearning(); |
532 |
+ this.fetchNews(); |
|
511 | 533 |
}, |
512 | 534 |
}; |
513 | 535 |
</script> |
... | ... | @@ -591,4 +613,15 @@ |
591 | 613 |
font-weight: bold; |
592 | 614 |
font-family: 'ONEMobileOTF-Regular'; |
593 | 615 |
} |
616 |
+ |
|
617 |
+.news_font { |
|
618 |
+ margin: 10px; |
|
619 |
+ text-align: justify; |
|
620 |
+ font-size: 18px; |
|
621 |
+} |
|
622 |
+ |
|
623 |
+.news_font span { |
|
624 |
+ font-size: 18px; |
|
625 |
+ color: #64a56d; |
|
626 |
+} |
|
594 | 627 |
</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?