Your Name hai 1 ano
pai
achega
7740fbd7b3

+ 10 - 0
package-lock.json

@@ -24877,6 +24877,11 @@
       "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
       "dev": true
     },
+    "v-contextmenu": {
+      "version": "3.1.1",
+      "resolved": "https://registry.npmmirror.com/v-contextmenu/-/v-contextmenu-3.1.1.tgz",
+      "integrity": "sha512-BbniJm48f5N8OdJK1b9HNpdWFcUGoNvV3vgn7leqk5BBSDNHBMLTRHi54iNrV1jaZMhtgYfK11Hmy3mDXFMTqQ=="
+    },
     "verror": {
       "version": "1.10.0",
       "resolved": "https://registry.npmmirror.com/verror/-/verror-1.10.0.tgz",
@@ -24910,6 +24915,11 @@
         "markdown-it": "^8.4.0"
       }
     },
+    "vue-contextmenujs": {
+      "version": "1.4.11",
+      "resolved": "https://registry.npmmirror.com/vue-contextmenujs/-/vue-contextmenujs-1.4.11.tgz",
+      "integrity": "sha512-k8y0ExOL5yn7fRRCo6UDT81ekq/Ls1JBz70eBBpIgcf1p++84amDL6uCMmlt6D6WK5a9f0NhW2kc2pkCUb2bHA=="
+    },
     "vue-cropper": {
       "version": "0.4.9",
       "resolved": "https://registry.npmmirror.com/vue-cropper/download/vue-cropper-0.4.9.tgz",

+ 2 - 0
package.json

@@ -19,8 +19,10 @@
     "js-base64": "^2.5.2",
     "qrcode.vue": "^1.7.0",
     "url-search-params-polyfill": "^8.0.0",
+    "v-contextmenu": "^3.1.1",
     "vue": "^2.6.6",
     "vue-baidu-map": "^0.21.22",
+    "vue-contextmenujs": "^1.4.11",
     "vue-full-calendar": "^2.8.1-0",
     "vue-fullcalendar": "^1.0.9",
     "vue-router": "^3.0.1",

+ 8 - 0
src/api.js

@@ -139,6 +139,9 @@ export default {
     tryRecPaper: params => {
         return axios.post(`${baseURL}/api/admin/papers/rec/try`, params)
     },
+    tryRecArray: params => {
+        return axios.post(`${baseURL}/api/admin/papers/rec/onerect`, params)
+    },
     // 试卷管理
     getDoctorsSearchList: params => {
         return axios.get(`${baseURL}/api/admin/doctor/search/list`, { params: params })
@@ -178,4 +181,9 @@ export default {
     delMarkTaskStudents: params => {
         return axios.delete(`${baseURL}/api/admin/marktask/students`, { params: params })
     },
+    downloadObjectiveResult:params => {
+		return axios.get(`${baseURL}/api/admin/papers/task/students/download`, {
+			params: params, responseType: "blob"
+		});
+	},
 }

BIN=BIN
src/assets/scanner.png


BIN=BIN
src/assets/stdkh.jpg


+ 7 - 7
src/constant.js

@@ -35,12 +35,12 @@ export default{
         {label:"A4",value:"A4"}
     ],
     ansOptionList:[
-        {label:"A",value:"A"},
-        {label:"B",value:"B"},
-        {label:"C",value:"C"},
-        {label:"D",value:"D"},
-        {label:"E",value:"E"},
-        {label:"F",value:"F"},
-        {label:"G",value:"G"}
+        {label:"A",value:"A",flag:0},
+        {label:"B",value:"B",flag:0},
+        {label:"C",value:"C",flag:0},
+        {label:"D",value:"D",flag:0},
+        {label:"E",value:"E",flag:0},
+        {label:"F",value:"F",flag:0},
+        {label:"G",value:"G",flag:0}
     ],
 }

+ 5 - 0
src/main.js

@@ -22,6 +22,11 @@ import '../public/static/UEditor/ueditor.config'
 import '../public/static/UEditor/ueditor.all'
 import '../public/static/UEditor/lang/zh-cn/zh-cn'
 import '../public/static/UEditor/themes/default/css/ueditor.css';
+// import VContextMenu from 'v-contextmenu';
+// Vue.use(VContextMenu);
+
+import Contextmenu from "vue-contextmenujs"
+Vue.use(Contextmenu);
 
 Vue.component('vue-ueditor-wrap', VueUeditorWrap)
 // Vue.use(FullCalendar)

+ 8 - 1
src/router.js

@@ -79,7 +79,14 @@ export default new Router({
                         import ('./views/papers/cutPaper.vue'),
                     name: '试卷切割',
                     hide:1
-                }
+                },
+                {
+                    path: '/papertpl/drawer',
+                    component: () =>
+                        import ('./views/papers/canvasDrawer.vue'),
+                    name: '试卷切割',
+                    hide:1
+                },
                 
             ]
         },

