Browse Source

更新导出功能

xjc 1 week ago
parent
commit
bb8dba8ab9

+ 18 - 7
public/index.html

@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <!DOCTYPE html>
 <html lang="en">
 <html lang="en">
 
 
-<head>
+  <head>
     <meta charset="utf-8">
     <meta charset="utf-8">
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
     <meta name="viewport" content="width=device-width,initial-scale=1.0">
     <meta name="viewport" content="width=device-width,initial-scale=1.0">
@@ -10,16 +10,27 @@
     <!-- <script src="https://api.map.baidu.com/api?v=1.0&type=webgl&ak=uscumpiG2CkippMbzaC7njksj7OuL7hj"></script> -->
     <!-- <script src="https://api.map.baidu.com/api?v=1.0&type=webgl&ak=uscumpiG2CkippMbzaC7njksj7OuL7hj"></script> -->
     <!-- <script src="https://printjs-4de6.kxcdn.com/print.min.js"></script>
     <!-- <script src="https://printjs-4de6.kxcdn.com/print.min.js"></script>
     <link rel="stylesheet" href="https://printjs-4de6.kxcdn.com/print.min.css"> -->
     <link rel="stylesheet" href="https://printjs-4de6.kxcdn.com/print.min.css"> -->
+    <link
+      href="https://kendo.cdn.telerik.com/themes/9.0.0/default/default-main.css"
+      rel="stylesheet" />
+    <link href="static/css/default-ocean-blue.css" rel="stylesheet" />
+    <script src="https://code.jquery.com/jquery-3.7.0.min.js"></script>
+
+    <script src="https://unpkg.com/jszip/dist/jszip.min.js"></script>
+    <script src="static/js/kendo.all.min.js"></script>
+    <!-- <script src="static/js/exportPdf.js"></script> -->
+
   </head>
   </head>
 
 
-<body>
+  <body>
     <noscript>
     <noscript>
-      <strong>We're sorry but admin doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
+      <strong>We're sorry but admin doesn't work properly without JavaScript
+        enabled. Please enable it to continue.</strong>
     </noscript>
     </noscript>
     <div id="app"></div>
     <div id="app"></div>
     <!-- built files will be auto injected -->
     <!-- built files will be auto injected -->
-</body>
-<script>
-    
-  </script>
+  </body>
+  <script>
+</script>
+
 </html>
 </html>

File diff suppressed because it is too large
+ 9 - 0
public/static/css/default-ocean-blue.css


BIN
public/static/font/msyh.ttf


BIN
public/static/font/simhei.ttf


+ 275 - 0
public/static/js/exportPdf.js

