zengyicheng 2 years ago
parent
commit
235531b760

+ 1 - 1
src/components/pages/components/worksDetail3.vue

@@ -497,7 +497,7 @@
                   <div class="ech" style="margin-left: 23px">
                     <img src="../../../assets/icon/pj/score.png" alt="" />
                   </div>
-                  <div style="height: 80%; overflow: auto">
+                  <div style="height: 80%;">
                     <div
                       class="score_box"
                       v-for="(item, index) in worksDetail[sIndex].eList"

+ 278 - 272
src/components/pages/learnAnalysis/components/beDataBase.vue

@@ -315,84 +315,47 @@ export default {
       this.$message.warning("暂未开放此功能!");
     },
     searchModel() {
-      let params = {
-        cn: this.mName,
-        oid: this.ooid,
-      };
-      this.ajax
-        .get(this.$store.state.api + "selectModelList", params)
-        .then((res) => {
-          var evaList = res.data[0];
-          var courseList = res.data[1];
-          var sWorksList = res.data[2];
-          var studyAllTime = res.data[3];
-          var loginAllTime = res.data[4];
-          var courseRateList = res.data[5];
-          var sWorksCList = [];
-          var cList = [];
-          var tool = 0;
-          var isFinish = 0;
-          var scoreXarray = [];
-          let overPer = {};
-          for (var i = 0; i < evaList.length; i++) {
-            evaList[i].course = [];
-            evaList[i].isChoose = [];
-            for (var j = 0; j < courseList.length; j++) {
-              if (evaList[i].id == courseList[j].evaId) {
-                evaList[i].course.push(courseList[j]);
-              }
-            }
-          }
-          for (var i = 0; i < courseList.length; i++) {
-            cList.push(JSON.parse(courseList[i].chapters));
-            scoreXarray.push(courseList[i].title);
-          }
-          for (var i = 0; i < courseRateList.length; i++) {
-            sWorksCList.push({
-              courseid: courseRateList[i].courseId,
-              title: courseRateList[i].title,
-              rate: courseRateList[i].rate,
-              eTitle: courseRateList[i].eTitle,
-            });
-          }
-          for (var i = 0; i < cList.length; i++) {
-            for (var j = 0; j < cList[i].length; j++) {
-              for (
-                var k = 0;
-                k < cList[i][j].chapterInfo[0].taskJson.length;
-                k++
-              ) {
-                let _toolsAarry = [
-                  1, 3, 6, 7, 16, 15, 4, 40, 41, 42, 49, 50, 52, 32, 57,
-                ];
-                for (
-                  var q = 0;
-                  q < cList[i][j].chapterInfo[0].taskJson[k].toolChoose.length;
-                  q++
-                ) {
-                  if (
-                    _toolsAarry.indexOf(
-                      cList[i][j].chapterInfo[0].taskJson[k].toolChoose[q]
-                        .tool[0]
-                    ) != -1
-                  ) {
-                    tool++;
-                  }
+      if (this.mName != "") {
+        let params = {
+          cn: this.mName,
+          oid: this.ooid,
+        };
+        this.ajax
+          .get(this.$store.state.api + "selectModelList", params)
+          .then((res) => {
+            var evaList = res.data[0];
+            var courseList = res.data[1];
+            var sWorksList = res.data[2];
+            var studyAllTime = res.data[3];
+            var loginAllTime = res.data[4];
+            var courseRateList = res.data[5];
+            var sWorksCList = [];
+            var cList = [];
+            var tool = 0;
+            var isFinish = 0;
+            var scoreXarray = [];
+            let overPer = {};
+            for (var i = 0; i < evaList.length; i++) {
+              evaList[i].course = [];
+              evaList[i].isChoose = [];
+              for (var j = 0; j < courseList.length; j++) {
+                if (evaList[i].id == courseList[j].evaId) {
+                  evaList[i].course.push(courseList[j]);
                 }
               }
             }
-          }
-          var toolList = [
-            [10, 49], //互动类
-            [7, 1, 52, 3], //思维类
-            [4, 45, 15, 16, 50, 40, 41, 47, 48], //评价类
-            [18, 21, 22, 23, 24, 32, 57], //编程类
-            [28, 37, 38, 31, 39, 58, 59, 60], //学科类
-            [26, 25], //其他
-          ];
-          var toolAllArray = [];
-          for (var p = 0; p < toolList.length; p++) {
-            toolAllArray[p] = [];
+            for (var i = 0; i < courseList.length; i++) {
+              cList.push(JSON.parse(courseList[i].chapters));
+              scoreXarray.push(courseList[i].title);
+            }
+            for (var i = 0; i < courseRateList.length; i++) {
+              sWorksCList.push({
+                courseid: courseRateList[i].courseId,
+                title: courseRateList[i].title,
+                rate: courseRateList[i].rate,
+                eTitle: courseRateList[i].eTitle,
+              });
+            }
             for (var i = 0; i < cList.length; i++) {
               for (var j = 0; j < cList[i].length; j++) {
                 for (
@@ -400,6 +363,9 @@ export default {
                   k < cList[i][j].chapterInfo[0].taskJson.length;
                   k++
                 ) {
+                  let _toolsAarry = [
+                    1, 3, 6, 7, 16, 15, 4, 40, 41, 42, 49, 50, 52, 32, 57,
+                  ];
                   for (
                     var q = 0;
                     q <
@@ -407,241 +373,281 @@ export default {
                     q++
                   ) {
                     if (
-                      toolList[p].indexOf(
+                      _toolsAarry.indexOf(
                         cList[i][j].chapterInfo[0].taskJson[k].toolChoose[q]
                           .tool[0]
                       ) != -1
                     ) {
-                      toolAllArray[p].push(
-                        cList[i][j].chapterInfo[0].taskJson[k].toolChoose[q]
-                          .tool[0]
-                      );
+                      tool++;
                     }
                   }
                 }
               }
             }
-          }
-          var tTypeAnaArray = [];
-          var allTypeNum = 0;
-          for (var i = 0; i < toolAllArray.length; i++) {
-            tTypeAnaArray.push(toolAllArray[i].length);
-            allTypeNum += toolAllArray[i].length;
-          }
-          var hdGdp = Math.floor((tTypeAnaArray[0] / allTypeNum) * 100),
-            swGdp = Math.floor((tTypeAnaArray[1] / allTypeNum) * 100),
-            pjGdp = Math.floor((tTypeAnaArray[2] / allTypeNum) * 100),
-            bcGdp = Math.floor((tTypeAnaArray[3] / allTypeNum) * 100),
-            xkGdp = Math.floor((tTypeAnaArray[4] / allTypeNum) * 100),
-            qtGdp = Math.floor((tTypeAnaArray[5] / allTypeNum) * 100);
-          if (hdGdp > 0 || hdGdp == 0) {
-            overPer.hdGdp = hdGdp + "%";
-          } else {
-            overPer.hdGdp = 0;
-          }
-          if (swGdp > 0 || hdGdp == 0) {
-            overPer.swGdp = swGdp + "%";
-          } else {
-            overPer.swGdp = 0;
-          }
-          if (pjGdp > 0 || hdGdp == 0) {
-            overPer.pjGdp = pjGdp + "%";
-          } else {
-            overPer.pjGdp = 0;
-          }
-          if (bcGdp > 0 || hdGdp == 0) {
-            overPer.bcGdp = bcGdp + "%";
-          } else {
-            overPer.bcGdp = 0;
-          }
-          if (xkGdp > 0 || hdGdp == 0) {
-            overPer.xkGdp = xkGdp + "%";
-          } else {
-            overPer.xkGdp = 0;
-          }
-          if (qtGdp > 0 || hdGdp == 0) {
-            overPer.qtGdp = qtGdp + "%";
-          } else {
-            overPer.qtGdp = 0;
-          }
-
-          for (var i = 0; i < sWorksList.length; i++) {
-            for (var j = 0; j < courseList.length; j++) {
-              if (sWorksList[i].courseid == courseList[j].courseId) {
-                isFinish++;
+            var toolList = [
+              [10, 49], //互动类
+              [7, 1, 52, 3], //思维类
+              [4, 45, 15, 16, 50, 40, 41, 47, 48], //评价类
+              [18, 21, 22, 23, 24, 32, 57], //编程类
+              [28, 37, 38, 31, 39, 58, 59, 60], //学科类
+              [26, 25], //其他
+            ];
+            var toolAllArray = [];
+            for (var p = 0; p < toolList.length; p++) {
+              toolAllArray[p] = [];
+              for (var i = 0; i < cList.length; i++) {
+                for (var j = 0; j < cList[i].length; j++) {
+                  for (
+                    var k = 0;
+                    k < cList[i][j].chapterInfo[0].taskJson.length;
+                    k++
+                  ) {
+                    for (
+                      var q = 0;
+                      q <
+                      cList[i][j].chapterInfo[0].taskJson[k].toolChoose.length;
+                      q++
+                    ) {
+                      if (
+                        toolList[p].indexOf(
+                          cList[i][j].chapterInfo[0].taskJson[k].toolChoose[q]
+                            .tool[0]
+                        ) != -1
+                      ) {
+                        toolAllArray[p].push(
+                          cList[i][j].chapterInfo[0].taskJson[k].toolChoose[q]
+                            .tool[0]
+                        );
+                      }
+                    }
+                  }
+                }
               }
             }
-          }
+            var tTypeAnaArray = [];
+            var allTypeNum = 0;
+            for (var i = 0; i < toolAllArray.length; i++) {
+              tTypeAnaArray.push(toolAllArray[i].length);
+              allTypeNum += toolAllArray[i].length;
+            }
+            var hdGdp = Math.floor((tTypeAnaArray[0] / allTypeNum) * 100),
+              swGdp = Math.floor((tTypeAnaArray[1] / allTypeNum) * 100),
+              pjGdp = Math.floor((tTypeAnaArray[2] / allTypeNum) * 100),
+              bcGdp = Math.floor((tTypeAnaArray[3] / allTypeNum) * 100),
+              xkGdp = Math.floor((tTypeAnaArray[4] / allTypeNum) * 100),
+              qtGdp = Math.floor((tTypeAnaArray[5] / allTypeNum) * 100);
+            if (hdGdp > 0 || hdGdp == 0) {
+              overPer.hdGdp = hdGdp + "%";
+            } else {
+              overPer.hdGdp = 0;
+            }
+            if (swGdp > 0 || hdGdp == 0) {
+              overPer.swGdp = swGdp + "%";
+            } else {
+              overPer.swGdp = 0;
+            }
+            if (pjGdp > 0 || hdGdp == 0) {
+              overPer.pjGdp = pjGdp + "%";
+            } else {
+              overPer.pjGdp = 0;
+            }
+            if (bcGdp > 0 || hdGdp == 0) {
+              overPer.bcGdp = bcGdp + "%";
+            } else {
+              overPer.bcGdp = 0;
+            }
+            if (xkGdp > 0 || hdGdp == 0) {
+              overPer.xkGdp = xkGdp + "%";
+            } else {
+              overPer.xkGdp = 0;
+            }
+            if (qtGdp > 0 || hdGdp == 0) {
+              overPer.qtGdp = qtGdp + "%";
+            } else {
+              overPer.qtGdp = 0;
+            }
 
-          var allToolWorks = tool;
-          var isFinishTaskWorks = isFinish;
-          if (allToolWorks > 0) {
-            overPer.toolSubRate =
-              (isFinishTaskWorks / allToolWorks).toFixed(2) * 100;
-          } else {
-            overPer.toolSubRate = 0;
-          }
+            for (var i = 0; i < sWorksList.length; i++) {
+              for (var j = 0; j < courseList.length; j++) {
+                if (sWorksList[i].courseid == courseList[j].courseId) {
+                  isFinish++;
+                }
+              }
+            }
 
-          var xArray = [];
-          for (var i = 0; i < sWorksCList.length; i++) {
-            if (xArray.length == 0) {
-              xArray.push({
-                eTitle: sWorksCList[i].eTitle,
-                name: sWorksCList[i].title,
-                value: 0,
-              });
+            var allToolWorks = tool;
+            var isFinishTaskWorks = isFinish;
+            if (allToolWorks > 0) {
+              overPer.toolSubRate =
+                (isFinishTaskWorks / allToolWorks).toFixed(2) * 100;
             } else {
-              if (xArray.indexOf(sWorksCList[i].title) == -1) {
+              overPer.toolSubRate = 0;
+            }
+
+            var xArray = [];
+            for (var i = 0; i < sWorksCList.length; i++) {
+              if (xArray.length == 0) {
                 xArray.push({
                   eTitle: sWorksCList[i].eTitle,
                   name: sWorksCList[i].title,
                   value: 0,
                 });
+              } else {
+                if (xArray.indexOf(sWorksCList[i].title) == -1) {
+                  xArray.push({
+                    eTitle: sWorksCList[i].eTitle,
+                    name: sWorksCList[i].title,
+                    value: 0,
+                  });
+                }
               }
             }
-          }
-          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]];
+            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));
+                }
+              }
+            }
+            var evaArray = xArray.reduce((acc, cur) => {
+              let item = acc.find((i) => i.title === cur.eTitle);
+              if (!item) {
+                acc.push({ title: cur.eTitle, value: cur.value });
+              } else {
+                item.value += cur.value;
+              }
+              return acc;
+            }, []);
+            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;
                 }
-                xArray[j].value = Math.round(courseCount / (a.length - 1));
               }
+              yzArray.push({ name: scoreXarray[i], value: yCount });
+            }
+            yzArray.sort(function (a, b) {
+              return b.value - a.value;
+            });
+            var lTime = 0;
+            for (var i = 0; i < loginAllTime.length; i++) {
+              lTime += parseInt(loginAllTime[i].text);
             }
-          }
-          var evaArray = xArray.reduce((acc, cur) => {
-            let item = acc.find((i) => i.title === cur.eTitle);
-            if (!item) {
-              acc.push({ title: cur.eTitle, value: cur.value });
+            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) {
+              overPer.loginTime = `${hours}小时${minutes}分钟`;
+            } else if (days == 0 && hours == 0 && minutes > 0) {
+              overPer.loginTime = `${minutes}分钟${loginAllTime}秒`;
             } else {
-              item.value += cur.value;
+              overPer.loginTime = `${loginAllTime}秒`;
             }
-            return acc;
-          }, []);
-          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;
-              }
+            var sTime = 0;
+            for (var i = 0; i < studyAllTime.length; i++) {
+              sTime += parseInt(studyAllTime[i].text);
             }
-            yzArray.push({ name: scoreXarray[i], value: yCount });
-          }
-          yzArray.sort(function (a, b) {
-            return b.value - a.value;
-          });
-          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) {
-            overPer.loginTime = `${hours}小时${minutes}分钟`;
-          } else if (days == 0 && hours == 0 && minutes > 0) {
-            overPer.loginTime = `${minutes}分钟${loginAllTime}秒`;
-          } else {
-            overPer.loginTime = `${loginAllTime}秒`;
-          }
-          var sTime = 0;
-          for (var i = 0; i < studyAllTime.length; i++) {
-            sTime += parseInt(studyAllTime[i].text);
-          }
-          var days1 = Math.floor(sTime / (3600 * 24));
-          sTime %= 3600 * 24;
-          var hours1 = Math.floor(sTime / 3600);
-          sTime %= 3600;
-          var minutes1 = Math.floor(sTime / 60);
-          sTime %= 60;
-          if (days1 > 0) {
-            overPer.studyTime = `${days1}天${hours1}小时`;
-          } else if (days1 < 0 && hours1 > 0) {
-            overPer.studyTime = `${hours1}小时${minutes1}分钟`;
-          } else if (days1 == 0 && hours1 == 0 && minutes1 > 0) {
-            overPer.studyTime = `${minutes1}分钟${sTime}秒`;
-          } else {
-            overPer.studyTime = `${sTime}秒`;
-          }
-          var courseNum = "";
-          if (yzArray.length == 0) {
-            courseNum = "暂无课程平均得分";
-          } else {
-            for (var i = 0; i < yzArray.length; i++) {
-              if (yzArray.length == 1) {
-                courseNum = yzArray[i].name + ":" + yzArray[i].value;
-              } else {
-                if (courseNum == "") {
+            var days1 = Math.floor(sTime / (3600 * 24));
+            sTime %= 3600 * 24;
+            var hours1 = Math.floor(sTime / 3600);
+            sTime %= 3600;
+            var minutes1 = Math.floor(sTime / 60);
+            sTime %= 60;
+            if (days1 > 0) {
+              overPer.studyTime = `${days1}天${hours1}小时`;
+            } else if (days1 < 0 && hours1 > 0) {
+              overPer.studyTime = `${hours1}小时${minutes1}分钟`;
+            } else if (days1 == 0 && hours1 == 0 && minutes1 > 0) {
+              overPer.studyTime = `${minutes1}分钟${sTime}秒`;
+            } else {
+              overPer.studyTime = `${sTime}秒`;
+            }
+            var courseNum = "";
+            if (yzArray.length == 0) {
+              courseNum = "暂无课程平均得分";
+            } else {
+              for (var i = 0; i < yzArray.length; i++) {
+                if (yzArray.length == 1) {
                   courseNum = yzArray[i].name + ":" + yzArray[i].value;
                 } else {
-                  courseNum += "," + yzArray[i].name + ":" + yzArray[i].value;
+                  if (courseNum == "") {
+                    courseNum = yzArray[i].name + ":" + yzArray[i].value;
+                  } else {
+                    courseNum +=
+                      "," + yzArray[i].name + ":" + yzArray[i].value;
+                  }
                 }
               }
             }
-          }
 
-          var mbNum = "";
-          if (evaArray.length == 0) {
-            mbNum = "暂无目标得分";
-          } else {
-            for (var i = 0; i < evaArray.length; i++) {
-              if (mbNum == "") {
-                mbNum = evaArray[i].title + ":" + evaArray[i].value;
-              } else {
-                mbNum += "," + evaArray[i].title + ":" + evaArray[i].value;
+            var mbNum = "";
+            if (evaArray.length == 0) {
+              mbNum = "暂无目标得分";
+            } else {
+              for (var i = 0; i < evaArray.length; i++) {
+                if (mbNum == "") {
+                  mbNum = evaArray[i].title + ":" + evaArray[i].value;
+                } else {
+                  mbNum += "," + evaArray[i].title + ":" + evaArray[i].value;
+                }
               }
             }
-          }
 
-          var isTable = [...this.table1];
-          for (var i = 0; i < isTable.length; i++) {
-            if (isTable[i].title == "登录时长") {
-              isTable[i].value =
-                overPer.loginTime != "秒" ? overPer.loginTime : 0 + "秒";
-            } else if (isTable[i].title == "学习时长") {
-              isTable[i].value = overPer.studyTime ? overPer.studyTime : 0;
-            } else if (isTable[i].title == "工具提交率") {
-              isTable[i].value = overPer.toolSubRate + "%";
-            } else if (isTable[i].title == "工具使用(类型)") {
-              isTable[i].value =
-                "互动类占比:" +
-                overPer.hdGdp +
-                ",思维类占比:" +
-                overPer.swGdp +
-                ",评价类占比:" +
-                overPer.pjGdp +
-                ",编程类占比:" +
-                overPer.bcGdp +
-                ",学科类占比:" +
-                overPer.xkGdp +
-                ",其他占比:" +
-                overPer.qtGdp;
-            } else if (isTable[i].title == "课程平均得分") {
-              isTable[i].value = courseNum;
-            } else if (isTable[i].title == "目标得分") {
-              isTable[i].value = mbNum;
+            var isTable = [...this.table1];
+            for (var i = 0; i < isTable.length; i++) {
+              if (isTable[i].title == "登录时长") {
+                isTable[i].value =
+                  overPer.loginTime != "秒" ? overPer.loginTime : 0 + "秒";
+              } else if (isTable[i].title == "学习时长") {
+                isTable[i].value = overPer.studyTime ? overPer.studyTime : 0;
+              } else if (isTable[i].title == "工具提交率") {
+                isTable[i].value = overPer.toolSubRate + "%";
+              } else if (isTable[i].title == "工具使用(类型)") {
+                isTable[i].value =
+                  "互动类占比:" +
+                  overPer.hdGdp +
+                  ",思维类占比:" +
+                  overPer.swGdp +
+                  ",评价类占比:" +
+                  overPer.pjGdp +
+                  ",编程类占比:" +
+                  overPer.bcGdp +
+                  ",学科类占比:" +
+                  overPer.xkGdp +
+                  ",其他占比:" +
+                  overPer.qtGdp;
+              } else if (isTable[i].title == "课程平均得分") {
+                isTable[i].value = courseNum;
+              } else if (isTable[i].title == "目标得分") {
+                isTable[i].value = mbNum;
+              }
             }
-          }
-          this.table = [...isTable];
-          this.$forceUpdate();
-        })
-        .catch((err) => {
-          console.error(err);
-        });
+            this.table = [...isTable];
+            this.$forceUpdate();
+          })
+          .catch((err) => {
+            console.error(err);
+          });
+      } else {
+        this.table = [];
+      }
     },
   },
 };

+ 1 - 1
src/components/pages/myReport/components/MyLookComponent/worksDetail3.vue

@@ -497,7 +497,7 @@
                   <div class="ech" style="margin-left: 23px">
                     <img src="../../../../../assets/icon/pj/score.png" alt="" />
                   </div>
-                  <div style="height: 80%; overflow: auto">
+                  <div style="height: 80%;">
                     <div
                       class="score_box"
                       v-for="(item, index) in worksDetail[sIndex].eList"