EST-100身份证社保卡签批屏按捺终端PC版web版本http协议接口文档,支持web网页开发对接使用

本文主要是介绍EST-100身份证社保卡签批屏按捺终端PC版web版本http协议接口文档,支持web网页开发对接使用,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>演示DEMO</title>
<script type="text/javascript" src="jquery-1.12.4.js"></script>
<style type="text/css">
.mdiv div {
text-align: center;
}
.mdiv>div {
display: inline-block;
box-sizing: border-box;
/*height: 8rem;*/
vertical-align: top;
}
.mdiv>div>div:first-child,
.dtitle {
background-color: #DDDDDD;
padding: 5px 0px;
margin: 0px 0px 15px 0px;
text-align: center;
}
mdiv img {
border: 1px solid gray;
}
button,
select,
input {
box-sizing: border-box;
width: 145px;
font-size: 16px;
padding: 5px;
margin-left: 15px;
margin-bottom: 25px;
}
</style>
</head>
<body>
<div class="dtitle" style="margin-bottom: 0px;border-bottom: 1px solid gray;">展示区</div>
<div class='mdiv'>
<div>
<div>设备屏幕监控</div>
<div>
<img style="width: 320px;height:200px;" id="imgDeviceScreen" οnerrοr="monitorDeviceFail(this)">
</div>
</div>
<div>
<div>摄像头画面</div>
<div>
<img style="width: 320px;height:180px;" id="imgCameraVideo" οnerrοr="openCameraFail(this)">
</div>
</div>
<div>
<div>拍照内容</div>
<div>
<img style="width: 320px;height:180px;" id="imgCameraPhoto">
</div>
</div>
<div>
<div>签名图片</div>
<div>
<img style="width: 320px;height:180px;" id="imgSignPic">
</div>
</div>
<div style="width: 120px;">
<div style="padding-right: 20px;">身份证照片</div>
<div>
<img style="width: 100px;height:126px;margin-right: 20px;" id="imgIDCard">
</div>
</div>
<div style="width: 150px;">
<div>指纹图片</div>
<div>
<img style="width: 128px;height:180px;" id="imgFingerPic">
</div>
</div>
</div>
<div id="dmsg" style="margin-top: 10px; margin-bottom: 30px;font-weight: bold;">返回消息:</div>
<div class="dtitle">操作区</div>
<div>
<button οnclick="monitorDevice()">打开设备屏幕监控</button>
<button οnclick="stopMonitor()">关闭设备屏幕监控</button>
<br>
<button οnclick="getCamera()">获取摄像头</button>
<select id="cameraSelect"></select>
<button οnclick="openCamera()">打开摄像头</button>
<button οnclick="takePhoto()">拍照</button>
<button οnclick="closeCamera()">关闭摄像头</button>
<button οnclick="openFaceVerify()">开始人证比对</button>
<button οnclick="stopFaceVerify()">取消人证比对</button>
<br>
<button οnclick="openSign()">打开签字窗口</button>
<button οnclick="stopSign()">关闭签字窗口</button>
<button οnclick="openFinger()">开始指纹采集</button>
<button οnclick="stopFinger()">取消指纹采集</button>
<button οnclick="openWeb()">打开网页</button>
<button οnclick="closeWeb()">关闭网页</button>
<button οnclick="evaluation()">服务评价</button>
<br>
<button οnclick="openReadChinaIdCard()">开始读取身份证</button>
<button οnclick="stopReadChinaIdCard()">取消读取身份证</button>
<button οnclick="openReadBankCard()">读取银行卡</button>
<br>
<button οnclick="readDeviceData()">读取数据</button>
<input type="text" name="DeviceNo" id="DeviceNo" placeholder="写入内容" disabled>
<button οnclick="initDeviceData(DeviceNo.value)" disabled>写入数据</button>
<br>
</div>
<script type="text/javascript">
jQuery.support.cors = true
var selectElement = document.getElementById('cameraSelect')
/**
To 秋博君:
1、使用http服务,注意看每个函数里面的地址和参数,要做的和这个网页一样
2、他们返回时用的 {code: int, message: string} 的形式,有时code=0表示成功,有时候code=1表示成功,你注意看ajax的success回调里面的判断
**/
function showMsg(msg) {
$("#dmsg").text("返回消息:" + msg)
}
function openCameraFail(obj) {
if (obj.src == null || obj.src.length == 0) return
alert("打开摄像头失败0308")
}
function monitorDeviceFail(obj) {
if (obj.src == null || obj.src.length == 0) return
alert("获取屏幕监控失败,可能是服务器未启动")
}
//开启设备屏幕监控
function monitorDevice() {
$("#imgDeviceScreen").attr("src", "http://127.0.0.1:38089/sign=stream&time=" + new Date().getTime())
}
//关闭设备屏幕监控
function stopMonitor() {
$.ajax({
type: "post",
url: "http://127.0.0.1:38089/closewebontablet",
dataType: "json",
success: function (data) {
/** {code:int , message:string} **/
showMsg(data.code == 1 ? "成功关闭设备屏幕监控" : "当前并没有展示设备屏幕监控")
$("#imgDeviceScreen").attr('src', "")
$("#imgDeviceScreen").removeAttr('src')
}
})
}
//打开签字窗口 设备有:取消、重签、确定 按个按钮
function openSign() {
$("#imgSignPic").attr("src", "")
$.ajax({
type: "post",
url: "http://127.0.0.1:38088/sign=start",
dataType: "json",
data: "{\"pos\": {\"top\":\"400\",\"left\":\"420\",\"width\":\"640\",\"height\":\"400\"}}",
// header: { //这一段是上一个版本有,我感觉是没必要了
// 'Access-Control-Allow-Private-Network': 'true',
// 'Access-Control-Request-Method': 'GET, POST',
// 'Access-Control-Request-Headers': 'Content-Type'
// },
success: function (data) {
/** {code:int , message:string, status:int[1-取消了签名 2-完成签名 ], image:string[图片base64] } **/
if (data.code != 0)
return showMsg("打开签字窗口失败, 返回代码 = " + data.code + ", 返回信息 = " + data.message)
if (data.status != 2)
return showMsg("签名被取消了")
showMsg("签名成功")
$("#imgSignPic").attr("src", "data:image/png;base64," + data.image)
}
})
}
//关闭签字窗口
function stopSign() {
$.ajax({
type: "post",
url: "http://127.0.0.1:38088/sign=stop",
dataType: "json",
success: function (data) {
/** 这里原来的DEMO就没有判断 **/
}
})
}
//开始指纹采集
function openFinger() {
$("#imgFingerPic").attr("src", "")
$.ajax({
type: "post",
url: "http://127.0.0.1:38088/finger=record",
dataType: "json",
//data: params,
success: function (data) {
/** {code:int, message:string, status:int[1-取消了采集 2-完成了采集], FigPic:string[图片base64] } **/
if (data.code != 0)
return showMsg("采集指纹失败, 返回代码 = " + data.code + ", 返回信息 = " + data.message)
if (data.status != 2)
return showMsg("指纹采集被取消了")
showMsg("采集指纹成功")
$("#imgFingerPic").attr("src", "data:image/jpeg;base64," + data.FigPic)
}
})
}
//取消指纹采集
function stopFinger() {
$.ajax({
type: "post",
url: "http://127.0.0.1:38088/finger=stop",
dataType: "json",
success: function (data) {
/** 这个是仿照关闭签字窗口添加的 **/
}
})
}
//在设备上打开网页 -这里是打开的测试页,要求在设备上从测试页打开签名要能用调用到签名、指纹也要能正常使用
// [前面的SDK有这个破问题,我感觉新版不会有这个问题,还是测试一下放心些]
function openWeb() {
var url = location.href
myWindow = window.open(url, '_blank', 'height=800px, width=1280px, top=0, left=0, toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no')
myWindow.focus()
$.ajax({
type: "post",
url: "http://127.0.0.1:38088/openwebontablet",
dataType: "json",
data: "{\"url\": \"" + url + "\"}",
success: function (data) {
/** {code:int , message:string} **/
showMsg(data.message)
}
})
}
//关闭网页
function closeWeb() {
$.ajax({
type: "post",
url: "http://127.0.0.1:38088/sign=closebrowser",
dataType: "json",
//data: params,
success: function (data) {
/** {code:int , message:string} **/
showMsg(data.code == 1 ? "成功关闭网页" : "当前并没有展示网页")
}
})
}
var cameraInfo = []
//获取摄像头
function getCamera() {
$.ajax({
type: "post",
url: "http://127.0.0.1:38088/camera=get",
dataType: "json",
// contentType: "application/json",
success: function (data) {
/** {code:int , message:string, camera:[{index:int, name:string, resolution:[{width:int, height:int},{width:int, height:int,....}]}, ...]} **/
//返回的resolution中摄像头支持的分辨率
console.log(JSON.stringify(data))
if (data.code != 0)
return showMsg(data.message)
showMsg(JSON.stringify(data))
cameraInfo = data.camera
selectElement.innerHTML = '<span></span>'
for (var i = 0; i < cameraInfo.length; i++) {
var option = document.createElement('option')
option.value = cameraInfo[i].index
option.label = cameraInfo[i].name
selectElement.appendChild(option)
}
}
})
}
//打开摄像头
function openCamera() {
if (cameraInfo == null || cameraInfo.length == 0)
return showMsg("未调用获取摄像头或未查找到摄像头信息")
//直接以最小的分辨率打开摄像头
var index = selectElement.value
var camera
for (var i = 0; i < cameraInfo.length; i++) {
if (i == index) {
camera = cameraInfo[i]
var width = camera.resolution[camera.resolution.length - 1].width
var height = camera.resolution[camera.resolution.length - 1].height
break
}
}
//这里应该的img标签,可以用onerror事件来得到打开摄像头失败的事件
$("#imgCameraVideo").attr("src", "http://127.0.0.1:38088/camera=stream&index=" + index + "&width=" + width + "&height=" + height + "?" + new Date().getTime())
}
//拍照
function takePhoto() {
if (cameraInfo == null || cameraInfo.length == 0) {
return showMsg("未调用获取摄像头或未查找到摄像头信息")
}
var index = selectElement.value
$.ajax({
type: "post",
url: "http://127.0.0.1:38088/camera=photo&index=" + index,
dataType: "json",
success: function (data) {
/** {code:int , message:string, picture:string[图像base64,jpg格式]} **/
//返回的resolution中摄像头支持的分辨率
// console.log(JSON.stringify(data))
if (data.code != 0) {
return showMsg(data.message)
}
$("#imgCameraPhoto").attr("src", "")
$("#imgCameraPhoto").attr("src", "data:image/jpeg;base64," + data.picture)
}
})
}
//关闭摄像头
function closeCamera() {
if (cameraInfo == null || cameraInfo.length == 0) {
return showMsg("未调用获取摄像头或未查找到摄像头信息")
}
$.ajax({
type: "post",
url: "http://127.0.0.1:38088/camera=close&index=" + selectElement.value,
dataType: "json",
success: function (data) {
/** {code:int , message:string} **/
if (data.code != 0) {
return showMsg(data.message)
} else {
$("#imgCameraVideo").attr('src', "")
$("#imgCameraVideo").removeAttr('src')
return showMsg('摄像头已关闭')
}
}
})
}
//开始人证比对
function openFaceVerify() {
$.ajax({
type: "post",
url: "http://127.0.0.1:38088/method=startPersonVerify",
dataType: "json",
success: function (data) {
/** {code:int , message:string, retData:{score:int[相似度], photo:string[base64拍照图], pic:string[base64身份证照片], ...其他身份证内容}} **/
showMsg(data.message)
if (data.code != 0) return
$("#imgCameraPhoto").attr("src", "data:image/jpeg;base64," + data.retData.photo)
$("#imgIDCard").attr("src", "data:image/jpeg;base64," + data.retData.pic)
}
})
}
//取消人证比对
function stopFaceVerify() {
$.ajax({
type: "post",
url: "http://127.0.0.1:38088/method=cancelPersonVerify",
dataType: "json",
success: function (data) {
/** {code:int , message:string} **/
console.log(JSON.stringify(data))
//showMsg(JSON.stringify(data));
return showMsg(data.message)
}
})
}
//开始读取身份证 提供一个界面提示,然后循环读取,读取到,或者网页上取消了,就返回
function openReadChinaIdCard() {
$.ajax({
type: "post",
url: "http://127.0.0.1:38088/method=startReadChinaIdCard",
dataType: "json",
success: function (data) {
console.log(JSON.stringify(data))
/** {code:int , message:string, retData:{pic:string[base64身份证照片], ...其他身份证内容}} **/
if (data.code != 0) return showMsg(data.message)
$("#imgIDCard").attr("src", "data:image/jpeg;base64," + data.retData.pic)
retdata = data.retData
delete retdata.pic
showMsg(JSON.stringify(retdata))
}
})
}
//取消读取身份证
function stopReadChinaIdCard() {
$.ajax({
type: "post",
url: "http://127.0.0.1:38088/method=cancelReadChinaIdCard",
dataType: "json",
success: function (data) {
console.log(JSON.stringify(data))
/** {code:int , message:string} **/
showMsg(JSON.stringify(data))
}
})
}
// 开始读取银行卡
function openReadBankCard() {
$.ajax({
type: "post",
url: "http://127.0.0.1:38088/method=startReadBankCard",
dataType: "json",
success: function (data) {
console.log(JSON.stringify(data))
/** {code:int , message:string, data:string} **/
if (data.code != 0) return showMsg(data.message)
showMsg(JSON.stringify(data))
}
})
}
//写数据
function initDeviceData(data) {
$.ajax({
type: "post",
url: "http://127.0.0.1:38088/deviceDataInit" + data,
dataType: "json",
success: function (data) {
/** {code:int , message:string]} **/
//返回的resolution中摄像头支持的分辨率
console.log(JSON.stringify(data))
if (data.code != 0)
return showMsg(data.message)
showMsg(JSON.stringify(data))
}
})
}
//读数据
function readDeviceData() {
$.ajax({
type: "post",
url: "http://127.0.0.1:38088/readDeviceData",
dataType: "json",
success: function (data) {
/** {code:int , message:string, data:string ]} **/
//返回的resolution中摄像头支持的分辨率
console.log(JSON.stringify(data))
if (data.code != 0)
return showMsg(data.message)
showMsg(JSON.stringify(data))
}
})
}
function evaluation() {
$.ajax({
type: "post",
url: "http://127.0.0.1:38088/evaluation",
dataType: "json",
success: function (data) {
/** {code:int , message:string, data:string ]} **/
//评价信息
console.log(JSON.stringify(data))
if (data.code != 0)
return showMsg(data.message)
showMsg(JSON.stringify(data))
}
})
}
</script>
</body>
</html>

