From f27ff2b3682bf2fea4780ecdd71fdd377c41aa28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=BA=20=E6=9D=A8?= Date: Thu, 21 Sep 2023 11:09:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=87=E6=8D=A2=E9=A1=B5?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Temp/Default.aspx | 379 ++++++++++++++++++++++++------------------- Temp/Default.aspx.cs | 115 ++++++++----- js/index.js | 195 +++++++++++----------- 3 files changed, 378 insertions(+), 311 deletions(-) diff --git a/Temp/Default.aspx b/Temp/Default.aspx index 3c92505..51a5fcc 100644 --- a/Temp/Default.aspx +++ b/Temp/Default.aspx @@ -4,88 +4,112 @@ - + 导入外部答题卡制作模板 -
-
- - + + -
- - -
-
- - - - - - - + + + + + + + + + - - + +
- - + - + <% if (PageCount >1) { %> + + <% } %> + - - - - - -
选定锚点 -
左上锚点
+
+ + <% if (PageIndex == "1") { %> +
第一页
+ <% } + else + { %> +
第一页
+ <% } %> + +
+ <% if (PageIndex == "2") { %> +
第二页
+ <% } + else + { %> +
第二页
+ <% } %> + +
纸张类型: - +
准考证号: - + + + + + + + @@ -93,37 +117,37 @@ 设置准考证号
+ +
设置条码
-
设置缺考
+
+
设置缺考
-
标准涂点
+
+
标准涂点
-
增加屏蔽
+
+
增加屏蔽
- + - +
-
-
- - +
+
+ +
- +
-
折叠
+
折叠
-
-
    -
  • 客观题设置
  • -
  • -
    -

    - 题号:- -

    - -


    - 选项:- +
    +
    + +
    +
    +
    + 选项: + + +
    +
    +
    + 类型: + 分数: + - - -


    - 类型: - 分数: - -

    -
    开始配置
    -
    -
  • -
+
+
+
开始配置
+
+ + - + -
    -
  • 主观题设置
  • -
  • - 切割成两半 如11题 如 第一半11X1 第二半11X2 - -
    - 题号:小题: - 分数: - -

    - 阅卷分值间隔: - 小题: + 分数: + +
    +
    + 阅卷分值间隔: + - 类型: - -
    + + <% if (Request.QueryString["ishand"] == "1") + { %> + 类型: + + <% } %> +
- -


-
开始配置
-
- 先批后阅题号: +
+
+
+
开始配置
+ +
+ 先批后阅题号: - - <%-- --%> -
- - - -
模板删减区
-
    - -
