华视 CVR-100UC 身份证读取 html二次开发模板

python读卡:python读卡

最近小唐应要求要开发一个前端的身份证读卡界面,结果华视CVR-100UC 的读取界面是在是有点,而且怎么调试连官方最基本的启动程序都执行不了。CertReader.ocx 已成功,后面在问询一系列前辈之后,大概知道可能是ActiveX组件禁用的问题,各种禁用【哭死】。后来去找到了一个比较远古的CVR-100UC读卡,是基于后端服务器的,exe双击运行即可

cpp 复制代码
资源:
链接:https://pan.baidu.com/s/1FtC12sv6g45lFMKI4SZMbQ?pwd=6boq 
提取码:6boq
#读卡
http://localhost:19196/readCard
#关闭连接
http://localhost:19196/CloseDevice
#打开连接
http://localhost:19196/openDevice

目录结构

代码如下

html

cpp 复制代码
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Document</title>
</head>
<body>
  <button id="lj">连接设备</button>
  <button id="read">读取信息</button>
  <button id="close">断开连接</button>
  <div>
    <img id="tx" src="" alt="身份证照片">
    <div id="data"></div>
    <script src="./js/dy.js"></script>
  </div>
</body>
</html>

js

cpp 复制代码
document.getElementById('lj').addEventListener('click', function() {
    const xhr = new XMLHttpRequest();
    xhr.onreadystatechange = function () {
      if (xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) {
        const data = JSON.parse(xhr.responseText);
        document.getElementById('data').innerHTML = JSON.stringify(data);
      }
    };
    xhr.open('GET', 'http://localhost:19196/openDevice');
    xhr.send();
  });
  document.getElementById('read').addEventListener('click', function() {
    const xhr = new XMLHttpRequest();
    xhr.onreadystatechange = function () {
      if (xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) {
        const data = JSON.parse(xhr.responseText);
        const imageBase64 = 'data:image/jpeg;base64,' + data.identityPic;
        document.getElementById('tx').src = imageBase64;
        document.getElementById('data').innerHTML = JSON.stringify(data);
      }
    };
    xhr.open('GET', 'http://localhost:19196/readCard');
    xhr.send();
  });
  document.getElementById('close').addEventListener('click', function() {
    const xhr = new XMLHttpRequest();
    xhr.onreadystatechange = function () {
      if (xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) {
        const data = JSON.parse(xhr.responseText);
        document.getElementById('data').innerHTML = JSON.stringify(data);
      }
    };
    xhr.open('GET', 'http://localhost:19196/CloseDevice');
    xhr.send();
  });
  

测试结果


相关推荐
酷爱码39 分钟前
好看的个人主页HTML源码分享
前端·html
wuhen_n8 小时前
CSS元素动画篇:基于当前位置的变换动画(三)
前端·css·html·css3·html5
Watermelo6179 小时前
Vue3调度器错误解析,完美解决Unhandled error during execution of scheduler flush.
前端·javascript·vue.js·elementui·html·es6·bug
低代码布道师9 小时前
第一部分:网页的骨架 —— HTML
前端·html
凌晨一点的程序员10 小时前
antd中的表格穿梭框(Transfer)如何使用
前端·javascript·html·react·antd·transfer
^小桃冰茶11 小时前
HTML 从标签到动态效果的基础
前端·html
火柴盒zhang11 小时前
基于HTML CANVAS和EXCEL的xlsx文件展示工具websheet
前端·javascript·html·spreadsheet·websheet
软件技术NINI19 小时前
html css js网页制作成品——HTML+CSS甜品店网页设计(4页)附源码
javascript·css·html
NoneCoder1 天前
HTML响应式网页设计与跨平台适配
前端·html
wsdhla1 天前
form表单提交前设置请求头request header及文件下载
html·form·request·send·header·submit