这篇关于EST-100身份证社保卡签批屏按捺终端PC版web版本http协议接口文档,支持web网页开发对接使用的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/549482

相关文章

Rust中的注释使用解读

《Rust中的注释使用解读》本文介绍了Rust中的行注释、块注释和文档注释的使用方法,通过示例展示了如何在实际代码中应用这些注释,以提高代码的可读性和可维护性... 目录Rust 中的注释使用指南1. 行注释示例:行注释2. 块注释示例:块注释3. 文档注释示例:文档注释4. 综合示例总结Rust 中的注释

Linux使用cut进行文本提取的操作方法

《Linux使用cut进行文本提取的操作方法》Linux中的cut命令是一个命令行实用程序,用于从文件或标准输入中提取文本行的部分,本文给大家介绍了Linux使用cut进行文本提取的操作方法,文中有详... 目录简介基础语法常用选项范围选择示例用法-f:字段选择-d:分隔符-c:字符选择-b:字节选择--c

Python自动化Office文档处理全攻略

《Python自动化Office文档处理全攻略》在日常办公中,处理Word、Excel和PDF等Office文档是再常见不过的任务,手动操作这些文档不仅耗时耗力,还容易出错,幸运的是,Python提供... 目录一、自动化处理Word文档1. 安装python-docx库2. 读取Word文档内容3. 修改