-
+ + <%-- --%> +
+ + + +
模板删减区
+ + - - + + diff --git a/Temp/Default.aspx.cs b/Temp/Default.aspx.cs index 31f5f31..aa6b686 100644 --- a/Temp/Default.aspx.cs +++ b/Temp/Default.aspx.cs @@ -26,6 +26,7 @@ using System.Security.AccessControl; public partial class 外部答题卡_Default : System.Web.UI.Page { public long TempID = 0; + public long AnotherTempID = 0; public string PageIndex = "0"; public string Bindlist = ""; public string imgage = ""; @@ -37,13 +38,14 @@ public partial class 外部答题卡_Default : System.Web.UI.Page public string pager = ""; public int isHand = 0; public string MainTempId = "0"; + public int PageCount = 0; protected void Page_Load(object sender, EventArgs e) { - int action = Globals.Request("action") == "" ? 0 : Convert.ToInt32(Globals.Request("action")); - tenant = Globals.Request("tenant") == "" ? 0 : Convert.ToInt64(Globals.Request("tenant")); + int action = Globals.Request("action") == "" ? 0 : Convert.ToInt32(Globals.Request("action")); + tenant = Globals.Request("tenant") == "" ? 0 : Convert.ToInt64(Globals.Request("tenant")); isHand = Globals.Request("isHand") == "" ? 0 : Convert.ToInt32(Globals.Request("isHand")); - pager = Globals.Request("pager").ToLower() ; + pager = Globals.Request("pager").ToLower(); if (action != 0) { @@ -62,7 +64,8 @@ public partial class 外部答题卡_Default : System.Web.UI.Page else { TempID = Globals.Request("TempID") == "" ? 0 : Convert.ToInt32(Globals.Request("TempID"));//获取小模板ID - if (TempID == 0) { + if (TempID == 0) + { Response.Write(""); return; } @@ -76,21 +79,36 @@ public partial class 外部答题卡_Default : System.Web.UI.Page HideAreaText = dtx.Rows[0]["HideAreaPostionList_nvarchar"] == null ? "" : dtx.Rows[0]["HideAreaPostionList_nvarchar"].ToString(); IsPostionValue = dtx.Rows[0]["HideAreaPostionList_nvarchar"] == null ? "" : dtx.Rows[0]["HideAreaPostionList_nvarchar"].ToString(); PageIndex = dtx.Rows[0]["PageIndex_int"] == null ? "" : dtx.Rows[0]["PageIndex_int"].ToString(); - sql = "select HasPosition FROM MK_TempleteMain WHERE ID_bigint=" + dtx.Rows[0]["MainID_bigint"].ToString(); MainTempId = dtx.Rows[0]["MainID_bigint"].ToString(); - IsPostionValue = new MysqlDBHelper(tenant).ExecuteScalar(sql).ToString(); + sql = "select MainPage_int,HasPosition from MK_TempleteMain where ID_bigint=" + MainTempId; + var maindt = new MysqlDBHelper(tenant).ExecuteQuery(sql); + if (maindt == null || maindt.Rows.Count <= 0) + { + Response.Write(""); + return; + } + PageCount = Convert.ToInt32(maindt.Rows[0]["MainPage_int"]); + IsPostionValue = maindt.Rows[0]["HasPosition"].ToString(); + + if (PageCount > 1) + { + sql = "select ID_bigint from MK_TempleteData where MainID_bigint="+ MainTempId + " and ID_bigint!=" + TempID; + AnotherTempID = Convert.ToInt32(new MysqlDBHelper(tenant).ExecuteScalar(sql)); + } } } } - private void UpdateTempData() { + private void UpdateTempData() + { TempID = Globals.Request("TempID") == "" ? 0 : Convert.ToInt32(Globals.Request("TempID"));//获取小模板ID string totalHtml = Server.UrlDecode(Globals.Request("totalHtml")); - string HideAreaPostionList= Server.UrlDecode(Globals.Request("HideAreaPostionList")); + string HideAreaPostionList = Server.UrlDecode(Globals.Request("HideAreaPostionList")); - if (AnsyTemp(HideAreaPostionList, totalHtml)) { + if (AnsyTemp(HideAreaPostionList, totalHtml)) + { string sql = "Update MK_TempleteData SET TempValue_nvarchar=@TempValue_nvarchar,HideAreaPostionList_nvarchar=@HideAreaPostionList_nvarchar where ID_bigint=" + TempID; MySqlParameter[] sp = new MySqlParameter[] { new MySqlParameter("@TempValue_nvarchar",totalHtml), @@ -101,7 +119,7 @@ public partial class 外部答题卡_Default : System.Web.UI.Page } - + //if (new MysqlDBHelper(tenant).ExecuteNoQuery(sql, sp) == 1) //{ @@ -153,7 +171,8 @@ public partial class 外部答题卡_Default : System.Web.UI.Page //} } - private void AddQuestionData(string totalHtml) { + private void AddQuestionData(string totalHtml) + { TempID = Convert.ToInt64(Globals.Request("TempID")); string[] totalHtmlList = totalHtml.Split('$'); string kg = totalHtmlList[2]; @@ -171,14 +190,15 @@ public partial class 外部答题卡_Default : System.Web.UI.Page string endNum = detailtList[5].ToUpper(); string score = detailtList[9]; - if (score == "") { + if (score == "") + { score = "0"; } string selectNum = detailtList[6]; string isselectmore = detailtList[8]; - - - + + + string bigNum = ""; if (starNum.Contains("M")) { @@ -199,7 +219,7 @@ public partial class 外部答题卡_Default : System.Web.UI.Page new MySqlParameter("@Score_float",score), new MySqlParameter("@selectNum_int",selectNum), new MySqlParameter("@selecttype_int",isselectmore), - + }; new MysqlDBHelper(tenant).ExecuteNoQuery(sql, sp); } @@ -242,7 +262,7 @@ public partial class 外部答题卡_Default : System.Web.UI.Page issplit = true; detailtList[4] = detailtList[4].Split('X')[0]; } - + //sql = "SELECT COUNT(1) FROM MK_TempQuestionData WHERE TempID_bigint=" + TempID + " AND QuestionIndex_int='" + detailtList[4] + "'"; sql = String.Format("SELECT COUNT(1) FROM MK_TempQuestionData where TempID_bigint in(select ID_bigint from MK_TempleteData where MainID_bigint =(SELECT MainID_bigint FROM " + "`MK_TempleteData` where ID_bigint={0})) AND QuestionIndex_int='{1}';", TempID, detailtList[4]); @@ -253,7 +273,8 @@ public partial class 外部答题卡_Default : System.Web.UI.Page { mkscoretype = "1"; } - else { + else + { mkscoretype = detailtList[7]; } @@ -279,12 +300,12 @@ public partial class 外部答题卡_Default : System.Web.UI.Page /// /// 锁定模板数据 /// - public bool AnsyTemp(string HideAreaPostionList,string totalHtml) + public bool AnsyTemp(string HideAreaPostionList, string totalHtml) { try { CommonUse commonUse = new CommonUse(); - long TempID =Convert.ToInt64(Globals.Request("TempID")); + long TempID = Convert.ToInt64(Globals.Request("TempID")); string sql = "SELECT * FROM MK_TempleteData WHERE ID_bigint=" + TempID; DataTable dt = new MysqlDBHelper(tenant).ExecuteQuery(sql); if (dt.Rows.Count <= 0) @@ -312,7 +333,7 @@ public partial class 外部答题卡_Default : System.Web.UI.Page int height = Convert.ToInt32(GetData[6].Split(',')[1]); PictureBoxBitMap = ScaleToSize(PictureBoxBitMap, width, height); Image imagex = new Image(PictureBoxBitMap); - + Mat mat_threshold1 = new Mat(); CvInvoke.Threshold(imagex, mat_threshold1, 160, 255, Emgu.CV.CvEnum.ThresholdType.BinaryInv); Mat mat_dilate1 = commonUse.MyDilate(mat_threshold1); @@ -321,7 +342,8 @@ public partial class 外部答题卡_Default : System.Web.UI.Page Image currentFramext = new Image(PictureBoxBitMap); Mat color_mxxx = commonUse.GetPostionXYByFindPostionAndXieLv(imagex.Mat, selected_contours1, GetData[0], out PYPostionList, currentFramext, out xielv); - if (xielv == -100) { + if (xielv == -100) + { Response.Write("模板配置错误,斜率无法计算"); return false; } @@ -337,7 +359,8 @@ public partial class 外部答题卡_Default : System.Web.UI.Page int PageIndex = Convert.ToInt32(Globals.Request("PageIndex")); - if (PageIndex == 1) { + if (PageIndex == 1) + { int mx = GetOtherBitmaplist(currentFramext.Mat, 160, PYPostionList.Split(','), GetData[9]); if (mx == 0) { @@ -376,14 +399,14 @@ public partial class 外部答题卡_Default : System.Web.UI.Page int width = Convert.ToInt32(GetData[6].Split(',')[0]); int height = Convert.ToInt32(GetData[6].Split(',')[1]); PictureBoxBitMap = ScaleToSize(PictureBoxBitMap, width, height); - Image imagex = new Image(PictureBoxBitMap); + Image imagex = new Image(PictureBoxBitMap); Mat mat_threshold1 = new Mat(); CvInvoke.Threshold(imagex, mat_threshold1, 160, 255, Emgu.CV.CvEnum.ThresholdType.BinaryInv); Mat mat_dilate1 = commonUse.MyDilate(mat_threshold1); VectorOfVectorOfPoint selected_contours1; selected_contours1 = commonUse.GetUsefulContoursDingWei(mat_dilate1, 1); Image currentFramext = new Image(PictureBoxBitMap); - + int PageIndex = Convert.ToInt32(Globals.Request("PageIndex")); if (PageIndex == 1) { @@ -442,8 +465,8 @@ public partial class 外部答题卡_Default : System.Web.UI.Page string[] quekao = postiontiaomaX.Split(','); //int X = Convert.ToInt32(Convert.ToDouble(quekao[0])) - Convert.ToInt32(PYPostion[0]); //int Y = Convert.ToInt32(Convert.ToDouble(quekao[1])) - Convert.ToInt32(PYPostion[1]); - int X = Convert.ToInt32(Convert.ToDouble(quekao[0])) ; - int Y = Convert.ToInt32(Convert.ToDouble(quekao[1])) ; + int X = Convert.ToInt32(Convert.ToDouble(quekao[0])); + int Y = Convert.ToInt32(Convert.ToDouble(quekao[1])); int W = Convert.ToInt32(Convert.ToDouble(quekao[2])); int H = Convert.ToInt32(Convert.ToDouble(quekao[3])); int xuanXiang = 1;//选项数量 @@ -454,14 +477,14 @@ public partial class 外部答题卡_Default : System.Web.UI.Page Image bytimg = GetMatCutImg(color_mat.Bitmap, X, Y, W, H); X = 0; Y = 0; - Mat src = bytimg.Mat; + Mat src = bytimg.Mat; Mat mat_threshold = new Mat(); CvInvoke.Threshold(src, mat_threshold, Threshold, 254, Emgu.CV.CvEnum.ThresholdType.BinaryInv); Mat mat_dilate = commonUse.MyDilate(mat_threshold); VectorOfVectorOfPoint selected_contours; - int option_pixel_options =0; + int option_pixel_options = 0; selected_contours = GetUsefulContoursSelectoOptionQK(mat_dilate, 1, out option_pixel_options); - + mx = GetValueAndDrawGrid_Other(src.Bitmap, selected_contours, X, wL, xuanXiang, Y, hL, tiliang, ""); bytimg.Dispose(); src.Dispose(); @@ -476,7 +499,7 @@ public partial class 外部答题卡_Default : System.Web.UI.Page /// 轮廓外接矩形小于该宽度值 /// 轮廓外接矩形大于该高度值 /// 轮廓外接矩形小于该高度值 - public static VectorOfVectorOfPoint GetUsefulContoursSelectoOptionQK(Mat mat, double ratio,out int option_pixel_options) + public static VectorOfVectorOfPoint GetUsefulContoursSelectoOptionQK(Mat mat, double ratio, out int option_pixel_options) { option_pixel_options = 0; VectorOfVectorOfPoint contours = new VectorOfVectorOfPoint();//所有的轮廓 @@ -498,13 +521,14 @@ public partial class 外部答题卡_Default : System.Web.UI.Page CvInvoke.ApproxPolyDP(contours[i], approx_curve, length * 0.02, true); //bool bo = (area > 500 && area < 12000);//&& rect.Height<100 //bool bo = ((area > 20 && area < 150000) && rect.Height > 8 ); - bool bo = ((area > 10 && area < 150000) && rect.Height > 5 ); + bool bo = ((area > 10 && area < 150000) && rect.Height > 5); if (bo) { - if (pxNums > (area * 0.7)) { + if (pxNums > (area * 0.7)) + { option_pixel_options = pxNums; selected_contours.Push(contours[i]); - } + } } } return selected_contours; @@ -741,7 +765,8 @@ public partial class 外部答题卡_Default : System.Web.UI.Page /// 检查边距是否合格 /// /// - private string TempV(string[] GetData,string PYPostionList,int oldWidth,int oldHeight,string HideAreaPostionList) { + private string TempV(string[] GetData, string PYPostionList, int oldWidth, int oldHeight, string HideAreaPostionList) + { double pyLeft = Convert.ToInt32(PYPostionList.Split(',')[0]); double pyTop = Convert.ToInt32(PYPostionList.Split(',')[1]); double Xtop = 0; @@ -757,8 +782,8 @@ public partial class 外部答题卡_Default : System.Web.UI.Page Xheight = Convert.ToDouble(list[3]); if (Xleft < pyLeft) { - return "学号编辑框左边超过定位点边界!"; - + return "学号编辑框左边超过定位点边界!"; + } if (Xleft + Xwidth - pyLeft > oldWidth) { @@ -771,14 +796,15 @@ public partial class 外部答题卡_Default : System.Web.UI.Page if (Xtop + Xheight - pyTop > oldHeight) { - return "学号编辑框下边超过定位点边界!"; + return "学号编辑框下边超过定位点边界!"; } } if (GetData[2] != "")//客观题 { string[] keguantiList = GetData[2].Split('^'); - foreach (string slist in keguantiList) { + foreach (string slist in keguantiList) + { string[] list = slist.Split(','); Xleft = Convert.ToDouble(list[0]); Xtop = Convert.ToDouble(list[1]); @@ -802,7 +828,7 @@ public partial class 外部答题卡_Default : System.Web.UI.Page { return "客观题:[" + tihao + "] 编辑框下边超过定位点边界!"; } - } + } } if (GetData[3] != "")//主观题 { @@ -814,7 +840,7 @@ public partial class 外部答题卡_Default : System.Web.UI.Page Xtop = Convert.ToDouble(list[1]); Xwidth = Convert.ToDouble(list[2]); Xheight = Convert.ToDouble(list[3]); - string tihao = list[4] ; + string tihao = list[4]; if (Xleft < pyLeft) { return "主观题:[" + tihao + "] 编辑框左边超过定位点边界!"; @@ -944,11 +970,12 @@ public partial class 外部答题卡_Default : System.Web.UI.Page return "批阅分数编辑框编辑框下边超过定位点边界!"; } } - if (HideAreaPostionList != "") { + if (HideAreaPostionList != "") + { JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); List ht = javaScriptSerializer.Deserialize>(HideAreaPostionList); - int count =0; + int count = 0; foreach (HideAreaData h in ht) { count++; @@ -958,7 +985,7 @@ public partial class 外部答题卡_Default : System.Web.UI.Page Xheight = Convert.ToDouble(h.height); if (Xleft < pyLeft) { - return "屏蔽区"+count+"编辑框左边超过定位点边界!"; + return "屏蔽区" + count + "编辑框左边超过定位点边界!"; } if (Xleft + Xwidth - pyLeft > oldWidth) diff --git a/js/index.js b/js/index.js index bb62bd6..6a12347 100644 --- a/js/index.js +++ b/js/index.js @@ -8,7 +8,7 @@ function ChangePageSize(obj) { //设定全卷遮挡区域 function SetHideArea() { - var html=""; + var html = ""; html += "
"; html += "
屏蔽显示区
"; html += "
X
"; @@ -34,20 +34,20 @@ function SetMao(obj, index) { return; } var style = ""; - var pright=parseInt($(".main_papermain").width()) -120; - var pheight=parseInt($(".main_papermain").height())-100; + var pright = parseInt($(".main_papermain").width()) - 120; + var pheight = parseInt($(".main_papermain").height()) - 100; if (index == 0) { style = "left:60px; top:40px;" } if (index == 1) { - style = "left:"+pright+"px; top:30px;" + style = "left:" + pright + "px; top:30px;" } if (index == 2) { - style = "left:60px; top:"+pheight+"px;" + style = "left:60px; top:" + pheight + "px;" } if (index == 3) { - style = "left:"+pright+"px; top:"+pheight+"px;" + style = "left:" + pright + "px; top:" + pheight + "px;" } $(obj).attr("class", "maodian_hover"); @@ -55,7 +55,7 @@ function SetMao(obj, index) { $("#draggable_" + index).draggable({ containment: ".main_papermain" }); - $("#draggable_" + index).resizable({ containment: ".main_papermain", handles: 'all' });//设置缩放 + $("#draggable_" + index).resizable({ containment: ".main_papermain", handles: 'all' });//设置缩放 } ///设置锚点 ///设置学号 @@ -79,7 +79,7 @@ function SetXuehao(obj) { $(".main_papermain").append("
" + html + "
"); $("#xuehaoTable").draggable({ containment: ".main_papermain" }); - $("#xuehaoTable").resizable({ containment: ".main_papermain", handles: 'all' });//设置缩放 + $("#xuehaoTable").resizable({ containment: ".main_papermain", handles: 'all' });//设置缩放 } //设置学号 @@ -98,29 +98,28 @@ function SetKeguanTi() { return; } - + if (document.getElementById("keguan_" + tihaoM) != undefined) { alert("题目配置重复:" + tihaoM); return; } - + var rd_listtype = document.getElementsByName("listtype");//题目横竖向 var listtype = 0; var selectNum = $("#selectNum").val(); - + for (var i = 0; i < rd_listtype.length; i++) { if (rd_listtype[i].checked) { listtype = rd_listtype[i].value; } } - + var questiontype = $("#questiontype").val(); var startnum = parseInt(tihaoList[0]); var endnum = parseInt(tihaoList[1]); - if (endnum == undefined) - { + if (endnum == undefined) { endnum = startnum; } var html = ""; @@ -134,12 +133,10 @@ function SetKeguanTi() { if (listtype == 0)//横向 { - for (var i = parseInt(startnum); i <=parseInt(endnum); i++) - { + for (var i = parseInt(startnum); i <= parseInt(endnum); i++) { html += ""; - for (var j = 0; j < selectNum; j++) - { + for (var j = 0; j < selectNum; j++) { html += ""; } html += ""; @@ -156,7 +153,7 @@ function SetKeguanTi() { } html += "
"; var selectMore = 0; - + var questionHtml = "单选题"; if (questiontype == 1) { questionHtml = "多选题"; @@ -167,9 +164,9 @@ function SetKeguanTi() { $(".main_papermain").append("
" + tihaoM + "
" + html + "
"); $("#keguan_" + tihao).draggable({ containment: ".main_papermain" }); - $("#keguan_" + tihao).resizable({ containment: ".main_papermain", handles: 'all' });//设置缩放 + $("#keguan_" + tihao).resizable({ containment: ".main_papermain", handles: 'all' });//设置缩放 var listtypeText = listtype == 0 ? "横向" : "竖向"; - $("#NowSelect").append("
  • " + questionHtml + "
    " + tihaoM + "
    " + selectNum + "
    " + listtypeText + "
    " + score + "
    x
  • "); + $("#NowSelect").append("
  • " + questionHtml + "
    " + tihaoM + "
    " + selectNum + "
    " + listtypeText + "
    " + score + "
    x
  • "); } function DeleteKeguanti(tihao) { @@ -187,7 +184,7 @@ function DeleteKeguanti(tihao) { function SetZhuguanTi() { - var zhuguan_tihao = $("#zhuguan_tihao").val().toUpperCase().replace(".", "·").replace("(", "(").replace(")", ")").replace(")", ")").replace("=", "=").replace("@","@"); + var zhuguan_tihao = $("#zhuguan_tihao").val().toUpperCase().replace(".", "·").replace("(", "(").replace(")", ")").replace(")", ")").replace("=", "=").replace("@", "@"); if (zhuguan_tihao == "") { alert("主观题 题号不能为空"); @@ -198,7 +195,7 @@ function SetZhuguanTi() { var questiontype_zg = $("#questiontype_zg").val(); //var scoretypeText = scoretype == "1" ? "全分" : "半分"; var scoretypeText = scoretype; - + if (document.getElementById("keguan_" + zhuguan_tihao) != undefined) { alert("0题目配置重复:" + zhuguan_tihao); return; @@ -206,14 +203,14 @@ function SetZhuguanTi() { var zhuguan_xiaoti = $("#zhuguan_xiaoti").val(); if (zhuguan_xiaoti == "") { zhuguan_xiaoti = "0"; - } - var lineWh = "width:800px;height:200px;"; + } + var lineWh = "width:450px;height:250px;"; var lineWhTx = "大题"; if (questiontype_zg == "2") { var lineWh = "width:200px;height:90px;"; - lineWhTx="填空" + lineWhTx = "填空" } - $(".main_papermain").append("
    " + lineWhTx+":" + zhuguan_tihao + "
    "); + $(".main_papermain").append("
    " + lineWhTx + ":" + zhuguan_tihao + "
    "); $("#keguan_" + zhuguan_tihao).draggable({ containment: ".main_papermain" }); $("#keguan_" + zhuguan_tihao).resizable({ containment: ".main_papermain", handles: 'all' }); @@ -238,9 +235,9 @@ function SetTiaoMa(obj) { $(".main_papermain").append("
    条码
    "); setTimeout(function () { $("#keguan_tiaomashibie").draggable({ containment: ".main_papermain" }); - $("#keguan_tiaomashibie").resizable({ containment: ".main_papermain", handles: 'all' }); + $("#keguan_tiaomashibie").resizable({ containment: ".main_papermain", handles: 'all' }); }, 500); - + } ////////////////设置条码识别区////////////////////// @@ -255,7 +252,7 @@ function SetZunkaoZheng() { } $(".main_papermain").append("
    准考证号
    "); $("#keguan_zhunkaozhenghaoshibie").draggable({ containment: ".main_papermain" }); - $("#keguan_zhunkaozhenghaoshibie").resizable({ containment: ".main_papermain", handles: 'all' }); + $("#keguan_zhunkaozhenghaoshibie").resizable({ containment: ".main_papermain", handles: 'all' }); $("#NowSelect").append("
  • 准考证号删除
  • "); } @@ -284,7 +281,7 @@ function SetWenziQuyu(obj) { } $(".main_papermain").append("
    " + zhuguan_tihao + "
    "); $("#keguan_" + zhuguan_tihao).draggable({ containment: ".main_papermain" }); - $("#keguan_" + zhuguan_tihao).resizable({ containment: ".main_papermain", handles: 'all' }); + $("#keguan_" + zhuguan_tihao).resizable({ containment: ".main_papermain", handles: 'all' }); } @@ -294,7 +291,7 @@ function SetWenziQuyu(obj) { function SetBiaoZhunDian(obj) { var zhuguan_tihao = "标准点"; - + if ($(obj).attr("class") == "biaozhundian_hover") { $(obj).attr("class", "biaozhundian"); DeleteKeguanti(zhuguan_tihao); @@ -319,7 +316,7 @@ function SetBiaoZhunDian(obj) { ////设置先批后阅////// function SetPYPostion(type) { - + var py_tihao = $("#py_tihao").val(); var isHaveX = false; if (document.getElementById("pyti_" + py_tihao) != null) { @@ -340,7 +337,7 @@ function SetPYPostion(type) { if (isHaveX) { score = $("#keguan_" + py_tihao + "X1").attr("score"); - type = $("#keguan_" + py_tihao+"X1").attr("questiontype_zg"); + type = $("#keguan_" + py_tihao + "X1").attr("questiontype_zg"); } else { score = $("#keguan_" + py_tihao).attr("score"); @@ -353,7 +350,7 @@ function SetPYPostion(type) { var lineWh = "width:35px;height:35px;"; - + if (type == "") { @@ -370,10 +367,10 @@ function SetPYPostion(type) { alert("题目分数不能有小数点"); return; } - + var html = ""; - html += "
    "; + html += "
    "; html += "
    " + lineWhTx + ":" + py_tihao + "x
    "; html += "
    "; html += "
    "; @@ -427,7 +424,7 @@ function GetKeguanPostion() { } var xy = ""; $(".keguanti").each(function () { - xy += parseFloat($(this).position().left) + "," + parseFloat($(this).position().top) + "," + parseFloat($(this).width()) + "," + parseFloat($(this).height()) + "," + $(this).attr("startnum") + "," + $(this).attr("endNum") + "," + $(this).attr("selectNum") + "," + $(this).attr("listtype") + "," + $(this).attr("questiontype") + "," + $(this).attr("score") + "^"; + xy += parseFloat($(this).position().left) + "," + parseFloat($(this).position().top) + "," + parseFloat($(this).width()) + "," + parseFloat($(this).height()) + "," + $(this).attr("startnum") + "," + $(this).attr("endNum") + "," + $(this).attr("selectNum") + "," + $(this).attr("listtype") + "," + $(this).attr("questiontype") + "," + $(this).attr("score") + "^"; }) return xy.trim('^'); } @@ -439,7 +436,7 @@ function GetZhuguanPostion() { return ""; } $(".zhuguanti").each(function () { - xy += parseFloat($(this).position().left) + "," + parseFloat($(this).position().top) + "," + parseFloat($(this).width()) + "," + parseFloat($(this).height()) + "," + $(this).attr("tihaovalue") + "," + $(this).attr("zhuguan_xiaoti") + "," + $(this).attr("score") + "," + $(this).attr("scoretype") + "," + $(this).attr("questiontype_zg")+"^"; + xy += parseFloat($(this).position().left) + "," + parseFloat($(this).position().top) + "," + parseFloat($(this).width()) + "," + parseFloat($(this).height()) + "," + $(this).attr("tihaovalue") + "," + $(this).attr("zhuguan_xiaoti") + "," + $(this).attr("score") + "," + $(this).attr("scoretype") + "," + $(this).attr("questiontype_zg") + "^"; }) return xy.trim('^'); } @@ -512,23 +509,23 @@ function GetPyAreaPostion() { return ""; } $(".pyti").each(function () { - xy += parseFloat($(this).position().left) + "," + parseFloat($(this).position().top) + "," + parseFloat($(this).width()) + "," + parseFloat($(this).height()) + "," + $(this).attr("tihaovalue") + "," + $(this).attr("score") + "," + $(this).attr("piyueType")+"^"; + xy += parseFloat($(this).position().left) + "," + parseFloat($(this).position().top) + "," + parseFloat($(this).width()) + "," + parseFloat($(this).height()) + "," + $(this).attr("tihaovalue") + "," + $(this).attr("score") + "," + $(this).attr("piyueType") + "^"; }) - + return xy.trim('^'); } ///////////////////统计数据////////////////////////// -function GetDataTotal(objvalue,tenant) { +function GetDataTotal(objvalue, tenant) { if ($("#hd_isHand").val() == "1") { if ($("#py_tihao").val() != "all") { alert("主观题有未批阅分数,请先配置好主观题分数选择框!"); return; } } - + var maodian = GetMaoPostion();//左边距,右边距,长,高 @@ -555,7 +552,7 @@ function GetDataTotal(objvalue,tenant) { return; } - if (document.getElementById("keguan_缺考") == undefined && $("#PageIndex").val()=="1") { + if (document.getElementById("keguan_缺考") == undefined && $("#PageIndex").val() == "1") { if (confirm("您尚未设置缺考标记,无需设置点击取消按钮")) { return; } @@ -574,14 +571,14 @@ function GetDataTotal(objvalue,tenant) { if (confirm("锁定模板后,仅可修改识别区域,无法增删主客观题!")) { $("#ansyButton").attr("disabled", "disabled"); $("#ansyButton").attr("value", "正在更新数据"); - $.post("default.aspx", { action: "2", rd: Math.round(), MainTempId: MainTempId, PageIndex: PageIndex, totalHtml: encodeURIComponent(totalHtml), TempID: $("#TempID").val(), HideAreaPostionList: encodeURIComponent(hideArea),tenant:tenant }, function (res) { + $.post("default.aspx", { action: "2", rd: Math.round(), MainTempId: MainTempId, PageIndex: PageIndex, totalHtml: encodeURIComponent(totalHtml), TempID: $("#TempID").val(), HideAreaPostionList: encodeURIComponent(hideArea), tenant: tenant }, function (res) { if (res == "ok") { $("#ansyButton").attr("disabled", "disabled"); $("#ansyButton").attr("value", "模板已锁定"); alert("数据更新成功"); LockFunction(1); } - + else { $("#ansyButton").removeAttr("disabled"); $("#ansyButton").attr("value", "锁定模板"); @@ -593,28 +590,28 @@ function GetDataTotal(objvalue,tenant) { else { $("#noButton").attr("disabled", "disabled"); $("#noButton").attr("value", "正在更新数据"); - $.post("default.aspx", { action: "1", rd: Math.round(), MainTempId: MainTempId, PageIndex: PageIndex, totalHtml: encodeURIComponent(totalHtml), TempID: $("#TempID").val(), HideAreaPostionList: encodeURIComponent(hideArea),tenant:tenant }, function (res) { + $.post("default.aspx", { action: "1", rd: Math.round(), MainTempId: MainTempId, PageIndex: PageIndex, totalHtml: encodeURIComponent(totalHtml), TempID: $("#TempID").val(), HideAreaPostionList: encodeURIComponent(hideArea), tenant: tenant }, function (res) { $("#noButton").removeAttr("disabled"); $("#noButton").attr("value", "保存数据"); if (res == "ok") { alert("数据更新成功"); } else { - - alert(res +"或更新失败,定位点错误"); + + alert(res + "或更新失败,定位点错误"); } }) } } - + ///////////////////统计数据////////////////////////// //初始化绑定数据 function BaseDataBind() { - - + + var Bindlist = $("#Bindlist").val() var list = Bindlist.split('$'); @@ -656,19 +653,19 @@ function BaseDataBind() { } //if(pageWidth==""){ - var pageType= $("#pager_A").val(); - if(pageType=="a3"){ + var pageType = $("#pager_A").val(); + if (pageType == "a3") { pageWidth = 1570; - } - else{ + } + else { pageWidth = 1200; - } + } //} - $(".main_papermain").width(pageWidth+"px"); + $(".main_papermain").width(pageWidth + "px"); if ($("#pager_A").val() == "a3") { - + $("#selectPageSize").val("1570"); } if ($("#pager_A").val() == "a4") { @@ -710,7 +707,7 @@ function SetPyPostion(PostionData) { var score = zhuguanList[5] == undefined ? "" : zhuguanList[5]; var type = zhuguanList[6] == undefined ? "1" : zhuguanList[6]; - + @@ -721,7 +718,7 @@ function SetPyPostion(PostionData) { var style = ""; style = "left:" + zhuguanList[0] + "px; top: " + zhuguanList[1] + "px; width:" + zhuguanList[2] + "px;height:" + zhuguanList[3] + "px;"; var html = ""; - html += "
    "; + html += "
    "; html += "
    " + lineWhTx + ":" + py_tihao + "x
    "; html += "
    "; html += "
    "; @@ -732,7 +729,7 @@ function SetPyPostion(PostionData) { - } + } } ////////////////设置主观题////////////////////// @@ -753,7 +750,7 @@ function SetHideAreaBind(data) { } $(".main_papermain").append(html); $(".hidearea").draggable({ containment: ".main_papermain" }); - $(".hidearea").resizable({ containment: ".main_papermain", handles: 'all' });//设置缩放 + $(".hidearea").resizable({ containment: ".main_papermain", handles: 'all' });//设置缩放 } ///设置锚点 @@ -780,8 +777,7 @@ function SetMaoPostion(postiondata) { var list = postiondata.split('^'); - for (var i = 0; i < list.length; i++) - { + for (var i = 0; i < list.length; i++) { var obj = document.getElementById("point_" + i); //左边距,右边距,长,高 if ($(obj).attr("class") == "maodian_hover") { @@ -795,7 +791,7 @@ function SetMaoPostion(postiondata) { $(obj).attr("class", "maodian_hover"); $(".main_papermain").append("
    " + $(obj).html() + "
    "); $("#draggable_" + i).draggable({ containment: ".main_papermain" }); - $("#draggable_" + i).resizable({ containment: ".main_papermain", handles: 'all' }); + $("#draggable_" + i).resizable({ containment: ".main_papermain", handles: 'all' }); } } @@ -826,7 +822,7 @@ function SetXuehaoPostion(postionData) { html += ""; $(".main_papermain").append("
    " + html + "
    "); $("#xuehaoTable").draggable({ containment: ".main_papermain" }); - $("#xuehaoTable").resizable({ containment: ".main_papermain", handles: 'all' });//设置缩放 + $("#xuehaoTable").resizable({ containment: ".main_papermain", handles: 'all' });//设置缩放 } //设置学号 @@ -838,11 +834,10 @@ function SetKeguanTiPostion(PostionData) { //左边距,右边距,长,高,题号开始,题号结束,横排还是竖排 var listOption = PostionData.split('^') - for (var jt = 0; jt < listOption.length; jt++) - { + for (var jt = 0; jt < listOption.length; jt++) { var listpostion = listOption[jt].split(','); var tihao = listpostion[4].replace(".", "·").replace("(", "(").replace(")", ")").replace(")", ")").replace("=", "=").replace("@", "@") + "-" + listpostion[5].replace(".", "·").replace("(", "(").replace(")", ")").replace(")", ")").replace("=", "=").replace("@", "@");//题号 - + if (document.getElementById("keguan_" + tihao) != undefined) { alert("题目配置重复:" + tihao); return; @@ -857,10 +852,10 @@ function SetKeguanTiPostion(PostionData) { rd_listtype[i].checked } } - + var tihaolist = tihao.split('-'); - + var startnum = tihaolist[0]; var endnum = tihaolist[1]; @@ -877,7 +872,7 @@ function SetKeguanTiPostion(PostionData) { if (listtype == 0)//横向 { - for (var i = parseInt(startnum) ; i <= parseInt(endnum) ; i++) { + for (var i = parseInt(startnum); i <= parseInt(endnum); i++) { html += ""; for (var j = 0; j < selectNum; j++) { @@ -902,35 +897,33 @@ function SetKeguanTiPostion(PostionData) { } if (questiontype == 2) { questionHtml = "判断"; - } + } - $(".main_papermain").append("
    " + tihao + "
    " + html + "
    "); + $(".main_papermain").append("
    " + tihao + "
    " + html + "
    "); $("#keguan_" + tihao).draggable({ containment: ".main_papermain" }); - $("#keguan_" + tihao).resizable({ containment: ".main_papermain", handles: 'all' });//设置缩放 + $("#keguan_" + tihao).resizable({ containment: ".main_papermain", handles: 'all' });//设置缩放 var listtypeText = listtype == 0 ? "横向" : "竖向"; - $("#NowSelect").append("
  • " + questionHtml + "
    " + tihao + "
    " + selectNum + "
    " + listtypeText + "
    " + score + "
    x
  • "); + $("#NowSelect").append("
  • " + questionHtml + "
    " + tihao + "
    " + selectNum + "
    " + listtypeText + "
    " + score + "
    x
  • "); } - + } /////////////////设置主观题////////////////////// function SetZhuguanTiPostion(PostionData) { - if (PostionData == "" || PostionData == undefined) - { + if (PostionData == "" || PostionData == undefined) { return; } //左边距,右边距,长,高,题号,小题数量 var listdata = PostionData.split('^'); - for (var i = 0; i < listdata.length; i++) - { + for (var i = 0; i < listdata.length; i++) { var zhuguanList = listdata[i].split(','); var zhuguan_tihao = zhuguanList[4].toUpperCase().replace(".", "·").replace("(", "(").replace(")", ")").replace(")", ")").replace("=", "=").replace("@", "@"); var score = zhuguanList[6] == undefined ? "" : zhuguanList[6]; var scoretype = zhuguanList[7] == undefined ? "1" : zhuguanList[7]; - + //var scoretypetext = scoretype; var scoretypetext = scoretype; var questiontype_zg = zhuguanList[8] == undefined ? "1" : zhuguanList[8]; @@ -945,10 +938,10 @@ function SetZhuguanTiPostion(PostionData) { lineWhTx = "填空" } var zhuguan_xiaoti = zhuguanList[5]; - $(".main_papermain").append("
    " + lineWhTx+":" + zhuguan_tihao + "
    "); + $(".main_papermain").append("
    " + lineWhTx + ":" + zhuguan_tihao + "
    "); $("#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
  • "); + $("#keguan_" + zhuguan_tihao).resizable({ containment: ".main_papermain", handles: 'all' }); + $("#NowSelect").append("
  • 主观题
    " + zhuguan_tihao + "
    " + zhuguan_xiaoti + "
    " + score + "
    " + scoretypetext + "
    x
  • "); } } ////////////////设置主观题////////////////////// @@ -970,9 +963,9 @@ function SetWenziQuyuPostion(PostionData) { } $(".main_papermain").append("
    " + zhuguan_tihao + "
    "); $("#keguan_" + zhuguan_tihao).draggable({ containment: ".main_papermain" }); - $("#keguan_" + zhuguan_tihao).resizable({ containment: ".main_papermain", handles: 'all' }); + $("#keguan_" + zhuguan_tihao).resizable({ containment: ".main_papermain", handles: 'all' }); $(".quelapsz").attr("class", "quelapsz_hover"); - } + } } @@ -1040,7 +1033,7 @@ BaseDataBind(); function LockFunction(flag) { var islocked = $("#isLocked").val(); - if (islocked == true || islocked=="True"||flag==1) { + if (islocked == true || islocked == "True" || flag == 1) { $("#ansyButton").attr("disabled", "disabled"); $("#ansyButton").attr("value", "模板已锁定"); $(".sd").hide(); @@ -1055,7 +1048,7 @@ if (hd_isHand == 0) { $("#isHand_Py").hide(); } //批阅判定 -function GetZhuguantiScoreList(){ +function GetZhuguantiScoreList() { if ($("#hd_isHand").val() == "1") { var py_tihao = ""; var git = document.getElementById("py_tihao"); @@ -1065,7 +1058,7 @@ function GetZhuguantiScoreList(){ $(".zhuguanti").each(function () { var tihaovalue = $(this).attr("tihaovalue").toUpperCase(); //如果有分割 - + if (tihaovalue.indexOf("X") > -1) { var mx = tihaovalue.split('X'); if (mx[1] != 1) { @@ -1073,7 +1066,7 @@ function GetZhuguantiScoreList(){ } } var isok = true; - + if ($(".pyti").each(function () { if ($(this).attr("tihaovalue") == tihaovalue) { isok = false; @@ -1087,9 +1080,9 @@ function GetZhuguantiScoreList(){ html += ""; } - // git.options[i] = new Option("主观题" + tihaovalue, tihaovalue); - isallPY = false; - } + // git.options[i] = new Option("主观题" + tihaovalue, tihaovalue); + isallPY = false; + } i++; }) if (isallPY) { @@ -1165,4 +1158,14 @@ String.prototype.trim = function (char, type) { return this.replace(new RegExp('^\\' + char + '+|\\' + char + '+$', 'g'), ''); } return this.replace(/^\s+|\s+$/g, ''); -}; \ No newline at end of file +}; + +//////////// 切换页数 //////////////// +function ChangePageNum(anotherTempID) { + if (confirm("当前页未保存,是否继续切换?")){ + var currentURL = window.location.href; + var newUrl = currentURL.replace(/(TempID=)\d+/, "$1" + anotherTempID); + window.location.href = newUrl; + } + +} \ No newline at end of file