@@ -0,0 +1,275 @@
+$(document).ready(function() {
+    // pdf容器contenterPdf
+    var contenterPdf = $("#contenterPdf")
+    var baseX = contenterPdf.offset().left
+    var baseY = contenterPdf.offset().top
+    // 每一页pdf
+    var page_cell = contenterPdf.find(".page_cell")
+    // pdf数据
+    var pdfData = {
+        "stdPoints":[],
+        "titleInfo":{},
+        "studentInfo":[],
+        "studentNo":[],
+        "noteInfo":[],
+        "barCodeInfo":[],
+        "missExamInfo":[],
+        "objectiveQues":[]
+    }
+    Array.from(page_cell).forEach((item) => {
+        console.log(item)
+        // 标准点
+        var std_points = $(".stdPoints")
+        for(var i=0;i<std_points.length;i++){
+            point = std_points.eq(i)
+            console.log(point.offset(),2222222222)
+            pdfData.stdPoints.push({
+                x:point.offset().left-baseX,
+                y:point.offset().top-baseY,
+                w:point.width(),
+                h:point.height()
+            })
+        }
+        // 标题
+        var titleInfo = $("#paperNameTextAreaTem")
+        let pointObj = {}
+        pointObj.x = titleInfo.offset().left-baseX
+        pointObj.y = titleInfo.offset().top-baseY
+        pointObj.w = titleInfo.width()
+        pointObj.h = titleInfo.height()
+        pdfData.titleInfo = pointObj
+        // 考生信息
+        let pointList = []
+        // 姓名,下划线
+        pointList.push({
+            x:$("#name").offset().left-baseX,
+            y:$("#name").offset().top-baseY,
+            w:$("#name").width(),
+            h:$("#name").height(),
+            text:$("#name").text(),
+            type:"text"
+        })
+        pointList.push({
+            x:$("#nameLine").offset().left-baseX,
+            y:$("#nameLine").offset().top-baseY,
+            w:$("#nameLine").width(),
+            h:$("#nameLine").height(),
+            text:$("#nameLine").text(),
+            type:"line"
+        })
+        // 班级,下划线
+        pointList.push({
+            x:$("#className").offset().left-baseX,
+            y:$("#className").offset().top-baseY,
+            w:$("#className").width(),
+            h:$("#className").height(),
+            text:$("#className").text()
+        })
+        pointList.push({
+            x:$("#classNameLine").offset().left-baseX,
+            y:$("#classNameLine").offset().top-baseY,
+            w:$("#classNameLine").width(),
+            h:$("#classNameLine").height(),
+            text:$("#classNameLine").text(),
+            type:"line"
+        })
+        // 考场号,下划线
+        pointList.push({
+            x:$("#kcNo").offset().left-baseX,
+            y:$("#kcNo").offset().top-baseY,
+            w:$("#kcNo").width(),
+            h:$("#kcNo").height(),
+            text:$("#kcNo").text()
+        })
+        pointList.push({
+            x:$("#kcNoLine").offset().left-baseX,
+            y:$("#kcNoLine").offset().top-baseY,
+            w:$("#kcNoLine").width(),
+            h:$("#kcNoLine").height(),
+            text:$("#kcNoLine").text(),
+            type:"line"
+        })
+        // 座位号,下划线
+        pointList.push({
+            x:$("#sitNo").offset().left-baseX,
+            y:$("#sitNo").offset().top-baseY,
+            w:$("#sitNo").width(),
+            h:$("#sitNo").height(),
+            text:$("#sitNo").text(),
+        })
+        pointList.push({
+            x:$("#sitNoLine").offset().left-baseX,
+            y:$("#sitNoLine").offset().top-baseY,
+            w:$("#sitNoLine").width(),
+            h:$("#sitNoLine").height(),
+            text:$("#sitNoLine").text(),
+            type:"line"
+        })
+        pdfData.studentInfo = pointList
+        // 准考证号和填涂框
+        pointList = []
+        pointList.push({
+            x:$("#zkzh").offset().left-baseX,
+            y:$("#zkzh").offset().top-baseY,
+            w:$("#zkzh").width(),
+            h:$("#zkzh").height(),
+            type:"text"
+        })
+        for(var i=0;i<$(".zkzh_rect").length;i++){
+            pointList.push({
+                x:$(".zkzh_rect").eq(i).offset().left-baseX,
+                y:$(".zkzh_rect").eq(i).offset().top-baseY,
+                w:$(".zkzh_rect").eq(i).width(),
+                h:$(".zkzh_rect").eq(i).height(),
+                type:"rect"
+            })
+        }
+        pdfData.studentNo = pointList
+        // 注意事项
+        pointList = []
+        pointList.push({
+            x:$("#noteInfo").offset().left-baseX,
+            y:$("#noteInfo").offset().top-baseY,
+            w:$("#noteInfo").width(),
+            h:$("#noteInfo").height(),
+            type:"rect"
+        })
+        pointList.push({
+            x:$("#noteInfo_title").offset().left-baseX,
+            y:$("#noteInfo_title").offset().top-baseY,
+            w:$("#noteInfo_title").width(),
+            h:$("#noteInfo_title").height(),
+            type:"text",
+            text:$("#noteInfo_title").text()
+        })
+        for(var i=0;i<$(".noteInfo_desc").length;i++){
+            pointList.push({
+                x:$(".noteInfo_desc").eq(i).offset().left-baseX,
+                y:$(".noteInfo_desc").eq(i).offset().top-baseY,
+                w:$(".noteInfo_desc").eq(i).width(),
+                h:$(".noteInfo_desc").eq(i).height(),
+                type:"text",
+                text:$(".noteInfo_desc").eq(i).text()
+            })
+        }
+        pdfData.noteInfo = pointList
+
+        // 条形码区域
+        pointList = []
+        pointList.push({
+            x:$("#barCodeRect").offset().left-baseX,
+            y:$("#barCodeRect").offset().top-baseY,
+            w:$("#barCodeRect").width(),
+            h:$("#barCodeRect").height(),
+            type:"rect"
+        })
+        pointList.push({
+            x:$("#barCodeTitle").offset().left-baseX,
+            y:$("#barCodeTitle").offset().top-baseY,
+            w:$("#barCodeTitle").width(),
+            h:$("#barCodeTitle").height(),
+            type:"text",
+            text:$("#barCodeTitle").text()
+        })
+        pointList.push({
+            x:$("#barCodeNote").offset().left-baseX,
+            y:$("#barCodeNote").offset().top-baseY,
+            w:$("#barCodeNote").width(),
+            h:$("#barCodeNote").height(),
+            type:"text",
+            text:$("#barCodeNote").text()
+        })
+        pdfData.barCodeInfo = pointList
+        
+        // 缺考标记
+        pointList = []
+        pointList.push({
+            x:$("#missExamRect").offset().left-baseX,
+            y:$("#missExamRect").offset().top-baseY,
+            w:$("#missExamRect").width(),
+            h:$("#missExamRect").height(),
+            type:"rect"
+        })
+        pointList.push({
+            x:$("#exactFill").offset().left-baseX,
+            y:$("#exactFill").offset().top-baseY,
+            w:$("#exactFill").width(),
+            h:$("#exactFill").height(),
+            type:"text",
+            text:$("#exactFill").text()
+        })
+        pointList.push({
+            x:$("#exactFillRect").offset().left-baseX,
+            y:$("#exactFillRect").offset().top-baseY,
+            w:$("#exactFillRect").width(),
+            h:$("#exactFillRect").height(),
+            type:"rect",
+        })
+        pointList.push({
+            x:$("#missExamFill").offset().left-baseX,
+            y:$("#missExamFill").offset().top-baseY,
+            w:$("#missExamFill").width(),
+            h:$("#missExamFill").height(),
+            type:"text",
+            text:$("#missExamFill").text()
+        })
+        pointList.push({
+            x:$("#missExamFillRect").offset().left-baseX,
+            y:$("#missExamFillRect").offset().top-baseY,
+            w:$("#missExamFillRect").width(),
+            h:$("#missExamFillRect").height(),
+            type:"rect"
+        })
+        pdfData.missExamInfo = pointList
+
+        // 客观题
+        pointList = []
+        // 客观题标题
+        pointList.push({
+            x:$("#page_objective_title").offset().left-baseX,
+            y:$("#page_objective_title").offset().top-baseY,
+            w:$("#page_objective_title").width(),
+            h:$("#page_objective_title").height(),
+            type:"text",
+            text:$("#page_objective_title").text()
+        })
+        // 客观题矩形区域
+        pointList.push({
+            x:$("#page_objective_rect").offset().left-baseX,
+            y:$("#page_objective_rect").offset().top-baseY,
+            w:$("#page_objective_rect").width(),
+            h:$("#page_objective_rect").height(),
+            type:"rext"
+        })
+        // 客观题选项
+        $(".page_objective_ques").forEach(item=>{
+            let tmid = $(item).find(".page_cell_tm_id").eq(0);
+            let tmoptions = $(item).find(".page_cell_tm_id");
+            pointList.push({
+                x:tmid.offset().left-baseX,
+                y:tmid.offset().top-baseY,
+                w:tmid.width(),
+                h:tmid.height(),
+                type:"text",
+                text:tmid.text()
+            })
+            for(var i=0;i<tmoptions.length;i++){
+                pointList.push({
+                    x:tmoptions.eq(i).offset().left-baseX,
+                    y:tmoptions.eq(i).offset().top-baseY,
+                    w:tmoptions.eq(i).width(),
+                    h:tmoptions.eq(i).height(),
+                    type:"rext"
+                })
+            }
+        })
+        pdfData.objectiveQues = pointList
+
+
+    });
+
+
+    console.log(pdfData,33333333333333)
+
+
+})

