Преглед изворни кода

将裁切图默认切割规则挪到配置文件可以全局修改

luoshi пре 4 година
родитељ
комит
9e76310b3a

+ 0 - 12
stmms-biz/src/main/java/cn/com/qmth/stmms/biz/mark/model/Task.java

@@ -33,11 +33,6 @@ public class Task extends MarkResult implements Serializable {
      */
     private List<PictureConfigItem> pictureConfig;
 
-    /**
-     * 大图默认切割配置
-     */
-    private List<PictureConfigItem> splitConfig;
-
     /**
      * 题卡原图地址
      */
@@ -331,11 +326,4 @@ public class Task extends MarkResult implements Serializable {
         this.jsonUrl = jsonUrl;
     }
 
-    public List<PictureConfigItem> getSplitConfig() {
-        return splitConfig;
-    }
-
-    public void setSplitConfig(List<PictureConfigItem> splitConfig) {
-        this.splitConfig = splitConfig;
-    }
 }

+ 10 - 7
stmms-web/src/main/webapp/WEB-INF/application.properties

@@ -1,26 +1,29 @@
-#jdbc config
+#\u6570\u636E\u5E93\u914D\u7F6E
 jdbc.driver=com.mysql.jdbc.Driver
 jdbc.url=jdbc:mysql://localhost:3306/stmms_ft_new?useUnicode=true&characterEncoding=UTF-8
 jdbc.username=root
 jdbc.password=root
 jdbc.maxActive=50
 jdbc.initSize=5
-
-##file config
+##\u6587\u4EF6\u5B58\u50A8\u914D\u7F6E
 file.server=http://localhost:9000/stmms-ft/
 file.store=/Users/luoshi/develop/data/stmms-ft
-
+##\u88C1\u5207\u56FE\u9ED8\u8BA4\u5207\u5272\u89C4\u5219
+slice.split.config=0,0.55,0.45,0.55,0.8
+##\u9ED8\u8BA4\u95EE\u9898\u5377\u7C7B\u578B
+exam.problem.type1=\u7B54\u9519\u4F4D\u7F6E
+exam.problem.type2=\u8BD5\u5377\u6A21\u7CCA
+##\u8BC4\u5377\u76F8\u5173\u5B9A\u65F6\u4EFB\u52A1
 mark.cleanTimeoutMinute=20
 mark.activeExpireMinute=30
 mark.cleanTaskSchedule=0 0/10 6-23 * * ?
 mark.cleanLockSchedule=0 0 3 * * ?
-
+##\u8BC4\u5377\u5458\u63A7\u5236
 marker.showBtnImportAndBtnUpdateImport=false
 marker.forceMode=
 ##\u9996\u9875\u53EF\u9009\u7684logo\u6587\u4EF6
 index.logo=
-
-##qmth.config
+##\u4E91\u5E73\u53F0\u5BF9\u63A5\u914D\u7F6E
 qmth.examcloud.host=iepcc-ps.ecs.qmth.com.cn
 qmth.examcloud.port=80
 qmth.examcloud.rootOrgId=16923

+ 2 - 1
stmms-web/src/main/webapp/WEB-INF/views/include/trackView.jsp