+ 18 - 1
src/views/papers/Index.vue

@@ -32,7 +32,8 @@
       <el-table-column align="center" prop="ctime" label="创建时间" />
       <el-table-column align="center" prop="date" label="操作" width="320">
         <template slot-scope="scope">
-          <el-button @click="edit(scope.row.id)" size="mini" type="warning">编辑</el-button>
+            <el-button @click="edit(scope.row.id)" size="mini" type="primary">编辑</el-button>
+          <el-button @click="cutpaper(scope.row.id)" size="mini" type="warning">试卷分隔</el-button>
           <el-button @click="del(scope.row.id)" size="mini" type="danger">删除</el-button>
         </template>
       </el-table-column>
@@ -61,6 +62,7 @@
             class="upload-demo"
             action="/api/admin/uploadfile"
             :on-success="handleSuccess"
+            :on-remove="handleRemove"
             :file-list="fileList"
             list-type="picture">
             <el-button size="small" type="primary">点击上传</el-button>
@@ -154,7 +156,22 @@
       handleSuccess(res){
         this.fileList.push({"name":res.data.name,"url":res.data.url})
       },
+      handleRemove(file,fileList){
+        console.log(file,fileList,22222222222)
+        this.fileList = fileList
+      },
       edit(id) {
+        this.fileList = [];
+        this.$api.getPaperInfo({id:id}).then(res=>{
+          this.form = res.data.data;
+          let imgs = res.data.data.imgs?JSON.parse(res.data.data.imgs):[];
+          imgs.forEach((item,index)=>{
+            this.fileList.push({"name":item,"url":item})
+          })
+          this.open = true;
+        })
+      },
+      cutpaper(id) {
         this.title = "编辑医生";
         this.$router.push({path:"/papertpl/cutpaper",query:{id:id}})
       },

+ 420 - 0
src/views/papers/canvasDrawer.vue