File diff suppressed because it is too large
+ 10 - 0
public/static/js/kendo.all.min.js


+ 4 - 0
src/api.js

@@ -384,4 +384,8 @@ export default {
 			params: params,
 			params: params,
 		});
 		});
     },
     },
+    // 导出答题卡pdf
+    downloadAnsCardPdf: params => {
+        return axios.post(`${baseURL}/api/admin/anscard/pdf/download`, params, {responseType: "blob"} )
+    },
 }
 }

BIN
src/assets/font/simhei.ttf


+ 376 - 0
src/utils/exportPdf.js

@@ -0,0 +1,376 @@
+// $(document).ready(function() {
+
+export default function getPdfPoints() {
+    // pdf容器contenterPdf
+    var contenterPdf = $("#contenterPdf")
+    var baseX = contenterPdf.offset().left
+    var baseY = contenterPdf.offset().top
+    // 每一页pdf
+    var page_cell = contenterPdf.find(".page_cell")
+    // pdf数据
+    var pdfData = {
+        "stdPoints": [],
+        "titleInfo": {},
+        "studentInfo": [],
+        "studentNo": [],
+        "noteInfo": [],
+        "barCodeInfo": [],
+        "missExamInfo": [],
+        "objectiveQues": [],
+        "tkQues":[],
+        ywzwQues:[]
+    }
+    var pdfPointsList = [];
+    Array.from(page_cell).forEach((item) => {
+        console.log(item)
+        // 标准点
+        let pointList = [];
+        for (var i = 0; i < $(".stdPoints").length; i++) {
+            pointList.push({
+                x: $(".stdPoints").eq(i).offset().left - baseX,
+                y: $(".stdPoints").eq(i).offset().top - baseY,
+                w: $(".stdPoints").eq(i).width(),
+                h: $(".stdPoints").eq(i).height(),
+                type: "rect",
+                fill:1
+            })
+        }
+        pdfData.stdPoints = pointList
+        pdfPointsList = pdfPointsList.concat(pointList)
+
+        pointList = [];
+        // 标题
+        pointList.push({
+            x: $("#paperNameTextAreaTem").offset().left - baseX,
+            y: $("#paperNameTextAreaTem").offset().top - baseY,
+            w: $("#paperNameTextAreaTem").width(),
+            h: $("#paperNameTextAreaTem").height(),
+            text: $("#paperNameTextAreaTem").text(),
+            type: "rect"
+        })
+        pdfData.titleInfo = pointList
+        pdfPointsList = pdfPointsList.concat(pointList)
+
+        // 考生信息
+        pointList = []
+        // 姓名,下划线
+        pointList.push({
+            x: $("#name").offset().left - baseX,
+            y: $("#name").offset().top - baseY,
+            w: $("#name").width(),
+            h: $("#name").height(),
+            text: $("#name").text(),
+            type: "text"
+        })
+        pointList.push({
+            x: $("#nameLine").offset().left - baseX,
+            y: $("#nameLine").offset().top - baseY,
+            w: $("#nameLine").width(),
+            h: $("#nameLine").height(),
+            text: $("#nameLine").text(),
+            type: "line"
+        })
+        // 班级,下划线
+        pointList.push({
+            x: $("#className").offset().left - baseX,
+            y: $("#className").offset().top - baseY,
+            w: $("#className").width(),
+            h: $("#className").height(),
+            type: "text",
+            text: $("#className").text()
+        })
+        pointList.push({
+            x: $("#classNameLine").offset().left - baseX,
+            y: $("#classNameLine").offset().top - baseY,
+            w: $("#classNameLine").width(),
+            h: $("#classNameLine").height(),
+            text: $("#classNameLine").text(),
+            type: "line"
+        })
+        // 考场号,下划线
+        pointList.push({
+            x: $("#kcNo").offset().left - baseX,
+            y: $("#kcNo").offset().top - baseY,
+            w: $("#kcNo").width(),
+            h: $("#kcNo").height(),
+            type: "text",
+            text: $("#kcNo").text()
+        })
+        pointList.push({
+            x: $("#kcNoLine").offset().left - baseX,
+            y: $("#kcNoLine").offset().top - baseY,
+            w: $("#kcNoLine").width(),
+            h: $("#kcNoLine").height(),
+            text: $("#kcNoLine").text(),
+            type: "line"
+        })
+        // 座位号,下划线
+        pointList.push({
+            x: $("#sitNo").offset().left - baseX,
+            y: $("#sitNo").offset().top - baseY,
+            w: $("#sitNo").width(),
+            h: $("#sitNo").height(),
+            type: "text",
+            text: $("#sitNo").text(),
+        })
+        pointList.push({
+            x: $("#sitNoLine").offset().left - baseX,
+            y: $("#sitNoLine").offset().top - baseY,
+            w: $("#sitNoLine").width(),
+            h: $("#sitNoLine").height(),
+            text: $("#sitNoLine").text(),
+            type: "line"
+        })
+        pdfData.studentInfo = pointList
+        pdfPointsList = pdfPointsList.concat(pointList)
+
+        // 准考证号和填涂框
+        pointList = []
+        pointList.push({
+            x: $("#zkzh").offset().left - baseX,
+            y: $("#zkzh").offset().top - baseY,
+            w: $("#zkzh").width(),
+            h: $("#zkzh").height(),
+            text: $("#zkzh").text().replace(" ",""),
+            type: "text"
+        })
+        for (var i = 0; i < $(".zkzh_rect").length; i++) {
+            pointList.push({
+                x: $(".zkzh_rect").eq(i).offset().left - baseX,
+                y: $(".zkzh_rect").eq(i).offset().top - baseY,
+                w: $(".zkzh_rect").eq(i).width(),
+                h: $(".zkzh_rect").eq(i).height(),
+                type: "rect"
+            })
+        }
+        pdfData.studentNo = pointList
+        pdfPointsList = pdfPointsList.concat(pointList)
+
+        // 注意事项
+        pointList = []
+        pointList.push({
+            x: $("#noteInfo").offset().left - baseX,
+            y: $("#noteInfo").offset().top - baseY,
+            w: $("#noteInfo").width(),
+            h: $("#noteInfo").height(),
+            type: "rect"
+        })
+        pointList.push({
+            x: $("#noteInfo_title").offset().left - baseX,
+            y: $("#noteInfo_title").offset().top - baseY,
+            w: $("#noteInfo_title").width(),
+            h: $("#noteInfo_title").height(),
+            type: "text",
+            text: $("#noteInfo_title").text()
+        })
+        for (var i = 0; i < $(".noteInfo_desc").length; i++) {
+            pointList.push({
+                x: $(".noteInfo_desc").eq(i).offset().left - baseX,
+                y: $(".noteInfo_desc").eq(i).offset().top - baseY,
+                w: $(".noteInfo_desc").eq(i).width(),
+                h: $(".noteInfo_desc").eq(i).height(),
+                type: "text",
+                text: $(".noteInfo_desc").eq(i).text()
+            })
+        }
+        pdfData.noteInfo = pointList
+        pdfPointsList = pdfPointsList.concat(pointList)
+
+        // 条形码区域
+        pointList = []
+        pointList.push({
+            x: $("#barCodeRect").offset().left - baseX,
+            y: $("#barCodeRect").offset().top - baseY,
+            w: $("#barCodeRect").width(),
+            h: $("#barCodeRect").height(),
+            type: "rect"
+        })
+        pointList.push({
+            x: $("#barCodeTitle").offset().left - baseX,
+            y: $("#barCodeTitle").offset().top - baseY,
+            w: $("#barCodeTitle").width(),
+            h: $("#barCodeTitle").height(),
+            type: "text",
+            text: $("#barCodeTitle").text()
+        })
+        pointList.push({
+            x: $("#barCodeNote").offset().left - baseX,
+            y: $("#barCodeNote").offset().top - baseY,
+            w: $("#barCodeNote").width(),
+            h: $("#barCodeNote").height(),
+            type: "text",
+            text: $("#barCodeNote").text()
+        })
+        pdfData.barCodeInfo = pointList
+        pdfPointsList = pdfPointsList.concat(pointList)
+
+        // 缺考标记
+        pointList = []
+        pointList.push({
+            x: $("#missExamRect").offset().left - baseX,
+            y: $("#missExamRect").offset().top - baseY,
+            w: $("#missExamRect").width(),
+            h: $("#missExamRect").height(),
+            type: "rect"
+        })
+        pointList.push({
+            x: $("#exactFill").offset().left - baseX,
+            y: $("#exactFill").offset().top - baseY,
+            w: $("#exactFill").width(),
+            h: $("#exactFill").height(),
+            type: "text",
+            text: $("#exactFill").text()
+        })
+        pointList.push({
+            x: $("#exactFillRect").offset().left - baseX,
+            y: $("#exactFillRect").offset().top - baseY,
+            w: $("#exactFillRect").width(),
+            h: $("#exactFillRect").height(),
+            type: "rect",
+            fill:1
+        })
+        pointList.push({
+            x: $("#missExamFill").offset().left - baseX,
+            y: $("#missExamFill").offset().top - baseY,
+            w: $("#missExamFill").width(),
+            h: $("#missExamFill").height(),
+            type: "text",
+            text: $("#missExamFill").text()
+        })
+        pointList.push({
+            x: $("#missExamFillRect").offset().left - baseX,
+            y: $("#missExamFillRect").offset().top - baseY,
+            w: $("#missExamFillRect").width(),
+            h: $("#missExamFillRect").height(),
+            type: "rect"
+        })
+        pdfData.missExamInfo = pointList
+        pdfPointsList = pdfPointsList.concat(pointList)
+
+        // 客观题
+        pointList = []
+        if ($(".page_objective_title").length > 0) {
+            // 客观题标题
+            pointList.push({
+                x: $(".page_objective_title").eq(0).offset().left - baseX,
+                y: $(".page_objective_title").eq(0).offset().top - baseY,
+                w: $(".page_objective_title").eq(0).width(),
+                h: $(".page_objective_title").eq(0).height(),
+                type: "text",
+                text: $(".page_objective_title").eq(0).text()
+            })
+            // 客观题矩形区域
+            pointList.push({
+                x: $(".page_objective_rect").eq(0).offset().left - baseX,
+                y: $(".page_objective_rect").eq(0).offset().top - baseY,
+                w: $(".page_objective_rect").eq(0).width(),
+                h: $(".page_objective_rect").eq(0).height(),
+                type: "rect"
+            })
+            // 客观题选项
+            // Array.from($(".page_objective_ques")).forEach(item=>{
+            let tmid = $(".page_cell_tm_id").eq(0);
+            for (var i = 0; i < $(".page_cell_tm_id").length; i++) {
+                pointList.push({
+                    x: $(".page_cell_tm_id").eq(i).offset().left - baseX,
+                    y: $(".page_cell_tm_id").eq(i).offset().top - baseY,
+                    w: $(".page_cell_tm_id").eq(i).width(),
+                    h: $(".page_cell_tm_id").eq(i).height(),
+                    type: "text",
+                    text: $(".page_cell_tm_id").eq(i).text(),
+                })
+            }
+            for (var i = 0; i < $(".page_cell_options").length; i++) {
+                pointList.push({
+                    x: $(".page_cell_options").eq(i).offset().left - baseX,
+                    y: $(".page_cell_options").eq(i).offset().top - baseY,
+                    w: $(".page_cell_options").eq(i).width(),
+                    h: $(".page_cell_options").eq(i).height(),
+                    type: "rect"
+                })
+            }
+            for (var i = 0; i < $(".page_cell_options_char").length; i++) {
+                pointList.push({
+                    x: $(".page_cell_options_char").eq(i).offset().left - baseX,
+                    y: $(".page_cell_options_char").eq(i).offset().top - baseY,
+                    w: $(".page_cell_options_char").eq(i).width(),
+                    h: $(".page_cell_options_char").eq(i).height(),
+                    type: "text",
+                    text: $(".page_cell_options_char").eq(i).text()
+                })
+            }
+
+        }
+        pdfData.objectiveQues = pointList
+        pdfPointsList = pdfPointsList.concat(pointList)
+        console.log(pdfData, 33333333333333)
+        console.log(pdfPointsList,44444444444444444)
+
+        // 填空题
+        pointList = []
+        if ($(".page_tk_title").length > 0) {
+            pointList.push({
+                x: $(".page_tk_title").eq(0).offset().left - baseX,
+                y: $(".page_tk_title").eq(0).offset().top - baseY,
+                w: $(".page_tk_title").eq(0).width(),
+                h: $(".page_tk_title").eq(0).height(),
+                type: "text",
+                text: $(".page_tk_title").eq(0).text()
+            })
+            pointList.push({
+                x: $(".page_tk_rect").eq(0).offset().left - baseX,
+                y: $(".page_tk_rect").eq(0).offset().top - baseY,
+                w: $(".page_tk_rect").eq(0).width(),
+                h: $(".page_tk_rect").eq(0).height(),
+                type: "rect",
+            })
+            for (var i = 0; i < $(".page_tk_tm_id").length; i++) {
+                pointList.push({
+                    x: $(".page_tk_tm_id").eq(i).offset().left - baseX,
+                    y: $(".page_tk_tm_id").eq(i).offset().top - baseY,
+                    w: $(".page_tk_tm_id").eq(i).width(),
+                    h: $(".page_tk_tm_id").eq(i).height(),
+                    type: "text",
+                    text: $(".page_tk_tm_id").eq(i).text(),
+                })
+            }
+            for (var i = 0; i < $(".page_tk_tm_line").length; i++) {
+                pointList.push({
+                    x: $(".page_tk_tm_line").eq(i).offset().left - baseX,
+                    y: $(".page_tk_tm_line").eq(i).offset().top - baseY,
+                    w: $(".page_tk_tm_line").eq(i).width(),
+                    h: $(".page_tk_tm_line").eq(i).height(),
+                    type: "line"
+                })
+            }
+            pdfData.tkQues = pointList
+            pdfPointsList = pdfPointsList.concat(pointList)
+        }
+
+        // 语文作文题
+        pointList = []
+        if ($(".page_tk_title").length > 0) {
+            for (var i = 0; i < $(".left_div_words").length; i++) {
+                pointList.push({
+                    x: $(".left_div_words").eq(i).offset().left - baseX,
+                    y: $(".left_div_words").eq(i).offset().top - baseY,
+                    w: $(".left_div_words").eq(i).width(),
+                    h: $(".left_div_words").eq(i).height(),
+                    type: "rect"
+                })
+            }
+            for (var i = 0; i < $(".left_div_words_li").length; i++) {
+                pointList.push({
+                    x: $(".left_div_words_li").eq(i).offset().left - baseX,
+                    y: $(".left_div_words_li").eq(i).offset().top - baseY,
+                    w: $(".left_div_words_li").eq(i).width(),
+                    h: $(".left_div_words_li").eq(i).height(),
+                    type: "rect"
+                })
+            }
+            pdfData.ywzwQues = pointList
+            pdfPointsList = pdfPointsList.concat(pointList)
+        }
+    });
+    return pdfPointsList;
+}

