jichoi / lms_front star
정다정 10-21
241021 정다정 오늘의뉴스 API 연결
@82a6d2738f49ad524500831fee55d091c89f2c51
client/views/pages/main/MyPlan.vue
--- client/views/pages/main/MyPlan.vue
+++ client/views/pages/main/MyPlan.vue
@@ -170,13 +170,16 @@
                         </div>
                         <div class="green-scroll" style="overflow: auto; height: 73%; margin: 5px">
                             <div style="padding: 10px">
-                                <div v-for="(news, index) in schedules" :key="index">
-                                    <div style="display: flex">
+                                <div v-for="(student, index) in news" :key="index">
+                                    <div class="flex align-center">
                                         <div>
                                             <img src="../../../resources/img/img16_s.png" alt="" />
                                         </div>
-                                        <p style="margin-left: 5px; font-size: 18px">
-                                            {{ name }}님이 {{ unit }}을 다 끝냈습니다.
+                                        <p class="news_font">
+                                            <span>{{ student.user_nm }}</span
+                                            >님이<br />
+                                            <span> {{ student.unit_nm }}</span
+                                            >을 다 끝냈습니다.
                                         </p>
                                     </div>
                                     <hr style="margin: 10px 0" />
@@ -267,7 +270,25 @@
     methods: {
         ...mapActions(['updateSchdlId', 'updateBookId', 'updateUnitId']),
 
-        fetchNews() {},
+        // 오늘의 뉴스
+        fetchNews() {
+            // const userId = this.getUserInfo.userId;
+            // console.log('오늘의 뉴스 아이디 : ', userId);
+            axios({
+                url: '/photo/selectPhotoInfo.json',
+                method: 'post',
+                hedaers: {
+                    'Content-Type': 'application/json; charset=UTF-8',
+                },
+                data: {
+                    // userId: userId,
+                    userId: '1',
+                },
+            }).then((res) => {
+                console.log('오늘의 뉴스 - response : ', res.data);
+                this.news = res.data;
+            });
+        },
         goToPage(page, scheduleId) {
             const startScheduleIndex = this.schedules.findIndex((schedule) => schedule.schdl_id === scheduleId);
 
@@ -498,7 +519,7 @@
     },
     watch: {},
     computed: {
-        ...mapGetters(['getBookId', 'getUnitId']),
+        ...mapGetters(['getBookId', 'getUnitId', 'getUserInfo']),
     },
     components: {
         SvgIcon,
@@ -508,6 +529,7 @@
         console.log('Main2 mounted');
         this.fetchSchedules();
         this.selectAiLearning();
+        this.fetchNews();
     },
 };
 </script>
@@ -591,4 +613,15 @@
     font-weight: bold;
     font-family: 'ONEMobileOTF-Regular';
 }
+
+.news_font {
+    margin: 10px;
+    text-align: justify;
+    font-size: 18px;
+}
+
+.news_font span {
+    font-size: 18px;
+    color: #64a56d;
+}
 </style>
Add a comment
List