@@ -0,0 +1,420 @@
+<template>
+    <div>
+        <el-form :inline="true">
+            <el-form-item label="考号类型">
+                <el-radio v-model="khType" :label="1" :value="1">手写</el-radio>
+                <el-radio v-model="khType" :label="2" :value="2">条码</el-radio>
+            </el-form-item>
+            <el-form-item label="考号位数">
+                <el-input-number size="mini" v-model="khLength" :min="6" :max="20" label="描述文字"></el-input-number>
+            </el-form-item>
+            <el-form-item label="识别设置">
+                <el-radio v-model="recTarget" :label="1" :value="1">整块区域</el-radio>
+                <el-radio v-model="recTarget" :label="2" :value="2">单个涂点</el-radio>
+            </el-form-item>
+            <el-form-item>
+                <el-button type="primary" size="mini" @click="updateStdKhInfo">保存</el-button>
+            </el-form-item>
+        </el-form>
+        <div style="border:1px solid #ccc;overflow: scroll;" @contextmenu.prevent="onContextmenu">
+            <canvas id="myCanvas" ref="myCanvas" :width="srcImgWidth" :height="srcImgHeight" @click="findRect"
+                @mousedown="mousedown" @mouseup="mouseup" @mousemove="mousemove">
+            </canvas>
+            <canvas id="myCopyCanvas" ref="myCopyCanvas" :width="srcImgWidth" :height="srcImgHeight"
+                style="display: none;">
+            </canvas>
+            <canvas id="myCropCanvas" ref="myCropCanvas" :width="rectWidth" :height="rectHeight">
+            </canvas>
+            <img :src="srcImg" width="100%" alt="" id="stdKhImg" style="display:none;">
+        </div>
+    </div>
+</template>
+
+<script>
+    export default {
+        name: "canvasDrawer",
+        props: {
+            srcImg: String,
+            curId:String
+        },
+        data() {
+            return {
+                flag: false,
+                rectWidth: 0, //矩形框的宽
+                rectHeight: 0, //矩形框的高
+                totalRect: [], //画的所有的矩形坐标长度数据存储在数组中
+                downX: 0, //鼠标点击图片落下时的位置(X)
+                downY: 0, //鼠标点击图片落下时的位置(Y)
+                ctx: "", //dom节点
+                canvas: null,
+                rectTag: false,
+                delIndex: null, //删除时选中的矩形框的index
+                atime: null,
+                dialogVisible: false, //删除的弹出框
+                keyCode: null,
+                startX: null,
+                startY: null,
+                img: null,
+                imgWidth: null,
+                imgHeight: null,
+                cropWidth: 0,
+                cropHeight: 0,
+                khType: 1,
+                khLength: 6,
+                recTarget: 1,
+                curArea:null,
+                stdRect:null,
+                srcImgWidth:null,
+                srcImgHeight:null,
+                stdKhList:[]
+            };
+        },
+        created() {
+            var image = new Image();
+            image.src = this.srcImg
+            this.srcImgWidth = image.width;
+            this.srcImgHeight = image.height;
+            this.getData();
+        },
+        mounted() {
+            var image = new Image();
+            image.src = this.srcImg
+            this.srcImgWidth = image.width;
+            this.srcImgHeight = image.height;
+            let that = this
+            // 绘图canvas
+            this.canvas = this.$refs.myCanvas;
+            this.canvas = document.getElementById("myCanvas")
+            this.ctx = this.canvas.getContext("2d");
+            // 复制canvas
+            this.copyCanvas = document.getElementById("myCopyCanvas")
+            this.copyCtx = this.copyCanvas.getContext("2d");
+            // 裁剪canvas
+            this.cropCanvas = document.getElementById("myCropCanvas")
+            this.cropCtx = this.cropCanvas.getContext("2d");
+
+            let img = document.getElementById("stdKhImg");
+
+            img.onload = function () {
+                that.ctx.drawImage(img, 0, 0, that.srcImgWidth, that.srcImgHeight, 0, 0, that.srcImgWidth, that
+                    .srcImgHeight)
+                that.copyCtx.drawImage(img, 0, 0, 672, 264, 0, 0, 672, 264)
+            }
+            that.img = img
+
+            document.onkeydown = function (event) {
+                that.keyCode = event.keyCode
+            }
+
+            document.onkeyup = function (event) {
+                that.keyCode = null
+                that.downX = that.startX
+                that.downY = that.downY
+                that.startX = null
+                that.startY = null
+
+            }
+        },
+
+        methods: {
+            onContextmenu(event) {
+                this.$contextmenu({
+                    items: [{
+                        label: "复制",
+                        onClick: () => {
+                            this.message = "返回(B)";
+                            console.log("返回(B)");
+                        }
+                    }, {
+                        label: "删除",
+                        onClick: () => {
+                            this.del()
+                        }
+                    }, {
+                        label: "刷新",
+                        onClick: () => {
+                            this.clear();
+                            this.totalRect = [];
+                            this.redrawAll();
+                        }
+                    },{
+                        label: "正列",
+                        onClick: () => {
+                            this.message = "返回(B)";
+                            console.log("返回(B)");
+                            this.zhenlie();
+                        }
+                    }],
+                    x: event.clientX,
+                    y: event.clientY,
+                    zIndex: 10000,
+                    minWidth: 100
+                })
+            },
+            copy() {
+                console.log("复制操作");
+            },
+
+            delete() {
+                console.log("删除操作");
+            },
+            zhenlie(){
+                let stdW = this.stdRect["w"];
+                let stdH = this.stdRect["h"];
+                // 计算涂点间距
+                let totalWidth = this.curArea["w"];
+                let totalHeight = this.curArea["h"];
+                let startX = this.curArea["x"];
+                let startY = this.curArea["y"];
+                let stepW = (totalWidth - stdW*this.khLength)/(this.khLength-1);
+                let stepH = (totalHeight - stdH*10)/9;
+                // 计算阵列矩形列表
+                let rectArray = [];
+                let stdKhList = [];
+                for(var i=0;i<this.khLength;i++){
+                    let tmpRow = [];
+                    for(var j=0;j<10;j++){
+                        let tmp = {
+                            beforex:(stepW+stdW)*i+startX,
+                            beforey:(stepH+stdH)*j+startY,
+                            rectW:stdW,
+                            rectH:stdH
+                        }
+                        rectArray.push(tmp)
+                        tmpRow.push(tmp)
+                    }
+                    stdKhList.push(tmpRow)
+                }
+                this.clear();
+                this.totalRect = rectArray;
+                this.stdKhList = stdKhList;
+                this.redrawAll();
+            },
+            zoom2(flag = true) {
+                const scale = 0.8;
+                const beta = flag ? 1 / scale : scale;
+                this.ctx.scale(beta, beta);
+            },
+            // 放下鼠标
+            mousedown(e) {
+                console.log("鼠标落下");
+                this.atime = new Date().getTime();
+                this.flag = true;
+                this.downX = e.offsetX; // 鼠标落下时的X
+                this.downY = e.offsetY; // 鼠标落下时的Y
+                this.mousemove(e);
+            },
+            // 移动鼠标
+            mousemove(e) {
+                if (this.flag) {
+                    //判断如果重右下往左上画,这种画法直接return
+                    if (this.downX - e.offsetX > 0 || this.downY - e.offsetY > 0) {
+                        console.log("重右下往左上画");
+                        return
+                    } else {
+                        console.log("重左上往右下画");
+                        this.clear(); //清空画布
+                        this.redrawAll();
+                        console.log(this.keyCode)
+                        if (this.keyCode == 32) {
+                            this.startX = this.downX + (e.offsetX - this.downX) - this.rectWidth
+                            this.startY = this.downY + (e.offsetY - this.downY) - this.rectHeight
+                            //   console.log(startX,startY,this.rectWidth,this.rectHeight)
+                            this.drawRect(
+                                this.startX,
+                                this.startY,
+                                this.rectWidth,
+                                this.rectHeight
+                            )
+                        } else {
+                            //如果重左上往右下画,计算出鼠标移动的距离,也就是矩形框的宽和高
+                            this.rectWidth = Math.abs(this.downX - e.offsetX)
+                            this.rectHeight = Math.abs(this.downY - e.offsetY)
+                            console.log("this.rectWidth", this.rectWidth);
+                            console.log("this.rectHeight", this.rectHeight);
+                            //判断这个宽高的长度,如果小于10,直接return,因为鼠标移动距离过于短
+                            //防止点击页面时,会画成一个点,没有意义
+                            if (this.rectWidth < 10 || this.rectHeight < 10) {
+                                console.log("只是点击");
+                                this.rectWidth = 0;
+                                this.rectHeight = 0;
+                                return;
+                            }
+                            if (this.startX) {
+                                this.downX = this.startX
+                            }
+                            if (this.startY) {
+                                this.downY = this.startY
+                            }
+                            this.drawRect(
+                                this.downX,
+                                this.downY,
+                                this.rectWidth,
+                                this.rectHeight
+                            )
+                        }
+                    }
+                }
+            },
+            // 抬起鼠标
+            mouseup(e) {
+                // console.log("鼠标抬起");
+                this.flag = false;
+                let a = new Date().getTime();
+                console.log(a - this.atime, 444444444)
+                if (a - this.atime > 150) {
+                    this.rectTag = false;
+                } else {
+                    this.rectTag = true;
+                }
+                if (this.rectWidth || this.rectHeight) {
+                    //将画出的数据保存在totalRect中
+                    this.totalRect.push({
+                        beforex: this.downX,
+                        beforey: this.downY,
+                        rectW: this.rectWidth,
+                        rectH: this.rectHeight,
+                    });
+
+                    let data = this.copyCtx.getImageData(this.downX, this.downY, this.rectWidth, this.rectHeight)
+                    this.cropWidth = this.rectWidth;
+                    this.cropHeight = this.rectHeight;
+                    let c = document.getElementById("myCropCanvas");
+                    let ctx = c.getContext("2d");
+                    ctx.putImageData(data, 0, 0)
+                    let val = c.toDataURL("image/jpeg");
+                    // 单个涂点
+                    if (this.recTarget == 2) {
+                        this.$api.tryRecArray({
+                            sx: this.downX,
+                            sy: this.downY,
+                            img: val,
+                            khLength: 15
+                        }).then(res => {
+                            let oneRect = res.data.data.oneRect;
+                            this.totalRect.pop()
+                            this.totalRect.push({
+                                beforex: oneRect.x,
+                                beforey: oneRect.y,
+                                rectW: oneRect.w,
+                                rectH: oneRect.h
+                            })
+                            this.stdRect = {x:oneRect.x,y:oneRect.y,w:oneRect.w,h:oneRect.h}
+                            this.clear(); //清空画布
+                            this.redrawAll();
+
+                        })
+                    }else{
+                        this.curArea = {x:this.downX,y:this.downY,w:this.rectWidth,h:this.rectHeight}
+                    }
+                }
+            },
+            redrawAll() {
+                //    console.log("先画之前画过的图,保证画多个的时候看起来像前一个不消失");
+                this.ctx.drawImage(this.img, 0, 0)
+                if (this.totalRect.length > 0) {
+                    this.totalRect.forEach((e) => {
+                        //    console.log("eeeeeeeeeeeeeeeee",e);
+                        this.drawRect(e.beforex, e.beforey, e.rectW, e.rectH);
+                    });
+                }
+            },
+            //清除画布
+            clear() {
+                this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
+            },
+            drawRect(x, y, lineW, lineY) {
+                //   开始绘制;
+                this.ctx.beginPath();
+                //   //设置线条颜色,必须放在绘制之前
+                this.ctx.strokeStyle = "#850a1e";
+                //   console.log("44444444");
+                //   // 线宽设置,必须放在绘制之前
+                this.ctx.lineWidth = 1;
+                //   console.log("5555555555");
+                // strokeRect参数:(左上角x坐标,y:左上角y坐标,绘画矩形的宽度,绘画矩形的高度)
+                this.ctx.strokeRect(x, y, lineW, lineY);
+                //   console.log("66666666666666");
+            },
+            //点击画布
+            findRect(e) {
+                console.log(e,88888888888888)
+                if (this.rectTag || true) {
+                    console.log("this.totalRect", this.totalRect);
+                    //当点击画布的时候,计算有没有点再矩形框内、哪个矩形框内
+                    this.totalRect.map((item, index) => {
+                        if (
+                            e.offsetX - item.beforex > item.rectW ||
+                            e.offsetX < item.beforex ||
+                            e.offsetY - item.beforey > item.rectH ||
+                            e.offsetY < item.beforey
+                        ) {
+                            return;
+                        } else {
+                            //找到之后,设置下标
+                            this.delIndex = index;
+                            //打开删除弹框
+                            this.dialogVisible = true;
+                            console.log("this.delIndex", this.delIndex);
+                        }
+                    });
+                }
+            },
+            //点击删除按钮
+            del() {
+                this.dialogVisible = false;
+                //删除
+                this.ctx.clearRect(
+                    this.totalRect[this.delIndex].beforex - 2,
+                    this.totalRect[this.delIndex].beforey - 2,
+                    this.totalRect[this.delIndex].rectW + 4,
+                    this.totalRect[this.delIndex].rectH + 4
+                );
+                //删掉totalRect的数据,真正的项目中需要调用后台接口,删掉数据库中存储的数据
+                this.totalRect.splice(this.delIndex, 1);
+                //删掉之后,再画一次,刷新页面
+                this.redrawAll();
+                console.log(this.totalRect, "删除了没");
+            },
+            getData(){
+                this.totalRect = [];
+                this.$api.getPaperInfo({id:this.curId}).then((res) => {
+                    this.khType = res.data.data.khType;
+                    this.khLength = res.data.data.khLength;
+                    let stdKhList = JSON.parse(res.data.data.stdKhList);
+                    stdKhList.forEach((children,index)=>{
+                        children.forEach((item,index)=>{
+                            this.totalRect.push(item)
+                        })
+                    })
+                    this.redrawAll();
+                });
+            },
+            updateStdKhInfo(){
+                let params = {
+                    id: this.curId,
+                    stdKhList:this.stdKhList,
+                    khType:this.khType,
+                    khLength:this.khLength,
+                    khPoints:this.srcImg
+                }
+                this.$api.updatePaperInfo(params).then(res => {
+                    this.msgSuccess("成功!");
+                    this.open = false;
+                })
+            }
+        },
+    };
+</script>
+
+<style lang="scss" scoped>
+    #myCanvas {
+        background-color: #ccc;
+    }
+
+    .dislog {
+        /* width: 200px; */
+        /* height: 200px; */
+        background-color: pink;
+    }
+</style>

