Marking.Template/js/indexuser.js

707 lines
30 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var islocked = $("#islocked").val();
if (islocked == "" || islocked == "null") {
islocked = 0;
}
//设置页面大小
function ChangePageSize(obj) {
$(".main_papermain").width(obj.value);
$(".main").width(obj.value);
}
///设置锚点
function SetMao(obj, index) {
if ($(obj).attr("class") == "maodian_hover") {
$("#draggable_" + index).remove();
$(obj).attr("class", "maodian");
return;
}
var style = "";
if (index == 0) {
style = "left:100px; top 10px;"
}
if (index == 1) {
style = "left:200px; top 10px;"
}
if (index == 2) {
style = "left:300px; top 10px;"
}
if (index == 3) {
style = "left:400px; top 10px;"
}
$(obj).attr("class", "maodian_hover");
$(".main_papermain").append("<div class='main_tabletop' style='" + style + "' id='draggable_" + index + "'>" + $(obj).html() + "</div>");
$("#draggable_" + index).draggable({ containment: ".main_papermain" });
$("#draggable_" + index).resizable({ containment: ".main_papermain" });//设置缩放
}
///设置锚点
///设置学号
function SetXuehao(obj) {
if ($(obj).attr("class") == "main_select_set_hover") {
$("#xuehaoTable").remove();
$(obj).attr("class", "main_select_set");
return;
}
$(obj).attr("class", "main_select_set_hover");
var num = $("#xuehaonum").val();
var html = "<table class='xuehaotable_list' listNum='" + num + "' cellpadding=\"0\" cellspacing=\"0\">";
for (var i = 0; i < 10; i++) {
html += "<tr>";
for (var j = 0; j < num; j++) {
html += "<td></td>";
}
html += "</tr>";
}
html += "</table>";
$(".main_papermain").append("<div id=\"xuehaoTable\" listNum='" + num + "' class='main_tabletop' style='width:300px; height:200px'>" + html + "</div>");
$("#xuehaoTable").draggable({ containment: ".main_papermain" });
$("#xuehaoTable").resizable({ containment: ".main_papermain" });//设置缩放
}
//设置学号
/////////设置客观题//////////////////
function SetKeguanTi() {
var tihao = $("#tihao").val();//题号
var tihaoList = tihao.split('-');
if (tihaoList.length != 2) {
alert("题号规则错误,请重新输入");
return;
}
if (document.getElementById("keguan_" + tihao) != undefined) {
alert("题目配置重复");
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 tihaolist = tihao.split('-');
var startnum = parseInt(tihaolist[0]);
var endnum = parseInt(tihaolist[1]);
if (endnum == undefined)
{
endnum = startnum;
}
var html = "<table class='keguan_list' cellpadding=\"0\" style='background:#ff3300;' cellspacing=\"0\">";
var BigTihao = "";
if (tihao.indexOf('M') > -1) {
BigTihao = tihaolist[0].split('M')[0] + "M";
startnum = tihaolist[0].split('M')[1];
endnum = tihaolist[1].split('M')[1];
}
if (listtype == 0)//横向
{
for (var i = parseInt(startnum); i <=parseInt(endnum); i++)
{
html += "<tr>";
for (var j = 0; j < selectNum; j++)
{
html += "<td></td>";
}
html += "</tr>";
}
}
else {//竖向
for (var i = 0; i < selectNum; i++) {
html += "<tr>";
for (var j = startnum; j <= endnum; j++) {
html += "<td></td>";
}
html += "</tr>";
}
}
html += "</table>";
var selectMore = 0;
var questionHtml = "单选题";
if (questiontype == 1) {
questionHtml = "多选题";
}
if (questiontype == 2) {
questionHtml = "判断";
}
$(".main_papermain").append("<div id=\"keguan_" + tihao + "\" class='main_tabletop keguanti' questiontype='" + questiontype + "' tihaovalue='" + tihao + "' startnum='" + BigTihao + "" + startnum + "' endNum='" + BigTihao+"" + endnum + "' selectNum='" + selectNum + "' listtype='" + listtype + "' style='width:300px;background:none; left:100px; top:200px; height:200px'><div style=\" float:left; width:60px; text-align:center; height:30px; position:absolute; margin-top:-30px;z-index:22; color:#fff; line-height:30px; background:#666;\">" + tihao + "</div>" + html + "</div>");
$("#keguan_" + tihao).draggable({ containment: ".main_papermain" });
$("#keguan_" + tihao).resizable({ containment: ".main_papermain" });//设置缩放
var listtypeText = listtype == 0 ? "横向" : "竖向";
$("#NowSelect").append("<li id='selectNow_" + tihao + "'>客观题:<a>" + questionHtml + "" + tihao + " 选项:" + selectNum + " 排列:" + listtypeText + "</a> <span onclick=\"DeleteKeguanti('" + tihao + "')\">删除</span></li>");
}
function DeleteKeguanti(tihao) {
$("#keguan_" + tihao).remove();
$("#selectNow_" + tihao).remove();
}
/////////设置客观题/////////////
/////////////////设置主观题//////////////////////
function SetZhuguanTi() {
var zhuguan_tihao = $("#zhuguan_tihao").val();
if (document.getElementById("keguan_" + zhuguan_tihao) != undefined) {
alert("题目配置重复");
return;
}
var zhuguan_xiaoti = $("#zhuguan_xiaoti").val();
if (zhuguan_xiaoti == "") {
zhuguan_xiaoti = "0";
}
$(".main_papermain").append("<div id=\"keguan_" + zhuguan_tihao + "\" class='main_tabletop zhuguanti' tihaovalue='" + zhuguan_tihao + "' zhuguan_xiaoti='" + zhuguan_xiaoti + "' style='width:300px;background:none; left:100px; top:200px; height:200px'><div style=\" float:left; width:60px; 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;'></div></div>");
$("#keguan_" + zhuguan_tihao).draggable({ containment: ".main_papermain" });
$("#keguan_" + zhuguan_tihao).resizable({ containment: ".main_papermain" });
$("#NowSelect").append("<li id='selectNow_" + zhuguan_tihao + "' >题号:" + zhuguan_tihao + "<span onclick=\"DeleteKeguanti('" + zhuguan_tihao + "')\">删除</span></li>");
}
////////////////设置主观题//////////////////////
/////////////////设置条码识别区//////////////////////
function SetTiaoMa() {
if (document.getElementById("keguan_tiaomashibie") != undefined) {
alert("条码配置重复");
return;
}
$(".main_papermain").append("<div id=\"keguan_tiaomashibie\" class='main_tabletop' style='width:300px;background:none; left:100px; top:200px; height:200px'><div style=\" float:left; width:60px; text-align:center; height:30px; position:absolute; margin-top:-30px;z-index:22; color:#fff; line-height:30px; background:#666;\">条码</div><div style='width:100%;height:100%;background:#fff;border:1px solid red;'></div></div>");
$("#keguan_tiaomashibie").draggable({ containment: ".main_papermain" });
$("#keguan_tiaomashibie").resizable({ containment: ".main_papermain" });
$("#NowSelect").append("<li id='selectNow_tiaomashibie' >条码<span onclick=\"DeleteKeguanti('tiaomashibie')\">删除</span></li>");
}
////////////////设置条码识别区//////////////////////
/////////////////准考证号识别区//////////////////////
function SetZunkaoZheng() {
if (document.getElementById("zhunkaozhenghaoshibie") != undefined) {
alert("准考证号配置重复");
return;
}
$(".main_papermain").append("<div id=\"keguan_zhunkaozhenghaoshibie\" class='main_tabletop' style='width:300px;background:none; left:100px; top:200px; height:200px'><div style=\" float:left; width:60px; text-align:center; height:30px; position:absolute; margin-top:-30px;z-index:22; color:#fff; line-height:30px; background:#666;\">准考证号</div><div style='width:100%;height:100%;background:#fff;border:1px solid red;'></div></div>");
$("#keguan_zhunkaozhenghaoshibie").draggable({ containment: ".main_papermain" });
$("#keguan_zhunkaozhenghaoshibie").resizable({ containment: ".main_papermain" });
$("#NowSelect").append("<li id='selectNow_zhunkaozhenghaoshibie' >准考证号<span onclick=\"DeleteKeguanti('zhunkaozhenghaoshibie')\">删除</span></li>");
}
////////////////准考证号识别区//////////////////////
/////////////////设置缺考标记//////////////////////
function SetWenziQuyu() {
var zhuguan_tihao = $("#wenzi_tihao").val();
if (document.getElementById("selectNow_" + zhuguan_tihao) != undefined) {
alert("缺考已标记");
return;
}
$(".main_papermain").append("<div id=\"keguan_" + zhuguan_tihao + "\" class='main_tabletop wenzimiaoshu' wenzimiaoshu='" + zhuguan_tihao + "' style='width:300px;background:none; left:100px; top:200px; height:200px'><div style=\" float:left; width:60px; 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;'></div></div>");
$("#keguan_" + zhuguan_tihao).draggable({ containment: ".main_papermain" });
$("#keguan_" + zhuguan_tihao).resizable({ containment: ".main_papermain" });
$("#NowSelect").append("<li id='selectNow_" + zhuguan_tihao + "'>文字描述:" + zhuguan_tihao + "<span onclick=\"DeleteKeguanti('" + zhuguan_tihao + "')\">删除</span></li>");
}
////////////////设置文字区域//////////////////////
///////////////////统计数据//////////////////////////
//获取锚点位置
function GetMaoPostion() {
if ($(".maodian_hover").length == 0) {
return "";
}
var xy = "";
if ($(".maodian_hover").length == 4) {
for (var i = 0; i < 4; i++) {
xy += parseInt($("#draggable_" + i).position().left) + "," + parseInt($("#draggable_" + i).position().top) + "," + parseInt($("#draggable_" + i).width()) + "," + parseInt($("#draggable_" + i).height()) + "^";
}
}
else {
alert("锚点未设置完成");
return "";
}
return xy.trim('^');;
}
//获取学号数据
function GetXuehaoPostion() {
if (document.getElementById("xuehaoTable") == undefined) {
return "";
}
var xy = "";
xy = parseInt($("#xuehaoTable").position().left) + "," + parseInt($("#xuehaoTable").position().top) + "," + parseInt($("#xuehaoTable").width()) + "," + parseInt($("#xuehaoTable").height()) + "," + $("#xuehaoTable").attr("listNum") ;
return xy;
}
//获取客观题
function GetKeguanPostion() {
if ($(".keguanti").length == 0) {
return "";
}
var xy = "";
$(".keguanti").each(function () {
xy += parseInt($(this).position().left) + "," + parseInt($(this).position().top) + "," + parseInt($(this).width()) + "," + parseInt($(this).height()) + "," + $(this).attr("startnum") + "," + $(this).attr("endNum") + "," + $(this).attr("selectNum") + "," + $(this).attr("listtype") + "," + $(this).attr("questiontype") + "^";
})
return xy.trim('^');
}
//获取主观题
function GetZhuguanPostion() {
var xy = "";
if ($(".zhuguanti").length == 0) {
return "";
}
$(".zhuguanti").each(function () {
xy += parseInt($(this).position().left) + "," + parseInt($(this).position().top) + "," + parseInt($(this).width()) + "," + parseInt($(this).height()) + "," + $(this).attr("tihaovalue") + "," + $(this).attr("zhuguan_xiaoti") + "^";
})
return xy.trim('^');
}
//获取条码
function GettiaomaPostion() {
var xy = "";
if (document.getElementById("keguan_tiaomashibie") == undefined) {
return "";
}
xy += parseInt($("#keguan_tiaomashibie").position().left) + "," + parseInt($("#keguan_tiaomashibie").position().top) + "," + parseInt($("#keguan_tiaomashibie").width()) + "," + parseInt($("#keguan_tiaomashibie").height());
return xy.trim('^');
}
//获取准考证号
function GetZKZHPostion() {
var xy = "";
if (document.getElementById("keguan_zhunkaozhenghaoshibie") == undefined) {
return "";
}
xy += parseInt($("#keguan_zhunkaozhenghaoshibie").position().left) + "," + parseInt($("#keguan_zhunkaozhenghaoshibie").position().top) + "," + parseInt($("#keguan_zhunkaozhenghaoshibie").width()) + "," + parseInt($("#keguan_zhunkaozhenghaoshibie").height());
return xy.trim('^');
}
//获取文字截获
function GetWenziPostion() {
var xy = "";
if ($(".wenzimiaoshu").length == 0) {
return "";
}
$(".wenzimiaoshu").each(function () {
xy += parseInt($(this).position().left) + "," + parseInt($(this).position().top) + "," + parseInt($(this).width()) + "," + parseInt($(this).height()) + "," + $(this).attr("wenzimiaoshu") + "^";
})
return xy.trim('^');
}
///////////////////统计数据//////////////////////////
function GetDataTotal(flag,tenant) {
var maodian = GetMaoPostion();//左边距,右边距,长,高
var xuehao = GetXuehaoPostion();//左边距,右边距,长,高,学号数量
var keguanti = GetKeguanPostion(); //左边距,右边距,长,高,题号开始,题号结束,选择几项,横排还是竖排,单选多选或者判断
var zhuguanti = GetZhuguanPostion();//左边距,右边距,长,高,题号,小题数量
var wenzimiaoshu = GetWenziPostion();//左边距,右边距,长,高,文字描述
var tiaoma = GettiaomaPostion();////左边距,右边距,长,高
var zhunkaozhenghao = GetZKZHPostion();///获取准考证号识别区域
var WandH = $("#SelectImg").width() + "," + $("#SelectImg").height();
var totalHtml = maodian + "$" + xuehao + "$" + keguanti + "$" + zhuguanti + "$" + wenzimiaoshu + "$" + tiaoma + "$" + WandH + "$" + zhunkaozhenghao;
//if (maodian == "") {
// alert("必须设置4个锚点");
// return;
//}
var roteDY = rote;//获取定义
$("#saveData_btn").attr("value", "正在保存数据");
$("#saveData_btn").attr("disabled", "disabled");
$.post("UserTemp.aspx", { action: "1", tenant:tenant,rd: Math.round(), totalHtml: encodeURIComponent(totalHtml), TempID: $("#TempID").val(), UserID: $("#UserID").val(), roteDY: roteDY }, function (res) {
if (res == "ok") {
if (flag == "1") {
alert("更新成功");
}
}
else {
alert("无法定位,请调整定位模块");
}
$("#saveData_btn").attr("value", "保存数据");
$("#saveData_btn").removeAttr("disabled");
})
}
function GetDataTotalAnsy(tenant) {
if (!confirm("锁定后开始阅卷,无法修改定位数据,请谨慎操作")) {
return;
}
var maodian = GetMaoPostion();//左边距,右边距,长,高
var xuehao = GetXuehaoPostion();//左边距,右边距,长,高,学号数量
var keguanti = GetKeguanPostion(); //左边距,右边距,长,高,题号开始,题号结束,选择几项,横排还是竖排,单选多选或者判断
var zhuguanti = GetZhuguanPostion();//左边距,右边距,长,高,题号,小题数量
var wenzimiaoshu = GetWenziPostion();//左边距,右边距,长,高,文字描述
var tiaoma = GettiaomaPostion();////左边距,右边距,长,高
var zhunkaozhenghao = GetZKZHPostion();///获取准考证号识别区域
var WandH = $("#SelectImg").width() + "," + $("#SelectImg").height();
var totalHtml = maodian + "$" + xuehao + "$" + keguanti + "$" + zhuguanti + "$" + wenzimiaoshu + "$" + tiaoma + "$" + WandH + "$" + zhunkaozhenghao;
//if (maodian == "") {
// alert("必须设置4个锚点");
// return;
//}
var roteDY = rote;//获取定义
$.post("TempDraw.aspx", { action: 1, rd: Math.random(), TempID: $("#ID_bigint").val(), UserID: $("#UserID").val(), tenant:tenant}, function (res) {
if (res == "-100" || res == "") {
alert("无法锁定模板,无法获取定位点");
}
else {
$.post("UserTemp.aspx", { action: "2", tenant:tenant, rd: Math.round(), totalHtml: encodeURIComponent(totalHtml), TempID: $("#TempID").val(), UserID: $("#UserID").val(), roteDY: roteDY }, function (res) {
if (res == "ok") {
alert("锁定成功");
document.location.href = document.location.href;
}
else {
alert("无法定位,请调整定位模块");
}
})
$("#SelectImg").attr("src", "data:image/jpg;base64," + res);
}
})
}
///////////////////统计数据//////////////////////////
//初始化绑定数据
function BaseDataBind() {
var Bindlist = $("#Bindlist").val()
var list = Bindlist.split('$');
var maodian = "";//左边距,右边距,长,高
var xuehao = "";//左边距,右边距,长,高,学号数量
var keguanti = ""; //左边距,右边距,长,高,题号开始,题号结束,横排还是竖排
var zhuguanti = "";//左边距,右边距,长,高,题号,小题数量
var wenzimiaoshu = "";//左边距,右边距,长,高,文字描述
var tiaoma = "";//左边距,右边距,长,高,文字描述
var pageWidth = "";
var pageHeight="";
var zhunkaozhenghao = "";
if (Bindlist != "") {
maodian = list[0].trim('^');//左边距,右边距,长,高
xuehao = list[1].trim('^');//左边距,右边距,长,高,学号数量
keguanti = list[2].trim('^'); //左边距,右边距,长,高,题号开始,题号结束,横排还是竖排
zhuguanti = list[3].trim('^');//左边距,右边距,长,高,题号,小题数量
wenzimiaoshu = list[4].trim('^');//左边距,右边距,长,高,文字描述
tiaoma = list[5].toString().trim('^');//左边距,右边距,长,高,文字描述
pageWidth = list[6].toString().trim('^').split(',')[0];
pageHeight=list[6].toString().trim('^').split(',')[1];
if (list[7] != undefined) {
zhunkaozhenghao = list[7].toString().trim('^');
}
}
if (pageWidth == 1200 || pageWidth == 1199 || pageWidth == 1198 || pageWidth == 1201) {
pageWidth = 1200;
}
if (pageWidth == 1570 || pageWidth == 1569 || pageWidth == 1571 || pageWidth == 1572 || pageWidth == 1573) {
pageWidth = 1570;
}
//if(pageWidth==""){
var pageType = $("#pager_A").val().toLowerCase();
if (pageType == "a3") {
pageWidth = 1570;
}
else {
pageWidth = 1200;
}
$("#kaochi_Line").draggable({ containment: ".main_papermain" });
$("#kaochi_Line").css("top", (pageHeight / 2) + "px");
$("#selectPageSize").val(pageWidth);
$("#selectPageSize").change();
SetMaoPostion(maodian);
SetXuehaoPostion(xuehao);
SetKeguanTiPostion(keguanti);
SetZhuguanTiPostion(zhuguanti);
SetWenziQuyuPostion(wenzimiaoshu);
SetTiaomaPostion(tiaoma);
SetZhunkaozhengPostion(zhunkaozhenghao);
if (islocked == 1) {
$("#draggable_0").hide();
$("#draggable_1").hide();
$("#draggable_2").hide();
$("#draggable_3").hide();
$(".btn_XY").attr("disabled", "disabled");
$("#kaochi_Line").hide();
}
}
///设置锚点
function SetMaoPostion(postiondata) {
if (postiondata == "") {
return;
}
var list = postiondata.split('^');
for (var i = 0; i < list.length; i++)
{
var obj = document.getElementById("point_" + i);
//左边距,右边距,长,高
if ($(obj).attr("class") == "maodian_hover") {
$("#draggable_" + i).remove();
$(obj).attr("class", "maodian");
return;
}
var postionList = list[i].split(',');
var style = "";
style = "left:" + postionList[0] + "px; top: " + postionList[1] + "px; width:" + postionList[2] + "px;height:" + postionList[3] + "px;";
$(obj).attr("class", "maodian_hover");
$(".main_papermain").append("<div class='main_tabletop' style='font-size:12px;color:#fff;" + style + "' id='draggable_" + i + "'>" + $(obj).html() + "</div>");
$("#draggable_" + i).draggable({ containment: ".main_papermain" });
$("#draggable_" + i).resizable({ containment: ".main_papermain" });
}
}
///设置学号
function SetXuehaoPostion(postionData) {
if (postionData == "") {
return;
}
var obj = document.getElementById("main_select_set");
var postionList = postionData.split(',');
if ($(obj).attr("class") == "main_select_set_hover") {
$("#xuehaoTable").remove();
$(obj).attr("class", "main_select_set");
return;
}
//左边距,右边距,长,高,学号数量
$(obj).attr("class", "main_select_set_hover");
var num = postionList[4];
$("#xuehaonum").val(num);
var html = "<table class='xuehaotable_list' listNum='" + postionList[4] + "' cellpadding=\"0\" cellspacing=\"0\">";
for (var i = 0; i < 10; i++) {
html += "<tr>";
for (var j = 0; j < num; j++) {
html += "<td></td>";
}
html += "</tr>";
}
html += "</table>";
$(".main_papermain").append("<div id=\"xuehaoTable\" listNum='" + num + "' class='main_tabletop hideinfo' style='top:" + postionList[1] + "px; left:" + postionList[0] + "px;width:" + postionList[2] + "px; height:" + postionList[3] + "px'>" + html + "</div>");
}
//设置学号
/////////设置客观题//////////////////
function SetKeguanTiPostion(PostionData) {
if (PostionData == "") {
return;
}
//左边距,右边距,长,高,题号开始,题号结束,横排还是竖排
var listOption = PostionData.split('^')
for (var jt = 0; jt < listOption.length; jt++)
{
var listpostion = listOption[jt].split(',');
var tihao = listpostion[4] + "-" + listpostion[5];//题号
if (document.getElementById("keguan_" + tihao) != undefined) {
alert("题目配置重复");
return;
}
var rd_listtype = document.getElementsByName("listtype");//题目横竖向
var listtype = listpostion[7];
var selectNum = listpostion[6];
var questiontype = listpostion[8];
for (var i = 0; i < rd_listtype.length; i++) {
if (rd_listtype[i].value == listtype) {
rd_listtype[i].checked
}
}
var tihaolist = tihao.split('-');
var startnum = tihaolist[0];
var endnum = tihaolist[1];
if (endnum == undefined) {
endnum = startnum;
}
var BigTihao = "";
if (tihao.indexOf('M') > -1) {
BigTihao = tihaolist[0].split('M')[0] + "M";
startnum = tihaolist[0].split('M')[1];
endnum = tihaolist[1].split('M')[1];
}
var html = "<table class='keguan_list' cellpadding=\"0\" style='background:#ff3300;' cellspacing=\"0\">";
if (listtype == 0)//横向
{
for (var i = parseInt(startnum) ; i <= parseInt(endnum) ; i++) {
html += "<tr>";
for (var j = 0; j < selectNum; j++) {
html += "<td></td>";
}
html += "</tr>";
}
}
else {//竖向
for (var i = 0; i < selectNum; i++) {
html += "<tr>";
for (var j = parseInt(startnum); j <= parseInt(endnum); j++) {
html += "<td></td>";
}
html += "</tr>";
}
}
html += "</table>";
var questionHtml = "单选题";
if (questiontype == 1) {
questionHtml = "多选题";
}
if (questiontype == 2) {
questionHtml = "判断";
}
$(".main_papermain").append("<div id=\"keguan_" + tihao + "\" questiontype=\"" + questiontype + "\" class='main_tabletop keguanti hideinfo' tihaovalue='" + tihao + "' startnum='" + BigTihao + "" + startnum + "' endNum='" + BigTihao + "" + endnum + "' selectNum='" + selectNum + "' listtype='" + listtype + "' style='background:none; left:" + listpostion[0] + "px; top:" + listpostion[1] + "px;width:" + listpostion[2] + "px; height:" + listpostion[3] + "px'><div style=\" float:left; width:60px; text-align:center; height:30px; position:absolute; margin-top:-30px;z-index:22; color:#fff; line-height:30px; background:#666;\">" + tihao + "</div>" + html + "</div>");
var listtypeText = listtype == 0 ? "横向" : "竖向";
$("#NowSelect").append("<li id='selectNow_" + tihao + "'><a>" + questionHtml + "" + tihao + "</a> <a>选项:" + selectNum + " 排列:" + listtypeText + "</a> <span onclick=\"DeleteKeguanti('" + tihao + "')\">删除</span></li>");
}
}
/////////////////设置主观题//////////////////////
function SetZhuguanTiPostion(PostionData) {
if (PostionData == "" || PostionData == undefined)
{
return;
}
//左边距,右边距,长,高,题号,小题数量
var listdata = PostionData.split('^');
for (var i = 0; i < listdata.length; i++)
{
var zhuguanList = listdata[i].split(',');
var zhuguan_tihao = zhuguanList[4];
if (document.getElementById("keguan_" + zhuguan_tihao) != undefined) {
alert("题目配置重复");
return;
}
var zhuguan_xiaoti = zhuguanList[5];
$(".main_papermain").append("<div id=\"keguan_" + zhuguan_tihao + "\" class='main_tabletop zhuguanti hideinfo' tihaovalue='" + zhuguan_tihao + "' zhuguan_xiaoti='" + zhuguan_xiaoti + "' style='left:" + zhuguanList[0] + "px; top:" + zhuguanList[1] + "px;width:" + zhuguanList[2] + "px;height:" + zhuguanList[3] + "px; background:none; '><div style=\" float:left; width:60px; 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;'></div></div>");
$("#NowSelect").append("<li id='selectNow_" + zhuguan_tihao + "'><a>题号:" + zhuguan_tihao + "</a><span onclick=\"DeleteKeguanti('" + zhuguan_tihao + "')\">删除</span></li>");
}
}
////////////////设置主观题//////////////////////
/////////////////设置文字区域//////////////////////
function SetWenziQuyuPostion(PostionData) {
if (PostionData == "" || PostionData == undefined) {
return;
}
//左边距,右边距,长,高,题号,小题数量
var listdata = PostionData.split('^');
for (var i = 0; i < listdata.length; i++) {
var zhuguanList = listdata[i].split(',');
var zhuguan_tihao = zhuguanList[4];
if (document.getElementById("keguan_缺考") != undefined) {
alert("题目配置重复");
return;
}
$(".main_papermain").append("<div id=\"keguan_" + zhuguan_tihao + "\" class='main_tabletop wenzimiaoshu hideinfo' wenzimiaoshu='" + zhuguan_tihao + "' 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;\">" + zhuguan_tihao + "</div><div style='width:100%;height:100%;background:#fff;border:1px solid red;'></div></div>");
$(".quelapsz").attr("class", "quelapsz_hover");
}
}
////////////////设置文字区域//////////////////////
/////////////////设置条码//////////////////////
function SetTiaomaPostion(PostionData) {
if (PostionData == "") {
return;
}
var zhuguanList = PostionData.split(',');
$(".main_papermain").append("<div id=\"keguan_tiaomashibie hideinfo\" class='main_tabletop hideinfo' style='left:" + zhuguanList[0] + "px; top:" + zhuguanList[1] + "px;width:" + zhuguanList[2] + "px;height:" + zhuguanList[3] + "px; background:none; '><div style=\" float:left; width:60px; text-align:center; height:30px; position:absolute; margin-top:-30px;z-index:22; color:#fff; line-height:30px; background:#666;\">条码</div><div style='width:100%;height:100%;background:#fff;border:1px solid red;'></div></div>");
$("#NowSelect").append("<li id='selectNow_tiaomashibie'>条码<span onclick=\"DeleteKeguanti('tiaomashibie')\">删除</span></li>");
}
/////////////////设置准考证号//////////////////////
function SetZhunkaozhengPostion(PostionData) {
if (PostionData == "") {
return;
}
var zhuguanList = PostionData.split(',');
$(".main_papermain").append("<div id=\"keguan_zhunkaozhenghaoshibie hideinfo\" class='main_tabletop' style='left:" + zhuguanList[0] + "px; top:" + zhuguanList[1] + "px;width:" + zhuguanList[2] + "px;height:" + zhuguanList[3] + "px; background:none; '><div style=\" float:left; width:60px; text-align:center; height:30px; position:absolute; margin-top:-30px;z-index:22; color:#fff; line-height:30px; background:#666;\">准考证号</div><div style='width:100%;height:100%;background:#fff;border:1px solid red;'></div></div>");
$("#NowSelect").append("<li id='selectNow_zhunkaozhenghaoshibie'>准考证号<span onclick=\"DeleteKeguanti('zhunkaozhenghaoshibie')\">删除</span></li>");
}
////////////////设置文字区域//////////////////////
//初始化绑定数据
BaseDataBind();
//扩展方法
String.prototype.trim = function (char, type) {
if (char) {
if (type == 'left') {
return this.replace(new RegExp('^\\' + char + '+', 'g'), '');
} else if (type == 'right') {
return this.replace(new RegExp('\\' + char + '+$', 'g'), '');
}
return this.replace(new RegExp('^\\' + char + '+|\\' + char + '+$', 'g'), '');
}
return this.replace(/^\s+|\s+$/g, '');
};