11wqe1 7 месяцев назад
Родитель
Сommit
90072d2b94
1 измененных файлов с 65 добавлено и 119 удалено
  1. 65 119
      src/components/pages/components/worksDetail2.vue

+ 65 - 119
src/components/pages/components/worksDetail2.vue

@@ -218,7 +218,7 @@
                 type="primary"
                 size="small"
                 @click="
-                  lookWork(scope.row.id, scope.row.userid, 0, scope.$index)
+                  lookWork(scope.row.id, scope.row.userid, 0, scope.$index,scope.row)
                 "
                 >查看&批改</el-button
               >
@@ -228,14 +228,14 @@
                 @click="lookData(scope.row.userid)"
                 >生成报告</el-button
               >-->
-              <el-button
+              <!-- <el-button
                 type="primary"
                 size="small"
                 @click="
                   lookWork2(scope.row.id, scope.row.userid, scope.row.courseid, dyList[scope.row.stage].name,dyList[scope.row.stage].taskList[scope.row.task].name)
                 "
                 >导出作业</el-button
-              >
+              > -->
               <!-- <el-button
                 class="de_button"
                 type="primary"
@@ -2178,7 +2178,7 @@ export default {
       }
       // this.getWorks();
     },
-    lookWork(id, uid, type, index) {
+    lookWork(id, uid, type, index,con) {
       this.scopeId1 = id;
       this.studentId = uid;
       let params = {
@@ -2936,9 +2936,16 @@ export default {
             }
           }
 				
-					this.$nextTick(()=>{
-						this.openTask(this.chooseDy?this.chooseDy:0,this.chooseTask?this.chooseTask:0,this.chooseDy?this.dyList2.findIndex(i=>i.id==this.chooseDy):0,this.chooseTask?this.dyList2[this.dyList2.findIndex(i=>i.id==this.chooseDy)].taskList.findIndex(i=>i.id==this.chooseTask):0)
-					})
+          // if(this.cutTabNum == 2){
+            this.$nextTick(()=>{
+              this.openTask2(con)
+            })
+          // }else{
+          //   this.$nextTick(()=>{
+          //     this.openTask(con,this.chooseDy?this.chooseDy:0,this.chooseTask?this.chooseTask:0,this.chooseDy?this.dyList2.findIndex(i=>i.id==this.chooseDy):0,this.chooseTask?this.dyList2[this.dyList2.findIndex(i=>i.id==this.chooseDy)].taskList.findIndex(i=>i.id==this.chooseTask):0)
+          //   })
+          // }
+					
           // this.preStep();
           // this.nextStep();
         })
@@ -3382,97 +3389,44 @@ export default {
             wordInfo: [],
           };
           var eList = [];
