lsc 1 anno fa
parent
commit
4f3d472a1e

+ 220 - 31
src/components/pages/CaseDesignS.vue

@@ -29,7 +29,7 @@
             <el-option label="字数" value="font"> </el-option>
           </el-select>
 
-          <el-select v-model="ttype" @change="page=1,isLoading = true, getData()">
+          <el-select v-model="ttype" @change="page = 1, isLoading = true, getData()">
             <el-option label="全部" value=""></el-option>
             <el-option v-for="item in courseTypeId" :key="item.id" :label="item.name" :value="item.id">
             </el-option>
@@ -41,8 +41,8 @@
     </div>
     <div class="cd_table">
       <el-table ref="table" :data="tableData" border :fit="true" v-loading="isLoading" style="width: 100%"
-        :header-cell-style="{ background: '#f1f1f1', fontSize: '17px' }" :row-class-name="tableRowClassName"
-        class="table" :height="tableHeight" :key="mode">
+        :header-cell-style="{ background: '#f1f1f1', fontSize: '17px' }" :row-class-name="tableRowClassName" class="table"
+        :height="tableHeight" :key="mode">
         <el-table-column label="序号" prop="number" width="70px" align="center">
         </el-table-column>
         <el-table-column label="项目" width="150px" align="center">
@@ -245,7 +245,7 @@
           <template slot-scope="scope">
             <div>{{ scope.row.score ? '已评分' : '未评分' }}</div>
           </template>
-        </el-table-column>        
+        </el-table-column>
         <el-table-column label="评审结果" prop="score" width="80px" align="center">
           <template slot-scope="scope">
             <div>{{ scope.row.score }}分</div>
@@ -253,7 +253,8 @@
         </el-table-column>
         <el-table-column label="评审类型" prop="psType" width="80px" align="center">
           <template slot-scope="scope">
-            <div>{{ scope.row.psType == '1' ? '造型结构' : scope.row.psType == '2' ? '开源硬件' :   scope.row.psType == '3' ? '软件设计' :  scope.row.psType == '4' ? '总分' : '—' }}</div>
+            <div>{{ scope.row.psType == '1' ? '造型结构' : scope.row.psType == '2' ? '开源硬件' : scope.row.psType == '3' ? '软件设计'
+              : scope.row.psType == '4' ? '总分' : '—' }}</div>
           </template>
         </el-table-column>
         <el-table-column fixed="right" label="操作" width="180px" align="center">
@@ -269,8 +270,9 @@
         </el-table-column>
       </el-table>
       <div class="student_page">
-        <el-pagination background layout="prev, pager, next, sizes" :page-size="pageSize" :page-sizes="[10, 50, 100, 200]" :total="total"
-          v-if="page && tableData.length" style="padding: 0px" @current-change="handleCurrentChange" @size-change="handleSizeChange"></el-pagination>
+        <el-pagination background layout="prev, pager, next, sizes" :page-size="pageSize" :page-sizes="[10, 50, 100, 200]"
+          :total="total" v-if="page && tableData.length" style="padding: 0px" @current-change="handleCurrentChange"
+          @size-change="handleSizeChange"></el-pagination>
       </div>
     </div>
     <el-dialog title="查看" :visible.sync="dialogVisible" :append-to-body="true" width="620px" :before-close="handleClose"