@@ -64,7 +64,8 @@
         new ImageLoader({
             server: imageServer,
             flush: true,
-            strict: false
+            strict: false,
+            split: [${properties['slice.split.config']}]
         }).combine(picUrls, canvas, config, function () {
             //阅卷轨迹
             if (markTracks != undefined && markTracks.length > 0) {

+ 71 - 70
stmms-web/src/main/webapp/WEB-INF/views/include/trialDetail.jsp

@@ -57,7 +57,8 @@
                         new ImageLoader({
                             server: data.fileServer,
                             flush: true,
-                            strict: false
+                            strict: false,
+                            split: [${properties['slice.split.config']}]
                         }).merge(data.urls, data.pictureConfig, function (image) {
                             trialDetailModal.setContent($('#trial-detail-content'));
                             $(image).width($('#trial-left-div').width() * 0.95);
@@ -73,78 +74,78 @@
                         questionNumbers.forEach(questionNumber => {
                             questionArr[questionNumber] = true;
                         });
-                        let paperqQuestions=[];
-				        $.ajax({
-				            type: "GET",
-				            url: paperUrl,
-				            dataType: "json",
-				            success: function (data) {
-				            	paperqQuestions = data.subjectives;
-				            }
-				        })
+                        let paperqQuestions = [];
                         $.ajax({
-				            type: "GET",
-				            url: answerUrl,
-				            dataType: "json",
-				            success: function (data) {
-                            	let questions = JSON.parse(data) || [];
-                            	//var data = '[{"mainNumber": 6,"subNumber": 19,"body": {"sections": [{ "blocks":[{"type": "text","value": "我是题目我是题目我是题目"}]}]},"answer": {"sections": [{"blocks":[{"type": "image","value": "https://ecs-test-static.qmth.com.cn/oe-answer-file/3/8/20/3_8_20_15748452889591137.jpeg"}]},{"blocks":[{"type": "audio","value": "https://ecs-test-static.qmth.com.cn/oe-answer-file/3/8/19/3_8_19_15748452552644264.mp3"}]}]},"studentAnswer": {"sections": [{"blocks":[{"type": "image","value": "https://ecs-test-static.qmth.com.cn/oe-answer-file/3/8/20/3_8_20_15748452889591137.jpeg"},{"type": "image","value": "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1582709869784&di=39683b1330bd09bebd93c95fe925ca70&imgtype=0&src=http%3A%2F%2Fn.sinaimg.cn%2Fsinacn10108%2F170%2Fw600h370%2F20190222%2Fd6de-htknpmh2595255.jpg"},{"type": "text","value": "我是答案答案daan"}]}]}}]';
-                            	//let questions = JSON.parse(data);
-                             for (var j in questions) {
-                				var question = questions[j];
-                				var paperQuestion = paperqQuestions[j];
-                                // 按题号过滤
-                                if (questionArr[question.mainNumber + "." + question.subNumber] === true) {
-                                    let numberTitle = {
-                                        "blocks": [{
-                                            "type": "text",
-                                            "param": {"bold": true},
-                                            "value": "题号:" + question.mainNumber + "-" + question.subNumber
-                                        }]
-                                    };
-                                    let bodyTitle = {
-                                        "blocks": [{
-                                            "type": "text",
-                                            "param": {"bold": true},
-                                            "value": "题干:"
-                                        }]
-                                    };
-                                    let answerTitle = {
-                                        "blocks": [{
-                                            "type": "text",
-                                            "param": {"bold": true},
-                                            "value": "考生答案:"
-                                        }, {
-                                            "type": "text",
-                                            "param": {
-                                                "italic": true,
-                                                "danger": true
-                                            },
-                                            "value": "(字数统计:" + textCount(question.studentAnswer) + ")"
-                                        }]
-                                    };
-                                    let standardTitle = {
-                                        "blocks": [{
-                                            "type": "text",
-                                            "param": {"bold": true},
-                                            "value": "标准答案:"
-                                        }]
-                                    };
-                                    this.holder = $('#trial-left-div');
-                                    $(renderSection(numberTitle)).appendTo(this.holder);
-                                    $(renderSection(bodyTitle)).appendTo(this.holder);
-                                    if (paperQuestion.parentBody != null && paperQuestion.parentBody != undefined) {
-                                        $(renderRichText(paperQuestion.parentBody)).appendTo(this.holder);
+                            type: "GET",
+                            url: paperUrl,
+                            dataType: "json",
+                            success: function (data) {
+                                paperqQuestions = data.subjectives;
+                            }
+                        })
+                        $.ajax({
+                            type: "GET",
+                            url: answerUrl,
+                            dataType: "json",
+                            success: function (data) {
+                                let questions = JSON.parse(data) || [];
+                                //var data = '[{"mainNumber": 6,"subNumber": 19,"body": {"sections": [{ "blocks":[{"type": "text","value": "我是题目我是题目我是题目"}]}]},"answer": {"sections": [{"blocks":[{"type": "image","value": "https://ecs-test-static.qmth.com.cn/oe-answer-file/3/8/20/3_8_20_15748452889591137.jpeg"}]},{"blocks":[{"type": "audio","value": "https://ecs-test-static.qmth.com.cn/oe-answer-file/3/8/19/3_8_19_15748452552644264.mp3"}]}]},"studentAnswer": {"sections": [{"blocks":[{"type": "image","value": "https://ecs-test-static.qmth.com.cn/oe-answer-file/3/8/20/3_8_20_15748452889591137.jpeg"},{"type": "image","value": "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1582709869784&di=39683b1330bd09bebd93c95fe925ca70&imgtype=0&src=http%3A%2F%2Fn.sinaimg.cn%2Fsinacn10108%2F170%2Fw600h370%2F20190222%2Fd6de-htknpmh2595255.jpg"},{"type": "text","value": "我是答案答案daan"}]}]}}]';
+                                //let questions = JSON.parse(data);
+                                for (var j in questions) {
+                                    var question = questions[j];
+                                    var paperQuestion = paperqQuestions[j];
+                                    // 按题号过滤
+                                    if (questionArr[question.mainNumber + "." + question.subNumber] === true) {
+                                        let numberTitle = {
+                                            "blocks": [{
+                                                "type": "text",
+                                                "param": {"bold": true},
+                                                "value": "题号:" + question.mainNumber + "-" + question.subNumber
+                                            }]
+                                        };
+                                        let bodyTitle = {
+                                            "blocks": [{
+                                                "type": "text",
+                                                "param": {"bold": true},
+                                                "value": "题干:"
+                                            }]
+                                        };
+                                        let answerTitle = {
+                                            "blocks": [{
+                                                "type": "text",
+                                                "param": {"bold": true},
+                                                "value": "考生答案:"
+                                            }, {
+                                                "type": "text",
+                                                "param": {
+                                                    "italic": true,
+                                                    "danger": true
+                                                },
+                                                "value": "(字数统计:" + textCount(question.studentAnswer) + ")"
+                                            }]
+                                        };
+                                        let standardTitle = {
+                                            "blocks": [{
+                                                "type": "text",
+                                                "param": {"bold": true},
+                                                "value": "标准答案:"
+                                            }]
+                                        };
+                                        this.holder = $('#trial-left-div');
+                                        $(renderSection(numberTitle)).appendTo(this.holder);
+                                        $(renderSection(bodyTitle)).appendTo(this.holder);
+                                        if (paperQuestion.parentBody != null && paperQuestion.parentBody != undefined) {
+                                            $(renderRichText(paperQuestion.parentBody)).appendTo(this.holder);
+                                        }
+                                        $(renderRichText(paperQuestion.body)).appendTo(this.holder);
+                                        $(renderSection(answerTitle)).appendTo(this.holder);
+                                        $(renderRichText(question.studentAnswer)).appendTo(this.holder);
+                                        $(renderSection(standardTitle)).appendTo(this.holder);
+                                        $(renderRichText(paperQuestion.answer)).appendTo(this.holder);
+                                        trialDetailModal.setContent($('#trial-detail-content'));
                                     }
-                                    $(renderRichText(paperQuestion.body)).appendTo(this.holder);
-                                    $(renderSection(answerTitle)).appendTo(this.holder);
-                                    $(renderRichText(question.studentAnswer)).appendTo(this.holder);
-                                    $(renderSection(standardTitle)).appendTo(this.holder);
-                                    $(renderRichText(paperQuestion.answer)).appendTo(this.holder);
-                                    trialDetailModal.setContent($('#trial-detail-content'));
                                 }
-                            }
-                        }).error(function () {
+                            }).error(function () {
                             trialDetailModal.setTitle('加载失败')
                         });
                     }

+ 44 - 43
stmms-web/src/main/webapp/WEB-INF/views/modules/exam/inspected.jsp

@@ -24,44 +24,44 @@
 </head>
 <body>
 <div style="height: 100vh;">
-	<div class="c-top cl">
-    	<div class="z">
-    		<span><b>编号:</b><span id="studentId"></span></span>
-    		<span><b>科目:</b><span id="subject"></span></span>
-    		<span><b>待复核:</b><span id="progress">${inspectCount}</span></span>
-    	</div>
+    <div class="c-top cl">
+        <div class="z">
+            <span><b>编号:</b><span id="studentId"></span></span>
+            <span><b>科目:</b><span id="subject"></span></span>
+            <span><b>待复核:</b><span id="progress">${inspectCount}</span></span>
+        </div>
         <div class="y">
-        	<span><a class="user" href="">${web_user.name}</a></span>
-        	<span><a class="close" href="javascript:window.close()">关闭</a></span>
+            <span><a class="user" href="">${web_user.name}</a></span>
+            <span><a class="close" href="javascript:window.close()">关闭</a></span>
         </div>
     </div>
     <div class="c-cont cl">
-    	<div class="mn">
-    		<div id="image-holder-track" class="image-content" style="position: relative; "></div>
-    	</div>
+        <div class="mn">
+            <div id="image-holder-track" class="image-content" style="position: relative; "></div>
+        </div>
         <div class="sd">
             <div class="c-button"><a href="#" id="save-button">复核</a></div>
             <div class="c-theadlist">
-        		<h1>试卷总分:<span id="totalScore"></span></h1>
-        		<div id="question-content">
-            	<div class="mt">
-                	<table cellpadding="0" cellspacing="0" width="100%">
-                    	<!-- <thead>
-                        	<tr>
-                                <td>题号</td>
-                                <td>给分</td>
-                                <td class="td"><a href="" id="back-button">打回</a></td>
-                            </tr>
-                        </thead>
-                        <tbody>
-                        	<tr>
-                                <td>1</td>
-                                <td>2</td>
-                                <td class="td"></td>
-                            </tr>
-                        </tbody> -->
-                    </table>
-                </div>
+                <h1>试卷总分:<span id="totalScore"></span></h1>
+                <div id="question-content">
+                    <div class="mt">
+                        <table cellpadding="0" cellspacing="0" width="100%">
+                            <!-- <thead>
+                                <tr>
+                                    <td>题号</td>
+                                    <td>给分</td>
+                                    <td class="td"><a href="" id="back-button">打回</a></td>
+                                </tr>
+                            </thead>
+                            <tbody>
+                                <tr>
+                                    <td>1</td>
+                                    <td>2</td>
+                                    <td class="td"></td>
+                                </tr>
+                            </tbody> -->
+                        </table>
+                    </div>
                 </div>
             </div>
         </div>
@@ -140,18 +140,18 @@
         $('#subject').html(student.subjectCode + '-' + student.subjectName);
         $('#totalScore').html(student.totalScore);
         $("#question-content").empty();
-        
+
         for (var i = 0; i < student.groups.length; i++) {
             var group = student.groups[i];
-            $('<div class="mt" id="div_'+group.groupNumber+'"></div>').appendTo("#question-content");
-            
-            $('<table id="table_'+group.groupNumber+'" cellpadding="0" cellspacing="0" width="100%"></table>').appendTo("#div_"+group.groupNumber);
-            
-            $("<thead><tr><td>分组"+group.groupNumber+"</td><td>给分</td><td class='td'><a href='#' data-id='"+group.groupNumber+"' class='back-button'>打回</a></td></tr></thead>").appendTo("#table_"+group.groupNumber);
-            $('<tbody id="tbody_'+group.groupNumber+'"></tbody>').appendTo("#table_"+group.groupNumber);
+            $('<div class="mt" id="div_' + group.groupNumber + '"></div>').appendTo("#question-content");
+
+            $('<table id="table_' + group.groupNumber + '" cellpadding="0" cellspacing="0" width="100%"></table>').appendTo("#div_" + group.groupNumber);
+
+            $("<thead><tr><td>分组" + group.groupNumber + "</td><td>给分</td><td class='td'><a href='#' data-id='" + group.groupNumber + "' class='back-button'>打回</a></td></tr></thead>").appendTo("#table_" + group.groupNumber);
+            $('<tbody id="tbody_' + group.groupNumber + '"></tbody>').appendTo("#table_" + group.groupNumber);
             for (var j = 0; j < group.questions.length; j++) {
-            	var question = group.questions[j];
-	           $("<tr><td>"+question.questionNumber+"</td><td>"+question.score+"</td><td class='td'></td></tr>").appendTo("#tbody_"+group.groupNumber);
+                var question = group.questions[j];
+                $("<tr><td>" + question.questionNumber + "</td><td>" + question.score + "</td><td class='td'></td></tr>").appendTo("#tbody_" + group.groupNumber);
             }
         }
 
@@ -168,7 +168,7 @@
             return;
         }
         $.post('${ctx}/admin/exam/inspected/save', {
-        	studentId: student.id
+            studentId: student.id
         }, function (result) {
             if (result == true) {
                 $('#progress').html(ids.length - current);
@@ -203,9 +203,10 @@
         new ImageLoader({
             server: imageServer,
             flush: true,
-            strict: false
+            strict: false,
+            split: [${properties['slice.split.config']}]
         }).combine(picUrls, canvas, config, function () {
-            
+
         })
     }
 

+ 5 - 3
stmms-web/src/main/webapp/WEB-INF/views/modules/mark/markNew.jsp

@@ -39,7 +39,7 @@
     <script type="text/javascript" src="${ctxStatic}/mark-new/js/modules/view-sidebar.js"></script>
     <script type="text/javascript" src="${ctxStatic}/mark-new/js/modules/specialTag.js"></script>
     <script type="text/javascript" src="${ctxStatic}/mark-new/js/modules/problem-process.js"></script>
-	<script type="text/javascript" src="${ctxStatic}/mark-new/js/modules/switch-group.js"></script>
+    <script type="text/javascript" src="${ctxStatic}/mark-new/js/modules/switch-group.js"></script>
 </head>
 <body>
 <div class="container-fluid" id="container"></div>
@@ -70,7 +70,9 @@
             settingSyncUrl: '${ctx}/mark/update-setting',
             modules: {
                 'single-image-view': {},
-                'image-builder': {},
+                'image-builder': {
+                    splitConfig: [${properties['slice.split.config']}]
+                },
                 'mark-status': {
                     simple: false,
                     subjectSelectUrl: '${ctx}/mark/subject-select',
@@ -109,7 +111,7 @@
                 },
                 'switch-group': {
                     url: '${ctx}/mark/subject-select',
-                    groups:'${groups}'
+                    groups: '${groups}'
                 },
                 'view-sidebar': {
                     list: [

+ 4 - 2
stmms-web/src/main/webapp/WEB-INF/views/modules/mark/markTrack.jsp

@@ -63,7 +63,9 @@
             settingSyncUrl: '${ctx}/mark/update-setting',
             modules: {
                 'single-image-view': {},
-                'image-builder': {},
+                'image-builder': {
+                    splitConfig: [${properties['slice.split.config']}]
+                },
                 'mark-status': {
                     simple: false,
                     subjectSelectUrl: '${ctx}/mark/subject-select',
@@ -92,7 +94,7 @@
                 },
                 'switch-group': {
                     url: '${ctx}/mark/subject-select',
-                    groups:'${groups}'
+                    groups: '${groups}'
                 },
                 'specialTag': {},
                 'slice-view': {

+ 2 - 1
stmms-web/src/main/webapp/static/mark-new/js/modules/image-builder.js

@@ -7,6 +7,7 @@ var image_builder = function (option, success) {
 
 function ImageBuilder(option) {
     this.markControl = option.markControl;
+    this.splitConfig = Array.isArray(option.splitConfig) ? option.splitConfig : [];
     this.init();
 }
 
@@ -22,7 +23,7 @@ ImageBuilder.prototype.build = function (task, callback) {
         server: this.markControl.context.imageServer,
         flush: true,
         strict: false,
-        split: task.splitConfig
+        split: this.splitConfig
     }).merge(task.pictureUrls, this.canvas, task.pictureConfig, function (image) {
         task.imageData = image
         task.imageLayout = image.layout

+ 10 - 3
stmms-web/src/main/webapp/static/utils/image-utils.js

@@ -28,9 +28,16 @@ function ImageLoader(option) {
     this.server = option.server || ''
     this.flush = option.flush === true
     this.strict = option.strict === true
-    this.split = Array.isArray(option.split) && option.split.length > 0 ? option.split : [
-        {left: 0, width: 0.55}, {left: 0.45, width: 0.55}
-    ]
+    this.split = []
+    if (Array.isArray(option.split) && option.split.length > 0) {
+        for (let i = 0; i < (option.split.length - 1); i = i + 2) {
+            this.split.push({left: option.split[i], width: option.split[i + 1]})
+        }
+    }
+    if (this.split.length == 0) {
+        this.split.push({left: 0, width: 0.55})
+        this.split.push({left: 0.45, width: 0.55})
+    }
 }
 
 ImageLoader.prototype.load = function (urls, config, onSuccess, onError) {