第二页锚定点优化等

This commit is contained in:
强 杨 2024-03-28 10:52:05 +08:00
parent a9837f5f3d
commit 3a6cc97a72
5 changed files with 186 additions and 63 deletions

91
App_Code/MysqlDBHelper.cs Normal file
View File

@ -0,0 +1,91 @@
using Dapper;
using MySql.Data.MySqlClient;
using System.Data;
using System.Data.SqlClient;
/// <summary>
/// 数据库操作类 需要nuget 安装 Dapper 和 MySql.Data
/// </summary>
public class MysqlDBHelper
{
// todo 生产环境切换数据库地址
//#if DEBUG
private const string _basicConnectionStr =
"Server=192.168.2.9;Port=3306;Database=marking_basic;Uid=root;Pwd=qwe123!@#;MinimumPoolSize=1;MaximumPoolSize=100;CharSet=utf8mb4;AllowLoadLocalInfile=true;AllowUserVariables=True;";
//#else
// private const string _basicConnectionStr =
// "Server=mk-rds.23544.com;Port=33306;Database=marking_basic;Uid=marking;Pwd=poiuytPOIUYT098765)(*&^%;MinimumPoolSize=1;MaximumPoolSize=100;CharSet=utf8mb4;AllowLoadLocalInfile=true;AllowUserVariables=True;";
//#endif
private string _tenantConnectionStr;
public MysqlDBHelper(long tenantCode)
{
if (tenantCode <= 0)
{
throw new System.ArgumentNullException("tenantCode");
}
_tenantConnectionStr = GetTenantConnectionString(tenantCode);
}
private string GetTenantConnectionString(long tenantCode)
{
using (IDbConnection connection = new MySqlConnection(_basicConnectionStr))
{
var tenant = connection.QueryFirst<dynamic>("select * from tenant where tenant_code=" + tenantCode);
return "Server=" + tenant.ip_addr + ";Port=" + tenant.port + ";Database=" + tenant.database + ";Uid=" + tenant.dbuser + ";Pwd=" + tenant.password + ";MinimumPoolSize=1;MaximumPoolSize=100;CharSet=utf8mb4;AllowLoadLocalInfile=true;AllowUserVariables=True;";
}
}
public DataTable ExecuteQuery(string sql)
{
DataTable dt = new DataTable();
using (IDbConnection connection = new MySqlConnection(_tenantConnectionStr))
{
using (var reader = connection.ExecuteReader(sql))
{
dt.Load(reader);
}
}
return dt;
}
public object ExecuteScalar(string sql)
{
using (IDbConnection connection = new MySqlConnection(_tenantConnectionStr))
{
return connection.ExecuteScalar(sql);
}
}
public int ExecuteNoQuery(string sql)
{
using (IDbConnection connection = new MySqlConnection(_tenantConnectionStr))
{
return connection.Execute(sql);
}
}
public int ExecuteNoQuery(string sql, params MySqlParameter[] sp)
{
using (MySqlConnection connection = new MySqlConnection(_tenantConnectionStr))
{
connection.Open();
using (MySqlCommand cmd = new MySqlCommand(sql, connection))
{
cmd.CommandType = CommandType.Text;
if (sp != null && sp.Length > 0)
{
cmd.Parameters.AddRange(sp);
}
return cmd.ExecuteNonQuery();
}
}
}
}

View File