+ 101 - 27
src/views/papers/cutPaper.vue

@@ -41,6 +41,11 @@
             <div slot="header" class="clearfix">
               <span>标注考号区域</span>
             </div>
+            <div style="margin-bottom:10px;">
+              <i class="el-icon-edit" @click="editKhCard(snoImg,curPaperId)"
+                style="float:right;color:blue;margin-right:20px;cursor: pointer;"></i>
+              <div class="clear"></div>
+            </div>
             <el-image height="60px" width="100%" :src="snoImg" :preview-src-list="[snoImg]"></el-image>
           </el-card>
           <el-card class="box-card" v-if="stepNum==3">
@@ -63,6 +68,10 @@
         </div>
       </el-col>
     </el-row>
+    <!-- 涂点考号 -->
+    <el-dialog title="考号设置" :visible.sync="khOpen" width="65%" append-to-body>
+        <canvasDrawer v-if="khOpen" :srcImg="snoImg" :curId="curPaperId" />
+    </el-dialog>
     <!-- 客观题设置 -->
     <el-dialog title="客观题设置" :visible.sync="open" width="90%" append-to-body>
       <el-row :gutter="20">
@@ -98,24 +107,46 @@
                   <el-option label="多选" value="多选">多选</el-option>
                 </el-select>
               </el-form-item>
