Browse Source

workdetail

lsc 2 years ago
parent
commit
c0e222fd7f
1 changed files with 104 additions and 130 deletions
  1. 104 130
      src/components/pages/components/worksDetail2.vue

+ 104 - 130
src/components/pages/components/worksDetail2.vue

@@ -84,7 +84,7 @@
               <el-button
                 type="primary"
                 size="small"
-                @click="lookWork(scope.row.id, scope.row.userid)"
+                @click="lookWork(scope.row.id, scope.row.userid,scope.row.stage,scope.row.task)"
               >查看作业</el-button>
               <el-button type="primary" size="small" @click="lookData(scope.row.userid)">生成报告</el-button>
               <!-- <el-button
@@ -140,7 +140,11 @@
               </div>
               <div style="width: 310px; margin-right: 10px">
                 <div class="sd_score" style="box-sizing: border-box; width: 100%; box-shadow: none">
-                  <div class="score_box">
+                  <div class="score_box" v-for="(item,index) in worksDetail.eList" :key="index">
+                    <span>{{item.value}}</span>
+                    <el-rate v-model="worksDetail.rateList[item.value]"></el-rate>
+                  </div>
+                  <!-- <div class="score_box">
                     <span>意识能力</span>
                     <el-rate></el-rate>
                   </div>
@@ -159,7 +163,7 @@
                   <div class="score_box">
                     <span>工程思维能力</span>
                     <el-rate></el-rate>
-                  </div>
+                  </div>-->
                 </div>
                 <div class="data_body">
                   <div class="title">
@@ -178,18 +182,6 @@
                 <div class="comment">
                   <div class="comment_title">问答</div>
                   <div class="other_Answer">暂无提交问答</div>
-                  <!-- <div class="other_Answer">
-									<div class="toux">
-										<img src="../../../assets/portal.png" alt="" />
-									</div>
-									<div class="nav">
-										<div class="nameAndTime">
-											<div class="otherName">{{ this.commentName }}</div>
-											<div class="time">{{ this.commentTime }}</div>
-										</div>
-										<div class="otherAnswer">{{ this.commentAnswer }}</div>
-									</div>
-                  </div>-->
                 </div>
                 <div
                   class="lastTop"
@@ -203,110 +195,24 @@
                   "
                 >
                   <div class="moreSay">更多评价</div>
-                  <div class="more_say_input">
+                  <div class="more_say_input" v-if="worksDetail.rateList">
                     <el-input
                       type="textarea"
                       placeholder="还有要说的吗..."
                       :rows="8"
                       resize="none"
                       style="background: #fafafa"
+                      v-model="worksDetail.rateList.content"
                     ></el-input>
                   </div>
                 </div>
               </div>
               <!-- <div class="rbButtom" @click="giveScore">评分</div> -->
               <!-- @click="updateWorks(item.id, item.rate, index)" -->
-              <div class="rbButtom">评分</div>
+              <div class="rbButtom" @click="updateWorks()">评分</div>
             </div>
           </div>
         </el-dialog>
-        <el-dialog
-          :visible.sync="dialogVisible2"
-          :append-to-body="true"
-          width="700px"
-          :before-close="handleClose"
-          class="add_work talkScore"
-        >
-          <div slot="title" class="header-title">
-            <!-- <div class="logoImg">
-              <img src="../../../assets/logo.png" alt="" />
-            </div>-->
-            <div class="title_add_student">"评分"</div>
-          </div>
-          <div class="firstTop">
-            <div class="score_top">
-              <div class="userTou">
-                <img :src="sInfo.tx != null ? sInfo.tx : tx" alt />
-              </div>
-              <div class="score_user_name">{{ sInfo.sName }}</div>
-            </div>
-            <div class="course_top">
-              <div>课程名称</div>
-              <div>
-                {{
-                chapInfo[publicIndex] != null
-                ? chapInfo[publicIndex].dyName
-                : "暂无课程"
-                }}
-              </div>
-            </div>
-          </div>
-
-          <div class="sd_score">
-            <div class="score_box">
-              <span>意识能力</span>
-              <el-rate
-                v-model="rateList.ca"
-                :disabled="rateParams[5] != '' && rateParams[5] != undefined"
-              ></el-rate>
-            </div>
-            <div class="score_box">
-              <span>科学探究能力</span>
-              <el-rate
-                v-model="rateList.sia"
-                :disabled="rateParams[5] != '' && rateParams[5] != undefined"
-              ></el-rate>
-            </div>
-            <div class="score_box">
-              <span>实践创新能力</span>
-              <el-rate
-                v-model="rateList.eta"
-                :disabled="rateParams[5] != '' && rateParams[5] != undefined"
-              ></el-rate>
-            </div>
-            <div class="score_box">
-              <span>学习反思能力</span>
-              <el-rate
-                v-model="rateList.pia"
-                :disabled="rateParams[5] != '' && rateParams[5] != undefined"
-              ></el-rate>
-            </div>
-            <div class="score_box">
-              <span>工程思维能力</span>
-              <el-rate
-                v-model="rateList.lra"
-                :disabled="rateParams[5] != '' && rateParams[5] != undefined"
-              ></el-rate>
-            </div>
-          </div>
-          <div class="lastTop">
-            <div class="moreSay">更多评价</div>
-            <div class="more_say_input">
-              <el-input
-                type="textarea"
-                placeholder="还有要说的吗..."
-                :rows="3"
-                resize="none"
-                v-model="rateList.content"
-                :readonly="rateParams[5] != '' && rateParams[5] != undefined"
-                style="background: #fafafa"
-              ></el-input>
-            </div>
-          </div>
-
-          <div class="assess_right" @click="updateWorks" v-if="!uploadBoolean">提交</div>
-          <div class="assess_right" @click="updateWorks" v-else>提交</div>
-        </el-dialog>
       </div>
       <div class="student_page">
         <el-pagination