@ -8,18 +8,18 @@
<title>导入外部答题卡制作模板</title>
<script src="../js/jquery-1.10.2.min.js"></script>
<link href="../css/default.css" rel="stylesheet" />
<%-- 禁用浏览器缓存 --%>
<%-- 禁用浏览器缓存 --%>
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Cache" content="no-cache">
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<script>
var SelectOBJ = null;
$(document).ready(function (e) {
$($(".main")[0]).find(".main_tabletop ").each(function () {
$(this).click(function () {
SelectOBJ = this;
@ -28,37 +28,37 @@
})
setInterval(function () {
$($(".main")[0]).find(".main_tabletop ").each(function () {
$(this).click(function () {
SelectOBJ = this;
})
})
},500)
}, 500)
$(document).keydown(function (event) {
if (event.keyCode == 38) {//上
$(SelectOBJ).css("top", (parseInt($(SelectOBJ).css("top")) - 1) + "px");
event.stopPropagation();
event.preventDefault();
}
if (event.keyCode == 40) {//下
$(SelectOBJ).css("top", (parseInt($(SelectOBJ).css("top")) + 1) + "px");
event.stopPropagation();
event.preventDefault();
}
if (event.keyCode == 37) {//左
$(SelectOBJ).css("left", (parseInt($(SelectOBJ).css("left")) - 1) + "px");
event.stopPropagation();
event.preventDefault();
}
if (event.keyCode == 39) {//左
$(SelectOBJ).css("left", (parseInt($(SelectOBJ).css("left")) + 1) + "px");
event.stopPropagation();
event.preventDefault();
}
});
document.body.onkeydown = function (e) {
@ -162,7 +162,7 @@
</select>
</td>
<% if (PageIndex == "1")
{ %>
{ %>
<th valign="middle" class="lockHide">
<div class="main_select_one">
<span>准考证号:</span>
@ -180,7 +180,7 @@
</select>
<span class="main_select_set" id="main_select_set" onclick="SetXuehao(this)">设置准考证号</span>
</div>
</th>
</th>
<td style="padding: 0;" valign="top" class="lockHide">
<div class="tiaomasz" onclick="SetTiaoMa(this)">设置条码</div>
</td>
@ -190,7 +190,7 @@
<td class="lockHide">
<div class="biaozhundian" onclick="SetBiaoZhunDian(this)">标准涂点</div>
</td>
<% }%>
<td class="lockHide">
<div class="maodingdian" onclick="SetMaoDingDian(this,<%=PageIndex %>)">锚定点</div>
@ -208,7 +208,7 @@
</table>
</div>
<div style="width: 1570px; overflow: hidden;">
<div class="main_papermain" id="mainbox_l_T">
<div class="main_papermain" id="mainbox_l_T">
<img id="SelectImg" src="<%=imgage %>" style="width: 100%; float: left; z-index: 0;" />
</div>
@ -302,7 +302,7 @@
<span style="float: left; width: 100%; display: block; padding-top: 1px; border: 0; border: 1px solid #ffd800; margin-top: 10px; color: #f00">切割成两半 如11题 如 第一半11X1 第二半11X2</span>
<div style="margin-top: 15px; padding-left: 20px; text-align: left; margin-bottom: 10px;">
题号:<input id="zhuguan_tihao" style="font-size: 14px; width: 60px;" type="text" value="" />小题:<input id="zhuguan_xiaoti" style="width: 40px; font-size: 14px;" type="text" value="0" />
题号:<input id="zhuguan_tihao" style="font-size: 14px; width: 60px;" type="text" value="" /><span style="display: none">小题:<input id="zhuguan_xiaoti" style="width: 40px; font-size: 14px;" type="text" value="0" /></span>
分数:
<select id="zgquestionscroe" style="font-size: 14px; width: 80px; text-align: center;">
<option value="">无分</option>
@ -338,28 +338,29 @@
<br />
<br />
<div style="margin-left: 45px;" class="goPeizhi" onclick="SetZhuguanTi()">开始配置</div>
<% if (Request.QueryString["ishand"] == "1")
{ %>
<% if (Request.QueryString["ishand"] == "1")
{ %>
<div id="isHand_Py" style="float: left; width: 100%; text-align: left; margin-top: 10px; border-bottom: 1px solid #ddd; padding-bottom: 5px;">
先批后阅题号:
<select id="py_tihao"></select>
<input type="button" value="题目配置" id="pytimups" onclick="SetPYPostion(0)" style="width: 90px; margin-right: 10px;" />
<%-- <input onclick="SetPYPostion(1)" style="width:100px;margin-right:10px;" type="button" value="常规题" />--%>
</div>
<% } %>
<% } %>
</li>
</ul>
<div style="width: 100%; text-align: center; float: left; padding-bottom: 10px; font-size: 14px; padding-top: 10px; background: #044775; border-top: 2px solid #000000; color: #fff;">模板删减区</div>
<div><div style="width:40px;height:20px;overflow:hidden;padding:5px;float:left;">题型</div>
<div style="width:70px;height:20px;overflow:hidden;padding:5px;float:left;">题号</div>
<div style="width:50px;height:20px;overflow:hidden;padding:5px;float:left;">选项数</div>
<div style="width:40px;height:20px;overflow:hidden;padding:5px;float:left;">分数</div>
<div style="width:72px;height:20px;overflow:hidden;padding:5px;float:left;">方向/步长</div>
<div style="width: 100%; text-align: center; float: left; padding-bottom: 10px; font-size: 14px; padding-top: 10px; background: #044775; border-top: 2px solid #000000; color: #fff; ">模板删减区(滑动滚轮查看所有题目)</div>
<div>
<div style="width: 40px; height: 18px; overflow: hidden; padding: 3px; float: left;">题型</div>
<div style="width: 70px; height: 18px; overflow: hidden; padding: 3px; float: left;">题号</div>
<div style="width: 50px; height: 18px; overflow: hidden; padding: 3px; float: left;">选项数</div>
<div style="width: 40px; height: 18px; overflow: hidden; padding: 3px; float: left;">分数</div>
<div style="width: 72px; height: 18px; overflow: hidden; padding: 3px; float: left;">方向/步长</div>
</div>
<ul id="NowSelect" class="lineul" style="overflow-y: scroll; height: 240px;">
<ul id="NowSelect" class="lineul" style="overflow-y: scroll; height: 300px;overflow-x: hidden;">
</ul>
</div>
@ -385,12 +386,12 @@
</script>
<script>
String.prototype.trim = function (char) {
char = char||'\s'
char = char || '\s'
char = char.replace("^", "\\^")
char = char.replace("+", "\\+")
char = char.replace("$", "\\$")
char = char.replace("+", "\\+")
char = char.replace("$", "\\$")
return this.replace(new RegExp('^' + char + '*|' + char + '*$', 'g'), '');
};
</script>
<script src="../js/index.js"></script>

View File

@ -57,7 +57,7 @@ public partial class 外部答题卡_Default : System.Web.UI.Page
case 1:
UpdateTempData();
break;
// 锁定
// 锁定
case 2:
LockTemp();
break;
@ -337,7 +337,7 @@ public partial class 外部答题卡_Default : System.Web.UI.Page
Image<Gray, byte> currentFramext = new Image<Gray, byte>(PictureBoxBitMap);
Image<Gray, byte> myImage = new Image<Gray, byte>(commonUse.FilterRed(PictureBoxBitMap));
// 进行中值滤波
CvInvoke.MedianBlur(myImage, myImage, 5);
// 进行高斯滤波
@ -368,7 +368,7 @@ public partial class 外部答题卡_Default : System.Web.UI.Page
//VectorOfVectorOfPoint selected_contours1;
//selected_contours1 = commonUse.GetUsefulContoursDingWei(mat_dilate1, 1);
string message = string.Empty;
Mat color_mxxx = commonUse.GetPostionXYByFindPostionAndXieLv(currentFramext.Mat, selected_contours1, GetData[0], out PYPostionList, currentFramext, out xielv,out message);
Mat color_mxxx = commonUse.GetPostionXYByFindPostionAndXieLv(currentFramext.Mat, selected_contours1, GetData[0], out PYPostionList, currentFramext, out xielv, out message);
if (xielv == -100)
{
Response.Write(message);
@ -515,7 +515,7 @@ public partial class 外部答题卡_Default : System.Web.UI.Page
int wL = Convert.ToInt32(W / xuanXiang);
int hL = Convert.ToInt32(H / tiliang);
Image<Gray, byte> bytimg = GetMatCutImg(color_mat.Bitmap, X, Y, W, H);
//Bitmap bmp = ScaleToSize(tempImage.Bitmap, tempImage.Bitmap.Width * 4, tempImage.Bitmap.Height * 4, groupNo);
@ -1075,28 +1075,34 @@ public partial class 外部答题卡_Default : System.Web.UI.Page
}
if (GetData[8] != "")
{
string[] list = GetData[8].Split(',');
Xleft = Convert.ToDouble(list[0]);
Xtop = Convert.ToDouble(list[1]);
Xwidth = Convert.ToDouble(list[2]);
Xheight = Convert.ToDouble(list[3]);
if (Xleft < pyLeft)
{
return "批阅分数编辑框左边超过定位点边界!";
string[] datipiyue = GetData[8].Split('^');
}
if (Xleft + Xwidth - pyLeft > oldWidth)
foreach (string slist in datipiyue)
{
return "批阅分数编辑框编辑框右边超过定位点边界!";
}
if (Xtop < pyTop)
{
return "批阅分数编辑框编辑框上边超过定位点边界!";
}
string[] list = slist.Split(',');
Xleft = Convert.ToDouble(list[0]);
Xtop = Convert.ToDouble(list[1]);
Xwidth = Convert.ToDouble(list[2]);
Xheight = Convert.ToDouble(list[3]);
string tihao = list[4];
if (Xleft < pyLeft)
{
return "题号:[" + tihao + "]批阅分数编辑框左边超过定位点边界!";
if (Xtop + Xheight - pyTop > oldHeight)
{
return "批阅分数编辑框编辑框下边超过定位点边界!";
}
if (Xleft + Xwidth - pyLeft > oldWidth)
{
return "题号:[" + tihao + "]批阅分数编辑框右边超过定位点边界!";
}
if (Xtop < pyTop)
{
return "题号:[" + tihao + "]批阅分数编辑框上边超过定位点边界!";
}
if (Xtop + Xheight - pyTop > oldHeight)
{
return "题号:[" + tihao + "]批阅分数编辑框下边超过定位点边界!";
}
}
}
if (HideAreaPostionList != "")

View File

@ -1,10 +1,29 @@

/*// 滚动条宽度*/
::-webkit-scrollbar {
width: 8px;
}
/*// 滚动条轨道*/
::-webkit-scrollbar-track {
background: rgb(239, 239, 239);
border-radius: 2px;
}
/*// 小滑块*/
::-webkit-scrollbar-thumb {
background: #044775;
border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
background: #40a0ff;
}
body {height: 100%; overflow-x:hidden;font-family:'Microsoft YaHei UI'; }
::-webkit-scrollbar {
/*::-webkit-scrollbar {
width: 0;
height: 0;
}
}*/
ul { text-decoration:none; list-style-type:none; }
img { max-width: 100%;}
a, abbr, address, b, blockquote, body, caption, cite, code, dd, del, dfn, div, dl, dt, em, fieldset, form, h1, h2, h3, h4, h5, h6, html, i, iframe, img, ins, kbd, label, legend, li, object, ol, p, pre, q, samp, small, span, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, ul, var {
@ -115,7 +134,7 @@ a, abbr, address, b, blockquote, body, caption, cite, code, dd, del, dfn, div, d
}
.right_list .lineul li div.sm { float:left; width:30px; background:#cd0a0a; text-align:center; padding:5px; height:20px; line-height:20px;}
.right_list .lineul li div.sx { float:left; width:50px; background:#0361e1; color:#fff; text-align:center; padding:5px;height:20px; line-height:20px;}
.right_list .lineul li div.sd { float:left; width:40px; text-align:center; background:#000; color:#fff; text-align:center; padding:5px; float:right;height:20px; line-height:20px; font-size:12px; }
.right_list .lineul li div.sd { float:left; width:40px; text-align:center; background:#000; color:#fff; text-align:center; padding:5px; float:right;height:20px; line-height:20px; font-size:12px; cursor:pointer; }
.right_list .lineul li div.ss {
float: left;
width: 40px;

View File

@ -214,7 +214,7 @@ function SetZhuguanTi() {
$("#keguan_" + zhuguan_tihao).draggable({ containment: ".main_papermain" });
$("#keguan_" + zhuguan_tihao).resizable({ containment: ".main_papermain", handles: 'all' });
$("#NowSelect").append("<li style='background:#fff;' id='selectNow_" + zhuguan_tihao + "'><div class='sp'><div class='go'>主观题</div></div><div class='sf'>" + zhuguan_tihao + "</div><div class='sm'>" + zhuguan_xiaoti + "</div><div class='ss' idAtt='keguan_" + zhuguan_tihao + "' id='ss_" + zhuguan_tihao + "' onclick=\"UpdateBaseData(1,'" + score + "','" + zhuguan_tihao + "','主观题')\">" + score + "</div><div class='ssd' id='ssd_" + zhuguan_tihao + "' onclick=\"UpdateBaseData(2,'" + scoretype + "','" + zhuguan_tihao + "','主观题')\">" + scoretypeText + "</div><div class='sd' onclick=\"DeleteKeguanti('" + zhuguan_tihao + "')\">x</div></li>");
$("#NowSelect").append("<li style='background:#fff;' id='selectNow_" + zhuguan_tihao + "'><div class='sp'><div class='go'>主观题</div></div><div class='sf'>" + zhuguan_tihao + "</div><div class='sm'>" + zhuguan_xiaoti + "</div><div class='ss' idAtt='keguan_" + zhuguan_tihao + "' id='ss_" + zhuguan_tihao + "' onclick=\"UpdateBaseData(1,'" + score + "','" + zhuguan_tihao + "','主观题')\">" + score + "</div><div class='ssd' id='ssd_" + zhuguan_tihao + "' onclick=\"UpdateBaseData(2,'" + scoretype + "','" + zhuguan_tihao + "','主观题')\">" + scoretypeText + "</div><div class='sd' onclick=\"DeleteKeguanti('" + zhuguan_tihao + "')\">X</div></li>");
//如果是手阅
GetZhuguantiScoreList();
}
@ -329,10 +329,16 @@ function SetMaoDingDian(obj, pageIndex) {
if (pageIndex == 1) {
ocrText = prompt("请输入学科:");
if (ocrText == '' || ocrText == null) {
alert("请输入学科");
alert("请输入学科!");
return;
}
}
} else {
ocrText = prompt("请输入识别的文字:", ocrText);
if (ocrText == '' || ocrText == null) {
alert("请输入识别的文字!");
return;
}
}
$(".main_papermain").append("<div id=\"keguan_" + zhuguan_tihao + "\" class='main_tabletop maodingdian_select' wenzimiaoshu='" + zhuguan_tihao + "' style='width:80px;background:none; left:100px; top:200px; height:30px'><div style=\" float:left; width:auto; text-align:center; height:30px; position:absolute; margin-top:-30px;z-index:22; color:#fff; line-height:30px; background:#666;\">" + zhuguan_tihao + "</div><div style='width:100%;height:100%;background:#fff;border:1px solid red;' id='maodingdian'>" + ocrText + "</div></div>");
$("#keguan_" + zhuguan_tihao).draggable({ containment: ".main_papermain" });
@ -393,10 +399,10 @@ function SetPYPostion(type) {
lineWh = "width:736px;height:30px;";
}
if (score.indexOf(".") > -1) {
alert("题目分数不能有小数点");
return;
}
//if (score.indexOf(".") > -1) {
// alert("题目分数不能有小数点");
// return;
//}
var html = "";