File diff suppressed because it is too large
+ 10 - 0
src/utils/kendo.all.min.js


+ 180 - 0
src/utils/xscan.js

@@ -0,0 +1,180 @@
+function ajax(options) {
+    var options = options || {};
+    options.type = (options.type || 'GET').toUpperCase();
+    options.dataType = options.dataType || 'json';
+    var params = formatParams(options.data);
+
+    //创建-第一步
+    var xhr;
+    //非IE6
+    if (window.XMLHttpRequest) {
+        xhr = new XMLHttpRequest();
+    } else {
+        //ie6及其以下版本浏览器
+        xhr = ActiveXObject('Microsoft.XMLHTTP');
+    }
+
+    //接收-第三步
+    xhr.onreadystatechange = function () {
+        if (xhr.readyState == 4) {
+            var status = xhr.status;
+            if (status >= 200 && status < 300) {
+                options.success && options.success(xhr.responseText, xhr.responseXML);
+            } else {
+                options.error && options.error(status);
+            }
+        }
+    }
+
+    //连接和发送-第二步
+    if (options.type == 'GET') {
+        xhr.open('GET', options.url + '?' + params, true);
+        xhr.send(null);
+    } else if (options.type == 'POST') {
+        xhr.open('POST', options.url, true);
+        //设置表单提交时的内容类型
+        xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
+        xhr.send(params);
+    }else if (options.type == 'HEAD') {
+        xhr.open('Head', options.url + '?' + params, true);
+        xhr.send(null);
+    }
+}
+
+//格式化参数
+function formatParams(data) {
+    var arr = [];
+    for (var name in data) {
+        arr.push(encodeURIComponent(name) + '=' + encodeURIComponent(data[name]));
+    }
+    // arr.push(('v='+Math.random()).replace('.',''));
+    return arr.join('&');
+}
+
+//获取兄弟节点
+function getSiblings(currentElement){
+	let siblings = [];  // 存储兄弟元素的数组
+	let parent = currentElement.parentNode;
+	 
+	// 获取所有子元素
+	let children = parent.children;
+	for (let i = 0; i < children.length; i++) {
+	  if (children[i] !== currentElement) {  // 排除指定元素自身
+		siblings.push(children[i]);
+	  }
+	}
+	return siblings;
+}
+
+export default function OpenDwSource(taskId,remoteHost=null) {
+    var host = "http://localhost:15982"
+    var xsource = '<div style="width:300px;position: absolute;border:1px solid #dddddd;background: #eeeeee;left:0; right:0;top:30%;margin:auto;box-shadow:0 1px 5px rgb(0 0 0 / 5%);border-radius:6px;z-index:10000000;">';
+    xsource += '<div id="xcanner-content" style="padding: 15px 20px 0px 20px;">';
+    xsource += '<h4 style="margin:0px;">请选择扫描仪:</h4>';
+    xsource += '<div id="xscanner-sourcelist">';
+    xsource += '<ul style="background: #fff;list-style: none;margin:0px;padding:0px;border-left:2px solid #777777;border-top:2px solid #777777;">';
+    xsource += '</ul></div>';
+    xsource += '<div><button id="xscanner-confirm-btn" style="margin:10px 10px 20px 0px;min-width: 80px;">确定</button><button id="xscanner-cancel-btn" style="margin:10px 10px 20px 0px;min-width: 80px;">取消</button></div>';
+    var sourcediv = document.createElement("div")
+    sourcediv.id = "xscanner-model"
+    sourcediv.innerHTML = xsource;
+    document.getElementsByTagName("body")[0].appendChild(sourcediv)
+    // 
+    ajax({
+        url: host + '/xscanSourceList.aspx',
+        type: 'get',
+        dataType: 'json',
+        // data: {},
+        success: function (response, xml) {
+            var listr = ""
+            JSON.parse(response).forEach((item, index) => {
+                if (index == 0) {
+                    listr += "<li class='scannerItem' active=1 style='background:rgb(199, 222, 252);'>" + item + "</li>";
+                } else {
+                    listr += "<li class='scannerItem'>" + item + "</li>";
+                }
+            })
+            document.getElementById("xscanner-sourcelist").children[0].innerHTML = listr;
+			//选择扫描仪
+			var scanners = document.getElementsByClassName("scannerItem");
+			for(var i=0;i<scanners.length;i++){
+				scanners[i].addEventListener("click",function(e){
+					var siblings = getSiblings(e.target);
+					for(var j=0;j<siblings.length;j++){
+						siblings[j].removeAttribute("style");
+						siblings[j].removeAttribute("active");
+					}
+					e.target.setAttribute("style","background:rgb(199, 222, 252)");
+					e.target.setAttribute("active",1);
+				})
+			}
+        },
+        error: function (status) {
+            //失败后执行的代码
+        }
+    });
+	
+	
+    // 确定
+    document.getElementById("xscanner-confirm-btn").addEventListener("click", function () {
+		//获取当前选中的扫描仪
+		var scanners = document.getElementsByClassName("scannerItem");
+		var curScanner = null;
+		for(var i=0;i<scanners.length;i++){
+			if(scanners[i].getAttribute("active")==1){
+				curScanner = scanners[i].innerText;
+			}
+		}
+		console.log(curScanner)
+        ajax({
+            url: host + '/xscanAction.aspx',
+            type: 'GET',
+            dataType: 'json',
+            data:{tid:taskId,name:curScanner,rh:remoteHost},
+            success: function (response, xml) {
+                if (response) {
+
+                }
+            },
+            error: function (status) {
+                //失败后执行的代码
+            }
+        });
+        var last = null;
+        var counter = "15982"
+        var i = 0;
+        var timer = window.setInterval(function () {
+            i += 1
+            var xscannercontainer = document.getElementById("imgReviewList")
+            // xscannercontainer.style = "overflow:scroll;padding:10px 20px 20px 20px;position:absolute;right:0px;top:0px;"
+            last = xscannercontainer.firstChild;
+            ajax({
+                url: host + '/xscanImgUri.aspx',
+                type: 'GET',
+                dataType: 'json',
+                data: {t:new Date().getTime()},
+                success: function (response, xml) {
+                    if (response) {
+                        var img = document.createElement("img")
+                        img.src = "http://localhost:15983" + "/xscanImgReview.aspx?imgid="+response
+                        img.style = "width:100%;margin:5px;box-shadow:2px 2px 2px 2px;"
+                        if (last) {
+                            xscannercontainer.insertBefore(img, last)
+                        } else {
+                            xscannercontainer.append(img)
+                        }
+                    }
+
+                },
+                error: function (status) {
+                    //失败后执行的代码
+                }
+            });
+        }, 1000)
+        document.getElementById("xscanner-model").remove();
+    })
+    // 取消
+    document.getElementById("xscanner-cancel-btn").addEventListener("click", function () {
+        document.getElementById("xscanner-model").remove();
+    })
+}