@@ -587,23 +493,85 @@ export default {
       this.page = val;
       this.getWorks();
     },
-    lookWork(id, uid) {
-      this.scopeId = id;
+    lookWork(id, uid, stage, task) {
+      // this.scopeId = id;
       let params = {
         uid: uid,
         cid: this.id,
+        stage: stage,
+        task: task,
       };
       this.ajax
-        .get(this.$store.state.api + "selectWorksDetail", params)
+        .get(this.$store.state.api + "selectWorksDetail2", params)
         .then((res) => {
           this.sInfo = res.data[0][0];
           this.chapInfo = JSON.parse(res.data[0][0].chapters);
+          var chapters = JSON.parse(res.data[0][0].chapters);
           var worksDetail = res.data[1];
-          var askArray = res.data[2];
+          // var askArray = res.data[2];
+          this.scopeId = res.data[2].length ? res.data[2][0].id : this.sInfo.id;
           var workJson = {
             img: [],
             imgIndex: 0,
+            eList: [],
+            rateList: {},
           };
+          var eList =
+            chapters[this.sInfo.stage].chapterInfo[0].taskJson[this.sInfo.task]
+              .eList;
+          //           ooption: [
+          //   { value: 0, name: "意识能力" },
+          //   { value: 0, name: "科学探究能力" },
+          //   { value: 0, name: "实践创新能力" },
+          //   { value: 0, name: "学习反思能力" },
+          //   { value: 0, name: "工程思维能力" },
+          // ],
+          if (eList) {
+            workJson.eList = eList;
+            var _ooption = [];
+            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: "工程思维能力" },
+            ];
+          }
+          if (this.sInfo.rate) {
+            var _rate = JSON.parse(this.sInfo.rate);
+            var _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 < worksDetail.length; i++) {
             workJson.img.push({ src: worksDetail[i].content, id: i });
@@ -615,14 +583,18 @@ export default {
           this.$forceUpdate;
           this.dialogVisible3 = true;
 
-          // if (this.chartObj[index]) {
-          //   _option.series[0].data = _ooption;
-          //   this.chartObj[index].setOption(_option);
-          // } else {
-          //   _option.series[0].data = _ooption;
-          //   this.setChart(index, _option);
-          // }
-          this.setChart(this.option);
+          setTimeout(() => {
+            var _ooption = JSON.parse(JSON.stringify(this.ooption));
+            var _option = JSON.parse(JSON.stringify(this.option));
+            if (this.chartObj) {
+              _option.series[0].data = _ooption;
+              this.chartObj.setOption(_option);
+            } else {
+              _option.series[0].data = _ooption;
+              this.setChart(_option);
+            }
+            // this.setChart(this.option);
+          }, 0);
         })
         .catch((err) => {
           console.error(err);
@@ -753,11 +725,11 @@ export default {
       this.dialogImageUrl = url;
       this.pictureDialog = true;
     },
-    updateWorks(id, rate, index) {
+    updateWorks() {
       let params = {
-        rate: rate,
+        rate: this.worksDetail.rateList,
         tuid: this.userid,
-        id: id,
+        id: this.scopeId,
       };
       this.ajax
         .get(this.$store.state.api + "updateWorks", params)
@@ -769,17 +741,17 @@ export default {
           var _ooption = JSON.parse(JSON.stringify(this.ooption));
           var _option = JSON.parse(JSON.stringify(this.option));
 
-          _ooption[0].value = rate.ca;
-          _ooption[1].value = rate.sia;
-          _ooption[2].value = rate.eta;
-          _ooption[3].value = rate.pia;
-          _ooption[4].value = rate.lra;
-          if (this.chartObj[index]) {
-            _option.series[0].data = _ooption;
-            this.chartObj[index].setOption(_option);
-          } else {
-            this.setChart(index, _ooption);
-          }
+          // _ooption[0].value = rate.ca;
+          // _ooption[1].value = rate.sia;
+          // _ooption[2].value = rate.eta;
+          // _ooption[3].value = rate.pia;
+          // _ooption[4].value = rate.lra;
+          // if (this.chartObj[index]) {
+          //   _option.series[0].data = _ooption;
+          //   this.chartObj[index].setOption(_option);
+          // } else {
+          //   this.setChart(index, _ooption);
+          // }
           // this.uploadBoolean = false;
           // this.dialogVisible2 = false;
         })
@@ -1091,6 +1063,8 @@ export default {
   border-radius: 5px;
   width: 90%;
   box-shadow: 2px 2px 5px #909090;
+  height: 220px;
+  overflow: auto;
 }
 .sd_score .score_box {
   display: flex;