huangminghao 1 year ago
parent
commit
0e060518c9

+ 1 - 1
dist/index.html

@@ -25,7 +25,7 @@
       height: 100%;
       width: 100%;
       background: #e6eaf0;
-    }</style><link href=./static/css/app.1df91d3746b3e5f9e0ad6efcb551d382.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.4ae2783fdfe7ab52e4d5.js></script><script type=text/javascript src=./static/js/vendor.b01159b52abeac4e6216.js></script><script type=text/javascript src=./static/js/app.1468336e03d9b239de03.js></script></body></html><script>function stopSafari() {
+    }</style><link href=./static/css/app.ebf1f6f9e6b8c458ac056b73fcad754d.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.4ae2783fdfe7ab52e4d5.js></script><script type=text/javascript src=./static/js/vendor.b01159b52abeac4e6216.js></script><script type=text/javascript src=./static/js/app.1538425ade6d84a1d3fe.js></script></body></html><script>function stopSafari() {
     //阻止safari浏览器双击放大功能
     let lastTouchEnd = 0  //更新手指弹起的时间
     document.documentElement.addEventListener("touchstart", function (event) {

File diff suppressed because it is too large
+ 0 - 0
dist/static/css/app.1df91d3746b3e5f9e0ad6efcb551d382.css.map


File diff suppressed because it is too large
+ 0 - 0
dist/static/css/app.ebf1f6f9e6b8c458ac056b73fcad754d.css


File diff suppressed because it is too large
+ 0 - 0
dist/static/css/app.ebf1f6f9e6b8c458ac056b73fcad754d.css.map


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/app.1538425ade6d84a1d3fe.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/app.1538425ade6d84a1d3fe.js.map


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/manifest.4ae2783fdfe7ab52e4d5.js.map


+ 100 - 0
src/components/pages/dataBoardNew/student/cateRank/index.vue

@@ -0,0 +1,100 @@
+<template>
+  <div class="data_body">
+    <div style="width: 100%;height: calc(100% - 15px);overflow: auto;">
+      <el-table :data="tableData" style="width: 100%" :header-cell-style="{ background: '#E0EAFB',color: '#000' }"
+        :row-class-name="tableRowClassName" class="tableClass">
+        <el-table-column label="排行" min-width="50" align="center">
+          <template slot-scope="scope">{{ scope.$index + 1 }}</template>
+        </el-table-column>
+        <el-table-column prop="name" label="姓名" min-width="80" align="center">
+        </el-table-column>
+        <el-table-column prop="courseCount" label="参与课程数量" min-width="80" align="center">
+        </el-table-column>
+        <el-table-column prop="scourseCount" label="参与项目数量" min-width="80" align="center">
+        </el-table-column>
+        <el-table-column prop="worksCount" label="提交作业数量" min-width="80" align="center">
+        </el-table-column>
+        <el-table-column prop="exchangeCount" label="互动交流" min-width="80" align="center">
+        </el-table-column>
+        <el-table-column prop="rateCount" label="评价得分" min-width="80" align="center">
+        </el-table-column>
+        <el-table-column prop="score" label="综合指数" min-width="80" align="center">
+        </el-table-column>
+      </el-table>
+    </div>
+  </div>
+</template>
+
+<script>
+export default {
+  props: {
+    rankData: {
+      type: Array,
+    },
+  },
+  data() {
+    return {
+      tableData: [
+        // { rank: "1", name: "一年级", sum: "2356" },
+        // { rank: "2", name: "二年级", sum: "2256" },
+        // { rank: "3", name: "三年级", sum: "2156" },
+        // { rank: "4", name: "四年级", sum: "1356" },
+        // { rank: "5", name: "五年级", sum: "1256" },
+        // { rank: "6", name: "六年级", sum: "1056" },
+      ],
+    };
+  },
+  methods: {
+    tableRowClassName({ row, rowIndex }) {
+      if ((rowIndex + 1) % 2 === 0) {
+        return "even_row";
+      } else {
+        return "";
+      }
+    },
+    setArray(array){
+      this.tableData = JSON.parse(JSON.stringify(array))
+
+      this.tableData = this.tableData.sort(function(a,b){
+        return b.score - a.score;
+      })
+    }
+  },
+  watch: {
+    rankData: {
+      immediate: true,
+      deep: true,
+      handler(newValue, oldValue) {
+        this.setArray(newValue)
+        this.$forceUpdate();
+      },
+    },
+  },
+  mounted() {
+    this.setArray(this.rankData)
+  },
+};
+</script>
+
+<style scoped>
+.el-table>>>.even_row {
+  background-color: #f2f7ff !important;
+}
+
+.data_body {
+  height: 100%;
+  /* display: flex; */
+  position: relative;
+  border-radius: 5px;
+  /* border: 1px solid #eee; */
+  margin: 0 auto;
+  box-sizing: border-box;
+  padding: 0;
+  width: 95%;
+  background: #fff;
+}
+
+.tableClass >>> td, .tableClass >>> th{
+  padding: 5px 0;
+}
+</style>

+ 115 - 4
src/components/pages/dataBoardNew/student/index.vue

@@ -170,7 +170,7 @@
             <div
               class="title"
               :class="{ isClick: courseType == 0 }"
-              @click="courseType = 0"
+              @click="courseType = 0;rankLoading = false"
               style="cursor: pointer; padding: 0 0 5px 0"
             >
               学生行为分布
@@ -183,6 +183,14 @@
             >
               学生协同情况
             </div> -->
+            <div
+              class="title"
+              :class="{ isClick: courseType == 2 }"
+              @click="checkRank()"
+              style="cursor: pointer; padding: 0 0 5px 0"
+            >
+              学生排行榜
+            </div> 
           </div>
           <div
             style="
@@ -198,8 +206,21 @@
               <el-option label="作业数量" value="worksNum"></el-option>
             </el-select>
           </div>
+          <div
+            style="
+              display: flex;
+              flex-direction: row;
+              flex-wrap: nowrap;
+              align-items: center;
+            "
+            v-if="courseType == 2"
+          >
+            <el-select v-model="cTypeRank" class="selectBox" style="width: 130px" @change="checkRank">
+              <el-option :label="item.name" :value="item.id" v-for="(item,index) in classList" :key="index"></el-option>
+            </el-select>
+          </div>
         </div>
-        <div class="dataBox">
+        <div class="dataBox" v-loading="rankLoading">
           <studentInfo
             v-if="courseType == 0 && cType2 == 'onlineTime'"
             style="height: calc(100%)"
@@ -214,6 +235,7 @@
             v-if="courseType == 1"
             style="height: calc(100%)"
           ></courseNum>
+          <cateRank v-if="courseType == 2" :rankData="rankData"></cateRank>
         </div>
       </div>
       <div class="bottom">
@@ -531,6 +553,7 @@ import toolUser2 from "./toolUser2";
 import bar from "./bar";
 import bar2 from "./bar2";
 import courseNum from "./courseNum";
+import cateRank from "./cateRank";
 export default {
   props: {
     oid: {
@@ -554,6 +577,7 @@ export default {
     bar,
     bar2,
     courseNum,
+    cateRank
   },
   data() {
     return {
@@ -603,6 +627,9 @@ export default {
       courseArray: [],
       scourseArray: [],
       EworksNumArray: [],
+      rankLoading: false,
+      cTypeRank: '',
+      rankData:[],
     };
   },
   mounted() {
@@ -727,8 +754,8 @@ export default {
           this.loginTime = parseInt(res.data[7][0].time) / 60 / 60;
           let _loginTimeArray = res.data[9]; //在线时间
           let _classList = res.data[8]; //班级
-          this.classList = _classList;
-
+          this.classList = _classList.filter(el => {return el.studentCount > 0});
+          this.cTypeRank = _classList[0].id
           let _EloginTimeArray = [];
           for (let i = 0; i < _classList.length; i++) {
             _EloginTimeArray.push({
@@ -943,6 +970,90 @@ export default {
           console.error(err);
         });
     },
+    checkRank(){
+      this.rankLoading = true;
+      let params = [
+        {
+          oid: this.oid,
+          org: this.org,
+          cid: this.cTypeRank
+        },
+      ];
+      this.ajax
+        .post(this.$store.state.api + "selectDataboardStudentRank", params)
+        .then((res) => {
+          this.rankLoading = false;
+          this.courseType = 2
+          let rankData = []
+          let students = res.data[0]
+          let courses = res.data[1]
+          let scourses = res.data[2]
+          let works = res.data[3]
+          let exchanges = res.data[4]
+
+          for (let i = 0; i < students.length; i++) {
+            rankData.push({
+              name: students[i].name,
+              userid: students[i].userid,
+              classid: students[i].classid,
+              courseCount:0,
+              scourseCount: 0,
+              worksCount: 0,
+              exchangeCount: 0,
+              rateCount: 0,
+              rate: 0,
+              score:0,
+            })
+          }
+
+          for(var j = 0; j < rankData.length; j++){
+            for(var i = 0; i < courses.length; i++){
+              if(courses[i].userid == rankData[j].userid){
+                rankData[j].courseCount++;
+              }
+            }
+
+            for(var i = 0; i < scourses.length; i++){
+              if(scourses[i].userid == rankData[j].userid){
+                rankData[j].scourseCount++;
+              }
+            }
+
+            for(var i = 0; i < works.length; i++){
+              if(works[i].userid == rankData[j].userid){
+                rankData[j].worksCount++;
+                if(works[i].score){
+                  try {
+                    let rate = JSON.parse(works[i].score)
+                    rankData[j].rateCount += rate.wScore
+                    rankData[j].rate++
+                  } catch (error) {
+                    
+                  }
+                }
+              }
+            }
+
+            rankData[j].rateCount = rankData[j].rateCount > 0 ? (rankData[j].rateCount / rankData[j].rate).toFixed(0) : 0
+
+            for(var i = 0; i < exchanges.length; i++){
+              if(exchanges[i].likesId == rankData[j].userid){
+                rankData[j].exchangeCount++;
+              }
+            }
+
+            rankData[j].score = ((rankData[j].rateCount * 0.5) + (rankData[j].exchangeCount * 0.1) + (rankData[j].worksCount * 0.2) + (rankData[j].scourseCount * 0.1) + (rankData[j].courseCount * 0.1)).toFixed(0);
+          }
+
+
+          this.rankData = rankData;
+          this.$forceUpdate();
+        })
+        .catch((err) => {
+          this.rankLoading = false;
+          console.error(err);
+        });
+    },
     classChange() {
       let _courseNumArray = this.courseNumArray; //参与课程数
       let _scourseNumArray = this.scourseNumArray; //参与项目数

Some files were not shown because too many files changed in this diff