@@ -348,7 +350,7 @@ export default {
       total: 0,
       page: 1,
       pageSize: 100,
-      tableHeight:"500px",
+      tableHeight: "500px",
     };
   },
   methods: {
@@ -421,12 +423,13 @@ export default {
                 if (_tasks[task].eList) {
                   evalC2 += _tasks[task].eList.length;
                 }
-                if (_tasks[task].toolArray.length > 0) {
+                console.log(_tasks[task].toolArray , i);
+                if (_tasks[task].toolArray && _tasks[task].toolArray.length > 0) {
                   toolC2 += _tasks[task].toolArray.length;
                 }
                 fontC2 += _tasks[task].task.length;
                 fontC2 += this.toText(_tasks[task].taskDetail).length;
-                let _tools = _tasks[task].toolArray;
+                let _tools = _tasks[task].toolArray ? _tasks[task].toolArray : [];
                 for (var tool = 0; tool < _tools.length; tool++) {
                   fontC2 += _tools[tool].toolDetail.length;
                 }
@@ -459,7 +462,7 @@ export default {
             for (var tk = _chapter.length - 1; tk >= 0; tk--) {
               let _tasks = _chapter[tk].chapterInfo[0].taskJson;
               for (var ttask = _tasks.length - 1; ttask >= 0; ttask--) {
-                let _tools = _tasks[ttask].toolArray;
+                let _tools = _tasks[ttask].toolArray ? _tasks[ttask].toolArray : [];
                 if (_tools.length) {
                   _res[i].lastTask = `第${tk + 1}阶段任务${ttask + 1}步骤${_tools.length}`
                   break;
@@ -471,23 +474,23 @@ export default {
                 break;
               }
             }
-            if(_res[i].score){
+            if (_res[i].score) {
               var psJson = JSON.parse(_res[i].score)
-              if(_res[i].psType == '1'){
+              if (_res[i].psType == '1') {
                 _res[i].score = psJson.cxx + psJson.yssm + psJson.jsygn + psJson.kxdy +
                   psJson.zpwcd
-              }else if(_res[i].psType == '2'){
+              } else if (_res[i].psType == '2') {
                 _res[i].score = psJson.cxx + psJson.yssm + psJson.jsygn + psJson.kxdd +
                   psJson.zpwcd
-              }else if(_res[i].psType == '3'){
+              } else if (_res[i].psType == '3') {
                 _res[i].score = psJson.cxx + psJson.yssm + psJson.jsygn + psJson.kxdd +
-                psJson.zpwcd
-              }else if(_res[i].psType == '4'){
+                  psJson.zpwcd
+              } else if (_res[i].psType == '4') {
                 _res[i].score = psJson.z
               }
-              
-              
-            }else{
+
+
+            } else {
               _res[i].score = 0
             }
           }
@@ -525,7 +528,7 @@ export default {
               item.number = index + 1
               return item;
             });;
-          }  else if (this.choose == "font") {
+          } else if (this.choose == "font") {
             let array = _res.sort(function (a, b) {
               //   return a.jdz.fontC - b.jdz.fontC;
               return b.jdz.fontC - a.jdz.fontC;
@@ -618,7 +621,7 @@ export default {
       this.dataArray = a;
       this.dialogVisible = true;
     },
-    changeMode(){
+    changeMode() {
       this.tableHeight =
         window.innerHeight - this.$refs.table.$el.offsetTop - 50;
       if (this.tableHeight <= 530) {
@@ -659,7 +662,7 @@ export default {
         _json["项目所处阶段"] = res[i].lastTask ? res[i].lastTask : '—';
         _json["评审状态"] = res[i].score ? '已评分' : '未评分';
         _json["评审结果"] = res[i].score + '分';
-        _json["评审类型"] = res[i].psType == '1' ? '造型结构' : res[i].psType == '2' ? '开源硬件' :   res[i].psType == '3' ? '软件设计' :  res[i].psType == '4' ? '总分' : '—';
+        _json["评审类型"] = res[i].psType == '1' ? '造型结构' : res[i].psType == '2' ? '开源硬件' : res[i].psType == '3' ? '软件设计' : res[i].psType == '4' ? '总分' : '—';
         array.push(_json);
       }
 
@@ -682,7 +685,7 @@ export default {
         type: "success",
       });
     },
-    async exportHtml(){
+    async exportHtml() {
       let res = this.tableData;
       for (let i = 0; i < res.length; i++) {
         await this.setMan(res[i])
@@ -697,13 +700,13 @@ export default {
       let _time = `<h2>创建时间:${course.ctime} 修改时间:${course.time}</h2>`
       let _type = `<h2>分类:${course.typename}</h2>`
       let _detail = `<h2>项目详情:${course.brief}</h2>`
-      let _jdZ = `<h2>项目阶段数量:${JSON.parse(course.chapters).length} 项目任务任数量:${course.jdz.taskC}</h2>`
+      let _jdZ = `<h2>项目阶段数量:${course.chapters.length} 项目任务任数量:${course.jdz.taskC}</h2>`
       let _lasttask = ''
       if (course.lastTask) {
         _lasttask = `<h2>项目所处阶段:${course.lastTask}</h2>`
       }
 
-      let _chapter = JSON.parse(course.chapters)
+      let _chapter = course.chapters
       let chapterHTML = ''
       for (var i = 0; i < _chapter.length; i++) {
         chapterHTML += `<h2 style="border-top: 1px solid #ddd;padding: 10px 0 0 0;">第${i + 1}阶段-${_chapter[i].dyName}</h2>`
@@ -711,7 +714,7 @@ export default {
         for (var j = 0; j < taskJson.length; j++) {
           chapterHTML += `<h3>任务${j + 1}-${taskJson[j].task}</h3>`
           if (taskJson[j].time && taskJson[j].time.length) {
-            chapterHTML += `<p>任务周期:${taskJson[j].time[0]}至${taskJson[j].time[1]}</p>`
+            chapterHTML += `<p>任务周期:${this.timeB(taskJson[j].time[0])}至${this.timeB(taskJson[j].time[1])}</p>`
           }
           if (taskJson[j].people) {
             chapterHTML += `<p>负责人:${this.getMan(Man, taskJson[j].people)}</p>`
@@ -725,7 +728,7 @@ export default {
           }
           chapterHTML += `<div>任务描述</div>`
           chapterHTML += `<div>${taskJson[j].taskDetail}</div>`
-          let _tool = taskJson[j].toolArray
+          let _tool = taskJson[j].toolArray ? taskJson[j].toolArray : []
           for (var tool = 0; tool < _tool.length; tool++) {
             if (_tool[tool].tool == 1) {
               chapterHTML += `<h4>步骤${tool + 1}:电子白板</h4>`
@@ -747,7 +750,93 @@ export default {
               chapterHTML += `<h4>步骤${tool + 1}:表格</h4>`
             } else if (_tool[tool].tool == 52) {
               chapterHTML += `<h4>步骤${tool + 1}:文档</h4>`
+            } else if (_tool[tool].tool == 51) {
+              chapterHTML += `<h4>步骤${tool + 1}:资源库</h4>`
+            } else if (_tool[tool].tool == 56) {
+              chapterHTML += `<h4>步骤${tool + 1}:投票</h4>`
+            } else if (_tool[tool].tool == 57) {
+              chapterHTML += `<h4>步骤${tool + 1}:CocoPi</h4>`
             }
+
+            if (_tool[tool].tool == 51) {
+              if (_tool[tool].toolData.length) {
+                for (var ti = 0; ti < _tool[tool].toolData.length; ti++) {
+                  let _td = _tool[tool].toolData[ti]
+                  if (_td.type == 2) {
+                    chapterHTML += `<div><span>视频链接:</span><a href='${_td.url}'>${_td.name}</a></div>`
+                  } else if (_td.type == 3) {
+                    chapterHTML += `<div><span>文档链接:</span><a href='${_td.url}'>${_td.name}</a></div>`
+                  } else if (_td.type == 6) {
+                    chapterHTML += `<div>图文标题:${_td.name}</div>`
+                    chapterHTML += `<div class="cont"><span>图文内容:</span>${_td.url}</div>`
+                  } else if (_td.type == 8) {
+                    chapterHTML += `<div><span>链接:</span><a href='${_td.src}'>${_td.title}</a></div>`
+                  }
+                }
+              }
+            } else {
+              if (_tool[tool].toolPhoto.length) {
+                for (var worki = 0; worki < _tool[tool].toolPhoto.length; worki++) {
+                  let photo = _tool[tool].toolPhoto[worki]
+                  if (photo.type == 1) {
+                    chapterHTML += `<div><img style="max-width:500px" src="${photo.content}"/></div>`
+                  } else if (photo.type == 10) {
+                    chapterHTML += `<div class="cont">${JSON.parse(photo.content)}</div>`
+                  } else if (photo.type == 4) {
+                    chapterHTML += `<div><span>文档链接:</span><a href='${photo.content}'>${photo.content}</a></div>`
+                  } else if (photo.type == 5) {
+                    chapterHTML += `<div><span>视频链接:</span><a href='${photo.content}'>${photo.content}</a></div>`
+                  } else if (photo.type == 12) {
+                    chapterHTML += `<div class="cont">${JSON.parse(photo.content)}</div>`
+                  } else if (photo.type == 14) {
+                    var _ask = "";
+                    var _div = document.createElement("div");
+                    _div.innerHTML = `<h4>标题:${_tool[tool].askJson.askTitle}</h4>`;
+                    for (
+                      var j = 0;
+                      j < _tool[tool].askJson.askJson.length;
+                      j++
+                    ) {
+                      let answer = JSON.parse(photo.content)
+                      var _div2 = document.createElement("div");
+                      _div2.innerHTML = `<h5>第${j + 1}题:${_tool[tool].askJson.askJson[j].askstitle
+                        }  选择:${answer &&
+                          answer.length > 0
+                          ? answer[j]
+                          : 1
+                        }</h5> `;
+                      var _div3 = document.createElement("div");
+                      for (
+                        var z = 0;
+                        z <
+                        _tool[tool].askJson.askJson[j].checkList
+                          .length;
+                        z++
+                      ) {
+                        _div3.innerHTML += `<span style="margin-right:5px">${z + 1}.${_tool[tool].askJson.askJson[j].checkList[z]
+                          }</span>`;
+                      }
+                      _div2.innerHTML += `<div>${_div3.innerHTML}</div>`;
+                      _div.innerHTML += `<div>${_div2.innerHTML}</div>`;
+                    }
+                    _ask += `<div>${_div.innerHTML}</div>`;
+                    chapterHTML += _ask
+                  } else if (photo.type == 13) {
+                    chapterHTML += `<div><span>文件链接:</span><a href='${photo.content}'>${photo.content}</a></div>`
+                  }
+                  // <img v-if="photo.type == 1" :src="photo.content" @click="previewImg(photo.content)" />
+                  //         <img v-if="photo.type == 10" :src="word" @click="openTable(photo.content)" />
+                  //         <img v-if="photo.type == 4" :src="word" @click="openFile(photo.content)" />
+                  //         <img v-if="photo.type == 5" :src="video" @click="openVideo(photo.content)" />
+                  //         <img v-if="photo.type == 12" :src="word" @click="openText(photo.content)" />
+                  //         <img v-if="photo.type == 14" :src="word" @click="
+                  //           openAsk(photo.content, taskCount, toolIndex)
+                  //         " />
+                  //         <img v-if="photo.type == 13" :src="zip" @click="downloadFile(photo.content)" />
+                }
+              }
+            }
+
             if (_tool[tool].toolDetail) {
               chapterHTML += `<div>工具描述</div>`
               chapterHTML += `<div>${_tool[tool].toolDetail}</div>`
@@ -771,8 +860,8 @@ export default {
       }
       return _people ? _people : "";
     },
-    async setMan(course) {
-      // let teacherJuri = this.teacherJuri2;
+    async setMan(ccourse) {
+      let course = JSON.parse(JSON.stringify(ccourse));
       this.ManAarray = [];
       let array = course.course_teacher.split(",")
       if (array.indexOf(course.userid) == -1) {
@@ -782,6 +871,42 @@ export default {
         uid: array.join(","),
       };
       const res = await this.ajax.get(this.$store.state.api + "getAllUserById", params)
+      let params2 = {
+        cid: course.courseId,
+      }
+      const res2 = await this.ajax.get(this.$store.state.api + "select_student_course_detail", params2)
+      let unitJson = JSON.parse(course.chapters);
+      let works = res2.data[2];
+      for (var i = 0; i < unitJson.length; i++) {
+        let task = unitJson[i].chapterInfo[0].taskJson;
+        for (var j = 0; j < task.length; j++) {
+          var tool = task[j].toolArray ? task[j].toolArray : [];
+          for (var z = 0; z < tool.length; z++) {
+            let _tool = tool[z];
+            _tool.toolPhoto = [];
+            _tool.people = [];
+            for (var k = 0; k < works.length; k++) {
+              let _work = works[k];
+              if (
+                _work.stage == i &&
+                _work.task == j &&
+                _work.tool == z &&
+                _work.atool == _tool.tool
+              ) {
+                if (_tool.tool == 48 || _tool.tool == 52) {
+                  _tool.toolPhoto[0] = _work;
+                  if (_tool.people.indexOf(_work.username) == -1) {
+                    _tool.people.push(_work.username);
+                  }
+                } else {
+                  _tool.toolPhoto.push(_work);
+                }
+              }
+            }
+          }
+        }
+      }
+      course.chapters = unitJson
       this.exportCourse(course, res.data[0])
     },
     async generate(a, html) {
@@ -794,6 +919,64 @@ export default {
           <meta http-equiv="X-UA-Compatible" content="IE=edge">
           <meta name="viewport" content="width=device-width, initial-scale=1.0">
           <title>报告</title>
+          <style>
+          .cont{
+            word-break: break-all;
+          }
+          .cont table {
+              border-top: 1px solid #ccc;
+              border-left: 1px solid #ccc;
+            }
+
+            .cont table td,
+            .cont table th {
+              border-bottom: 1px solid #ccc;
+              border-right: 1px solid #ccc;
+              /* padding: 20px 5px; */
+              padding: 5px 10px;
+              max-width: 0px;
+              height: 30px;
+              vertical-align: baseline;
+            }
+
+            .cont table th {
+              border-bottom: 2px solid #ccc;
+              text-align: center;
+            }
+
+            /* blockquote 样式 */
+            .cont blockquote {
+              display: block;
+              border-left: 8px solid #d0e5f2;
+              padding: 5px 10px;
+              margin: 10px 0;
+              line-height: 1.4;
+              font-size: 100%;
+              background-color: #f1f1f1;
+            }
+
+            /* code 样式 */
+            .cont code {
+              display: inline-block;
+              *display: inline;
+              *zoom: 1;
+              background-color: #f1f1f1;
+              border-radius: 3px;
+              padding: 3px 5px;
+              margin: 0 3px;
+            }
+
+            .cont pre code {
+              display: block;
+            }
+
+            /* ul ol 样式 */
+            .cont ul,
+            .cont ol {
+              margin: 10px 0 10px 20px;
+            }
+
+          </style>
       </head>
       <body>
       ${this.$store.state.report}
@@ -823,6 +1006,13 @@ export default {
       //   "报告.doc"
       // );
     },
+    timeB(timeA) {
+      var time = new Date(timeA);
+      time.setTime(time.getTime());
+      var s2 = time.getFullYear() + "-" + ((time.getMonth() + 1) < 10 ? '0' + (time.getMonth() + 1) : (time.getMonth() + 1)) + "-"
+        + ((time.getDate()) < 10 ? '0' + (time.getDate()) : (time.getDate()));
+      return time.getFullYear() ? s2 : '无'
+    },
   },
   beforeDestroy() {
     clearInterval(this.timer);
@@ -1030,5 +1220,4 @@ export default {
   -webkit-line-clamp: 3;
   -webkit-box-orient: vertical
 }
-
 </style>

+ 5 - 4
src/components/pages/teacherSource/dialog.vue

@@ -742,8 +742,7 @@ export default {
 
 .source-box .label>span {
     padding: 5px 10px;
-    background: rgb(98, 180, 238);
-    color: #fff;
+    background: rgb(244, 244, 244);
     border-radius: 5px;
     margin: 0 0 5px 5px;
 }
@@ -753,10 +752,12 @@ export default {
     text-align: center;
     display: flex;
     height: 40px;
-    background: rgb(244, 244, 244);
-    margin-top:auto;
+    background: rgb(88, 121, 198);
+    color: #fff;
+    margin-top: auto;
 }
 
+
 .source-box .button>span {
     width: 100%;
     cursor: pointer;

+ 3 - 3
src/components/pages/teacherSource/index.vue

@@ -770,8 +770,7 @@ export default {
 
 .source-box .label>span {
     padding: 5px 10px;
-    background: rgb(98, 180, 238);
-    color: #fff;
+    background: rgb(244, 244, 244);
     border-radius: 5px;
     margin: 0 0 5px 5px;
 }
@@ -781,7 +780,8 @@ export default {
     text-align: center;
     display: flex;
     height: 40px;
-    background: rgb(244, 244, 244);
+    background: rgb(88, 121, 198);
+    color: #fff;
     margin-top: auto;
 }