File diff suppressed because it is too large
+ 1529 - 1020
src/views/anscard/Index.vue


+ 9 - 2
src/views/tasks/uploadPaper.vue

@@ -32,8 +32,7 @@
               <el-button @click="reTryMark" size="mini" type="success" icon="el-icon-printer">重新识别</el-button>
               <el-button @click="reTryMark" size="mini" type="success" icon="el-icon-printer">重新识别</el-button>
             </el-form-item>
             </el-form-item>
             <el-form-item>
             <el-form-item>
-              <el-button size="mini" type="warning" icon="el-icon-printer">
-                试卷扫描</el-button>
+              <el-button size="mini" type="warning" icon="el-icon-printer" @click='starScanPaper(curTaskId,"http://test.scxjc.club/api/admin/papers/uploadpaper")'>试卷扫描</el-button>
 
 
             </el-form-item>
             </el-form-item>
             <el-form-item>
             <el-form-item>
@@ -95,6 +94,7 @@
           </el-table>
           </el-table>
           <Page ref="pageButton" :current="recPage" :page_size="recPageSize" :total="recTotal"
           <Page ref="pageButton" :current="recPage" :page_size="recPageSize" :total="recTotal"
             @pageChange="goRecPage" />
             @pageChange="goRecPage" />
+
         </el-col>
         </el-col>
       </el-row>
       </el-row>
       <!-- 试卷上传预览 -->
       <!-- 试卷上传预览 -->
