良田高拍仪集成WEB说明

良田高拍仪集成WEB说明

                                                                                                                ——By wuhebin 20180705

1.    硬件说明:良田高拍仪S620A3F(R) 带二代身份证阅读器和拍照摄像头等

良田高拍仪集成WEB说明_第1张图片

2. WEB平台集成读卡器功能说明(注只支持IE浏览器,高版本IE或360需要在兼容模式下:

 良田高拍仪集成WEB说明_第2张图片

3.    WEB增加控件OCX代码如下:


4.    JavaScript调用

如果仅需要二代证阅读和拍照功能。只需要'DevChange'和'IdCard'监听代码。拍照功能必须开摄像头OpenVideoMain()。

开启高拍仪资源:

plugin().Global_InitDevs();

关闭页面或者返回页面前最好调用关闭高拍仪资源:

plugin().Global_DeinitIdCard();


5.我的代码如下:

/*
* 新ERP系统 使用良田高拍仪扫描身份证或者拍照上传到系统
* 页面js使用,by wuhebin
*/

//注意:

//前台页面返回或者关闭页面必须调用一下代码
/*关闭所有高拍仪资源 by wuhebin 注意:如果需要拍照功能必须调用*/
//    var ret = me.plugin().Global_DeinitDevs();


me.initEloam = function(){

    //高拍仪代码///
    me.readIDcard = false;
    me.plugin = function(){//获取组件对象
        return document.getElementById('view1');
    }
    me.MainView =  function ()
    {
        return document.getElementById('view1');
    }

    /*关闭摄像头资源*/
    me.CloseVideoMain = function ()
    {
        if (me.VideoMain)
        {
            me.plugin().Video_Release(me.VideoMain);
            me.VideoMain = null;

        }			
    }

    /*开启摄像头资源*/
    me.OpenVideoMain = function ()
    {
        me.CloseVideoMain();

        if (!me.DeviceMain)
            return;

        var SelectType = me.plugin().Device_GetSubtype(me.DeviceMain);


        var nResolution = 0;


        me.VideoMain = me.plugin().Device_CreateVideo(me.DeviceMain, nResolution, SelectType);

        if (me.VideoMain)
        {
            me.MainView().View_SelectVideo(me.VideoMain);

        }
    }

    me.addEvent = function (obj, name, func)
    {
        if (obj.attachEvent) {
            obj.detachEvent("on" + name, func);
            obj.attachEvent("on" + name, func);
        } else {
            obj.removeEventListener(name, func, false);
            obj.addEventListener(name, func, false);
        }
    }

    //获取身份证数据
    me.getIcardData = function (){
        var data = {};
        data.empName = me.plugin().Global_GetIdCardData(1);
        data.empSex = me.plugin().Global_GetIdCardData(2);
        if(data.empSex){
            if("男" == data.empSex){
                data.empSex = "1";
            }else{
                data.empSex = "2";
            }
        }
        data.empNation = me.plugin().Global_GetIdCardData(3);
        if(data.empNation){
            if("汉" == data.empNation){
                data.empNation = "01";
            }else if("苗" == data.empNation){
                data.empNation = "02";
            }else if("侗" == data.empNation){
                data.empNation = "03";
            }else if("白" == data.empNation){
                data.empNation = "04";
            }else if("土家" == data.empNation){
                data.empNation = "05";
            }else if("仫佬" == data.empNation){
                data.empNation = "06";
            }else if("彝" == data.empNation){
                data.empNation = "07";
            }else if("革家" == data.empNation){
                data.empNation = "08";
            }else if("穿青" == data.empNation){
                data.empNation = "09";
            }else if("水" == data.empNation){
                data.empNation = "10";
            }else if("布依" == data.empNation){
                data.empNation = "12";
            }else if("瑶" == data.empNation){
                data.empNation = "13";
            }else if("回" == data.empNation){
                data.empNation = "11";
            }
            else if("壮" == data.empNation){
                data.empNation = "17";
            }else if("黎" == data.empNation){
                data.empNation = "14";
            }else if("畲" == data.empNation){
                data.empNation = "15";
            }else if("黎" == data.empNation){
                data.empNation = "14";
            }else{
                data.empNation = "";
            }
        }
        data.empBirthday = me.plugin().Global_GetIdCardData(4)+"-"+ me.plugin().Global_GetIdCardData(5)+"-"+ me.plugin().Global_GetIdCardData(6);
        var birthday= new Date((me.plugin().Global_GetIdCardData(4)+"-"+ me.plugin().Global_GetIdCardData(5)+"-"+ me.plugin().Global_GetIdCardData(6)).replace(/-/g, "\/"));   
        var d = new Date();   
        //年龄        
        //data.extNum1 = d.getFullYear()-birthday.getFullYear()-((d.getMonth()= 0){
            me.byId(i).extcombobox("setValue", data[i]);
        }else if(_.indexOf(datebox, i) >= 0){
           // console.log("empBirthday:setValue"+data[i]);
            me.byId(i).extdate("setValue", data[i]);
        }else{
            me.byId(i).val(data[i]);
        }
    }

}

6.注意上面是我们平台的写法,var me = this;封装了一些方法;使用时请客官实现自己的方法的形式;

      实例里的me.initEloam();方法需要初始化。同理window.load等

7.各位所需要的良田高拍仪的demo文件和调试文件下载链接如下:

良田高拍仪控件及调试ActiveX实例文档等下载

你可能感兴趣的:(WEB集成高拍仪和二代证阅读器,高拍仪,二代身份证,WEB,拍照,JavaScript调用OCX)