hjg
2023-10-14 f6c2f15c37aef4675dda01fb5ec17cde4e141c3f
提交 | 用户 | 时间
58d006 1 function toJsonForReader(str) {
A 2             //var obj = JSON.parse(str);
3             //return obj;
4             return eval('(' + str + ')');
5         }
6 /*
7     <OBJECT classid="clsid:10946843-7507-44FE-ACE8-2B3483D179B7" id="CVR_IDCard" name="CVR_IDCard" width="0" height="0" ></OBJECT>
8
9 */
10         jQuery(document).ready(function($) {
11             CertCtl=document.getElementById('CertCtl');
12         });
13
14 //var CertCtl=document.getElementById('CertCtl');
15 function certreadCard () {
16     var ttobj={};
17     if(CertCtl==null){
18         ttobj.code=1;
19         ttobj.errmsg='没有找到读卡器句柄';
20         return ttobj
21     }
22     try{
23         var strReadResult = CertCtl.ReadCard();
24         if(strReadResult=='0'){
25             ttobj.code=0;
26             ttobj.partyName= CertCtl.Name;
27             ttobj.gender   = CertCtl.Sex;
28             ttobj.nation   = CertCtl.Nation;
29             ttobj.bornDay  = CertCtl.Born;
30             ttobj.certAddress=CertCtl.Address;
31             ttobj.certNumber= CertCtl.CardNo;
32             ttobj.certOrg=  CertCtl.IssuedAt;
33             ttobj.effDate= CertCtl.EffectedDate;
34             ttobj.expDate=CertCtl.ExpiredDate;
35             ttobj.identityPic=  CertCtl.pic;
36             ttobj.base64ID_PicFront = CertCtl.Picture;
37             ttobj.base64ID_PicBack = CertCtl.PictureLen;
38             return ttobj;
39         }else{
40             ttobj.code=1;
41             ttobj.errmsg=strReadResult;
42             return ttobj;
43         }
44     }catch(e){
45         console.log('read card error:'+e)
46         ttobj.code=1;
47         ttobj.errmsg=e;
48         return ttobj;
49     }
50     return ttobj;
51 }
52
53
54
55 function setCertReaderInterval(sec,callback){
56     clearCertReaderInterval();
57     window.certreaderintervalid=setInterval(function(){
58         var readobj=certreadCard();
59         callback(readobj);
60         readobj=null;
61     },sec);
62 }
63 function clearCertReaderInterval(){
64     if(window.certreaderintervalid!=null){
65         clearInterval(window.certreaderintervalid);
66         window.certreaderintervalid=null;
67     }
68 }
69
70
71
72
73
74