<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Face.aspx.cs" Inherits="RM.Web.Training.Face.Face" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>人脸识别信息采集</title>   
    <style type="text/css">
        * { font-size: 10pt; }
body { font-family: 微软雅黑, 宋体, Arial, Helvetica, Verdana, sans-serif; color: #000000; }
       table{border-left:1px solid #ccc;border-right:1px solid #ccc; border-bottom:1px solid #ccc;}
    table th{ text-align:right;border-top:1px solid #ccc;border-right:1px solid #ccc;}
    table td{border-top:1px solid #ccc;}
   img{ border:1px solid #ccc;  margin :2px; }
   .swf1{border:1px solid #ccc;}
   h2{ font-size:16px;}
   .sysm{ font-size:14px; padding:10px 10px 10px 210px; }
    </style> 
    <script src="/Themes/Scripts/jquery-1.8.2.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        var isVali = false; //是否启动人脸识别
    </script>

    <script src="ckplayer.js" type="text/javascript"></script>
    <script type="text/javascript">
        
       //初始化
        $(function () { Setform(); });

        function Setform() {
            var strArray = new Array();
            var strArray1 = new Array();
            var item_value = $("#AppendProperty_value").val(); //后台返回值
            strArray = item_value.split(';');
            for (var i = 0; i < strArray.length; i++) {
                var item_value1 = strArray[i];
                strArray1 = item_value1.split('|');
                $("#" + strArray1[0]).html(strArray1[1]);
            }
        }


        var face1 = "<%=faceid %>"; // "238fdc9a7c64c3cff1912a2917288c0a";  "b7af028666fe3630f8e49d9efaac9f08"
        var purl = "";
        function callAS(json) {
            if (json == "") {
                document.getElementById("ld").innerHTML = "未能识别成功，请重试！";
            }
            else if (json == "1") {
                document.getElementById("ld").innerHTML = "正在进行人脸识别，请稍后！";
            } else {
            document.getElementById("ld").innerHTML = "";
                var obj = eval('(' + json + ')');
                var face2 = obj.photoface[0].face_id;
                $.get("/Training/Face/faceidSave.ashx", { filename: purl }, function (data2) {
                    var ret = data2;
                    if (ret == "0") {
                        alert("未找到人！"); return;
                    } else if (ret == "-1") {
                        alert("系统验证异常！"); return;
                    } else {
                        //保存用户 faceinfo
                        $.get("/Training/Face/SaveUserFace.ashx",
                        { action: "saveface", f2: ret, purl: "/Resources/Face/" + purl },
                        function (data) {
                            if (data == "-1") {
                                alert("参数异常！请重拍");
                            } else if (data == "0") {
                                alert("拍照失败！");
                            } else if (data == "1") {
                                alert("拍照成功！");
                            } else {
                                var saveInfo = data;
                                document.getElementById("ld").innerHTML = "拍照保存成功！";
                            }
                        });
                    }
                });
            }
        }

        function PhotoPath(url) {
            purl =url;
            setTimeout(function () { document.getElementById("pp").src = "/Resources/Face/" + url; }, 1000);
        }

        function thisMovie(movieName) {
            if (navigator.appName.indexOf("Microsoft") != -1) {
                window[movieName]
            } else {
                document[movieName]
            }
        }

        function PaiBtn() {
            var flash = (navigator.appName.indexOf("Microsoft") != -1) ? window["swf1"] : document["swf1"];
            flash.CallPaizhaos();
        }

        swfobject2.embedSWF("/Training/Face/Index.swf", "swf1", "395", "395", "9.0.0");
        

    </script>

</head>
<body>

    <form id="form1" runat="server">
    <div style="padding:0 10%;">    
    <div style="text-align:center;" ><h2>人脸识别信息采集</h2></div>
    <input type="text" id="AppendProperty_value" runat="server" style="display:none;"  />    
    <div style="float:left;" >
        <img width="200" src="/Mall/User_Image.ashx?id=<%=_key %>" /><br />
        <img src="<%=faceImg %>" width="200" id="pp" />
    </div>
    
    <div style="float:left; margin:0 5px; width:395px;border:1px solid #ccc; ">
        <div id="swf1"></div>
        <div  class="clear" style="padding-top:5px;"  >
        <div id="ld" style="float:left;color:Red; width:300px;margin-left:5px;">请手动点击拍照进行人脸识别</div>
        <div style="float:right; width:50px; margin-bottom:5px; "><input  value="拍照" type="button"  onclick="PaiBtn()" /></div>
        </div>
    </div>

    <div style="float:left;">
    <table cellpadding="0" cellspacing="0">
        <tr><td colspan="2" style="text-align:center;"  >个人信息确认</td></tr>
        <tr><th style="width:100px;" >姓名：</th><td><label runat="server" id="User_Name"></label></td></tr>        
        <tr><th>学生学号：</th><td><label runat="server" id="User_Code"></label></td></tr>
        <tr><th>地址邮箱：</th><td><label runat="server" id="Email"></label></td></tr>
        <!--<%=propertyStr %>-->
    </table>
    </div>
    
    <div style="float:left;" class="sysm"  >使用说明：<br />
            1、查看上方摄像头，确保摄像头显示位置为正面。<br />
            2、确保摄像位置正确后点击拍照按钮。<br />
            3、点击拍照后，系统自动与您在系统预留的照片进行人脸匹配。<br />
            4、匹配成功后可以进行学习和考试。<br />
            5、若总是出现不能正常识别，请调整摄像头位置，确保在光线充足 情况下拍照。<br />
            </div>
    </div>

    </form>
    
</body>
</html>