-              <el-form-item label="标准答案">
+              <!-- <el-form-item label="标准答案">
                 <el-select size="mini" v-model="addQueForm.stdAns" multiple>
                   <el-option :label="item.label" :value="item.value" v-for="(item,index) in $const.ansOptionList"
                     :key="index"></el-option>
                 </el-select>
-              </el-form-item>
+              </el-form-item> -->
               <el-form-item>
                 <el-button size="mini" type="primary" @click="addQues">设置</el-button>
               </el-form-item>
             </el-form>
 
-            <el-table :data="stdQueList">
-              <el-table-column label="序号" prop="qno"></el-table-column>
+            <el-table :data="stdQueList.slice((currentPage-1)*pageSize,currentPage*pageSize)">
+              <el-table-column label="序号" prop="qno" width="60px"></el-table-column>
               <el-table-column label="题号" prop="qno"></el-table-column>
               <el-table-column label="分数" prop="score"></el-table-column>
               <el-table-column label="题型" prop="qtype"></el-table-column>
-              <el-table-column label="标准答案" prop="stdAns"></el-table-column>
+              <el-table-column label="标准答案" prop="stdAns" width="240px">
+                <template slot-scope="scope">
+                  <el-tag
+                    v-for="item in ansOptionList"
+                    :key="item.label"
+                    type="success"
+                    :effect="scope.row.stdAns.indexOf(item.value)==-1?'plain':'dark'"
+                    @click="setStdAns(scope.row,item)"
+                    size="mini"
+                    >
+                    {{ item.label }}
+                  </el-tag>
+                </template>
+              </el-table-column>
             </el-table>
