Pārlūkot izejas kodu

标准点识别和切割完成

Your Name 1 gadu atpakaļ
vecāks
revīzija
c3f6f7d36f
2 mainītis faili ar 84 papildinājumiem un 17 dzēšanām
  1. 40 8
      src/views/papers/cutPaper.vue
  2. 44 9
      src/views/tasks/Index.vue

+ 40 - 8
src/views/papers/cutPaper.vue

@@ -217,7 +217,7 @@
       </el-row>
       <div slot="footer" class="dialog-footer">
         <el-button @click="open = false">取 消</el-button>
-        <el-button type="primary" @click="updatePaperRecInfo">保 存</el-button>
+        <el-button type="primary" @click="updatePaperScore">保 存</el-button>
       </div>
     </el-dialog>
   </section>
@@ -380,6 +380,7 @@
           this.stdPoints = res.data.data.stdPoints?JSON.parse(res.data.data.stdPoints):{};
           this.snoImg = res.data.data.khPoints;
           this.khPointsCrop = res.data.data.khPointsCrop?JSON.parse(res.data.data.khPointsCrop):{};
+          this.ansCardImgList = res.data.data.ansPoints?JSON.parse(res.data.data.ansPoints):[];
           this.ansPointsCrop = res.data.data.ansPointsCrop?[res.data.data.ansPointsCrop]:[];
           this.khType = res.data.data.khType;
           this.khLength = res.data.data.khLength;
@@ -407,7 +408,7 @@
         this.$api.getPaperInfo({id:curPaperId}).then((res) => {
           let imgs = JSON.parse(res.data.data.imgs);
           this.curPaperImg = imgs[0];
-          this.ansCardImgList = [res.data.data.ansPoints];
+          this.ansCardImgList = res.data.data.ansPoints?JSON.parse(res.data.data.ansPoints):[];
           this.snoImg = res.data.data.khPoints;
           if(res.data.data.stdChoices){
             this.stdChoiceList = JSON.parse(res.data.data.stdChoices);
@@ -449,6 +450,35 @@
           this.open = false;
         })
       },
