<%@ Page Language="C#" AutoEventWireup="true" CodeFile="UserTemp.aspx.cs" Inherits="Temp_UserTemp" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>导入外部答题卡制作模板</title>
    <script src="../js/jquery-1.10.2.min.js"></script>
    <link href="../css/index.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" />
</head>
<body>
    <input type="text" style=" display:none;" value="<%=Bindlist %>" id="Bindlist" />
    <input type="text" style=" display:none;"  value="<%=TempID %>" id="TempID" />
    <input type="text" style=" display:none;"  value="<%=UserID %>" id="UserID" />
    <input type="text" style=" display:none;"  value="<%=tenant %>" id="tenant" />
    <input type="text" style=" display:none;"  value="<%=ID_bigint %>" id="ID_bigint" />
    <input type="text" style=" display:none;"  value="<%=islocked %>" id="islocked" />
     <input type="hidden" id="pager_A" value="<%=pager %>" />

    <div class="main">
        
        <div class="main_tool" style="display:none;" >
            <table>
                <tr>
                    <th width="70px">选定锚点</th>
                    <td style=" position:relative; width:480px;">
                        <div class="maodian" id="point_0" onclick="SetMao(this,0)">左上锚点</div>
                        <div style="left:125px;"  onclick="SetMao(this,1)" class="maodian" id="point_1">右上锚点</div>
                        <div style="left:245px;"  onclick="SetMao(this,2)" class="maodian" id="point_2">左下锚点</div>
                        <div style="left:365px;"  onclick="SetMao(this,3)" class="maodian" id="point_3">右下锚点</div>
                    </td>
                    <th width="270px"  valign="middle">
                        <div class="main_select_one">
                            <span>学号:</span>
                            <select id="xuehaonum">
                                 <option value="3">3</option>
                                 <option value="4">4</option>
                                 <option value="5">5</option>
                                 <option selected="selected" value="6">6</option>
                                 <option value="7">7</option>
                                 <option value="8">8</option>
                                 <option value="9">9</option>
                                <option value="10">10</option>
                                <option value="11">11</option>
                                <option value="12">12</option>
                            </select>
                            <span class="main_select_set" id="main_select_set" onclick="SetXuehao(this)">设置学号</span>
                        </div>
                    </th>
                     <td width="150px">
                        <span  >版面：</span>
                        <select id="selectPageSize" onchange="ChangePageSize(this)">
                            <option value="1200">A4</option>
                            <option value="1570">A3</option>
                        </select>
                    </td>
                    <td>
                         <input type="button" style="padding:3px; " onclick="GetDataTotal(-1,'<%=tenant %>')" value="保存数据" />
                    </td>
                </tr>
                
           
            </table>
        </div>
    
        <div class="main_papermain" style="  margin:0 auto; position:relative;">
            <div style="  height:auto; margin:0 auto; border:1px solid #ff0000; padding:1%; color:#999; position:absolute;width:120px; margin-left:-160px; margin-top:200px; box-shadow:10px 10px 10px #666; border:1px solid #999;  z-index:999; ">
             <p style="font-size:14px;  color:#ff6a00">
                 1.如果图片倾斜，请调整倾斜角度,让他水平，如果倾斜角度过大，影响阅卷
             </p>
             <p style="font-size:14px; color:#ff6a00">
                 2.请保证定位点在黑框内，且黑框框选处减少干扰，例如线条文字等。
             </p>
        </div>

            <div id="kaochi_Line" style="position:absolute; background:#ff0000;opacity:0.5; height:10px; z-index:333; width:100%; left:0; top:200px;"></div>
            <img id="SelectImg" src="<%=imgage %>" style="width:100%; float:left; z-index:0; " />
        </div>
        <div style=" width:100%; height:auto; margin:0 auto;">
            <input type="button" class="btn_XY" value="左倾斜" onclick="PicRotate(0)"  style="float:left; padding:10px; padding-left:30px; padding-right:30px; font-size:14px; margin-right:10px;margin-top:15px; margin-right:50px;"/>
            <input type="button" class="btn_XY" value="右倾斜" onclick="PicRotate(1)" style="float:left;padding:10px; padding-left:30px; padding-right:30px; font-size:14px;margin-right:10px;margin-top:15px;margin-right:50px;" />
            <input type="button" class="btn_XY" id="YLData_btn" value="预览识别" onclick="YLSB(this)"  style="float:left;padding:10px; padding-left:30px; padding-right:30px; font-size:14px;margin-right:10px;margin-top:15px;margin-right:50px;" />
            <input type="button" class="btn_XY" id="saveData_btn" value="保存数据" onclick="GetDataTotal('1','<%=tenant %>')" style="float:left;padding:10px; padding-left:30px; padding-right:30px; font-size:14px;margin-right:10px;margin-top:15px;margin-right:50px;" />
            <input type="button" class="btn_XY" id="saveData_Locked" value="锁定模板" onclick="GetDataTotalAnsy('<%=tenant %>')" style="float:left;padding:10px; padding-left:30px; padding-right:30px; font-size:14px;margin-right:10px;margin-top:15px;margin-right:50px;" />
         </div>
    </div>

  
