From 8cc03f46705e16cbd1f7460fcf17487171ba1252 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=BA=20=E6=9D=A8?= Date: Tue, 27 Jun 2023 18:39:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=87=E9=A2=98=E9=AA=8C=E8=AF=81=E8=BE=B9?= =?UTF-8?q?=E6=A1=86=E6=8B=96=E5=8A=A8=E4=B8=8D=E8=B6=85=E8=BF=87=E5=AE=9A?= =?UTF-8?q?=E4=BD=8D=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Temp/Default.aspx.cs | 24 ++++++------- Temp/SplitQuestion.aspx | 6 ++-- Temp/SplitQuestion.aspx.cs | 73 +++++++++++++++++++++++++++++++++----- 3 files changed, 80 insertions(+), 23 deletions(-) diff --git a/Temp/Default.aspx.cs b/Temp/Default.aspx.cs index b276384..31f5f31 100644 --- a/Temp/Default.aspx.cs +++ b/Temp/Default.aspx.cs @@ -787,20 +787,20 @@ public partial class 外部答题卡_Default : System.Web.UI.Page string tihao = list[4] + "-" + list[5]; if (Xleft < pyLeft) { - return "客观题"+ tihao + "编辑框左边超过定位点边界!"; + return "客观题:[" + tihao + "] 编辑框左边超过定位点边界!"; } if (Xleft + Xwidth - pyLeft > oldWidth) { - return "客观题" + tihao + "编辑框右边超过定位点边界!"; + return "客观题:[" + tihao + "]编辑框右边超过定位点边界!"; } if (Xtop < pyTop) { - return "客观题" + tihao + "编辑框上边超过定位点边界!"; + return "客观题:[" + tihao + "] 编辑框上边超过定位点边界!"; } if (Xtop + Xheight - pyTop > oldHeight) { - return "客观题" + tihao + "编辑框下边超过定位点边界!"; + return "客观题:[" + tihao + "] 编辑框下边超过定位点边界!"; } } } @@ -817,20 +817,20 @@ public partial class 外部答题卡_Default : System.Web.UI.Page string tihao = list[4] ; if (Xleft < pyLeft) { - return "主观题" + tihao + "编辑框左边超过定位点边界!"; + return "主观题:[" + tihao + "] 编辑框左边超过定位点边界!"; } if (Xleft + Xwidth - pyLeft > oldWidth) { - return "主观题" + tihao + "编辑框右边超过定位点边界!"; + return "主观题:[" + tihao + "] 编辑框右边超过定位点边界!"; } if (Xtop < pyTop) { - return "主观题" + tihao + "编辑框上边超过定位点边界!"; + return "主观题:[" + tihao + "] 编辑框上边超过定位点边界!"; } if (Xtop + Xheight - pyTop > oldHeight) { - return "主观题" + tihao + "编辑框下边超过定位点边界!"; + return "主观题:[" + tihao + "] 编辑框下边超过定位点边界!"; } } } @@ -847,20 +847,20 @@ public partial class 外部答题卡_Default : System.Web.UI.Page string tihao = list[4]; if (Xleft < pyLeft) { - return "" + tihao + "编辑框左边超过定位点边界!"; + return "题号:[" + tihao + "] 编辑框左边超过定位点边界!"; } if (Xleft + Xwidth - pyLeft > oldWidth) { - return "" + tihao + "编辑框右边超过定位点边界!"; + return "题号:[" + tihao + "] 编辑框右边超过定位点边界!"; } if (Xtop < pyTop) { - return "" + tihao + "编辑框上边超过定位点边界!"; + return "题号:[" + tihao + "] 编辑框上边超过定位点边界!"; } if (Xtop + Xheight - pyTop > oldHeight) { - return "" + tihao + "编辑框下边超过定位点边界!"; + return "题号:[" + tihao + "] 编辑框下边超过定位点边界!"; } } } diff --git a/Temp/SplitQuestion.aspx b/Temp/SplitQuestion.aspx index 4ccba55..3b004a8 100644 --- a/Temp/SplitQuestion.aspx +++ b/Temp/SplitQuestion.aspx @@ -177,7 +177,7 @@ SelectValueList(); function SetZhuguanTi() { - var zhuguan_tihao = $("#zhuguan_tihao").val().toUpperCase().replace(".", "·").replace("(", "(").replace(")", ")").replace(")", ")").replace("=", "=").replace("@", "@"); + var zhuguan_tihao = $("#zhuguan_tihao").val().toUpperCase().replace(/\./g, "·").replace(/\(/g, "(").replace(/\)/g, ")").replace(/\=/g, "=").replace(/\@/g, "@"); if (!CheckTihao(zhuguan_tihao)) { alert("该题号原试卷已经存在"); return; @@ -277,8 +277,8 @@ } var zhuguan_xiaoti = zhuguanList[5]; $(".main_papermain").append("
" + lineWhTx + ":" + zhuguan_tihao + "
"); - $("#keguan_" + zhuguan_tihao).draggable({ containment: ".main_papermain" }); - $("#keguan_" + zhuguan_tihao).resizable({ containment: ".main_papermain", handles: 'all' }); + //$("#keguan_" + zhuguan_tihao).draggable({ containment: ".main_papermain" }); + // $("#keguan_" + zhuguan_tihao).resizable({ containment: ".main_papermain", handles: 'all' }); //$("#NowSelect").append("
  • 主观题
    " + zhuguan_tihao + "
    " + zhuguan_xiaoti + "
    " + score + "
    " + scoretypetext + "
    x
  • "); } diff --git a/Temp/SplitQuestion.aspx.cs b/Temp/SplitQuestion.aspx.cs index ad2fe50..59ca556 100644 --- a/Temp/SplitQuestion.aspx.cs +++ b/Temp/SplitQuestion.aspx.cs @@ -52,6 +52,18 @@ public partial class Temp_SplitQuestion : System.Web.UI.Page } } + //获取原始图片 + sql = "SELECT CutWidth_int,CutHeight_int,PyPPostion_nvarchar FROM MK_TempleteData WHERE ID_bigint=" + TemDataID; + DataTable dttmp = new MysqlDBHelper(tenant).ExecuteQuery(sql); + int oldWidth = Convert.ToInt32(dttmp.Rows[0]["CutWidth_int"]); + int oldHeight = Convert.ToInt32(dttmp.Rows[0]["CutHeight_int"]); + string PYPostionList = dttmp.Rows[0]["PyPPostion_nvarchar"].ToString(); + string tempEx = TempV(zhuguantiList, PYPostionList, oldWidth, oldHeight); + if (tempEx != "ok") + { + Response.Write(tempEx); + return; + } if (!isP) { @@ -62,13 +74,10 @@ public partial class Temp_SplitQuestion : System.Web.UI.Page long exam_subject_id = Convert.ToInt64(Globals.Request("exam_subject_id")); long subjective = Convert.ToInt64(Globals.Request("subjective")); - //if (!CheckStatus(exam_subject_id)) - //{ - // return; - //} + var checkResult = CheckStatusByApi(subjective); if (!checkResult.data) - { + { Response.Write(checkResult.message); return; } @@ -112,6 +121,8 @@ public partial class Temp_SplitQuestion : System.Web.UI.Page } allData = allData.Trim('$'); + + //更新原始模板 sql = "UPDATE MK_TempleteData SET TempValue_nvarchar=@TempValue_nvarchar WHERE ID_bigint=" + TemDataID; MySqlParameter[] sp = new MySqlParameter[] { @@ -177,7 +188,7 @@ public partial class Temp_SplitQuestion : System.Web.UI.Page //调用接口 result r = (result)JavaScriptConvert.DeserializeObject(RequestPost(subjective.ToString(), lt.ToJsonString()), typeof(result)); if (r.code == "200" && r.data) - { + { Response.Write("1"); } else @@ -198,6 +209,52 @@ public partial class Temp_SplitQuestion : System.Web.UI.Page } + /// + /// 检查边距是否合格 + /// + /// + private string TempV(string GetData, string PYPostionList, int oldWidth, int oldHeight) + { + double pyLeft = Convert.ToInt32(PYPostionList.Split(',')[0]); + double pyTop = Convert.ToInt32(PYPostionList.Split(',')[1]); + double Xtop = 0; + double Xleft = 0; + double Xwidth = 0; + double Xheight = 0; + if (GetData != "")//主观题 + { + string[] keguantiList = GetData.Split('^'); + foreach (string slist in keguantiList) + { + 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 (Xleft + Xwidth - pyLeft > oldWidth) + { + return "题号:[" + tihao + "] 编辑框右边超过定位点边界!"; + } + if (Xtop < pyTop) + { + return "题号:[" + tihao + "] 编辑框上边超过定位点边界!"; + } + + if (Xtop + Xheight - pyTop > oldHeight) + { + return "题号:[" + tihao + "] 编辑框下边超过定位点边界!"; + } + } + } + return "ok"; + } + + protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) @@ -364,7 +421,7 @@ public partial class Temp_SplitQuestion : System.Web.UI.Page httpItem.Method = "GET"; //httpItem.Postdata = body; //httpItem.PostEncoding = Encoding.UTF8; - httpItem.ContentType = "application/json"; + httpItem.ContentType = "application/json"; httpItem.URL = url; var reponse = HttpHelper.Default.GetHtml(httpItem); if (reponse.StatusCode != HttpStatusCode.OK) @@ -419,7 +476,7 @@ public partial class Temp_SplitQuestion : System.Web.UI.Page //string OrderQuantity = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding("UTF-8")).ReadToEnd(); //return OrderQuantity; } - + public class CutList {