| | |
| | | //是否是访客 |
| | | var isVisPager = false; |
| | | //定义驱动的版本号 |
| | | var fpDriverVersion="5.0.0.1"; |
| | | var fpDriverVersion = "5.0.0.1"; |
| | | //是否为比对功能 |
| | | var isComp= false; |
| | | var isComp = false; |
| | | |
| | | /** |
| | | * 加载xml中ISSOnline_server的ip和port |
| | |
| | | * @create 2013-06-15 15:01:31 pm |
| | | * @param url 加载xml的url |
| | | */ |
| | | function loadXml(url) |
| | | { |
| | | $.ajax( { |
| | | type : "GET", |
| | | url : url, |
| | | dataType : "xml", |
| | | function loadXml(url) { |
| | | $.ajax({ |
| | | type: "GET", |
| | | url: url, |
| | | dataType: "xml", |
| | | async: false, |
| | | success : function(xml) |
| | | { |
| | | $(xml).find('service').each(function(){ |
| | | success: function (xml) { |
| | | $(xml).find('service').each(function () { |
| | | var service = $(this); |
| | | serverIp = service.find('ISSOnline_serverIp').text(); |
| | | serverIp = service.find('ISSOnline_serverIp').text(); |
| | | serverPort = service.find('ISSOnline_serverPort').text(); |
| | | }) |
| | | }, |
| | | error : function(XMLHttpRequest, textStatus, errorThrown) |
| | | { |
| | | error: function (XMLHttpRequest, textStatus, errorThrown) { |
| | | //如果取配置文件出错,则设置默认 |
| | | serverIp = "127.0.0.1"; |
| | | serverPort = "22001"; |
| | | } |
| | | } |
| | | }); |
| | | //给issOnlineUrl赋值 |
| | | issOnlineUrl = "http://"+serverIp+":"+serverPort+"/ZKBIOOnline"; |
| | | issOnlineUrl = "http://" + serverIp + ":" + serverPort + "/ZKBIOOnline"; |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param fingerIdList 数据库查询的指纹标记 |
| | | * @param templateList 数据库查询的指纹模板 |
| | | */ |
| | | function loadFPDataTemplate(fingerIdList, templateList) |
| | | { |
| | | if(fingerIdList == "[]") |
| | | { |
| | | function loadFPDataTemplate(fingerIdList, templateList) { |
| | | if (fingerIdList == "[]") { |
| | | $("#fingerId").val(" "); |
| | | } |
| | | else |
| | | { |
| | | } |
| | | else { |
| | | $("#fingerId").val(fingerIdList); |
| | | } |
| | | if(templateList == "[]") |
| | | { |
| | | if (templateList == "[]") { |
| | | $("#fingerTemplate10").val(" "); |
| | | } |
| | | else |
| | | { |
| | | } |
| | | else { |
| | | $("#fingerTemplate10").val(templateList); |
| | | } |
| | | } |
| | |
| | | * @author wenxin |
| | | * @create 2013-08-09 17:24:31 pm |
| | | */ |
| | | function getBrowserType() |
| | | { |
| | | function getBrowserType() { |
| | | var browserFlag = ""; |
| | | //是否支持html5的cors跨域 |
| | | if (typeof(Worker) !== "undefined") |
| | | { |
| | | browserFlag = "html5"; |
| | | } |
| | | //此处判断ie8、ie9 |
| | | else if(navigator.userAgent.indexOf("MSIE 8.0")>0 || navigator.userAgent.indexOf("MSIE 9.0")>0) |
| | | { |
| | | browserFlag = "simple"; |
| | | } |
| | | else |
| | | { |
| | | //是否支持html5的cors跨域 |
| | | if (typeof (Worker) !== "undefined") { |
| | | browserFlag = "html5"; |
| | | } |
| | | //此处判断ie8、ie9 |
| | | else if (navigator.userAgent.indexOf("MSIE 8.0") > 0 || navigator.userAgent.indexOf("MSIE 9.0") > 0) { |
| | | browserFlag = "simple"; |
| | | } |
| | | else { |
| | | browserFlag = "upgradeBrowser";//当前浏览器不支持该功能,请升级浏览器 |
| | | } |
| | | return browserFlag; |
| | | return browserFlag; |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param paramArray 存放国际化元素的数组 |
| | | * @param isFPLogin 是否是指纹登录 true:是;false:否 |
| | | */ |
| | | function checkDriver(paramArray, browserFlag, isFPLogin) |
| | | { |
| | | function checkDriver(paramArray, browserFlag, isFPLogin) { |
| | | var hrefStr = ""; |
| | | if(browserFlag == "html5") |
| | | { |
| | | if (browserFlag == "html5") { |
| | | // 发送一个请求,检查是否安装驱动 |
| | | getWebServerInfo(paramArray, isFPLogin, "0"); |
| | | } |
| | | else if(browserFlag == "simple") |
| | | { |
| | | else if (browserFlag == "simple") { |
| | | //发送一个请求,检查是否安装驱动 |
| | | getWebServerInfoForSimple(paramArray, isFPLogin, "0"); |
| | | } |
| | | else if(browserFlag == "upgradeBrowser") |
| | | { |
| | | if($("#userLoginForm [name='fingerLogin']").val() != undefined) |
| | | { |
| | | else if (browserFlag == "upgradeBrowser") { |
| | | if ($("#userLoginForm [name='fingerLogin']").val() != undefined) { |
| | | $("#userLoginForm [name='fingerLogin']").attr("onclick", ""); |
| | | $("#userLoginForm [name='fingerLogin']").attr("title", "当前浏览器不支持改功能,请升级浏览器!"); |
| | | } |
| | | if($("#fpRegister").val() != undefined) |
| | | { |
| | | if ($("#fpRegister").val() != undefined) { |
| | | $("#fpRegister").attr("onclick", ""); |
| | | $("#fpRegister").attr("title", "当前浏览器不支持改功能,请升级浏览器!"); |
| | | } |
| | |
| | | * @param type 0 表示发送完请求后,还有别的操作。1 表示发送完请求后,没有其余的操作了 |
| | | * @create 2013-08-09 17:24:31 pm |
| | | */ |
| | | function getWebServerInfo(paramArray, isFPLogin, type) |
| | | { |
| | | $.ajax( { |
| | | type : "GET", |
| | | url : issOnlineUrl+"/info", |
| | | dataType : "json", |
| | | function getWebServerInfo(paramArray, isFPLogin, type) { |
| | | $.ajax({ |
| | | type: "GET", |
| | | url: issOnlineUrl + "/info", |
| | | dataType: "json", |
| | | async: true, |
| | | //timeout:1000, |
| | | success : function(result) |
| | | { |
| | | success: function (result) { |
| | | //检查驱动 |
| | | if(type == "0") |
| | | { |
| | | if (type == "0") { |
| | | getWebServerInfoCallBack(result, paramArray, isFPLogin); |
| | | } |
| | | //检查动态库连接 |
| | | else if(type == "1") |
| | | { |
| | | getDLLConnectCallBack(result,isComp); |
| | | else if (type == "1") { |
| | | getDLLConnectCallBack(result, isComp); |
| | | } |
| | | |
| | | |
| | | }, |
| | | error : function(XMLHttpRequest, textStatus, errorThrown) |
| | | { |
| | | |
| | | } |
| | | error: function (XMLHttpRequest, textStatus, errorThrown) { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | |
| | |
| | | * @param type 0 表示发送完请求后,还有别的操作。1 表示发送完请求后,没有其余的操作了 |
| | | * @create 2013-08-09 17:24:31 pm |
| | | */ |
| | | function getWebServerInfoForSimple(paramArray, isFPLogin, type) |
| | | { |
| | | function getWebServerInfoForSimple(paramArray, isFPLogin, type) { |
| | | //创建XDomainRequest实例,用于ie8和ie9跨域访问 |
| | | var xDomainRequest = new XDomainRequest(); |
| | | //如果xDomainRequest存在,则可以使用xDomainRequest函数,否则,说明不是ie浏览器 |
| | | if (xDomainRequest) |
| | | { |
| | | xDomainRequest.open('GET', issOnlineUrl+"/info?random="+getRandomNum()); |
| | | xDomainRequest.onload = function() |
| | | { |
| | | if (xDomainRequest) { |
| | | xDomainRequest.open('GET', issOnlineUrl + "/info?random=" + getRandomNum()); |
| | | xDomainRequest.onload = function () { |
| | | //检查驱动 |
| | | if(type == "0") |
| | | { |
| | | if (type == "0") { |
| | | getInfoForSimpleCallBack(xDomainRequest, paramArray, isFPLogin); |
| | | } |
| | | //检查动态库连接 |
| | | else if(type == "1") |
| | | { |
| | | getDLLConnectCallBack(xDomainRequest,isComp); |
| | | else if (type == "1") { |
| | | getDLLConnectCallBack(xDomainRequest, isComp); |
| | | } |
| | | }; |
| | | xDomainRequest.onerror = function() |
| | | { |
| | | }; |
| | | xDomainRequest.onerror = function () { |
| | | //用完后,将对象置为空 |
| | | xDomainRequest = null; |
| | | }; |
| | | xDomainRequest.send(); |
| | | } |
| | | xDomainRequest.send(); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | * @author wenxin |
| | | * @create 2013-08-09 17:24:31 pm |
| | | */ |
| | | function getWebServerInfoCallBack(result, paramArray, isFPLogin) |
| | | { |
| | | function getWebServerInfoCallBack(result, paramArray, isFPLogin) { |
| | | //返回码 |
| | | var ret = null; |
| | | ret = result.ret; |
| | | //接口调用成功返回时 |
| | | if(ret == 0) |
| | | { |
| | | if(isFPLogin) |
| | | { |
| | | if (ret == 0) { |
| | | if (isFPLogin) { |
| | | //显示指纹登录 |
| | | showFPVerify(paramArray); |
| | | } |
| | | else |
| | | { |
| | | else { |
| | | //显示登记--可以点击采集指纹 |
| | | showRegister(paramArray); |
| | | //计算指纹数量${pers_person_templateCount}:指纹数 |
| | |
| | | //鼠标over事件 |
| | | //mouseOverEvent(); |
| | | // 对比指纹驱动 |
| | | if (result.data&&result.data.server_version){ |
| | | compareFPDriver(result.data.server_version); |
| | | if (result.data && result.data.server_version) { |
| | | compareFPDriver(result.data.server_version); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | * @create 2013-06-14 10:09:20 am |
| | | * @param paramArray 存放国际化元素的数组 |
| | | */ |
| | | function showFPVerify(paramArray) |
| | | { |
| | | function showFPVerify(paramArray) { |
| | | $("#userLoginForm .but_fing_disabled").hide(); |
| | | $("#userLoginForm .but_fing").show(); |
| | | } |
| | |
| | | * @create 2013-06-14 10:09:20 am |
| | | * @param paramArray 存放国际化元素的数组 |
| | | */ |
| | | function showRegister(paramArray) |
| | | { |
| | | function showRegister(paramArray) { |
| | | var hrefStr = ""; |
| | | var param = '"'+paramArray[0]+'", "'+paramArray[1]+'", "'+paramArray[2]+'", '+null+''; |
| | | var param = '"' + paramArray[0] + '", "' + paramArray[1] + '", "' + paramArray[2] + '", ' + null + ''; |
| | | $("#fpRegister").remove(); |
| | | $("#downloadDriver").remove(); |
| | | //webservice接口调用成功,说明驱动已经安装 |
| | | hrefStr = "<a id='fpRegister' onclick='submitRegister("+param+", true"+")' title='"+paramArray[3]+"' class='linkStyle'>"+paramArray[3]+"</a>"; |
| | | hrefStr = "<button id='fpRegister' onclick='submitRegister(" + param + ", true" + ")' title='" + paramArray[3] + "' class='linkStyle'>" + paramArray[3] + "</button>"; |
| | | $("#fpRegisterDiv").append(hrefStr); |
| | | } |
| | | |
| | |
| | | * @create 2013-04-25 11:31:20 am |
| | | * |
| | | */ |
| | | function showFPCountInit(fingerIdCount, text) |
| | | { |
| | | $("#fpCountMessage").text(text +" "+ fingerIdCount); |
| | | function showFPCountInit(fingerIdCount, text) { |
| | | $("#fpCountMessage").text(text + " " + fingerIdCount); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param oldVersion 旧驱动版本 |
| | | * @create 2015-01-28 17:24:31 pm |
| | | */ |
| | | function compareFPDriver(oldVersion) |
| | | { |
| | | var existVersion = fpDriverVersion |
| | | function compareFPDriver(oldVersion) { |
| | | var existVersion = fpDriverVersion |
| | | var curVersion = oldVersion;//3.5.2 |
| | | var existVersionArr = existVersion.split("."); |
| | | var curVersionArr = curVersion.split("."); |
| | | var isLast = true; |
| | | var len = existVersionArr.length; |
| | | for(var i=len;i>0;i--) |
| | | { |
| | | var existVersionTemp = parseInt(existVersionArr[i-1]); |
| | | var curVersionTemp = parseInt(curVersionArr[i-1]); |
| | | if(existVersionTemp<curVersionTemp) |
| | | { |
| | | for (var i = len; i > 0; i--) { |
| | | var existVersionTemp = parseInt(existVersionArr[i - 1]); |
| | | var curVersionTemp = parseInt(curVersionArr[i - 1]); |
| | | if (existVersionTemp < curVersionTemp) { |
| | | isLast = false; |
| | | } |
| | | else if(existVersionTemp>curVersionTemp) |
| | | { |
| | | else if (existVersionTemp > curVersionTemp) { |
| | | isLast = true; |
| | | } |
| | | else |
| | | { |
| | | else { |
| | | //等于 忽略 |
| | | } |
| | | } |
| | |
| | | * @author gordon.zhang |
| | | * @create 2015-01-28 17:24:31 pm |
| | | */ |
| | | function showNewDriver(){ |
| | | var hrefStr = "<a id='downloadDriver' href='base/middleware/zkbioonline.exe' title='下载新驱动'>下载新驱动</a>"; |
| | | $("#driverDownload").append(hrefStr); |
| | | function showNewDriver() { |
| | | var hrefStr = "<a id='downloadDriver' href='base/middleware/zkbioonline.exe' title='下载新驱动'>下载新驱动</a>"; |
| | | $("#driverDownload").append(hrefStr); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param isFPLogin 是否是指纹登录 true:是;false:否 |
| | | * @create 2013-08-09 17:43:31 pm |
| | | */ |
| | | function getInfoForSimpleCallBack(xDomainRequest, paramArray, isFPLogin) |
| | | { |
| | | function getInfoForSimpleCallBack(xDomainRequest, paramArray, isFPLogin) { |
| | | //获取接口返回值 |
| | | var resultData = xDomainRequest.responseText; |
| | | //转化为json对象 |
| | | var obj = jQuery.parseJSON(resultData); |
| | | //返回码 |
| | | var ret = null; |
| | | if(obj != null && obj.ret != undefined) |
| | | { |
| | | if (obj != null && obj.ret != undefined) { |
| | | ret = obj.ret; |
| | | } |
| | | //接口调用成功返回时 |
| | | if(ret == 0) |
| | | { |
| | | if(isFPLogin) |
| | | { |
| | | if (ret == 0) { |
| | | if (isFPLogin) { |
| | | //显示指纹比对 |
| | | showFPVerify(paramArray); |
| | | } |
| | | else |
| | | { |
| | | else { |
| | | //显示登记--点击采集指纹 |
| | | showRegister(paramArray); |
| | | //计算指纹数量${pers_person_templateCount}:指纹数 |
| | | |
| | | |
| | | showFPCountInit(paramArray[5], paramArray[6]); |
| | | //鼠标over事件 |
| | | //mouseOverEvent(); |
| | |
| | | * @param downloadText 驱动安装国际化内容 |
| | | * @param isDriverInstall 是否安装了驱动 |
| | | */ |
| | | function submitRegister(title, fpCount, saveText, downloadText, isDriverInstall) |
| | | { |
| | | function submitRegister(title, fpCount, saveText, downloadText, isDriverInstall) { |
| | | //支持html5 |
| | | if (typeof(Worker) !== "undefined" && isDriverInstall) |
| | | { |
| | | var box=document.getElementById("box"); |
| | | var bg=document.getElementById("bg"); |
| | | box.style.display="block";//显示内容层,显示覆盖层 |
| | | box.style.left=parseInt((document.documentElement.scrollWidth-box.offsetWidth)/2)+document.documentElement.scrollLeft+"px"; |
| | | box.style.top=Math.abs(parseInt((document.documentElement.clientHeight-box.offsetHeight)/2))+document.documentElement.scrollTop+"px"; //为内容层设置位置 |
| | | bg.style.display="block"; |
| | | bg.style.height=document.documentElement.scrollHeight+"px"; |
| | | isComp=false; |
| | | dataInitReg(); |
| | | //关闭页面时,提示保存数据 |
| | | if (typeof (Worker) !== "undefined" && isDriverInstall) { |
| | | var box = document.getElementById("box"); |
| | | var bg = document.getElementById("bg"); |
| | | box.style.display = "block";//显示内容层,显示覆盖层 |
| | | box.style.left = parseInt((document.documentElement.scrollWidth - box.offsetWidth) / 2) + document.documentElement.scrollLeft + "px"; |
| | | box.style.top = Math.abs(parseInt((document.documentElement.clientHeight - box.offsetHeight) / 2)) + document.documentElement.scrollTop + "px"; //为内容层设置位置 |
| | | bg.style.display = "block"; |
| | | bg.style.height = document.documentElement.scrollHeight + "px"; |
| | | isComp = false; |
| | | dataInitReg(); |
| | | //关闭页面时,提示保存数据 |
| | | //storeBeforeClose(fpCount, saveText); |
| | | } |
| | | else if(typeof(Worker) == "undefined" && isDriverInstall) |
| | | { |
| | | //createWindow('base_baseFPRegisterSimple.action?random=' + getRandomNum() + '^0^0^465^460^' + title);//public/html/applet.html |
| | | showModalDialog('webapp/html/baseFPRegisterSimple.html',title,'dialogWidth:465px;dialogHeight:460px;dialogLeft:600px;dialogTop:150px;center:yes;resizable:no;status:yes'); |
| | | //关闭页面时,提示保存数据 |
| | | } |
| | | else if (typeof (Worker) == "undefined" && isDriverInstall) { |
| | | //createWindow('base_baseFPRegisterSimple.action?random=' + getRandomNum() + '^0^0^465^460^' + title);//public/html/applet.html |
| | | showModalDialog('webapp/html/baseFPRegisterSimple.html', title, 'dialogWidth:465px;dialogHeight:460px;dialogLeft:600px;dialogTop:150px;center:yes;resizable:no;status:yes'); |
| | | //关闭页面时,提示保存数据 |
| | | //storeBeforeClose(fpCount, saveText); |
| | | } |
| | | else if(!isDriverInstall) |
| | | { |
| | | } |
| | | else if (!isDriverInstall) { |
| | | alert("请安装指纹驱动或启动该服务!"); |
| | | //messageBox({messageType: "alert", title: "提示", text: "请安装指纹驱动或启动该服务!"}); |
| | | if(typeof($("#downloadDriver").val()) == "undefined") |
| | | { |
| | | var hrefStr = "<a id='downloadDriver' href='webapp/middleware/zkbioonline.exe' title='" + downloadText + "'>"+downloadText+"</a>"; |
| | | if (typeof ($("#downloadDriver").val()) == "undefined") { |
| | | var hrefStr = "<a id='downloadDriver' href='webapp/middleware/zkbioonline.exe' title='" + downloadText + "'>" + downloadText + "</a>"; |
| | | $("#driverDownload").append(hrefStr); |
| | | } |
| | | } |
| | |
| | | * @param fpCount 指纹数国际化内容 |
| | | * @param saveText 提示:是否保存国际化内容 |
| | | */ |
| | | function storeBeforeClose(fpCount, saveText) |
| | | { |
| | | //关闭页面时,监听关闭的onclick事件 |
| | | getCurrentWindow().button("close").attachEvent("onClick", function(){ |
| | | function storeBeforeClose(fpCount, saveText) { |
| | | //关闭页面时,监听关闭的onclick事件 |
| | | getCurrentWindow().button("close").attachEvent("onClick", function () { |
| | | //判断是否修改了数据(包括新增和删除) |
| | | if ($("#whetherModify").val() != undefined && (fpModifyFlag != undefined && fpModifyFlag)) |
| | | { |
| | | if ($("#whetherModify").val() != undefined && (fpModifyFlag != undefined && fpModifyFlag)) { |
| | | //获取指纹标记数据 |
| | | var fingerIdData = fingerIdArray; |
| | | //获取指纹模板数据 |
| | | var fingerTemplateData = templateDataArray; |
| | | var flag=confirm(saveText); |
| | | var flag = confirm(saveText); |
| | | saveFPData(flag, fpCount); |
| | | } |
| | | else |
| | | { |
| | | else { |
| | | //取消采集 |
| | | cancelRegister(); |
| | | //将定时器的递归调用关闭 |
| | |
| | | * @create 2013-05-13 10:18:31 am |
| | | * @param |
| | | */ |
| | | function getDataFromPage() |
| | | { |
| | | var fingerId = $("#fingerId").val(); |
| | | var fingerTemplate = $("#fingerTemplate10").val(); |
| | | //如果有数据 |
| | | if($.trim(fingerId) != "") |
| | | { |
| | | fingerId = fingerId.substr(1, fingerId.length-2); |
| | | fingerTemplate = fingerTemplate.substr(1, fingerTemplate.length-2); |
| | | fingerIdArray = fingerId.split(","); |
| | | templateDataArray = fingerTemplate.split(","); |
| | | }else{ |
| | | fingerIdArray=new Array(); |
| | | templateDataArray=new Array(); |
| | | } |
| | | function getDataFromPage() { |
| | | var fingerId = $("#fingerId").val(); |
| | | var fingerTemplate = $("#fingerTemplate10").val(); |
| | | //如果有数据 |
| | | if ($.trim(fingerId) != "") { |
| | | fingerId = fingerId.substr(1, fingerId.length - 2); |
| | | fingerTemplate = fingerTemplate.substr(1, fingerTemplate.length - 2); |
| | | fingerIdArray = fingerId.split(","); |
| | | templateDataArray = fingerTemplate.split(","); |
| | | } else { |
| | | fingerIdArray = new Array(); |
| | | templateDataArray = new Array(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | * @author wenxin |
| | | * @create 2013-06-15 15:40:31 pm |
| | | */ |
| | | function initCoordJson() |
| | | { |
| | | var coordJson = [{"num" : 0, "coord" : {"x" : x + 3, "y" : y - 37}}, |
| | | {"num" : 1, "coord" : {"x" : x + 25, "y" : y - 37}}, |
| | | {"num" : 2, "coord" : {"x" : x + 47, "y" : y - 34}}, |
| | | {"num" : 3, "coord" : {"x" : x + 67, "y" : y - 26}}, |
| | | {"num" : 4, "coord" : {"x" : x + 77, "y" : y + 18}}, |
| | | {"num" : 5, "coord" : {"x" : x + 153, "y" : y + 34}}, |
| | | {"num" : 6, "coord" : {"x" : x + 159, "y" : y - 19}}, |
| | | {"num" : 7, "coord" : {"x" : x + 177, "y" : y - 30}}, |
| | | {"num" : 8, "coord" : {"x" : x + 198, "y" : y - 36}}, |
| | | {"num" : 9, "coord" : {"x" : x + 220, "y" : y - 36}}, |
| | | {"num" : 10, "coord" : {"x" : x, "y" : y}}, |
| | | {"num" : 11, "coord" : {"x" : x + 170, "y" : y + 12}}, |
| | | {"num" : 12, "coord" : {"x" : x + 210, "y" : y - 346}}]; |
| | | function initCoordJson() { |
| | | var coordJson = [{ "num": 0, "coord": { "x": x + 3, "y": y - 37 } }, |
| | | { "num": 1, "coord": { "x": x + 25, "y": y - 37 } }, |
| | | { "num": 2, "coord": { "x": x + 47, "y": y - 34 } }, |
| | | { "num": 3, "coord": { "x": x + 67, "y": y - 26 } }, |
| | | { "num": 4, "coord": { "x": x + 77, "y": y + 18 } }, |
| | | { "num": 5, "coord": { "x": x + 153, "y": y + 34 } }, |
| | | { "num": 6, "coord": { "x": x + 159, "y": y - 19 } }, |
| | | { "num": 7, "coord": { "x": x + 177, "y": y - 30 } }, |
| | | { "num": 8, "coord": { "x": x + 198, "y": y - 36 } }, |
| | | { "num": 9, "coord": { "x": x + 220, "y": y - 36 } }, |
| | | { "num": 10, "coord": { "x": x, "y": y } }, |
| | | { "num": 11, "coord": { "x": x + 170, "y": y + 12 } }, |
| | | { "num": 12, "coord": { "x": x + 210, "y": y - 346 } }]; |
| | | return coordJson; |
| | | } |
| | | |
| | |
| | | * @param x, y 绘画手指的起点的坐标 |
| | | * @param num 手指、手掌编号0-9:手指编号;10:左手掌,11:右手掌,12:圆弧。 |
| | | */ |
| | | function initCoordArray(coordArray, x, y, num) |
| | | { |
| | | if(num == 0) |
| | | { |
| | | function initCoordArray(coordArray, x, y, num) { |
| | | if (num == 0) { |
| | | coordArray[0] = new Coord(x, y); |
| | | coordArray[1] = new Coord(x + 2, y - 35); |
| | | coordArray[2] = new Coord(x + 5, y - 40); |
| | |
| | | coordArray[9] = new Coord(x + 3, y + 5); |
| | | coordArray[10] = new Coord(x, y); |
| | | } |
| | | else if(num == 1) |
| | | { |
| | | else if (num == 1) { |
| | | coordArray[0] = new Coord(x, y); |
| | | coordArray[1] = new Coord(x + 8, y - 50); |
| | | coordArray[2] = new Coord(x + 12, y - 54); |
| | |
| | | coordArray[9] = new Coord(x + 3, y + 4); |
| | | coordArray[10] = new Coord(x, y); |
| | | } |
| | | else if(num == 2) |
| | | { |
| | | else if (num == 2) { |
| | | coordArray[0] = new Coord(x, y); |
| | | coordArray[1] = new Coord(x + 14, y - 54); |
| | | coordArray[2] = new Coord(x + 16, y - 57); |
| | |
| | | coordArray[9] = new Coord(x + 1, y + 5); |
| | | coordArray[10] = new Coord(x, y); |
| | | } |
| | | else if(num == 3) |
| | | { |
| | | else if (num == 3) { |
| | | coordArray[0] = new Coord(x, y); |
| | | coordArray[1] = new Coord(x + 19, y - 37); |
| | | coordArray[2] = new Coord(x + 21, y - 39); |
| | |
| | | coordArray[9] = new Coord(x + 1, y + 6); |
| | | coordArray[10] = new Coord(x, y); |
| | | } |
| | | else if(num == 4){ |
| | | else if (num == 4) { |
| | | coordArray[0] = new Coord(x, y); |
| | | coordArray[1] = new Coord(x + 30, y - 18); |
| | | coordArray[2] = new Coord(x + 34, y - 17); |
| | |
| | | coordArray[10] = new Coord(x - 2, y + 8); |
| | | coordArray[11] = new Coord(x, y); |
| | | } |
| | | else if(num == 5) |
| | | { |
| | | else if (num == 5) { |
| | | coordArray[0] = new Coord(x, y); |
| | | coordArray[1] = new Coord(x - 26, y - 21); |
| | | coordArray[2] = new Coord(x - 27, y - 24); |
| | |
| | | coordArray[9] = new Coord(x + 7, y + 1); |
| | | coordArray[10] = new Coord(x, y); |
| | | } |
| | | else if(num == 6) |
| | | { |
| | | else if (num == 6) { |
| | | coordArray[0] = new Coord(x, y); |
| | | coordArray[1] = new Coord(x - 17, y - 46); |
| | | coordArray[2] = new Coord(x - 17, y - 50); |
| | |
| | | coordArray[9] = new Coord(x + 4, y + 2); |
| | | coordArray[10] = new Coord(x, y); |
| | | } |
| | | else if(num == 7) |
| | | { |
| | | else if (num == 7) { |
| | | coordArray[0] = new Coord(x, y); |
| | | coordArray[1] = new Coord(x - 12, y - 54); |
| | | coordArray[2] = new Coord(x - 10, y - 58); |
| | |
| | | coordArray[9] = new Coord(x + 5, y + 4); |
| | | coordArray[10] = new Coord(x, y); |
| | | } |
| | | else if(num == 8) |
| | | { |
| | | else if (num == 8) { |
| | | coordArray[0] = new Coord(x, y); |
| | | coordArray[1] = new Coord(x - 5, y - 50); |
| | | coordArray[2] = new Coord(x - 2, y - 54); |
| | |
| | | coordArray[9] = new Coord(x + 4, y + 5); |
| | | coordArray[10] = new Coord(x, y); |
| | | } |
| | | else if(num == 9) |
| | | { |
| | | else if (num == 9) { |
| | | coordArray[0] = new Coord(x, y); |
| | | coordArray[1] = new Coord(x, y - 37); |
| | | coordArray[2] = new Coord(x + 3, y - 41); |
| | |
| | | coordArray[9] = new Coord(x + 3, y + 4); |
| | | coordArray[10] = new Coord(x, y); |
| | | } |
| | | else if(num == 10) |
| | | { |
| | | else if (num == 10) { |
| | | coordArray[0] = new Coord(x, y); |
| | | coordArray[1] = new Coord(x + 2, y - 8); |
| | | coordArray[2] = new Coord(x + 6, y - 16); |
| | |
| | | coordArray[7] = new Coord(x + 64, y - 16); |
| | | coordArray[8] = new Coord(x + 69, y - 11); |
| | | coordArray[9] = new Coord(x + 73, y - 3); |
| | | |
| | | |
| | | coordArray[10] = new Coord(x + 73, y + 10); |
| | | coordArray[11] = new Coord(x + 71, y + 18); |
| | | coordArray[12] = new Coord(x + 57, y + 40); |
| | |
| | | coordArray[19] = new Coord(x + 2, y + 29); |
| | | coordArray[20] = new Coord(x, y); |
| | | } |
| | | else if(num == 11) |
| | | { |
| | | else if (num == 11) { |
| | | coordArray[0] = new Coord(x, y); |
| | | coordArray[1] = new Coord(x - 2, y - 10); |
| | | coordArray[2] = new Coord(x + 1, y - 20); |
| | |
| | | coordArray[7] = new Coord(x + 68, y - 26); |
| | | coordArray[8] = new Coord(x + 72, y - 16); |
| | | coordArray[9] = new Coord(x + 72, y + 13); |
| | | |
| | | |
| | | coordArray[10] = new Coord(x + 68, y + 22); |
| | | coordArray[11] = new Coord(x + 62, y + 29); |
| | | coordArray[12] = new Coord(x + 60, y + 30); |
| | |
| | | coordArray[16] = new Coord(x + 16, y + 29); |
| | | coordArray[17] = new Coord(x, y); |
| | | } |
| | | else if(num == 12) |
| | | { |
| | | else if (num == 12) { |
| | | coordArray[0] = new Coord(x - 10, y); |
| | | coordArray[1] = new Coord(x + 212, y); |
| | | coordArray[2] = new Coord(x + 212, y + 129); |
| | |
| | | coordArray[7] = new Coord(x + 142, y + 127); |
| | | coordArray[8] = new Coord(x + 133, y + 125); |
| | | coordArray[9] = new Coord(x + 114, y + 120); |
| | | |
| | | |
| | | coordArray[10] = new Coord(x + 97, y + 113); |
| | | coordArray[11] = new Coord(x + 86, y + 108); |
| | | coordArray[12] = new Coord(x + 72, y + 100); |
| | |
| | | * @author wenxin |
| | | * @create 2013-05-31 18:01:33 pm |
| | | */ |
| | | var Coord = function(x, y) |
| | | { |
| | | var Coord = function (x, y) { |
| | | this.x = x; |
| | | this.y = y; |
| | | } |
| | |
| | | * @param renderFlag 渲染标记 stroke:绘画边线;fill:填充 |
| | | * @param color 渲染颜色 |
| | | */ |
| | | var renderFinger = function(context, pointArray) |
| | | { |
| | | var renderFinger = function (context, pointArray) { |
| | | this.context = context; |
| | | this.pointArray = pointArray; |
| | | this.isClick = false; |
| | | this.drawFinger = function(renderFlag, color) |
| | | { |
| | | if(renderFlag == "stroke") |
| | | { |
| | | this.drawFinger = function (renderFlag, color) { |
| | | if (renderFlag == "stroke") { |
| | | this.context.strokeStyle = color; |
| | | } |
| | | else if(renderFlag == "fill") |
| | | { |
| | | else if (renderFlag == "fill") { |
| | | this.context.fillStyle = color; |
| | | } |
| | | this.context.lineWidth = 1; |
| | | this.context.beginPath(); |
| | | for(var i=0; i<this.pointArray.length; i++) |
| | | { |
| | | if(i == 0) |
| | | { |
| | | for (var i = 0; i < this.pointArray.length; i++) { |
| | | if (i == 0) { |
| | | this.context.moveTo(this.pointArray[0].x, this.pointArray[0].y); |
| | | } |
| | | else |
| | | { |
| | | else { |
| | | this.context.lineTo(this.pointArray[i].x, this.pointArray[i].y); |
| | | } |
| | | } |
| | | if(renderFlag == "stroke") |
| | | { |
| | | if (renderFlag == "stroke") { |
| | | this.context.stroke(); |
| | | } |
| | | else if(renderFlag == "fill") |
| | | { |
| | | else if (renderFlag == "fill") { |
| | | this.context.fill(); |
| | | } |
| | | }; |
| | |
| | | * @param num 当前需要渲染的手指编号 |
| | | * @param browserFlag 浏览器标记 simple:简易版本,表示是ie浏览器;html5:表示支持html5的浏览器 |
| | | */ |
| | | function renderInit(context, num, browserFlag) |
| | | { |
| | | function renderInit(context, num, browserFlag) { |
| | | var fingerId; |
| | | for(var i=0; i<fingerIdArray.length; i++) |
| | | { |
| | | for (var i = 0; i < fingerIdArray.length; i++) { |
| | | fingerId = eval(fingerIdArray[i]); |
| | | if(fingerId >= DURESS_FINGER_NUM) |
| | | { |
| | | fingerId = fingerId -DURESS_FINGER_NUM; |
| | | if(browserFlag == "html5") |
| | | { |
| | | if(fingerId == num) |
| | | { |
| | | if (fingerId >= DURESS_FINGER_NUM) { |
| | | fingerId = fingerId - DURESS_FINGER_NUM; |
| | | if (browserFlag == "html5") { |
| | | if (fingerId == num) { |
| | | context.fillStyle = "red"; |
| | | context.fill(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if(browserFlag == "html5"){ |
| | | if(fingerId == num) |
| | | { |
| | | else { |
| | | if (browserFlag == "html5") { |
| | | if (fingerId == num) { |
| | | context.fillStyle = "rgb(122,193,66)"; |
| | | context.fill(); |
| | | } |
| | | } |
| | | } |
| | | if(browserFlag == "simple") |
| | | { |
| | | if (browserFlag == "simple") { |
| | | document.getElementById("finger" + fingerId).checked = true; |
| | | } |
| | | } |
| | |
| | | * @param context 2d画布上下文 |
| | | * @param browserFlag 浏览器标记 simple:简易版本,表示是ie浏览器;html5:表示支持html5的浏览器 |
| | | */ |
| | | function showImage(context, base64FPImg, browserFlag) |
| | | { |
| | | function showImage(context, base64FPImg, browserFlag) { |
| | | var img; |
| | | var imgSrc = "data:image/jpg;base64,"+base64FPImg; |
| | | if(browserFlag == "html5"){ |
| | | var imgSrc = "data:image/jpg;base64," + base64FPImg; |
| | | if (browserFlag == "html5") { |
| | | img = new Image(); |
| | | //img.src = sysCfg.rootPath + "/public/html/bmpFile1.jpg"; |
| | | img.src = ""; |
| | | img.src = imgSrc; |
| | | img.onload=function() { |
| | | img.onload = function () { |
| | | // 保存当前的绘图状态 |
| | | context.save(); |
| | | // 开始创建路径 |
| | |
| | | // 剪切路径 |
| | | context.clip(); |
| | | //将图片画到画布上 |
| | | context.drawImage(img, 70, 70, 112, 145); |
| | | context.drawImage(img, 70, 70, 112, 145); |
| | | //调用restore最后一次存储的状态会被恢复 |
| | | context.restore(); |
| | | } |
| | | context.restore(); |
| | | } |
| | | } |
| | | else if(browserFlag == "verification") |
| | | { |
| | | else if (browserFlag == "verification") { |
| | | img = new Image(); |
| | | img.src = ""; |
| | | img.src = imgSrc; |
| | | img.onload=function() { |
| | | img.onload = function () { |
| | | // 保存当前的绘图状态 |
| | | context.save(); |
| | | // 开始创建路径 |
| | |
| | | // 剪切路径 |
| | | context.clip(); |
| | | //将图片画到画布上 |
| | | context.drawImage(img, 37, 90, 112, 145); |
| | | context.drawImage(img, 37, 90, 112, 145); |
| | | //调用restore最后一次存储的状态会被恢复 |
| | | context.restore(); |
| | | } |
| | | context.restore(); |
| | | } |
| | | } |
| | | else if(browserFlag == "clearForVerify" || browserFlag == "clearForRegister") |
| | | { |
| | | else if (browserFlag == "clearForVerify" || browserFlag == "clearForRegister") { |
| | | img = new Image(); |
| | | img.src = ""; |
| | | img.src = base64FPImg; |
| | | img.onload=function() { |
| | | img.onload = function () { |
| | | // 保存当前的绘图状态 |
| | | context.save(); |
| | | // 开始创建路径 |
| | | context.beginPath(); |
| | | // 画一个椭圆 |
| | | if(browserFlag == "clearForVerify") |
| | | { |
| | | if (browserFlag == "clearForVerify") { |
| | | context.oval(91, 160, 112, 145); |
| | | } |
| | | else if(browserFlag == "clearForRegister") |
| | | { |
| | | else if (browserFlag == "clearForRegister") { |
| | | context.oval(125, 142, 132, 165); |
| | | } |
| | | // 关闭路径 |
| | |
| | | // 剪切路径 |
| | | context.clip(); |
| | | //将图片画到画布上 |
| | | if(browserFlag == "clearForVerify") |
| | | { |
| | | if (browserFlag == "clearForVerify") { |
| | | context.drawImage(img, 12, 54, 160, 213); |
| | | } |
| | | else if(browserFlag == "clearForRegister") |
| | | { |
| | | context.drawImage(img, 60, 60, 132, 165); |
| | | } |
| | | else if (browserFlag == "clearForRegister") { |
| | | context.drawImage(img, 60, 60, 132, 165); |
| | | } |
| | | //调用restore最后一次存储的状态会被恢复 |
| | | context.restore(); |
| | | } |
| | | context.restore(); |
| | | } |
| | | } |
| | | else if(browserFlag == "simple") |
| | | { |
| | | $("#showFPImageDiv").html("<img src="+imgSrc+" width='112' height='145' />"); |
| | | else if (browserFlag == "simple") { |
| | | $("#showFPImageDiv").html("<img src=" + imgSrc + " width='112' height='145' />"); |
| | | } |
| | | else if(browserFlag == "verifySimple") |
| | | { |
| | | else if (browserFlag == "verifySimple") { |
| | | $("#showSeachingDiv").show(); |
| | | $("#showSeachingDiv").html(" <img src=\"/public/images/searching.gif\" width='20' height='20'/></br><label style='color:yellow;align:center;font-size: 14px;'>处理中...</label>"); |
| | | } |
| | | else if(browserFlag == "clearForSimple") |
| | | { |
| | | else if (browserFlag == "clearForSimple") { |
| | | $("#showFPImageDiv").html(""); |
| | | } |
| | | } |
| | |
| | | * @param pointArray 坐标点数组 |
| | | * @param color 渲染颜色 |
| | | */ |
| | | var renderHand = function(context, pointArray) |
| | | { |
| | | var renderHand = function (context, pointArray) { |
| | | this.context = context; |
| | | this.pointArray = pointArray; |
| | | this.isClick = false; |
| | | this.drawHand = function(color) |
| | | { |
| | | this.drawHand = function (color) { |
| | | this.context.strokeStyle = color; |
| | | this.context.lineWidth = 1; |
| | | this.context.beginPath(); |
| | | for(var i=0; i<this.pointArray.length; i++) |
| | | { |
| | | if(i == 0) |
| | | { |
| | | for (var i = 0; i < this.pointArray.length; i++) { |
| | | if (i == 0) { |
| | | this.context.moveTo(this.pointArray[0].x, this.pointArray[0].y); |
| | | } |
| | | else |
| | | { |
| | | else { |
| | | this.context.lineTo(this.pointArray[i].x, this.pointArray[i].y); |
| | | } |
| | | } |
| | |
| | | * @param paramArray 存放国际化元素的数组 |
| | | * @param browserFlag 浏览器标记 simple:简易版本,表示是ie浏览器;html5:表示支持html5的浏览器 |
| | | */ |
| | | function checkFPReader(context, paramArray, browserFlag) |
| | | { |
| | | if(browserFlag == "html5") |
| | | { |
| | | $.ajax( { |
| | | type : "GET", |
| | | url : issOnlineUrl+"/fingerprint/beginCapture?type=1&FakeFunOn=0&random="+getRandomNum(), |
| | | dataType : "json", |
| | | function checkFPReader(context, paramArray, browserFlag) { |
| | | if (browserFlag == "html5") { |
| | | $.ajax({ |
| | | type: "GET", |
| | | url: issOnlineUrl + "/fingerprint/beginCapture?type=1&FakeFunOn=0&random=" + getRandomNum(), |
| | | dataType: "json", |
| | | async: false, |
| | | //timeout:1000, |
| | | success : function(result) |
| | | { |
| | | success: function (result) { |
| | | //返回码 |
| | | var ret = null; |
| | | ret = result.ret; |
| | | //接口调用成功返回时 |
| | | if(ret == 0) |
| | | { |
| | | if (ret == 0) { |
| | | //显示框--采集提示 |
| | | collectTips(context, paramArray[0], "html5"); |
| | | } |
| | | else if(ret == -2001) |
| | | { |
| | | else if (ret == -2001) { |
| | | //显示框--采集提示 |
| | | collectTips(context, paramArray[1], "html5"); |
| | | } |
| | | else if(ret == -2002) |
| | | { |
| | | else if (ret == -2002) { |
| | | getWebServerInfo(null, null, "1"); |
| | | } |
| | | else if(ret == -2005) |
| | | { |
| | | else if (ret == -2005) { |
| | | //显示框--采集提示 |
| | | collectTips(context, paramArray[3], "html5"); |
| | | } |
| | |
| | | //取消采集 |
| | | cancelRegister(); |
| | | }, |
| | | error : function(XMLHttpRequest, textStatus, errorThrown) |
| | | { |
| | | error: function (XMLHttpRequest, textStatus, errorThrown) { |
| | | alert("请安装指纹驱动或启动该服务!"); |
| | | //messageBox({messageType: "alert", title: "${common_prompt_title}", text: "${base_fp_connectPrompt}"}); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | else if(browserFlag == "simple") |
| | | { |
| | | else if (browserFlag == "simple") { |
| | | //创建XDomainRequest实例,用于ie8和ie9跨域访问 |
| | | var xDomainRequest = new XDomainRequest(); |
| | | //如果xDomainRequest存在,则可以使用xDomainRequest函数,否则,说明不是ie浏览器 |
| | | if (xDomainRequest) |
| | | { |
| | | xDomainRequest.open('GET', issOnlineUrl+"/fingerprint/beginCapture?type=1&FakeFunOn=0&random="+getRandomNum()); |
| | | xDomainRequest.onload = function() |
| | | { |
| | | if (xDomainRequest) { |
| | | xDomainRequest.open('GET', issOnlineUrl + "/fingerprint/beginCapture?type=1&FakeFunOn=0&random=" + getRandomNum()); |
| | | xDomainRequest.onload = function () { |
| | | //获取接口返回值 |
| | | var resultData = xDomainRequest.responseText; |
| | | //转化为json对象 |
| | | var obj = jQuery.parseJSON(resultData); |
| | | //返回码 |
| | | var ret = null; |
| | | if(obj != null && obj.ret != undefined) |
| | | { |
| | | if (obj != null && obj.ret != undefined) { |
| | | ret = obj.ret; |
| | | } |
| | | //接口调用成功返回时 |
| | | if(ret == 0) |
| | | { |
| | | if (ret == 0) { |
| | | //显示框--采集提示 |
| | | collectTips(null, paramArray[0], "simple"); |
| | | } |
| | | else if(ret == -2001) |
| | | { |
| | | else if (ret == -2001) { |
| | | //显示框--采集提示 |
| | | collectTips(null, paramArray[1], "simple"); |
| | | } |
| | | else if(ret == -2002) |
| | | { |
| | | else if (ret == -2002) { |
| | | getWebServerInfoForSimple(null, null, "1"); |
| | | } |
| | | collectFlag = true; |
| | | //取消采集 |
| | | cancelRegister(); |
| | | }; |
| | | xDomainRequest.onerror = function() |
| | | { |
| | | }; |
| | | xDomainRequest.onerror = function () { |
| | | //用完后,将对象置为空 |
| | | xDomainRequest = null; |
| | | }; |
| | | xDomainRequest.send(); |
| | | } |
| | | xDomainRequest.send(); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | * @param browserFlag 浏览器标记或比对验证标记 simple:简易版本,表示是ie浏览器;html5:表示支持html5的浏览器 |
| | | * --verification:指纹验证标记 |
| | | */ |
| | | function collectTips(context, text, browserFlag) |
| | | { |
| | | if(browserFlag == "simple") |
| | | { |
| | | $("#showCollInfoDiv").html("<span style='color:rgb(122,193,66); font-size: 12px;word-break: break-all; word-wrap: break-word;'>"+text+"</span>"); |
| | | function collectTips(context, text, browserFlag) { |
| | | if (browserFlag == "simple") { |
| | | $("#showCollInfoDiv").html("<span style='color:rgb(122,193,66); font-size: 12px;word-break: break-all; word-wrap: break-word;'>" + text + "</span>"); |
| | | } |
| | | else if(browserFlag == "html5") |
| | | { |
| | | else if (browserFlag == "html5") { |
| | | context.fillStyle = bgColor;//bgColor; |
| | | context.fillRect(205, 18, 240, 16); |
| | | |
| | | |
| | | //文字右对齐 |
| | | context.fillStyle = "rgb(122,193,66)"; |
| | | context.font ="12px Arial,微软雅黑"; |
| | | context.font = "12px Arial,微软雅黑"; |
| | | //context.shadowColor = 'white'; |
| | | //context.shadowBlur = 10; |
| | | //context.strokeText(text, 230, 30); |
| | | //context.shadowBlur = 10; |
| | | //context.strokeText(text, 230, 30); |
| | | context.textAlign = "end"; |
| | | context.fillText(text, 400, 30); |
| | | } |
| | | else if(browserFlag == "verification") |
| | | { |
| | | else if (browserFlag == "verification") { |
| | | //#6BA5D7 |
| | | context.fillStyle = "#F3F5F0";//#6BA5D7 |
| | | context.fillRect(2, 8, 600, 30); |
| | | //获取canvas对象 |
| | | var canvas =""; |
| | | if(isComp){ |
| | | var canvas = ""; |
| | | if (isComp) { |
| | | canvas = document.getElementById("canvasComp"); |
| | | }else{ |
| | | } else { |
| | | canvas = document.getElementById("canvas"); |
| | | } |
| | | // canvas.width = canvas.width; |
| | | // canvas.width = canvas.width; |
| | | //返回一个文本的度量信息对象metrics |
| | | var metrics = context.measureText(text); |
| | | //文本宽度 |
| | | var textWidth = metrics.width; |
| | | //canvas宽度 |
| | | canvas != null?canvasWidth = canvas.width:canvasWidth = 450; |
| | | canvas != null ? canvasWidth = canvas.width : canvasWidth = 450; |
| | | //文本开始x坐标 |
| | | var x = textWidth/2 + (canvasWidth - textWidth)/2; |
| | | |
| | | |
| | | var x = textWidth / 2 + (canvasWidth - textWidth) / 2; |
| | | |
| | | |
| | | //context.fillStyle = bgColor; |
| | | //context.fillRect(0, 18, 445, 16); |
| | | |
| | | |
| | | //文字右对齐 |
| | | context.fillStyle = "rgb(122,193,66)"; |
| | | context.font ="24px Arial,微软雅黑"; |
| | | context.font = "24px Arial,微软雅黑"; |
| | | context.textAlign = "center"; |
| | | //自动换行 |
| | | autoWordBreak(context,text,canvasWidth,x); |
| | | autoWordBreak(context, text, canvasWidth, x); |
| | | context.restore(); |
| | | } |
| | | else if(browserFlag == "verifyForSimple") |
| | | { |
| | | $("#showCollInfoDiv").html("<span style='color:yellow;align:center;font-size: 18px;word-break: break-all; word-wrap: break-word;'>"+text+"</span>"); |
| | | else if (browserFlag == "verifyForSimple") { |
| | | $("#showCollInfoDiv").html("<span style='color:yellow;align:center;font-size: 18px;word-break: break-all; word-wrap: break-word;'>" + text + "</span>"); |
| | | } |
| | | } |
| | | |
| | |
| | | * @param context 2d画布上下文 |
| | | * @param x,y,width,height 进度条底框的坐标和宽度、高度 |
| | | */ |
| | | function drawProgressBar(context, collCount) |
| | | { |
| | | function drawProgressBar(context, collCount) { |
| | | var x = 300; |
| | | var y = 60; |
| | | var width = 90; |
| | | var height = 20; |
| | | context.fillStyle = bgColor; |
| | | context.fillRect(x, y, width, height); |
| | | if(collCount == 0) |
| | | { |
| | | if (collCount == 0) { |
| | | context.fillStyle = "rgb(175,181,185)"; |
| | | context.fillRect(x + 4, y + 2, width - 52, height - 4); |
| | | context.fillRect(x + 46, y + 2, width -52, height - 4); |
| | | context.fillRect(x + 46, y + 2, width - 52, height - 4); |
| | | context.fillRect(x + 86, y + 2, width - 52, height - 4); |
| | | } |
| | | else if(collCount == 1) |
| | | { |
| | | else if (collCount == 1) { |
| | | context.fillStyle = "rgb(122,193,66)"; |
| | | context.fillRect(x + 4, y + 2, width - 52, height - 4); |
| | | context.fillStyle = "rgb(175,181,185)"; |
| | | context.fillRect(x + 46, y + 2, width - 52, height - 4); |
| | | context.fillRect(x + 86, y + 2, width - 52, height - 4); |
| | | } |
| | | else if(collCount == 2) |
| | | { |
| | | else if (collCount == 2) { |
| | | context.fillStyle = "rgb(122,193,66)"; |
| | | context.fillRect(x + 4, y + 2, width - 52, height - 4); |
| | | context.fillRect(x + 46, y + 2, width - 52, height - 4); |
| | | context.fillStyle = "rgb(175,181,185)"; |
| | | context.fillRect(x + 86, y + 2, width - 52, height - 4); |
| | | } |
| | | else if(collCount == 3) |
| | | { |
| | | else if (collCount == 3) { |
| | | context.fillStyle = "rgb(122,193,66)"; |
| | | context.fillRect(x + 4, y + 2, width - 52, height - 4); |
| | | context.fillRect(x + 46, y + 2, width - 52, height - 4); |
| | |
| | | * @param fingerIdArray 存放手指编号的数组 |
| | | * @return 返回boolean值 true:num包含在fingerIdArray中;false:没有包含 |
| | | */ |
| | | function isContains(fingerIdArray, num) |
| | | { |
| | | function isContains(fingerIdArray, num) { |
| | | var fingerId; |
| | | var isCollected = false; |
| | | for(var j=0; j<fingerIdArray.length; j++) |
| | | { |
| | | for (var j = 0; j < fingerIdArray.length; j++) { |
| | | fingerId = eval(fingerIdArray[j]); |
| | | if(fingerId >= DURESS_FINGER_NUM) |
| | | { |
| | | fingerId = fingerId -DURESS_FINGER_NUM; |
| | | if (fingerId >= DURESS_FINGER_NUM) { |
| | | fingerId = fingerId - DURESS_FINGER_NUM; |
| | | } |
| | | if(fingerId == num) |
| | | { |
| | | if (fingerId == num) { |
| | | isCollected = true; |
| | | } |
| | | } |
| | |
| | | * @author wenxin |
| | | * @create 2013-09-05 15:15:11 pm |
| | | */ |
| | | function clearFPImage(context, browserFlag) |
| | | { |
| | | if(browserFlag == "verification") |
| | | { |
| | | // showImage(context, "${base}/base/images/base_fpVerify_clearImage.png", "clearForVerify"); |
| | | function clearFPImage(context, browserFlag) { |
| | | if (browserFlag == "verification") { |
| | | // showImage(context, "${base}/base/images/base_fpVerify_clearImage.png", "clearForVerify"); |
| | | } |
| | | else if(browserFlag == "register") |
| | | { |
| | | else if (browserFlag == "register") { |
| | | showImage(context, "image/base_fpVerify_clearImage.png", "clearForRegister"); |
| | | } |
| | | else if(browserFlag == "verifyForSimple" || browserFlag == "registerForSimple") |
| | | { |
| | | else if (browserFlag == "verifyForSimple" || browserFlag == "registerForSimple") { |
| | | showImage(null, "", "clearForSimple"); |
| | | } |
| | | } |
| | |
| | | * @param paramArray 存放国际化元素的数组 |
| | | * @param flag 判断是登记和验证标记 register:登记;verification:验证 |
| | | */ |
| | | function getFPTemplate(paramArray, flag) |
| | | { |
| | | function getFPTemplate(paramArray, flag) { |
| | | var fpTemplate = ""; |
| | | var collectSuccessFlag = false; |
| | | $.ajax( { |
| | | type : "GET", |
| | | url : issOnlineUrl+"/fingerprint/getTemplate?random="+getRandomNum(), |
| | | dataType : "json", |
| | | $.ajax({ |
| | | type: "GET", |
| | | url: issOnlineUrl + "/fingerprint/getTemplate?random=" + getRandomNum(), |
| | | dataType: "json", |
| | | async: false, |
| | | success : function(result) |
| | | { |
| | | success: function (result) { |
| | | //返回码 |
| | | var ret = null; |
| | | ret = result.ret; |
| | | if(ret == 0) |
| | | { |
| | | if (ret == 0) { |
| | | fpTemplate = result.data.template; |
| | | console.log('fpTemplate', fpTemplate) |
| | | window.top.postMessage({ |
| | | fingerCode: result.data.template, |
| | | }); |
| | | } |
| | | //成功 |
| | | if(ret == 0) |
| | | { |
| | | if (ret == 0) { |
| | | collectSuccessFlag = true; |
| | | if(flag == "register") |
| | | { |
| | | if (flag == "register") { |
| | | //判断手指是否已经采集指纹 |
| | | var compareRet = ""; |
| | | //如果前面已经录入指纹 |
| | | if(templateDataArray.length > 0) |
| | | { |
| | | if (templateDataArray.length > 0) { |
| | | //发送请求,进行后台指纹比对yls |
| | | //compareRet = fpComparision(fpTemplate, templateDataArray, paramArray[3]); |
| | | } |
| | | if($.trim(compareRet) == "dllNotExist") |
| | | { |
| | | if ($.trim(compareRet) == "dllNotExist") { |
| | | //采集完指纹,渲染手指 |
| | | renderAfterColl(globalContext, fpIdNum, bgColor, false);//bgColor判断 |
| | | //显示框--采集提示 |
| | | collectTips(globalContext, "动态库加载失败", "html5"); |
| | | } |
| | | else |
| | | { |
| | | if(compareRet == "noFingerServer") |
| | | { |
| | | else { |
| | | if (compareRet == "noFingerServer") { |
| | | //采集完指纹,渲染手指 |
| | | renderAfterColl(globalContext, fpIdNum, bgColor, false);//bgColor判断 |
| | | //显示框--采集提示 |
| | | collectTips(globalContext, "未启动比对服务", "html5"); |
| | | } |
| | | else |
| | | { |
| | | else { |
| | | //此手指未采集指纹 |
| | | if(compareRet != "ok") |
| | | { |
| | | if (compareRet != "ok") { |
| | | //采集完指纹,渲染手指 |
| | | renderAfterColl(globalContext, fpIdNum, bgColor, true);//bgColor判断 |
| | | //显示框--采集提示 |
| | | collectTips(globalContext, paramArray[0], "html5"); |
| | | //胁迫指纹 |
| | | if(duressFingerFlag) |
| | | { |
| | | if (duressFingerFlag) { |
| | | //将手指标记保存到数组中 |
| | | fingerIdArray[fingerIdArray.length] = fpIdNum + DURESS_FINGER_NUM; |
| | | } |
| | | else |
| | | { |
| | | else { |
| | | //将手指标记保存到数组中 |
| | | fingerIdArray[fingerIdArray.length] = fpIdNum; |
| | | } |
| | | //将指纹模板保存到数组中 |
| | | templateDataArray[templateDataArray.length] = fpTemplate; |
| | | } |
| | | else |
| | | { |
| | | else { |
| | | //采集完指纹,渲染手指 |
| | | renderAfterColl(globalContext, fpIdNum, bgColor, false);//bgColor判断 |
| | | //Please don't repeat input fingerprint! |
| | |
| | | } |
| | | } |
| | | } |
| | | else if(flag == "verification") |
| | | { |
| | | else if (flag == "verification") { |
| | | verifyFlag = false; |
| | | //指纹比对 |
| | | fpComparison(fpTemplate); |
| | | } |
| | | } |
| | | else if(ret == -2003) |
| | | { |
| | | else if (ret == -2003) { |
| | | //采集完指纹,渲染手指 |
| | | renderAfterColl(globalContext, fpIdNum, bgColor, false); |
| | | //显示框--采集提示 |
| | | collectTips(globalContext, paramArray[1], "html5"); |
| | | } |
| | | }, |
| | | error : function(XMLHttpRequest, textStatus, errorThrown) |
| | | { |
| | | error: function (XMLHttpRequest, textStatus, errorThrown) { |
| | | alert(paramArray[3]); |
| | | //messageBox({messageType: "alert", title: "${common_prompt_title}", text: paramArray[3]}); |
| | | } |
| | | } |
| | | }); |
| | | return collectSuccessFlag; |
| | | } |
| | |
| | | * @param templateArray 指纹模板数组 |
| | | * @param errorMsg ajax请求报错,错误信息 |
| | | */ |
| | | function fpComparision(fpTemplate, templateArray, errorMsg) |
| | | { |
| | | function fpComparision(fpTemplate, templateArray, errorMsg) { |
| | | var ret = ""; |
| | | var templates = templateArray.toString(); |
| | | console.log('fpTemplate',fpTemplate) |
| | | console.log('fpTemplate', fpTemplate) |
| | | //特殊字符转义 |
| | | fpTemplate = transferredMeaning(fpTemplate); |
| | | templates = transferredMeaning(templates); |
| | | console.log('fpTemplate',fpTemplate) |
| | | $.ajax( { |
| | | type : "POST", |
| | | url : "baseBioVerifyAction!fpComparison.action", |
| | | contentType : "application/x-www-form-urlencoded;charset=UTF-8", |
| | | data : "verifyTemplate="+fpTemplate+"&templates="+templates, |
| | | dataType : "json", |
| | | console.log('fpTemplate', fpTemplate) |
| | | $.ajax({ |
| | | type: "POST", |
| | | url: "baseBioVerifyAction!fpComparison.action", |
| | | contentType: "application/x-www-form-urlencoded;charset=UTF-8", |
| | | data: "verifyTemplate=" + fpTemplate + "&templates=" + templates, |
| | | dataType: "json", |
| | | async: false, |
| | | success : function(result) |
| | | { |
| | | if(result.ret == "ok") |
| | | { |
| | | success: function (result) { |
| | | if (result.ret == "ok") { |
| | | ret = "ok"; |
| | | } |
| | | if(result.msg == "noFingerServer") |
| | | { |
| | | if (result.msg == "noFingerServer") { |
| | | ret = "noFingerServer"; |
| | | } |
| | | if(result.msg == "dllNotExist") |
| | | { |
| | | if (result.msg == "dllNotExist") { |
| | | ret = "dllNotExist"; |
| | | } |
| | | }, |
| | | error : function(XMLHttpRequest, textStatus, errorThrown) |
| | | { |
| | | error: function (XMLHttpRequest, textStatus, errorThrown) { |
| | | alert("服务器处理数据失败,请重试!错误码:"); |
| | | //messageBox({messageType: "alert", title: "${common_prompt_title}", text: "${common_prompt_serverError}"}); |
| | | } |
| | | } |
| | | }); |
| | | return ret; |
| | | } |
| | |
| | | * @param fillColor 采集完后填充颜色 |
| | | * @param successOrNot 采集是否成功--布尔值 true:采集成功;false:采集失败 |
| | | */ |
| | | function renderAfterColl(context, num, fillColor, successOrNot) |
| | | { |
| | | var canvas=""; |
| | | if(isComp){ |
| | | function renderAfterColl(context, num, fillColor, successOrNot) { |
| | | var canvas = ""; |
| | | if (isComp) { |
| | | canvas = document.getElementById("canvasComp"); |
| | | }else{ |
| | | } else { |
| | | canvas = document.getElementById("canvas"); |
| | | } |
| | | var localContext = canvas.getContext("2d"); |
| | |
| | | //初始化起始坐标,并返回json格式数据 |
| | | var coordJson = initCoordJson(); |
| | | //进来页面,点击删除 |
| | | if(num == null) |
| | | { |
| | | if (num == null) { |
| | | num = fpIdNum; |
| | | } |
| | | //点击的手指编号和json中num相等 |
| | | if(coordJson[num].num == num) |
| | | { |
| | | if (coordJson[num].num == num) { |
| | | //初始化坐标数组和绘画手指 |
| | | initCoordAndDrawFinger(context, coordArray, coordJson[num].coord.x, coordJson[num].coord.y, num); |
| | | } |
| | | |
| | | |
| | | //采集成功,填充颜色(红、绿) |
| | | if(successOrNot) |
| | | { |
| | | if(duressFingerFlag) |
| | | { |
| | | if (successOrNot) { |
| | | if (duressFingerFlag) { |
| | | localContext.fillStyle = "red";//fillColor |
| | | localContext.fill(); |
| | | fpModifyFlag = true; |
| | | } |
| | | else |
| | | { |
| | | else { |
| | | localContext.fillStyle = "rgb(122,193,66)";//fillColor |
| | | localContext.fill(); |
| | | fpModifyFlag = true; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | else { |
| | | //采集失败,填充背景色--消除颜色(黄) |
| | | localContext.fillStyle = fillColor; |
| | | localContext.fill(); |
| | |
| | | * @param x,y 绘画当前手指的起始坐标 |
| | | * @param num 手指标记 |
| | | */ |
| | | function initCoordAndDrawFinger(context, coordArray, x, y, num) |
| | | { |
| | | function initCoordAndDrawFinger(context, coordArray, x, y, num) { |
| | | coordArray = initCoordArray(coordArray, x, y, num); |
| | | new renderFinger(context, coordArray).drawFinger(strokeStyle, fingerBorderColor); |
| | | } |
| | |
| | | * @create 2013-05-15 17:21:13 pm |
| | | * @param "${base_fp_save}":确认保存当前修改吗? |
| | | */ |
| | | function cancelEvent(saveText, fpCountText) |
| | | { |
| | | if(!fpModifyFlag) |
| | | { |
| | | if(collectFlag) |
| | | { |
| | | function cancelEvent(saveText, fpCountText) { |
| | | if (!fpModifyFlag) { |
| | | if (collectFlag) { |
| | | //取消采集 |
| | | cancelRegister(); |
| | | //将定时器的递归调用关闭 |
| | |
| | | //closeWindow(); |
| | | close(); |
| | | } |
| | | else |
| | | { |
| | | var flag=confirm(saveText); |
| | | if(flag){ |
| | | else { |
| | | var flag = confirm(saveText); |
| | | if (flag) { |
| | | saveFPData(flag, fpCountText); |
| | | }else{ |
| | | } else { |
| | | close(); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param fpCount 指纹数国际化内容 |
| | | * @param ${pers_person_templateCount}:指纹数 |
| | | */ |
| | | var saveFPData = function(result, fpCount) |
| | | { |
| | | if(collectFlag) |
| | | { |
| | | var saveFPData = function (result, fpCount) { |
| | | if (collectFlag) { |
| | | //取消采集 |
| | | cancelRegister(); |
| | | //将定时器的递归调用关闭 |
| | | clearTimeout(timer); |
| | | } |
| | | if(result) |
| | | { |
| | | if (result) { |
| | | storeDataToHtml(); |
| | | showFPCount(fpCount); |
| | | //closeWindow(); |
| | | close(); |
| | | } |
| | | else |
| | | { |
| | | else { |
| | | clearImageData(); |
| | | //closeWindow(); |
| | | close(); |
| | |
| | | * @author wenxin |
| | | * @create 2013-04-22 21:26:31 pm |
| | | */ |
| | | function showFPCount(text) |
| | | { |
| | | function showFPCount(text) { |
| | | var fingerId = $("#fingerId").val(); |
| | | if($.trim(fingerId) == "") |
| | | { |
| | | if ($.trim(fingerId) == "") { |
| | | $("#fpCountMessage").text(text + " " + 0); |
| | | } |
| | | else |
| | | { |
| | | else { |
| | | fingerId = fingerId.substr(1, fingerId.length - 2); |
| | | var fingerIdArray = new Array(); |
| | | fingerIdArray = fingerId.split(","); |
| | |
| | | * @author wenxin |
| | | * @create 2013-05-24 16:12:21 pm |
| | | */ |
| | | function storeDataToHtml() |
| | | { |
| | | function storeDataToHtml() { |
| | | //没有手指标记数据 |
| | | if(fingerIdArray.length == 0) |
| | | { |
| | | if (fingerIdArray.length == 0) { |
| | | $("#fingerId").val(" "); |
| | | } |
| | | else |
| | | { |
| | | else { |
| | | //将手指标记数据保存到页面 |
| | | $("#fingerId").val("["+fingerIdArray.toString()+"]"); |
| | | $("#fingerId").val("[" + fingerIdArray.toString() + "]"); |
| | | } |
| | | //没有指纹模板数据 |
| | | if(templateDataArray.length == 0) |
| | | { |
| | | if (templateDataArray.length == 0) { |
| | | $("#fingerTemplate10").val(" "); |
| | | } |
| | | else |
| | | { |
| | | else { |
| | | //将指纹模板数据保存到页面 |
| | | $("#fingerTemplate10").val("["+templateDataArray.toString()+"]"); |
| | | $("#fingerTemplate10").val("[" + templateDataArray.toString() + "]"); |
| | | } |
| | | } |
| | | |
| | | //关闭窗体 |
| | | function close(){ |
| | | function close() { |
| | | $("#bg").css("display", "none"); |
| | | $("#box").css("display", "none"); |
| | | $("#comparisonDiv").css("display", "none"); |
| | | globalContext=""; |
| | | globalContext = ""; |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param context 2d画布上下文 |
| | | * @param browserFlag 浏览器标记 simple:简易版本,表示是ie浏览器;html5:表示支持html5的浏览器 |
| | | */ |
| | | var delFPData = function(result, context, browserFlag) |
| | | { |
| | | var delFPData = function (result, context, browserFlag) { |
| | | var fingerId; |
| | | if(result) |
| | | { |
| | | if (result) { |
| | | //将数组中的指定元素删除 |
| | | for(var i=0; i<fingerIdArray.length; i++) |
| | | { |
| | | for (var i = 0; i < fingerIdArray.length; i++) { |
| | | fingerId = eval(fingerIdArray[i]); |
| | | if(fingerId >= DURESS_FINGER_NUM) |
| | | { |
| | | if (fingerId >= DURESS_FINGER_NUM) { |
| | | fingerId = fingerId - DURESS_FINGER_NUM; |
| | | if(fingerId == fpIdNum) |
| | | { |
| | | if (fingerId == fpIdNum) { |
| | | //fingerIdArray.remove(i); |
| | | //templateDataArray.remove(i); |
| | | removeItem(fingerIdArray, i); |
| | | removeItem(templateDataArray, i); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if(fingerId == fpIdNum) |
| | | { |
| | | else { |
| | | if (fingerId == fpIdNum) { |
| | | //fingerIdArray.remove(i); |
| | | //templateDataArray.remove(i); |
| | | removeItem(fingerIdArray, i); |
| | |
| | | } |
| | | } |
| | | } |
| | | if(browserFlag == "simple") |
| | | { |
| | | if (browserFlag == "simple") { |
| | | document.getElementById("finger" + fingerId).checked = false; |
| | | } |
| | | else if(browserFlag == "html5") |
| | | { |
| | | else if (browserFlag == "html5") { |
| | | //将手指颜色改变--重画时也要判断 |
| | | context.fillStyle = bgColor; |
| | | context.fill(); |
| | | if(lastFPIdNum != null && lastFPIdNum != lastFPIdNum) |
| | | { |
| | | if (lastFPIdNum != null && lastFPIdNum != lastFPIdNum) { |
| | | //消除原来手指的颜色 |
| | | renderAfterColl(globalContext, lastFPIdNum, bgColor, false); |
| | | } |
| | |
| | | $("#duressFinger").attr("disabled", false); |
| | | $("#submitButtonId").attr("disabled", false); |
| | | } |
| | | else |
| | | { |
| | | if(browserFlag == "simple") |
| | | { |
| | | else { |
| | | if (browserFlag == "simple") { |
| | | document.getElementById("finger" + fpIdNum).checked = true |
| | | collectFlag = true; |
| | | } |
| | | else if(browserFlag == "html5") |
| | | { |
| | | else if (browserFlag == "html5") { |
| | | //消除原来手指的颜色--有问题,如果原来手指和现在的一样,有问题 |
| | | //renderAfterColl(globalContext, lastFPIdNum, bgColor, false); |
| | | } |
| | |
| | | * @create 2013-05-15 11:11:31 am |
| | | * @param dx 要删除元素的下标 |
| | | */ |
| | | function removeItem(array, dx) |
| | | { |
| | | array.splice(dx, 1); |
| | | function removeItem(array, dx) { |
| | | array.splice(dx, 1); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param isDriverInstall 是否安装了驱动 |
| | | * @param downloadPrompt 提示安装驱动国际化内容 |
| | | */ |
| | | function fpVerification(title, downloadPrompt, isDriverInstall,context) |
| | | { |
| | | {/* <div id="comparison" style="display: inline" |
| | | onclick='fpVerification("指纹比对","请安装指纹驱动或启动服务",true,globalContext)'>比对</div> |
| | | <div></div> */} |
| | | function fpVerification(title, downloadPrompt, isDriverInstall, context) { |
| | | //安装驱动 |
| | | if(isDriverInstall) |
| | | { |
| | | if (isDriverInstall) { |
| | | //支持html5 |
| | | if(typeof(Worker) != "undefined") |
| | | { |
| | | if (typeof (Worker) != "undefined") { |
| | | //createWindow('base_baseFPVerify.do?random=' + getRandomNum() + '^0^0^465^320^'+title); |
| | | var comparisonDiv=document.getElementById("comparisonDiv"); |
| | | var bg=document.getElementById("bg"); |
| | | comparisonDiv.style.display="block";//显示内容层,显示覆盖层 |
| | | comparisonDiv.style.left=parseInt((document.documentElement.scrollWidth-comparisonDiv.offsetWidth)/2)+document.documentElement.scrollLeft+"px"; |
| | | comparisonDiv.style.top=Math.abs(parseInt((document.documentElement.clientHeight-comparisonDiv.offsetHeight)/2))+document.documentElement.scrollTop+"px"; //为内容层设置位置 |
| | | bg.style.display="block"; |
| | | bg.style.height=document.documentElement.scrollHeight+"px"; |
| | | isComp= true; |
| | | //开始采集 |
| | | //beginCapture(context); |
| | | dataInitComp(); |
| | | //关闭页面前,取消采集 |
| | | var comparisonDiv = document.getElementById("comparisonDiv"); |
| | | var bg = document.getElementById("bg"); |
| | | comparisonDiv.style.display = "block";//显示内容层,显示覆盖层 |
| | | comparisonDiv.style.left = parseInt((document.documentElement.scrollWidth - comparisonDiv.offsetWidth) / 2) + document.documentElement.scrollLeft + "px"; |
| | | comparisonDiv.style.top = Math.abs(parseInt((document.documentElement.clientHeight - comparisonDiv.offsetHeight) / 2)) + document.documentElement.scrollTop + "px"; //为内容层设置位置 |
| | | bg.style.display = "block"; |
| | | bg.style.height = document.documentElement.scrollHeight + "px"; |
| | | isComp = true; |
| | | //开始采集 |
| | | //beginCapture(context); |
| | | dataInitComp(); |
| | | //关闭页面前,取消采集 |
| | | //cancelCaptureBeforeClose("html5"); |
| | | } |
| | | else |
| | | { |
| | | else { |
| | | createWindow('base_baseFPVerifySimple.do?random=' + getRandomNum() + '^0^0^465^320^' + title); |
| | | //关闭页面前,取消采集 |
| | | //关闭页面前,取消采集 |
| | | //cancelCaptureBeforeClose("simple"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | else { |
| | | alert(downloadPrompt); |
| | | //messageBox({messageType: "alert", title: "提示", text: downloadPrompt}); |
| | | } |
| | |
| | | * @param x 文本X坐标值 |
| | | * |
| | | */ |
| | | function autoWordBreak(context,text,CWidth,x){ |
| | | function autoWordBreak(context, text, CWidth, x) { |
| | | context.clear(); |
| | | var rownum = CWidth / 10; |
| | | var len = strlen(text); |
| | | if (rownum > len) |
| | | { |
| | | if (rownum > len) { |
| | | context.fillText(text, x, 30); |
| | | } |
| | | else |
| | | { |
| | | var endInd = rownum<text.length?rownum:text.length; |
| | | else { |
| | | var endInd = rownum < text.length ? rownum : text.length; |
| | | var beginInd = 0; |
| | | var endTemp=0; |
| | | for (var i = 0; i <= text.length / rownum; i++) |
| | | { |
| | | var endTemp = 0; |
| | | for (var i = 0; i <= text.length / rownum; i++) { |
| | | endTemp = text.substr(beginInd, endInd).lastIndexOf(" "); |
| | | if(endTemp!=-1) |
| | | endInd=beginInd+endTemp; |
| | | if (endTemp != -1) |
| | | endInd = beginInd + endTemp; |
| | | context.fillText(text.substr(beginInd, endInd), x, (i + 1) * 30); |
| | | beginInd = endInd+1; |
| | | if(beginInd>=text.length) |
| | | beginInd = endInd + 1; |
| | | if (beginInd >= text.length) |
| | | break; |
| | | endInd = beginInd + rownum; |
| | | } |
| | |
| | | |
| | | //清除画布内容 |
| | | CanvasRenderingContext2D.prototype.clear = |
| | | CanvasRenderingContext2D.prototype.clear || function (preserveTransform) { |
| | | if (preserveTransform) { |
| | | this.save(); |
| | | this.setTransform(1, 0, 0, 1, 0, 0); |
| | | } |
| | | |
| | | this.clearRect(0, 0, this.canvas.width, this.canvas.height); |
| | | |
| | | if (preserveTransform) { |
| | | this.restore(); |
| | | } |
| | | CanvasRenderingContext2D.prototype.clear || function (preserveTransform) { |
| | | if (preserveTransform) { |
| | | this.save(); |
| | | this.setTransform(1, 0, 0, 1, 0, 0); |
| | | } |
| | | |
| | | this.clearRect(0, 0, this.canvas.width, this.canvas.height); |
| | | |
| | | if (preserveTransform) { |
| | | this.restore(); |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * 关闭页面前,如果正在进行验证,则先取消采集 |
| | | * @author wenxin |
| | | * @create 2013-06-24 19:57:11 pm |
| | | * @param browserFlag 浏览器标记 simple:简易版本,表示是ie浏览器;html5:表示支持html5的浏览器 |
| | | */ |
| | | function cancelCaptureBeforeClose(browserFlag) |
| | | { |
| | | //关闭页面时,监听关闭的onclick事件 |
| | | getCurrentWindow().button("close").attachEvent("onClick", function() |
| | | { |
| | | clearTimeout(verifyTimer); |
| | | if(browserFlag == "html5") |
| | | { |
| | | //正在进行验证,还没有关闭指纹采集 |
| | | if(verifyFlag) |
| | | { |
| | | //取消采集 |
| | | cancelCapture(); |
| | | } |
| | | //关闭页面 |
| | | closeWindow(); |
| | | |
| | | /** |
| | | * 关闭页面前,如果正在进行验证,则先取消采集 |
| | | * @author wenxin |
| | | * @create 2013-06-24 19:57:11 pm |
| | | * @param browserFlag 浏览器标记 simple:简易版本,表示是ie浏览器;html5:表示支持html5的浏览器 |
| | | */ |
| | | function cancelCaptureBeforeClose(browserFlag) { |
| | | //关闭页面时,监听关闭的onclick事件 |
| | | getCurrentWindow().button("close").attachEvent("onClick", function () { |
| | | clearTimeout(verifyTimer); |
| | | if (browserFlag == "html5") { |
| | | //正在进行验证,还没有关闭指纹采集 |
| | | if (verifyFlag) { |
| | | //取消采集 |
| | | cancelCapture(); |
| | | } |
| | | else if(browserFlag == "simple") |
| | | { |
| | | //alert("cancel capture before close window!"); |
| | | //将定时器的递归调用关闭 |
| | | clearTimeout(timer); |
| | | //取消采集 |
| | | cancelRegister(); |
| | | //此处应该在取消结束后,再关闭窗口 |
| | | closeWindow(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 表单提交 |
| | | * @author wenxin |
| | | * @create 2013-08-05 15:19:11 pm |
| | | */ |
| | | function formSubmit(id) |
| | | { |
| | | |
| | | $('#'+id).serialize(); |
| | | $('#'+id).ajaxForm(function(data){ |
| | | callBackFormSubmit(data); |
| | | }); |
| | | $('#'+id).submit(); //表单提交。 |
| | | } |
| | | //关闭页面 |
| | | closeWindow(); |
| | | } |
| | | else if (browserFlag == "simple") { |
| | | //alert("cancel capture before close window!"); |
| | | //将定时器的递归调用关闭 |
| | | clearTimeout(timer); |
| | | //取消采集 |
| | | cancelRegister(); |
| | | //此处应该在取消结束后,再关闭窗口 |
| | | closeWindow(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 表单提交 |
| | | * @author wenxin |
| | | * @create 2013-08-05 15:19:11 pm |
| | | */ |
| | | function formSubmit(id) { |
| | | |
| | | $('#' + id).serialize(); |
| | | $('#' + id).ajaxForm(function (data) { |
| | | callBackFormSubmit(data); |
| | | }); |
| | | $('#' + id).submit(); //表单提交。 |
| | | } |