11wqe1 1 mês atrás
pai
commit
66a6f0871a
1 arquivos alterados com 67 adições e 46 exclusões
  1. 67 46
      src/components/components/choseWorksDetailDialog.vue

+ 67 - 46
src/components/components/choseWorksDetailDialog.vue

@@ -255,6 +255,7 @@
                     <div class="si_box2">
                       <div class="si_b_bottom">
                         <div class="si_b_t_item" 
+                          style="line-height: 47px;"
                          @click="sentenceBtn2(index,index2)" 
                          v-for="(item2,index2) in radioS[index]" 
                          :key="index2">
@@ -1049,11 +1050,29 @@ export default {
   watch: {
     worksStudentData: {
       handler(newValue) {
+
+        let workSData = []
+        let zjm = JSON.parse(
+          JSON.stringify(newValue[this.toolIndex])
+        );
+        // 判断是否开启学生查看作业
+        if (this.tType == 2 && !this.sIsOpen) {
+          workSData = zjm.filter( e =>{
+            return this.userId == e.userid
+          })
+        }else {
+          workSData = JSON.parse(
+            JSON.stringify(newValue[this.toolIndex])
+          );
+        }
+
+
+        
         if (
           this.show &&
           this.toolIndex !== null &&
           JSON.stringify(this.worksStudent) !==
-            JSON.stringify(newValue[this.toolIndex])
+            JSON.stringify(workSData)
         ) {
           // if (newValue[this.toolIndex].length) {
             let yym = JSON.parse(
@@ -1074,54 +1093,54 @@ export default {
               return this.userId == e.userid
             })
           // }
-          console.log('this.testData222',this.testData);
-          console.log('this.testJsonCopy222',this.testJsonCopy);
+          // console.log('this.testData222',this.testData);
+          // console.log('this.testJsonCopy222',this.testJsonCopy);
         
          
 
           // // 获取学生上传作业的格式
-          if (this.toolType == 45 ) { //选择题
-            this.testJson.forEach(e=>{
-              if (e.type == '2') {
-                this.radioS.push([])
-              }else{
-                this.radioS.push('')
-              }
-            })
-            this.testJsonCopy = [{answer:[],testJson:this.testJson ? this.testData.testJson : null}]
-          }else if(this.toolType == 52 ) { //文本
-            if (this.testJsonCopy && this.testJsonCopy.length) {
-              this.questionsData = JSON.parse(this.testJsonCopy[0].works).text
-            }else{
-              this.questionsData = this.testData.wordJson.text
-            }
-          }else if(this.toolType == 48) { //表格
-            if (this.testJsonCopy && this.testJsonCopy.length) {
-              this.questionsData = JSON.parse(this.testJsonCopy[0].works).text
-            }else if(this.testData && this.testData.tableJson && this.testData.tableJson.text){
-              this.questionsData = this.testData.tableJson.text
-            }else{
-              this.questionsData = ''
-            }
-          }else if(this.toolType == 47) { //排序
-
-            // 把正确答案的数组先创建好
-            this.testData.sentenceList.forEach((e,i)=>{
-              this.radioS.push([])
-              e.addSentence.forEach((k,l)=>{
-                this.radioS[i].push('')
-              })
-            })
-            console.log('this.testData.sentenceList',this.testData.sentenceList);
-
-            //把题目选项点击隐藏写好
-            this.testData.sentenceList.forEach((e,i)=>{
-              this.isShowList.push([])
-              e.addSentence.forEach((k,l)=>{
-                this.isShowList[i].push(true)
-              })
-            })
-          }
+          // if (this.toolType == 45 ) { //选择题
+          //   this.testJson.forEach(e=>{
+          //     if (e.type == '2') {
+          //       this.radioS.push([])
+          //     }else{
+          //       this.radioS.push('')
+          //     }
+          //   })
+          //   this.testJsonCopy = [{answer:[],testJson:this.testJson ? this.testData.testJson : null}]
+          // }else if(this.toolType == 52 ) { //文本
+          //   if (this.testJsonCopy && this.testJsonCopy.length) {
+          //     this.questionsData = JSON.parse(this.testJsonCopy[0].works).text
+          //   }else{
+          //     this.questionsData = this.testData.wordJson.text
+          //   }
+          // }else if(this.toolType == 48) { //表格
+          //   if (this.testJsonCopy && this.testJsonCopy.length) {
+          //     this.questionsData = JSON.parse(this.testJsonCopy[0].works).text
+          //   }else if(this.testData && this.testData.tableJson && this.testData.tableJson.text){
+          //     this.questionsData = this.testData.tableJson.text
+          //   }else{
+          //     this.questionsData = ''
+          //   }
+          // }else if(this.toolType == 47) { //排序
+
+          //   // 把正确答案的数组先创建好
+          //   this.testData.sentenceList.forEach((e,i)=>{
+          //     this.radioS.push([])
+          //     e.addSentence.forEach((k,l)=>{
+          //       this.radioS[i].push('')
+          //     })
+          //   })
+          //   console.log('this.testData.sentenceList',this.testData.sentenceList);
+
+          //   //把题目选项点击隐藏写好
+          //   this.testData.sentenceList.forEach((e,i)=>{
+          //     this.isShowList.push([])
+          //     e.addSentence.forEach((k,l)=>{
+          //       this.isShowList[i].push(true)
+          //     })
+          //   })
+          // }
 
 
           this.dialogTypeList[2].loading = false;
@@ -1275,7 +1294,9 @@ export default {
         }
 
         let zjm = []
-        zjm.push({ testJson: this.testJsonCopy[0].testJson, anwer: this.radioS });
+        
+        zjm.push({ testJson: this.testData.testJson, anwer: this.radioS });
+        
         answerData = JSON.stringify(zjm)
       }else if (this.toolType == 15) { //问答
         if (!this.questionsData) return this.$message.error('请填写答案')