华视 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();
  });
  

测试结果


相关推荐
破无差7 小时前
《赛事报名系统小程序》
小程序·html·uniapp
从零开始学习人工智能11 小时前
快速搭建B/S架构HTML演示页:从工具选择到实战落地
前端·架构·html
yddddddy12 小时前
html基本知识
前端·html
小白640219 小时前
前端梳理体系从常问问题去完善-基础篇(html,css,js,ts)
前端·css·html
蓝胖子的多啦A梦21 小时前
【前端】VUE+Element UI项目 页面自适应横屏、竖屏、大屏、PDA及手机等适配方案
前端·javascript·elementui·html·前端页面适配
面向星辰1 天前
html各种常用标签
前端·javascript·html
李昊哲小课2 天前
HTML 完整教程与实践
前端·html
小*-^-*九2 天前
php 使用html 生成pdf word wkhtmltopdf 系列2
pdf·html·php
hashiqimiya3 天前
html实现右上角有个图标,鼠标移动到该位置出现手型,点击会弹出登录窗口。
前端·html
BillKu3 天前
Vue3 中使用 DOMPurify 对渲染动态 HTML 进行安全净化处理
前端·安全·html