jichoi / lms_front star
guntaek 2024-08-12
240812 김건택 MyPage 포토북 랭킹 수정
@287f4786b5d94747f3c691e0ad77912f13cc6d1a
client/views/pages/main/MyPage.vue
--- client/views/pages/main/MyPage.vue
+++ client/views/pages/main/MyPage.vue
@@ -98,7 +98,7 @@
                     </div>
                     <div class="box " style="gap: 10px;">
                         <div><img src="../../../resources/img/img196_12p.png" alt=""></div>
-                        <P class="title2 mt10">현재 30명 중 <em class="blue">2등</em>입니다.</P>
+                        <P class="title2 mt10">현재 {{ stdCount }}명 중 <em class="blue">{{ rank }}등</em>입니다.</P>
                     </div>
                 </div>
                 <div class="textbook book-navy">
@@ -121,11 +121,15 @@
 import { mdiMagnify,  } from '@mdi/js';
 import { mdilArrowRight } from '@mdi/light-js';
 import ProgressBar from '../../component/ProgressBar.vue';
+import axios from "axios";
 
 
 export default {
     data() {
         return {
+            stdCount : 0,
+            rank: 0,
+
             mdiMagnify: mdiMagnify,
             mdilArrowRight: mdilArrowRight,
             timer: "00:00",
@@ -133,6 +137,51 @@
         }
     },
     methods: {
+        classStdCount: function () {
+            const vm = this;
+            axios({
+                url: "/userclass/classStdCount.json",
+                method: "post",
+                headers:{
+                    "Content-Type": "application/json; charset=UTF-8",
+                },
+                data: {
+                    sclsId:"1"
+                }
+            })
+            .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("Rank - response : ", response.data);
+                vm.rank = response.data;
+            })
+            .catch(function (error) {
+                console.log("Rank - error : ", error);
+                alert("학생 사진 랭킹 조회에 오류가 발생했습니다.");
+            });
+        },
+
         goToPage(page) {
             this.$router.push({ name: page });
         },
@@ -168,6 +217,8 @@
     },
     mounted() {
         console.log('Main2 mounted');
+        this.classStdCount();
+        this.photoRankByLikeData();
     }
 }
 </script>
Add a comment
List