使用Go语言开发一个命令行文件管理工具

《使用Go语言开发一个命令行文件管理工具》这篇文章主要为大家详细介绍了如何使用Go语言开发一款命令行文件管理工具,支持批量重命名,删除,创建,移动文件,需要的小伙伴可以了解下... 目录一、工具功能一览二、核心代码解析1. 主程序结构2. 批量重命名3. 批量删除4. 创建文件/目录5. 批量移动三、如何安

springboot的调度服务与异步服务使用详解

《springboot的调度服务与异步服务使用详解》本文主要介绍了Java的ScheduledExecutorService接口和SpringBoot中如何使用调度线程池,包括核心参数、创建方式、自定... 目录1.调度服务1.1.JDK之ScheduledExecutorService1.2.spring

Java使用Tesseract-OCR实战教程

《Java使用Tesseract-OCR实战教程》本文介绍了如何在Java中使用Tesseract-OCR进行文本提取,包括Tesseract-OCR的安装、中文训练库的配置、依赖库的引入以及具体的代... 目录Java使用Tesseract-OCRTesseract-OCR安装配置中文训练库引入依赖代码实

Python使用Pandas对比两列数据取最大值的五种方法

《Python使用Pandas对比两列数据取最大值的五种方法》本文主要介绍使用Pandas对比两列数据取最大值的五种方法,包括使用max方法、apply方法结合lambda函数、函数、clip方法、w... 目录引言一、使用max方法二、使用apply方法结合lambda函数三、使用np.maximum函数