+            <el-pagination
+              background
+              layout="prev, pager, next"
+              :page-sizes="[10,20,30,50]"
+              :page-size="pageSize"
+              @current-change="handleCurrentChange"
+              :current-page.sync="currentPage"
+              :total="stdQueList.length">
+            </el-pagination>
           </div>
         </el-col>
         <el-col :span="12">
@@ -175,10 +206,10 @@
             </el-col>
           </el-row>
           <div style="border:1px solid #ddd;position:relative;" v-loading="ansImgLoading">
-            <img v-if="recCurAnsImg" id="ansImage" ref="ansImage" width="100%" :src="recCurAnsImg" />
+            <img v-if="recCurAnsImg || stdChoiceList.length>0" id="ansImage" ref="ansImage" width="100%" :src="recCurAnsImg" />
             <img v-else id="ansImage" ref="ansImage" width="100%" :src="curAnsImg" />
             <!-- 题号 -->
-            <div :style="'display:inline-block;color:red;border:1px solid red;left:'+(item[0].x)+'px;top:'+(item[0].y)+'px;position:absolute;font-size:18px;'" v-for="(item,index) in stdQnoPoints" :key="index">{{item[0].qno}}</div>
+            <!-- <div :style="'display:inline-block;color:red;border:1px solid red;left:'+(item[0].x)+'px;top:'+(item[0].y)+'px;position:absolute;font-size:18px;'" v-for="(item,index) in stdQnoPoints" :key="index">{{item[0].qno}}</div> -->
           </div>
         </el-col>
       </el-row>
@@ -191,11 +222,13 @@
 </template>
 <script>
   import Page from "../../components/Page";
+  import canvasDrawer from "./canvasDrawer";
   import Cropper from 'cropperjs'
   import 'cropperjs/dist/cropper.css'
   export default {
     components: {
       Page,
+      canvasDrawer
     },
     data() {
       return {
@@ -215,36 +248,45 @@
         stepNum: 3,
         stdPointImg: "",
         snoImg: "",
+        snoImgW:0,
+        snoImgH:0,
         ansCardImgList: [],
         curAnsImg: "",
         curRecAnsImg: "",
         ansOptionList: [{
             label: "A",
-            value: 0
+            value: "A",
+            flag:0
           },
           {
             label: "B",
-            value: 1
+            value: "B",
+            flag:0
           },
           {
             label: "C",
-            value: 0
+            value: "C",
+            flag:0
           },
           {
             label: "D",
-            value: 0
+            value: "D",
+            flag:0
           },
           {
             label: "E",
-            value: 0
+            value: "E",
+            flag:0
           },
           {
             label: "F",
-            value: 0
+            value: "F",
+            flag:0
           },
           {
             label: "G",
-            value: 0
+            value: "G",
+            flag:0
           }
         ],
         stdAnsOptionList: [{
@@ -269,13 +311,7 @@
         optionDir: 1,
         queDir: 2,
         addQueForm: {},
-        stdQueList: [{
-          no: "",
-          qno: "",
-          score: 1,
-          qtype: "单选",
-          stdAns: ""
-        }],
+        stdQueList: [],
         stdQnoPoints: [],
         curPaperImg: "",
         recCurAnsImg: "",
@@ -286,7 +322,12 @@
         myAnsCropper: null,
         dragMode: "crop",
         ansDragMode: "crop",
-        curPaperId:null
+        curPaperId:null,
+        currentPage:1,
+        pageSize:10,
+        khType:1,
+        khLength:6,
+        khOpen:false
       };
     },
     watch: {
@@ -331,6 +372,8 @@
           this.curPaperImg = imgs[0];
           this.ansCardImgList = [res.data.data.ansPoints];
           this.snoImg = res.data.data.khPoints;
+          this.khType = res.data.data.khType;
+          this.khLength = res.data.data.khLength;
           this.initCropper();
           this.loading = false;
         });
@@ -341,6 +384,9 @@
         this.form = {};
         // this.initCropper();
       },
+      editKhCard(item,curPaperId){
+        this.khOpen = true;
+      },
       editAnsCard(item,curPaperId) {
         this.open = true;
         this.curAnsImg = item;
@@ -357,6 +403,9 @@
           if(res.data.data.stdChoices){
             this.stdChoiceList = JSON.parse(res.data.data.stdChoices);
           }
+          if(res.data.data.stdQueList){
+            this.stdQueList = JSON.parse(res.data.data.stdQueList);
+          }
           this.loading = false;
         });
         this.initAnsCropper();
