Browse Source

修改我的学习报告问题

zengyicheng 2 years ago
parent
commit
03f941f335

+ 7 - 7
src/components/pages/myReport/components/courseEvaScore.vue

@@ -8,7 +8,7 @@
         style="width: 100%; height: 100%"
       ></div>
     </div> -->
-    <div class="scoreBox" v-if="isSortArray && isSortArray.length && lastArray && lastArray.length">
+    <div class="scoreBox" v-if="isSortArray && isSortArray.length">
       <div class="scoreLeft" v-if="isSortArray && isSortArray.length">
         <div>
           <el-tooltip
@@ -208,14 +208,14 @@ export default {
   white-space: nowrap;
   height: 70px;
 }
-.scoreLeft > div:nth-child(1){
-  background: linear-gradient(to right, #F04A00, #F11700);;
+.scoreLeft > div:nth-child(1) {
+  background: #f9c56c;
 }
-.scoreLeft > div:nth-child(2){
-  background: linear-gradient(to right, #00A8FF, #009CFF);;
+.scoreLeft > div:nth-child(2) {
+  background: #6ba9df;
 }
-.scoreLeft > div:nth-child(3){
-  background: linear-gradient(to right, #98C304, #75C202);;
+.scoreLeft > div:nth-child(3) {
+  background: #e78686;
 }
 .scoreLeft > div:nth-child(2) > span {
   height: 90px;

+ 1 - 1
src/components/pages/myReport/components/mrEva.vue

@@ -5,7 +5,7 @@
         <div class="yuan">
           <img src="../../../../assets/icon/myReport/gang.png" alt="" />
         </div>
-        <div>目标体系-{{ item.title }}</div>
+        <div>{{ item.title }}</div>
       </div>
       <el-table :data="item.course" border style="width: 100%" stripe>
         <el-table-column

+ 2 - 2
src/components/pages/myReport/components/mrOverPer.vue

@@ -42,7 +42,7 @@
             </div>
           </div>
         </div>
-        <div class="allPerBoottom">
+        <!-- <div class="allPerBoottom">
           <div class="avaImg">
             <img src="../../../../assets/icon/myReport/courseStar.png" alt="" />
 
@@ -53,7 +53,7 @@
             </div>
           </div>
           <div>课堂智慧星</div>
-        </div>
+        </div> -->
       </div>
     </div>
   </div>

+ 2 - 0
src/components/pages/myReport/components/toolTypeAna.vue

@@ -75,6 +75,8 @@ export default {
         for(var i=0;i<this.toolTypeArray[0].length;i++){
           this.option.series[0].data[i].value = this.toolTypeArray[0][i];
         }
+        var a = this.option.series[0].data.filter(item => item.value !== 0);
+        this.option.series[0].data = a;
         this.chartObj = chartObj;
         this.chartObj.setOption(this.option);
       });

+ 73 - 45
src/components/pages/myReport/myReport.vue

@@ -190,12 +190,14 @@ export default {
           var courseList = res.data[2];
           var sWorksList = res.data[3];
           var studyAllTime = res.data[4];
-          var loginAllTime = parseInt(res.data[5][0].text);
+          var loginAllTime = res.data[5];
+          var courseRateList = res.data[6];
           var sWorksCList = [];
           var cList = [];
           var cTypeList = [];
           var tool = 0;
           var isFinish = 0;
+          var scoreXarray = [];
           for (var i = 0; i < this.evaList.length; i++) {
             this.evaList[i].course = [];
             this.evaList[i].isChoose = [];
@@ -207,15 +209,18 @@ export default {
           }
           for (var i = 0; i < courseList.length; i++) {
             cList.push(JSON.parse(courseList[i].chapters));
-            sWorksCList.push({
-              courseid: courseList[i].courseid,
-              title: courseList[i].title,
-              rate: courseList[i].rate,
-            });
+            scoreXarray.push(courseList[i].title);
             if (courseList[i].typename != null) {
               cTypeList.push(courseList[i].typename.split("/"));
             }
           }
+          for (var i = 0; i < courseRateList.length; i++) {
+            sWorksCList.push({
+              courseid: courseRateList[i].courseId,
+              title: courseRateList[i].title,
+              rate: courseRateList[i].rate,
+            });
+          }
           var count = 0;
           for (var i = 0; i < this.evaList.length; i++) {
             count += this.evaList[i].course.length;
@@ -308,45 +313,47 @@ export default {
           let overPer = {};
           overPer.toolSubRate =
             (this.stuMessage.isFinishTaskWorks / allToolWorks).toFixed(2) * 100;
-          var array = [];
           var xArray = [];
           for (var i = 0; i < sWorksCList.length; i++) {
             if (xArray.length == 0) {
-              xArray.push(sWorksCList[i].title);
+              xArray.push({ name: sWorksCList[i].title, value: 0 });
             } else {
               if (xArray.indexOf(sWorksCList[i].title) == -1) {
-                xArray.push(sWorksCList[i].title);
+                xArray.push({ name: sWorksCList[i].title, value: 0 });
               }
             }
-            var courseCount = 0;
-            if (
-              sWorksCList[i].rate &&
-              sWorksCList[i].rate != null &&
-              Object.keys(JSON.parse(sWorksCList[i].rate)).length > 0
-            ) {
-              var rateList = JSON.parse(sWorksCList[i].rate);
-              var a = Object.keys(rateList);
-              for (var k = 0; k < a.length; k++) {
-                if (a[k] == "content") {
-                  continue;
-                } else {
-                  courseCount += rateList[a[k]];
+          }
+          for (var i = 0; i < xArray.length; i++) {
+            for (var j = 0; j < sWorksCList.length; j++) {
+              if (xArray[i].name == sWorksCList[j].title) {
+                var rateList = JSON.parse(sWorksCList[j].rate);
+                var a = Object.keys(rateList);
+                var courseCount = 0;
+                for (var k = 0; k < a.length; k++) {
+                  if (a[k] == "content") {
+                    continue;
+                  } else {
+                    courseCount += rateList[a[k]];
+                  }
                 }
+                xArray[j].value = Math.round(courseCount / (a.length - 1));
               }
-              array.push(courseCount);
-            } else {
-              array.push(courseCount);
             }
           }
-          var tuples = xArray.map((label, index) => [label, array[index]]);
-          // 根据数据降序排序二元组
-          tuples.sort((a, b) => b[1] - a[1]);
-          // 提取已排序的标签
-          var xArrayNew = tuples.map((tuple) => tuple[0]);
-          var arrayNew = tuples.map((tuple) => tuple[1]);
-          for (var i = 0; i < xArrayNew.length; i++) {
-            this.cEvaScore.push({ name: xArrayNew[i], value: arrayNew[i] });
+          var yzArray = [];
+          for (var i = 0; i < scoreXarray.length; i++) {
+            var yCount = 0;
+            for (var j = 0; j < xArray.length; j++) {
+              if (scoreXarray[i] == xArray[j].name) {
+                yCount += xArray[j].value;
+              }
+            }
+            yzArray.push({ name: scoreXarray[i], value: yCount });
           }
+          yzArray.sort(function (a, b) {
+            return b.value - a.value;
+          });
+          this.cEvaScore = yzArray;
           var ctArray = [];
           var cxtArray = [];
           for (var i = 0; i < cTypeList.length; i++) {
@@ -361,7 +368,6 @@ export default {
               cxtArray.push(cTypeList[i][j]);
             }
           }
-
           const result = ctArray
             .filter((item) => cxtArray.includes(item))
             .map((item) => ({
@@ -377,19 +383,41 @@ export default {
           // 提取已排序的标签
           var txArrayNew = tuples1.map((tuple) => tuple[0]);
           var tarrayNew = tuples1.map((tuple) => tuple[1]);
+          var subjectList = [
+            "语文",
+            "数学",
+            "英语",
+            "科学",
+            "信息技术",
+            "物理",
+            "化学",
+            "生物",
+            "历史",
+            "地理",
+            "通用技术",
+            "政治",
+            "STEM",
+            "美术",
+            "其他",
+          ];
           for (var i = 0; i < txArrayNew.length; i++) {
-            this.cTypeAnaList.push({
-              name: txArrayNew[i],
-              value: tarrayNew[i],
-            });
+            if (subjectList.indexOf(txArrayNew[i]) != -1) {
+              this.cTypeAnaList.push({
+                name: txArrayNew[i],
+                value: tarrayNew[i],
+              });
+            }
           }
-
-          var days = Math.floor(loginAllTime / (3600 * 24));
-          loginAllTime %= 3600 * 24;
-          var hours = Math.floor(loginAllTime / 3600);
-          loginAllTime %= 3600;
-          var minutes = Math.floor(loginAllTime / 60);
-          loginAllTime %= 60;
+          var lTime = 0;
+          for (var i = 0; i < loginAllTime.length; i++) {
+            lTime += parseInt(loginAllTime[i].text);
+          }
+          var days = Math.floor(lTime / (3600 * 24));
+          lTime %= 3600 * 24;
+          var hours = Math.floor(lTime / 3600);
+          lTime %= 3600;
+          var minutes = Math.floor(lTime / 60);
+          lTime %= 60;
           if (days > 0) {
             overPer.loginTime = `${days}天${hours}小时`;
           } else if (days < 0 && hours > 0) {