@@ -194,11 +194,14 @@
     </el-dialog>
     </el-dialog>
     <!--阅卷设置-->
     <!--阅卷设置-->
     <MarkTaskSetDialog :remarkSetVisible="remarkSetVisible" :paperId="curPaperId" :taskId="curTaskId" @close="closeMarkTaskSet" />
     <MarkTaskSetDialog :remarkSetVisible="remarkSetVisible" :paperId="curPaperId" :taskId="curTaskId" @close="closeMarkTaskSet" />
+    <!-- 图片预览 -->
+    <div id="imgReviewList" style="position:absolute;right:20px;top:0px;width:20%;z-index:10000;height:880px;overflow:scroll;"></div>
   </section>
   </section>
 </template>
 </template>
 <script>
 <script>
   import Page from "../../components/Page";
   import Page from "../../components/Page";
   import MarkTaskSetDialog from "./components/MarkTaskSetDialog";
   import MarkTaskSetDialog from "./components/MarkTaskSetDialog";
+  import OpenDwSource from "../../utils/xscan.js"
   import Cropper from 'cropperjs'
   import Cropper from 'cropperjs'
   export default {
   export default {
     components: {
     components: {
@@ -208,6 +211,7 @@
     data() {
     data() {
       return {
       return {
         loading: false,
         loading: false,
+        drawerVisible:true,
         queryParams: {
         queryParams: {
           page: 1,
           page: 1,
           page_size: 20
           page_size: 20
@@ -767,6 +771,9 @@
       },
       },
       closeMarkTaskSet(){
       closeMarkTaskSet(){
         this.remarkSetVisible = false
         this.remarkSetVisible = false
+      },
+      starScanPaper(taskId,remoteHost){
+        OpenDwSource(taskId,remoteHost)
       }
       }
     },
     },
     created() {
     created() {