@@ -374,8 +423,11 @@
           id: this.$route.query.id,
           stdQnoPoints: this.stdQnoPoints,
           khPoints: this.snoImg,
-          ansPoints: this.ansCardImgList[0],
-          stdChoices: this.stdChoiceList
+          ansPoints: this.curAnsImg,
+          stdChoices: this.stdChoiceList,
+          stdQueList:this.stdQueList,
+          khType:this.khType,
+          khLength:this.khLength
         }
         this.$api.updatePaperInfo(params).then(res => {
           this.msgSuccess("成功!");
@@ -421,7 +473,8 @@
             cropstart: function (e) {},
             cropend: function (e) {
               if (that.dragMode == "crop") {
-                // let cropData = that.myCropper.getCropBoxData();
+                let cropData = that.myCropper.getCropBoxData();
+                console.log(cropData,333333333333)
                 let cropperImgData = this.cropper.getCroppedCanvas({
                   width: 1310
                 }).toDataURL("image/jpeg");
@@ -430,6 +483,9 @@
                 }
                 if (that.stepNum == 2) {
                   that.snoImg = cropperImgData;
+                  that.snoImgW = cropData.width;
+                  that.snoImgH = cropData.height;
+                  console.log(that.snoImgW,that.snoImgH,33333333333333)
                 }
                 if (that.stepNum == 3) {
                   that.ansCardImgList.push(cropperImgData);
@@ -509,7 +565,6 @@
           if (!res.data.code) {
             this.recCurAnsImg = res.data.data.recImg;
             this.stdQnoPoints = res.data.data.ansCnts;
-            console.log(this.stdQnoPoints,44444444444444444)
             this.myAnsCropper.destroy();
             this.initAnsCropper();
           } else {
@@ -529,7 +584,7 @@
               // item.qtype = this.addQueForm.qtype
               this.stdQueList[index].score = this.addQueForm.score
               this.stdQueList[index].qtype = this.addQueForm.qtype
-              this.stdQueList[index].stdAns = this.addQueForm.stdAns.join(",")
+              // this.stdQueList[index].stdAns = this.addQueForm.stdAns.join(",")
               this.$set(this.stdQueList[index], "score", this.addQueForm.score)
               this.$forceUpdate();
             }
@@ -547,6 +602,18 @@
           }
           this.stdQueList.push(queRow)
         })
+      },
+      setStdAns(row,item){
+        let orgAns = row.stdAns.split(",")
+        if(orgAns.indexOf(item.value)==-1){
+          orgAns.push(item.value)
+        }else{
+          orgAns.splice(orgAns.indexOf(item.value),1)
+        }
+        row.stdAns = orgAns.join(",")
+      },
+      handleCurrentChange(val){
+        this.currentPage=val
       }
     },
     created() {
@@ -580,4 +647,11 @@
     color: red;
     cursor: pointer;
   }
+
+  .setScoreForm{
+    .el-pagination{
+      margin-top:20px;
+      float:right;
+    }
+  }
 </style>

+ 64 - 14
src/views/tasks/Index.vue

@@ -17,7 +17,7 @@
         </el-col>
         <el-col :span="4">
           <el-form-item label="年级" v-model="queryParams.grade_id">
-            <el-select size="mini">
+            <el-select v-model="queryParams.school_id" size="mini">
               <el-option label="高三一班" value="高三一班">高三一班</el-option>
             </el-select>
           </el-form-item>
@@ -32,8 +32,8 @@
     </el-form>
     <el-table v-loading="loading" :data="list" style="width: 100%; margin-top: 10px" height="50vh">
       <el-table-column align="center" prop="name" label="名称" />
-      <el-table-column align="center" prop="phone" label="参考人数" />
-      <el-table-column align="center" prop="phone" label="已上传人数" />
+      <!-- <el-table-column align="center" prop="phone" label="参考人数" /> -->
+      <!-- <el-table-column align="center" prop="phone" label="已上传人数" /> -->
       <el-table-column align="center" prop="ctime" label="创建时间" />
       <el-table-column align="center" prop="date" label="操作" width="320">
         <template slot-scope="scope">
@@ -65,7 +65,10 @@
     <!-- 预览识别结果 -->
     <el-dialog title="预览识别结果" :visible.sync="showAnsVisible" width="500px" append-to-body>
       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
-        <el-image :src="curStudentRecImg"></el-image>
+        <el-image :src="curStudentRecImg">
+          <div slot="error" class="image-slot">
+            <i class="el-icon-picture-outline"></i>
+          </div></el-image>
       </el-form>
       <div slot="footer" class="dialog-footer">
         <el-button @click="showAnsVisible = false">关 闭</el-button>
@@ -75,21 +78,39 @@
     <el-dialog title="试卷上传" :visible.sync="uploadDialogVisible" width="90%" @close="closeUploadDialog">
       <el-row :gutter="20">
         <el-col :span="13">
