lsc 1 年之前
父节点
当前提交
8af7d4776d
共有 1 个文件被更改,包括 44 次插入7 次删除
  1. 44 7
      src/components/pages/dataBoard/student/index.vue

+ 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;
     }
   },
 }