<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="./qwebchannel.js"></script>
<script type="text/javascript">
//BEGIN SETUP
//拍照数据(base64)
var baseUrl;
var socket;
//储存图片路径的变量和数组
var imgPath = "";
var imgPathArray = new Array();
//预览图片
function openImage(imageItem)
{
var url = imageItem.parentNode.id;
window.showModalDialog(url, null, "dialogHeight:800px; dialogWidth:1000px; resizable:no");
}
//增加图片缩略图
function addImgDiv(){
var container =document.getElementById('container');
var newchild = document.createElement("div");
newchild.setAttribute("style", "float:left");
imgPath = "file:///" + imgPath ;
newchild.setAttribute("id", imgPath);
newchild.innerHTML = "<img width='105' height='85' src='"+imgPath+"' onclick='openImage(this)' /></img><input type='checkbox' onchange='checkboxClicked(this)' />";
container.appendChild(newchild);
}
//清空缩略图
function removeAll(){
document.getElementById('container').innerHTML = "";
imgPathArray = [];
}
//处理缩略图CheckBox点击事件
function checkboxClicked(checkboxItem){
if(imgPathArray.indexOf(checkboxItem.parentNode.id) < 0)
{
imgPathArray.push(checkboxItem.parentNode.id);
} else{
var index = imgPathArray.indexOf(checkboxItem.parentNode.id);
imgPathArray.splice(index, 1);
}
}
function openSocket() {
socket = new WebSocket(baseUrl);
socket.onclose = function()
{
console.error("web channel closed");
};
socket.onerror = function(error)
{
console.error("web channel error: " + error);
};
socket.onopen = function()
{
output("WebSocket connected");
new QWebChannel(socket, function(channel) {
//获取注册的对象
window.dialog = channel.objects.dialog;
//网页关闭函数
window.onbeforeunload = function() {
dialog.get_actionType("closeSignal");
}
window.onunload = function() {
dialog.get_actionType("closeSignal");
}
//反初始化
document.getElementById("closeHtml").onclick = function() {
dialog.get_actionType("closeSignal");
var element = document.getElementById("bigPriDev");
element.src = "";
var element1 = document.getElementById("bigSubDev");
element1.src = "";
};
//初始化
document.getElementById("openHtml").onclick = function() {
dialog.html_loaded("two");
};
/***********设备状态更改(区分摄像头)*****************/
//网页控件事件,模式列表点击
document.getElementById("priModelList").onchange = function() {
//清除展示信息
var resolutionList = document.getElementById("priResolutionList");
resolutionList.options.length = 0;
var select = document.getElementById("priModelList");
dialog.devChanged("primaryDev_:" + select.value);
};
//网页控件事件,分辨率列表点击
document.getElementById("priResolutionList").onchange = function() {
//清除展示信息
var select = document.getElementById("priResolutionList");
dialog.devChanged("primaryDev_:" + select.value);
};
//网页控件事件,模式列表点击
document.getElementById("subModelList").onchange = function() {
//清除展示信息
var resolutionList = document.getElementById("subResolutionList");
resolutionList.options.length = 0;
var select = document.getElementById("subModelList");
dialog.devChanged("subDev_:" + select.value);
};
//网页控件事件,分辨率列表点击
document.getElementById("subResolutionList").onchange = function() {
//清除展示信息
var select = document.getElementById("subResolutionList");
dialog.devChanged("subDev_:" + select.value);
};
//设置尺寸列表点击,只有主头有设置尺寸
document.getElementById("setScanSize").onchange = function() {
var select = document.getElementById("setScanSize");
if(select.value == "原始尺寸")
{
dialog.get_actionType("setScanSize_ori");
}
if(select.value == "A5")
{
dialog.get_actionType("setScanSize_A5");
}
if(select.value == "卡片")
{
dialog.get_actionType("setScanSize_card");
}
};
//打开主视频
document.getElementById("openPriVideo").onclick = function() {
var resolutionList = document.getElementById("priResolutionList");
resolutionList.options.length = 0;
var modelList = document.getElementById("priModelList");
modelList.options.length = 0;
var label1 = document.getElementById("lab1").innerHTML;
dialog.devChanged("primaryDev_:" + label1);
};
//关闭主视频
document.getElementById("closePriVideo").onclick = function() {
dialog.get_actionType("closePriVideo");
var element = document.getElementById("bigPriDev");
element.src = "";
};
//打开副视频
document.getElementById("openSubVideo").onclick = function() {
var resolutionList = document.getElementById("subResolutionList");
resolutionList.options.length = 0;
var modelList = document.getElementById("subModelList");
modelList.options.length = 0;
var label1 = document.getElementById("lab2").innerHTML;
dialog.devChanged("subDev_:" + label1);
};
//关闭副视频
document.getElementById("closeSubVideo").onclick = function() {
dialog.get_actionType("closeSubVideo");
var element = document.getElementById("bigSubDev");
element.src = "";
};
//主摄像头拍照按钮点击
document.getElementById("photographPri").onclick = function() {
//dialog.get_actionType("setdeskew");
dialog.photoBtnClicked("primaryDev_");
dialog.get_actionType("savePhotoPriDev");
//dialog.get_actionType("setdeskew");
};
//副摄像头拍照按钮点击
document.getElementById("photographSub").onclick = function() {
dialog.photoBtnClicked("subDev_");
dialog.get_actionType("savePhotoSubDev");
};
//左转
document.getElementById("rotateLeft").onclick = function() {
dialog.get_actionType("rotateLeft");
};
//右转
document.getElementById("rotateRight").onclick = function() {
dialog.get_actionType("rotateRight");
};
//属性设置
document.getElementById("showProperty").onclick = function() {
dialog.get_actionType("showProperty");
};
//纠偏裁边
document.getElementById("setdeskew").onclick = function() {
dialog.get_actionType("setdeskew");
};
//二代证阅读
document.getElementById("startIDCard").onclick = function() {
dialog.get_actionType("startIDCard");
};
//停止二代证阅读
document.getElementById("stopIDCard").onclick = function() {
dialog.get_actionType("stopIDCard");
};
//单次二代证阅读
document.getElementById("singleReadIDCard").onclick = function() {
dialog.get_actionType("singleReadIDCard");
};
//人证比对
document.getElementById("verifyFaceDetect").onclick = function() {
dialog.get_action