-          <el-row>
+          <!-- <el-row>
             <el-col :span="6">参考人数:{{studentsList.length}}</el-col>
             <el-col :span="6">已上传:{{studentsList.length}}</el-col>
             <el-col :span="6">识别异常:</el-col>
+          </el-row> -->
+          <el-form :inline="true">
+            <el-form-item label="姓名">
+              <el-input size="mini"></el-input>
+            </el-form-item>
+            <el-form-item>
+              <el-button type="primary" size="mini">搜索</el-button>
+              <el-button @click="downloadObjectiveResult(curTaskId)" type="warning" size="mini" icon="el-icon-download">导出</el-button>
+              <el-button size="mini" type="warning" icon="el-icon-printer">试卷扫描</el-button> 
+            </el-form-item>
+          </el-form>
+          <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-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="objective_score" label="得分" />
-            <el-table-column align="center" prop="mark_status" label="试卷状态">
+            <!-- <el-table-column align="center" prop="mark_status" label="试卷状态">
               <template slot-scope="scope">
                 <span v-if="scope.row.mark_status==0" style="color:#e6a23c;">待上传</span>
                 <span v-if="scope.row.mark_status==1" style="color:#85ce61;">已上传</span>
               </template>
-            </el-table-column>
+            </el-table-column> -->
             <el-table-column align="center" prop="mark_status" label="识别状态">
               <template slot-scope="scope">
                 <span v-if="scope.row.mark_status==0" style="color:#f78989;">异常</span>
@@ -104,14 +125,13 @@
             <el-table-column align="center" prop="date" label="操作" fixed="right" width="100px">
               <template slot-scope="scope">
                 <el-button @click="showCurRecImg(scope.row)" size="mini" type="text">查看</el-button>
-                <el-button @click="delStudents(scope.row.id)" size="mini" type="text">删除</el-button>
+                <el-button @click="delStudents(scope.row.id,scope.$index)" size="mini" type="text">删除</el-button>
               </template>
             </el-table-column>
           </el-table>
         </el-col>
         <el-col :span="11">
-            <el-button size="small" type="warning">试卷扫描</el-button>
-          <div style="height:70vh;overflow-y:scroll;">
+          <div style="height:70vh;overflow-y:scroll;position: relative;">
               <el-upload
                 class="upload-demo"
                 action="http://118.190.145.217/api/admin/papers/uploadpaper"
@@ -124,9 +144,9 @@
                 <el-button size="small" type="primary">点击上传</el-button>
                 <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>
               </el-upload>
+              <img v-if="fileList.length<1" src="../../assets/scanner.png" alt="" style="position:absolute;left: 50%;transform: translate(-50%,120px)">
           </div>
         </el-col>
-        
       </el-row>
       <div slot="footer" class="dialog-footer">
         <el-button type="primary" @click="closeUploadDialog">关 闭</el-button>
@@ -162,7 +182,9 @@
         timer:null,
         studentsList:[],
         showAnsVisible:false,
-        curStudentRecImg:""
+        curStudentRecImg:"",
+        activeName:"first",
+        curTaskId:null
       };
     },
     methods: {
@@ -178,7 +200,6 @@
               id: id,
             })
             .then((res) => {
-              console.log(res,3333333333333)
               if (!res.data.code) {
                 this.msgSuccess("删除成功");
                 this.getData();
@@ -258,6 +279,7 @@
         }
       },
       openUploadPaper(id) {
+        this.curTaskId = id
         this.uploadDialogVisible = true
         this.taskid = id
         let that = this;
@@ -291,9 +313,10 @@
           }
         }
       },
-      delStudents(id){
+      delStudents(id,index){
         this.$api.delMarkTaskStudents({id:id}).then(res=>{
           this.msgSuccess("删除成功!");
+          this.studentsList.splice(index,1)
         })
       },
       handleRemove(e){
@@ -302,6 +325,33 @@
       showCurRecImg(row){
         this.curStudentRecImg = row.ans_imgs.replace(".png","_draw_ans.png");
         this.showAnsVisible = true;
+      },
+      handleTabClick(){
+
+      },
+      downloadObjectiveResult(task_id){
+        this.$api
+          .downloadObjectiveResult({
+            task_id: task_id
+          })
+          .then((res) => {
+            var elink = document.createElement("a");
+            let blob = new Blob([res.data], {
+              type: "application/vnd.ms-excel,charset=UTF-8",
+            });
+            let objUrl = URL.createObjectURL(blob);
+            let file_name = decodeURIComponent(
+              res.headers["content-disposition"].split("=")[1]
+            );
+            console.log(file_name);
+            elink.download = file_name;
+            elink.style.display = "none";
+            elink.href = objUrl;
+            document.body.appendChild(elink);
+            elink.click();
+            document.body.removeChild(elink);
+            this.download_loading = false;
+          });
       }
     },
     created() {