+      updatePaperScore() {
+        if (!this.stdPointImg) {
+          this.msgError("请标注标准点!")
+          return
+        }
+        if (!this.snoImg) {
+          this.msgError("请标注考号区域!")
+          return
+        }
+        if (!this.ansCardImgList.length) {
+          this.msgError("请标注客观题区域!")
+          return
+        }
+        let params = {
+          id: this.$route.query.id,
+          stdQnoPoints: this.stdQnoPoints,
+          khPoints: this.snoImg,
+          ansPoints: this.ansCardImgList,
+          stdChoices: this.stdChoiceList,
+          stdQueList:this.stdQueList,
+          khType:this.khType,
+          khLength:this.khLength,
+        }
+        this.$api.updatePaperInfo(params).then(res => {
+          this.msgSuccess("成功!");
+          this.getData();
+          this.open = false;
+        })
+      },
       initCropper() {
         let that = this;
         that.myCropper = null;
@@ -495,8 +525,8 @@
                 if (that.stepNum == 1) {
                   that.stdPointImg = cropperImgData;
                   that.$api.tryRecArray({
-                            sx: cropData.x,
-                            sy: cropData.y,
+                            sx:cropData.x,
+                            sy:cropData.y,
                             yz: that.stdThreshVal,
                             img: that.stdPointImg,
                             khLength: 15
@@ -506,15 +536,16 @@
                       that.stdPointImg = b64img;
                       that.stdPoints = oneRect;
                   })
+                  // that.stdPoints = {"x":cropData.x,"y":cropData.y,"w":cropData.width,"h":cropData.height};
                 }
                 // 考号区域
                 if (that.stepNum == 2) {
                   let khPointsCrop = {
-                    x:cropData.x,
-                    y:cropData.y,
+                    x:cropData.x,y:cropData.y,
                     w:cropData.width,h:cropData.height
                     }
                   khPointsCrop["x"] = khPointsCrop["x"]-that.stdPoints["x"];
+                  
                   khPointsCrop["y"] = khPointsCrop["y"]-that.stdPoints["y"];
 
                   that.khPointsCrop = khPointsCrop;
@@ -525,12 +556,13 @@
                 // 客观题
                 if (that.stepNum == 3) {
                   let khPointsCrop = {
-                    x:cropData.x,
-                    y:cropData.y,
+                    x:cropData.x,y:cropData.y,
                     w:cropData.width,h:cropData.height
                     }
+                  
                   khPointsCrop["x"] = khPointsCrop["x"]-that.stdPoints["x"];
                   khPointsCrop["y"] = khPointsCrop["y"]-that.stdPoints["y"];
+
                   that.ansPointsCrop = khPointsCrop;
                   that.ansCardImgList.push(cropperImgData);
                 }

+ 44 - 9
src/views/tasks/Index.vue

@@ -96,14 +96,18 @@
           <el-row>
             <el-col :span="24">
               <el-tabs v-model="activeName" @tab-click="handleTabClick">
-                <el-tab-pane :label="'正常('+studentsList.length+')'" name="first"></el-tab-pane>
-                <el-tab-pane label="异常" name="second"></el-tab-pane>
+                <el-tab-pane :label="'正常('+recTotal+')'" :name="1"></el-tab-pane>
+                <el-tab-pane label="异常" :name="0"></el-tab-pane>
               </el-tabs>
             </el-col>
           </el-row>
           <el-table v-loading="loading" :data="studentsList" style="width: 100%; margin-top: 10px" height="60vh">
-            <el-table-column align="center" prop="student_name" label="姓名" width="80" />
-            <el-table-column align="center" prop="student_no" label="考号" />
+            <el-table-column align="center" prop="student_no" label="姓名" width="80" />
+            <el-table-column align="center" prop="student_no" label="考号" width="150">
+              <template slot-scope="scope">
+                  <el-button type="text" @click="showStudentImgs(scope.row)" size="mini">{{scope.row.student_no}}</el-button>
+              </template>
+            </el-table-column>
             <el-table-column align="center" prop="objective_score" label="得分" />
             <!-- <el-table-column align="center" prop="mark_status" label="试卷状态">
               <template slot-scope="scope">
@@ -130,6 +134,7 @@
               </template>
             </el-table-column>
           </el-table>
+          <Page ref="pageButton" :current="recPage" :page_size="recPageSize" :total="recTotal" @pageChange="goRecPage" />
         </el-col>
         <el-col :span="11">
           <div style="height:70vh;overflow-y:scroll;position: relative;">
@@ -184,8 +189,12 @@
         studentsList:[],
         showAnsVisible:false,
         curStudentRecImg:"",
-        activeName:"first",
-        curTaskId:null
+        activeName:1,
+        curTaskId:null,
+        recPage:1,
+        recPageSize:20,
+        recTotal:0,
+        recParams:{}
       };
     },
     methods: {
@@ -217,6 +226,20 @@
         this.queryParams.page = this.$refs.pageButton.page;
         this.getData();
       },
+      goRecPage(size) {
+        if (size) {
+          this.recPageSize = size;
+        }
+        this.recPage = this.$refs.pageButton.page;
+        this.recParams = {
+          task_id:this.curTaskId,
+          page:this.recPage,
+          page_size:this.recPageSize,
+          status:this.activeName
+        }
+        window.clearInterval(this.timer);
+        this.openUploadPaper(this.curTaskId)
+      },
       getData() {
         this.loading = true;
         this.$api
@@ -285,13 +308,21 @@
         this.taskid = id
         let that = this;
         this.loading = true;
-        this.$api.getMarkTaskStudents({task_id:id}).then(res=>{
+        this.recParams = {
+          task_id:id,
+          page:this.recPage,
+          page_size:this.recPageSize,
+          status:this.activeName
+        }
+        this.$api.getMarkTaskStudents(this.recParams).then(res=>{
           this.studentsList = res.data.data.list;
+          this.recTotal = res.data.data.total;
           this.loading = false;
         })
         this.timer = setInterval(function(){
-          that.$api.getMarkTaskStudents({task_id:id}).then(res=>{
+          that.$api.getMarkTaskStudents(that.recParams).then(res=>{
             that.studentsList = res.data.data.list;
+            that.recTotal = res.data.data.total;
           })
         },4000)
       },
@@ -323,6 +354,10 @@
       handleRemove(e){
         console.log(e)
       },
+      showStudentImgs(row){
+        this.curStudentRecImg = row.imgs;
+        this.showAnsVisible = true;
+      },
       showCurRecImg(row){
         this.curStudentRecImg = row.ans_imgs.replace(".png","_draw_ans.png");
         this.showAnsVisible = true;
@@ -335,8 +370,8 @@
         this.curStudentRecImg = row.ans_imgs.replace("_ans"+ext,"_sno"+ext);
         this.showAnsVisible = true;
       },
+      
       handleTabClick(){
-
       },
       downloadObjectiveResult(task_id){
         this.$api