-          if (workEvaList.length > 0) {
-            for (var qi = 0; qi < workEvaList.length; qi++) {
-              var eListOld =
-                chapters[workEvaList[qi].stage].chapterInfo[0].taskJson[
-                  workEvaList[qi].task
-                ].eList;
-              var _ooption = [];
-              if (eListOld && eListOld.length) {
-                var eListNew = Object.keys(eListOld).map(function (key) {
-                  return {
-                    detail: eListOld[key].detail,
-                    score: eListOld[key].score,
-                    value: eListOld[key].value,
-                  };
-                });
-                eList = eListNew;
-                if (eList && eList.length) {
-                  workJson.eList = eList;
-                  for (var i = 0; i < eList.length; i++) {
-                    _ooption.push({ value: 0, name: eList[i].value });
-                    workJson.rateList[eList[i].value] = 0;
-                  }
-                  workJson.rateList.content = "";
-                  this.ooption = _ooption;
-                } else {
-                  workJson.eList = [
-                    { value: "意识能力", detail: "", score: 5 },
-                    { value: "科学探究能力", detail: "", score: 5 },
-                    { value: "实践创新能力", detail: "", score: 5 },
-                    { value: "学习反思能力", detail: "", score: 5 },
-                    { value: "工程思维能力", detail: "", score: 5 },
-                  ];
-                  for (var i = 0; i < workJson.eList.length; i++) {
-                    _ooption.push({ value: 0, name: workJson.eList[i].value });
-                    workJson.rateList[workJson.eList[i].value] = 0;
-                  }
-                  workJson.rateList.content = "";
-                  this.ooption = [
-                    { value: 0, name: "意识能力" },
-                    { value: 0, name: "科学探究能力" },
-                    { value: 0, name: "实践创新能力" },
-                    { value: 0, name: "学习反思能力" },
-                    { value: 0, name: "工程思维能力" },
-                  ];
-                }
-              }
-            }
-          }
-          var _rate = [],
-            _rateList = [];
-          if (workEvaList.length > 0) {
-            for (var p = 0; p < workEvaList.length; p++) {
-              if (workEvaList[p].rate && eList && eList.length) {
-                _rate[p] = JSON.parse(workEvaList[p].rate);
-              }
-              _rateList[p] = Object.keys(JSON.parse(workEvaList[p].rate)).filter(e => {return e!='content'});
-              for (var i = 0; i < _rateList[p].length; i++) {
-                var _c = Object.keys(workJson.rateList);
-                if (_c.indexOf(_rateList[p][i]) != -1) {
-                  workJson.rateList[_rateList[i]] = _rate[_rateList[i]];
-                }
-              }
 
-              // console.log('1',JSON.parse(JSON.stringify(_rateList[p])));
-              // console.log('2',JSON.parse(JSON.stringify(this.ooption[p])));
 
-              
-              for (var i = 0; i < this.ooption[p].length; i++) {
-                if (_rateList[p].indexOf(this.ooption[p][i].name) != -1) {
-                  this.ooption[p][i].value = _rate[p][this.ooption[p][i].name];
-                }
+          var _title =
+            "<h2>" +
+            "第" +
+            (this.sInfo.stage + 1) +
+            "阶段 " +
+            this.dyList[this.sInfo.stage].name +
+            "</h2>";
+          var _subtitle =
+            "<h3>" +
+            "任务" +
+            (this.sInfo.task + 1) +
+            " " +
+            this.dyList[this.sInfo.stage].taskList[this.sInfo.task].name +
+            "-" +
+            this.sInfo.sName +
+            "</h3>";
+
+
+
+          if (this.sInfo.rate) {
+            _rate = JSON.parse(this.sInfo.rate);
+            _rateList = Object.keys(JSON.parse(this.sInfo.rate));
+            for (var i = 0; i < _rateList.length; i++) {
+              var _c = Object.keys(workJson.rateList);
+              if (_c.indexOf(_rateList[i]) != -1) {
+                workJson.rateList[_rateList[i]] = _rate[_rateList[i]];
               }
             }
-          } else {
-            if (this.sInfo.rate) {
-              _rate = JSON.parse(this.sInfo.rate);
-              _rateList = Object.keys(JSON.parse(this.sInfo.rate));
-              for (var i = 0; i < _rateList.length; i++) {
-                var _c = Object.keys(workJson.rateList);
-                if (_c.indexOf(_rateList[i]) != -1) {
-                  workJson.rateList[_rateList[i]] = _rate[_rateList[i]];
-                }
-              }
-              for (var i = 0; i < this.ooption.length; i++) {
-                if (_rateList.indexOf(this.ooption[i].name) != -1) {
-                  this.ooption[i].value = _rate[this.ooption[i].name];
-                }
+            for (var i = 0; i < this.ooption.length; i++) {
+              if (_rateList.indexOf(this.ooption[i].name) != -1) {
+                this.ooption[i].value = _rate[this.ooption[i].name];
               }
             }
           }
 
+
           for (var i = 0; i < worksDetail.length; i++) {
             workJson.img.push({
               src: worksDetail[i].content,
@@ -3611,8 +3565,6 @@ export default {
             }
           }
 
-          // console.log('lccjInfo',lccjInfo);
-          
           if (lccjInfo.length > 0) {
             for (var i = 0; i < lccjInfo.length; i++) {
               var lccj = lccjInfo[i];
@@ -3624,7 +3576,6 @@ export default {
               });
             }
           }
-          
 
           for (var i = 0; i < bgInfo.length; i++) {
             var bg = bgInfo[i];
@@ -3721,22 +3672,7 @@ export default {
           this.$forceUpdate;
 
           var _course = `<h1>${this.sInfo.course}</h1>`;
-          var _title =
-            "<h2>" +
-            "第" +
-            (this.sInfo.stage + 1) +
-            "阶段 " +
-            this.dyList[this.sInfo.stage].name +
-            "</h2>";
-          var _subtitle =
-            "<h3>" +
-            "任务" +
-            (this.sInfo.task + 1) +
-            " " +
-            this.dyList[this.sInfo.stage].taskList[this.sInfo.task].name +
-            "-" +
-            this.sInfo.sName +
-            "</h3>";
+         
           var _img = "";
           if (workJson.img.length > 0) {
             for (var i = 0; i < workJson.img.length; i++) {
@@ -3870,15 +3806,6 @@ export default {
                 var _div = document.createElement("div");
                 _div.innerHTML = `<h4>第${i+1}题${workJson.lccjInfo[0].lccjInfo[i].sentenceTitle}</h4> `;
                 var _div2 = document.createElement("div");
-                // for (
-                //   var j = 0;
-                //   j < workJson.lccjInfo[0][lccjInfo][i].chooseSenList.length;
-                //   j++
-                // ) {
-                //   _div2.innerHTML += ` 句子 ${j + 1} : ${
-                //     workJson.lccjInfo[0][lccjInfo][i].chooseSenList[j]
-                //   }`;
-                // }
                 _div2.innerHTML+= ` 句子 ${i + 1}:${ workJson.lccjInfo[0].lccjInfo[i].addSentence.join(',')} 选择:${
                     workJson.lccjInfo[0].lccjInfo[i].chooseSenList.join(',') 
                   } 答案:${
@@ -3945,7 +3872,7 @@ export default {
       this.dyList2[s].isOpen = !this.dyList2[s].isOpen;
     },
     openTask(s, i, dyi, navi) {
-      console.log('openTask2',s, i, dyi, navi);
+      // console.log('openTask2',con,s, i, dyi, navi);
 
       if (!this.dyList2[dyi].taskList[navi].isWork) {
         this.$message.warning("该任务暂时没提交作业");
@@ -3965,6 +3892,25 @@ export default {
         this.navId = a;
       }
     },
+    openTask2(con) {
+      console.log(con);
+      
+      let s = con.stage
+      let i = con.task
+
+      const element = document.getElementById(`${s}+${i}`);
+      if (element) {
+        element.scrollIntoView({
+          behavior: 'smooth'
+        });
+      }
+      var a = s + "-" + i;
+    
+      this.stageIndex = s;
+      this.taskCount = i;
+      this.navId = a;
+
+    },
     async generate(a,stage,task) {
       // 将html文件中需要用到的数据挂载到store上
       this.$store.commit("update", ["report", a]);