Qt 中集成mqtt协议的使用方法

《Qt中集成mqtt协议的使用方法》文章介绍了如何在工程中引入qmqtt库,并通过声明一个单例类来暴露订阅到的主题数据,本文通过实例代码给大家介绍的非常详细,感兴趣的朋友一起看看吧... 目录一,引入qmqtt 库二,使用一,引入qmqtt 库我是将整个头文件/源文件都添加到了工程中进行编译,这样 跨平台

C++使用栈实现括号匹配的代码详解

《C++使用栈实现括号匹配的代码详解》在编程中,括号匹配是一个常见问题,尤其是在处理数学表达式、编译器解析等任务时,栈是一种非常适合处理此类问题的数据结构,能够精确地管理括号的匹配问题,本文将通过C+... 目录引言问题描述代码讲解代码解析栈的状态表示测试总结引言在编程中,括号匹配是一个常见问题,尤其是在

Java中String字符串使用避坑指南

《Java中String字符串使用避坑指南》Java中的String字符串是我们日常编程中用得最多的类之一,看似简单的String使用,却隐藏着不少“坑”,如果不注意,可能会导致性能问题、意外的错误容... 目录8个避坑点如下:1. 字符串的不可变性:每次修改都创建新对象2. 使用 == 比较字符串,陷阱满