<script src="../js/indexuser.js"></script>
   <script>
       function bodyScale() {
           var devicewidth = document.documentElement.clientWidth;
           var scale = devicewidth / 8000;  // 分母——设计稿的尺寸
           document.body.style.zoom = scale;
       }
       window.onload = window.onresize = function () {
          //bodyScale();
       };
       var rote = 0;
       function PicRotate(flag) {
           if ($("#SelectImg").css("-webkit-transform") == "none") {
               rote = .2;
           }
           else {
               if (flag == 1) {
                   rote +=parseFloat(.2);
               }
               else {
                   rote -=parseFloat(.2);
               }
           }
 
           var value = $("#SelectImg").css("-webkit-transform").replace("matrix(", "").replace(");", "").replace(")", "");

           if (flag == 0) {
               document.getElementById("SelectImg").style.transform = 'rotate(' + rote + 'deg)';
           }
           else {
               document.getElementById("SelectImg").style.transform = 'rotate(' + rote + 'deg)';
           }
           //GetDataTotal();
       }
       var roteBind = parseFloat("<%=Rotate%>");
       rote = roteBind;
       document.getElementById("SelectImg").style.transform = 'rotate(' + roteBind + 'deg)';
       $(".hideinfo").hide();
       function GetImageUrl() {
           $.post("TempDraw.aspx", { action: 1, rd: Math.random(), TempID: $("#ID_bigint").val(), UserID: $("#UserID").val(),tenant:$("#tenant").val() }, function (res) {
               $("#SelectImg").attr("src", "data:image/jpg;base64,"+res);
           })
       }
       if (islocked == 1) {
           $("#SelectImg").attr("src", "");
           GetImageUrl();
       }

       function YLSB(obj) {
           if ($(obj).attr("value") == "预览识别") {
               $(obj).attr("value", "取消预览");
               
               $.post("TempDraw.aspx", { action: 1, rd: Math.random(), TempID: $("#ID_bigint").val(), UserID: $("#UserID").val() ,tenant:$("#tenant").val()}, function (res) {
                   if (res == "-1" || res=="") {
                       alert("定位点出错，请重新设置");
                       document.location.href = document.location.href;
                   }
                   else {
                       //GetDataTotal('1');
                       $("#SelectImg").attr("src", "data:image/jpg;base64," + res);
                       $("#draggable_0").hide();
                       $("#draggable_1").hide();
                       $("#draggable_2").hide();
                       $("#draggable_3").hide();
                       $(".btn_XY").attr("disabled", "disabled");
                       $("#kaochi_Line").hide();
                   }
                   $(obj).show();
                   $(obj).removeAttr("disabled");
               })
           }
           else {
               document.location.href = document.location.href;
               $(obj).attr("value", "预览识别");
           }
       }

   </script>
</body>

</html>