切题验证边框拖动不超过定位点

This commit is contained in:
强 杨 2023-06-27 18:39:55 +08:00
parent 9d808ad91a
commit 8cc03f4670
3 changed files with 80 additions and 23 deletions

View File

@ -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 + "] 编辑框下边超过定位点边界!";
}
}
}

View File

@ -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("<div id=\"keguan_" + zhuguan_tihao + "\" class='main_tabletop' questiontype_zg='" + questiontype_zg + "' tihaovalue='" + zhuguan_tihao + "' zhuguan_xiaoti='" + zhuguan_xiaoti + "' score='" + score + "' scoretype='" + scoretype + "' style=' left:" + zhuguanList[0] + "px; top:" + zhuguanList[1] + "px;width:" + zhuguanList[2] + "px;height:" + zhuguanList[3] + "px; background:none; '><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;\">" + lineWhTx + ":" + zhuguan_tihao + "</div><div style='width:100%;border:5px solid blue;height:100%;background:#fff;'></div></div>");
$("#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("<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' id='ss_" + zhuguan_tihao + "' idAtt='keguan_" + 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>");
}

View File

@ -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
}
/// <summary>
/// 检查边距是否合格
/// </summary>
/// <param name="getdata"></param>
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
{