jichoi / lms_front star
구자현 구자현 2024-08-22
240822 구자현 부모님 페이지 랭킹 로직 수정
@ecc1d28fbfdd2de26a800222d07ef3f8449c9068
client/views/pages/main/MyPage.vue
--- client/views/pages/main/MyPage.vue
+++ client/views/pages/main/MyPage.vue
@@ -181,7 +181,6 @@
                     alert("점수 랭킹 조회에 오류가 발생했습니다.");
                 });
         },
-
         problemRankByProblemData: function () {
             const vm = this;
             axios({
client/views/pages/parents/Main_p.vue
--- client/views/pages/parents/Main_p.vue
+++ client/views/pages/parents/Main_p.vue
@@ -44,28 +44,28 @@
                                         <p class="title1" style="color: #fff;">포토북 랭킹</p>
                                     </div>
                                     <div class="box">
-                                        <P class="title2 mt10">현재 30명 중 <em class="red">2등</em>입니다.</P>
+                                        <P class="title2 mt10">현재 {{ stdCount }}명 중 <em class="red">{{ photo_rank }}등</em>입니다.</P>
                                     </div>
                                 </div>
                                 <div class="textbook ">
                                     <div class="text ">
-                                        <p class="title1" style="color: #fff;">포토북 랭킹</p>
+                                        <p class="title1" style="color: #fff;">진도율 랭킹</p>
                                     </div>
                                     <div class="box">
-                                        <P class="title2 mt10">현재 30명 중 <em class="yellow">2등</em>입니다.</P>
+                                        <P class="title2 mt10">현재 {{ stdCount }}명 중 <em class="yellow">{{ problem_rank }}등</em>입니다.</P>
                                     </div>
                                 </div>
                                 <div class="textbook book-blue">
                                     <div class="text ">
-                                        <p class="title1" style="color: #fff;">포토북 랭킹</p>
+                                        <p class="title1" style="color: #fff;">점수 랭킹</p>
                                     </div>
                                     <div class="box">
-                                        <P class="title2 mt10">현재 30명 중 <em class="blue">2등</em>입니다.</P>
+                                        <P class="title2 mt10">현재 {{ stdCount }}명 중 <em class="blue">{{score_rank}}등</em>입니다.</P>
                                     </div>
                                 </div>
                                 <div class="textbook book-navy">
                                     <div class="text ">
-                                        <p class="title1" style="color: #fff;">포토북 랭킹</p>
+                                        <p class="title1" style="color: #fff;">학습시간 랭킹</p>
                                     </div>
                                     <div class="box">
                                         <P class="title2 mt10">현재 30명 중 <em class="navy">2등</em>입니다.</P>
@@ -195,6 +195,10 @@
 
     data() {
         return {
+            stdCount: 0,
+            photo_rank: 0,
+            problem_rank: 0,
+            score_rank: 0,
             progress: 20,
             donutChartData: {},
             currentDate: "2024-08-14",
@@ -211,6 +215,93 @@
     },
 
     methods: {
+        classStdCount: function () {
+            const vm = this;
+            axios({
+                url: "/userclass/classStdCountByUserId.json",
+                method: "post",
+                headers: {
+                    "Content-Type": "application/json; charset=UTF-8",
+                },
+                data: {
+                    userId: "USID_000000000000002"   // 로그인한 학생의 userId
+                }
+            })
+                .then(function (response) {
+                    console.log("classStdCount - response : ", response.data);
+                    vm.stdCount = response.data;
+                })
+                .catch(function (error) {
+                    console.log("classStdCount - error : ", error);
+                    alert("반 학생 수 조회에 오류가 발생했습니다.");
+                });
+        },
+
+        photoRankByLikeData: function () {
+            const vm = this;
+            axios({
+                url: "/photo/photoRankByLikeData.json",
+                method: "post",
+                headers: {
+                    "Content-Type": "application/json; charset=UTF-8",
+                },
+                data: {
+                    sclsId: "1",
+                    stdId: "1"
+                }
+            })
+                .then(function (response) {
+                    console.log("Photo Rank - response : ", response.data);
+                    vm.photo_rank = response.data;
+                })
+                .catch(function (error) {
+                    console.log("Photo Rank - error : ", error);
+                    alert("학생 사진 랭킹 조회에 오류가 발생했습니다.");
+                });
+        },
+        getUserRankByScore: function () {
+            const vm = this;
+            axios({
+                url: "/userclass/getUserRankByScore.json",
+                method: "post",
+                headers: {
+                    "Content-Type": "application/json; charset=UTF-8",
+                },
+                data: {
+                    userId: "USID_000000000000002"   // 로그인한 학생의 userId
+                }
+            })
+                .then(function (response) {
+                    console.log("User Rank - response : ", response.data);
+                    vm.score_rank = response.data; 
+                })
+                .catch(function (error) {
+                    console.log("User Rank - error : ", error);
+                    alert("점수 랭킹 조회에 오류가 발생했습니다.");
+                });
+        },
+        problemRankByProblemData: function () {
+            const vm = this;
+            axios({
+                url: "/problemLog/problemRankByProblemData.json",
+                method: "post",
+                headers: {
+                    "Content-Type": "application/json; charset=UTF-8",
+                },
+                data: {
+                    sclsId: "1",
+                    stdId: "2"
+                }
+            })
+                .then(function (response) {
+                    console.log("Problem Rank - response : ", response.data);
+                    vm.problem_rank = response.data;
+                })
+                .catch(function (error) {
+                    console.log("Problem Rank - error : ", error);
+                    alert("학생 문제 랭킹 조회에 오류가 발생했습니다.");
+                });
+        },
 
         // 학생 데이터 가져오기
         fetchStudentInfo() {
@@ -268,6 +359,10 @@
     mounted() {
         this.getStdProgressData();
         this.fetchStudentInfo();
+        this.classStdCount();
+        this.photoRankByLikeData();
+        this.getUserRankByScore();
+        this.problemRankByProblemData();
     }
 
 }
Add a comment
List