Parcourir la source

Merge branch 'beta' of https://git.cocorobo.cn/CocoRoboLabs/pbl-teacher-table into beta

zengyicheng il y a 1 an
Parent
commit
2bf3bdfaa2

+ 31 - 20
src/components/pages/dataBoard/school/index.vue

@@ -10,7 +10,7 @@
           <div class="info_box">
             <div class="info blueBG">
               <span>用户总数</span>
-              <span>15620</span>
+              <span>{{count}}</span>
             </div>
             <div class="info greenBG">
               <span>周使用频次</span>
@@ -18,11 +18,11 @@
             </div>
             <div class="info blueBG">
               <span>登录频次</span>
-              <span>15620</span>
+              <span>{{loginCount}}</span>
             </div>
             <div class="info greenBG">
               <span>人均使用频次</span>
-              <span>15620</span>
+              <span>{{(loginCount / count).toFixed(0)}}</span>
             </div>
           </div>
           <loginCount style="height: calc(100% - 140px)"></loginCount>
@@ -36,11 +36,11 @@
           <div class="info_box">
             <div class="info blueBG">
               <span>累计时长</span>
-              <span>15620</span>
+              <span>{{loginTime.toFixed(0)}}小时</span>
             </div>
             <div class="info greenBG">
               <span>人均时长</span>
-              <span>15620</span>
+              <span>{{(loginTime / count).toFixed(0)}}小时</span>
             </div>
           </div>
           <loginTime style="height: calc(100% - 70px)"></loginTime>
@@ -56,7 +56,7 @@
           <div class="info_box" style="width: 95%">
             <div class="info2 blueBG">
               <span>上传课程总数</span>
-              <span>15620</span>
+              <span>{{courseCount}}</span>
             </div>
             <div class="info2 greenBG">
               <span>各年级平均课程数</span>
@@ -68,7 +68,7 @@
             </div>
             <div class="info2 greenBG">
               <span>教师人均课程数</span>
-              <span>15620</span>
+              <span>{{(courseCount / teacherCount).toFixed(0)}}</span>
             </div>
           </div>
           <teacherInfo style="height: calc(100% - 70px)"></teacherInfo>
@@ -212,18 +212,18 @@
         <div class="dataBox">
           <div class="course_box">
             <div class="info_box">
-              <div class="info3 blueBG">
-                <span>课程总数</span>
-                <span>1254</span>
-              </div>
-              <div class="info3 greenBG">
-                <span>类别总数</span>
-                <span>546</span>
-              </div>
-              <div class="info3 blueBG">
-                <span>类别平均</span>
-                <span>12</span>
-              </div>
+                <div class="info3 blueBG">
+                  <span>课程总数</span>
+                  <span>{{courseCount}}</span>
+                </div>
+                <div class="info3 greenBG">
+                  <span>类别总数</span>
+                  <span>546</span>
+                </div>
+                <div class="info3 blueBG">
+                  <span>类别平均</span>
+                  <span>12</span>
+                </div>
             </div>
             <div class="course_box_p">
               <courseInfo></courseInfo>
@@ -270,7 +270,12 @@ export default {
   data() {
     return {
       isLoading: false,
-    };
+      count:0,
+      loginCount:0,
+      loginTime:0,
+      courseCount:0,
+      teacherCount:0
+    }
   },
   mounted() {
     this.getData();
@@ -287,6 +292,12 @@ export default {
         .post(this.$store.state.api + "selectDataBoardSchool", params)
         .then((res) => {
           this.isLoading = false;
+          this.count = res.data[0][0].count
+          this.loginCount = res.data[1][0].loginCount
+          this.loginTime = parseInt(res.data[3][0].time) / 60  / 60
+          this.courseCount = res.data[5][0].courseCount
+          this.teacherCount = res.data[6][0].count
+          
         })
         .catch((err) => {
           this.isLoading = false;

+ 44 - 7
src/components/pages/dataBoard/student/index.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="body">
+  <div class="body" v-loading="isLoading">
     <!-- 学生数据 -->
     <div class="left">
       <div class="top">
@@ -10,7 +10,7 @@
           <div class="info_box">
             <div class="info blueBG">
               <span>学生总数</span>
-              <span>15620</span>
+              <span>{{count}}</span>
             </div>
             <div class="info greenBG">
               <span>周使用频次</span>
@@ -18,11 +18,11 @@
             </div>
             <div class="info blueBG">
               <span>登录频次</span>
-              <span>15620</span>
+              <span>{{loginCount}}</span>
             </div>
             <div class="info greenBG">
               <span>人均使用频次</span>
-              <span>15620</span>
+              <span>{{ (loginCount / count).toFixed(0) }}</span>
             </div>
           </div>
           <loginCount style="height: calc(100% - 140px);"></loginCount>
@@ -44,7 +44,7 @@
           <div class="info_box" style="width:95%;justify-content: flex-start;">
               <div class="info2 blueBG">
                 <span>学生总数</span>
-                <span>15620</span>
+                <span>{{count}}</span>
               </div>
               <div class="info2 greenBG">
                 <span>班级总数</span>
@@ -105,11 +105,11 @@
           <div class="info_box">
             <div class="info blueBG">
               <span>累计在线时长</span>
-              <span>15620</span>
+              <span>{{loginTime.toFixed(0)}}小时</span>
             </div>
             <div class="info greenBG">
               <span>学生在线平均时长</span>
-              <span>15620</span>
+              <span>{{(loginTime / count).toFixed(0)}}</span>
             </div>
           </div>
           <loginTime style="height:calc(100% - 70px)"></loginTime>
@@ -126,11 +126,48 @@ import studentInfo2 from './studentInfo2'
 import loginTime from './loginTime'
 
 export default {
+  props: {
+    oid: {
+      type: String,
+    },
+  },
   components: {
     loginCount,studentInfo,studentInfo2,loginTime
   },
   data() {
     return {
+      isLoading:false,
+      count:0,
+      loginCount: 0,
+      loginTime: 0,
+    }
+  },
+  mounted() {
+    this.getData()
+  },
+  methods: {
+    getData() {
+      this.isLoading = true;
+      let params = [{
+        oid: this.oid
+      }]
+      this.ajax
+        .post(this.$store.state.api + "selectDataBoardStudent", params)
+        .then((res) => {
+          this.isLoading = false;
+          this.count = res.data[0][0].count
+          this.loginCount = res.data[1][0].loginCount
+          this.loginTime = parseInt(res.data[2][0].time) / 60 / 60
+
+          
+        })
+        .catch((err) => {
+          this.isLoading = false;
+          console.error(err);
+        });
+    },
+    format(percentage) {
+      return percentage;
     }
   },
 }