public/zhiwenDemo/1png.png
public/zhiwenDemo/CID.html
New file @@ -0,0 +1,88 @@ <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>TypeScript HTML App</title> <link rel="stylesheet" href="app.css" type="text/css" /> <script src="language.js"></script> <script src="Client.js"></script> <script src="app.js"></script> </head> <body> <!-- <button id="change_language" onclick="changelanguage_CID()">Change to English</button> <h3 id="title">亚略特设备管理助手Demo(CID)</h3> <a id="link" href="AratekDMA://4397and7934">打开设备管理助手</a> <button id="connect_server" onclick="connect()">连接助手程序</button> <br /> <br /> <select id="device_select"> <option value="cid4000">CID4000</option> <option value="cid5000">CID5000</option> <option value="cid7000">CID7000</option> <option value="cid3000tc">CID3000TC</option> <option value="cid3000">CID3000</option> <option value="cid7000r">CID7000R</option> </select> --> <div id="zhiwenOur"> <div id="main"> <div id="imgs"> <img id="img" width="256" height="360" /> </div> <div id="butDiv"> <button id="connect_server" onclick="connect()">开始采集</button> <button id="closeG" onclick="closeGfn()">取消采集</button> <button id="onceGgin" onclick="onceGgin()">重新采集</button> </div> </div> <div id="down"> <div id="zhiwentip">请按下食指开始采集指纹!</div> <div id="zhiwentipok">指纹采集成功!</div> <div id="zhiwentipno">未采集指纹!</div> </div> </div> <!--<button id="open_device" onclick="LIVESCAN_Init()">设备初始化</button> <button id="close_device" onclick="LIVESCAN_Close()">关闭设备</button> <button id="device_count" onclick="LIVESCAN_GetChannelCount()">获取设备数量</button> <button id="device_desc" onclick="LIVESCAN_GetDesc()">获取设备信息</button> <br /> <br /> <p1 id="score_thresh_desc">分数阈值:</p1> <input type="text" id="score_thresh" value="60" oninput="value=value.replace(/[^\d]/g,'')" /> <br /> <br /> <button id="start" onclick="LIVESCAN_BeginCapture()">开始预览</button> <button id="end" onclick="LIVESCAN_EndCapture()">结束预览</button> <p1 id="score_desc">当前分数:</p1> <p2 id="score"></p2> <br /> <br /> <button id="cap1" onclick="CID_Cap1()">采集图像1</button> <button id="ext1" onclick="CID_Ext1()">提取图像1特征</button> <button id="cap2" onclick="CID_Cap2()">采集图像2</button> <button id="ext2" onclick="CID_Ext2()">提取图像2特征</button> <br /> <br /> <button id="feaverify" onclick="FP_FeatureMatch()">特征1与特征2比对</button> <button id="imgverify" onclick="FP_ImageMatch()">图像1与特征2比对</button> <br /> <br /> <img id="img1" border="0" width="256" height="360" /> <img id="img2" border="0" width="256" height="360" /> <br /> <textarea name="FeaData" id="Fea1" cols="54" rows="20" style="height:300px"></textarea> <textarea name="FeaData" id="Fea2" cols="54" rows="20" style="height:300px"></textarea> <div id="content"></div> --> </body> </html> public/zhiwenDemo/Client.js
New file @@ -0,0 +1,1300 @@ var CommandType; (function (CommandType) { CommandType[CommandType["OpenDevice_Type"] = 1] = "OpenDevice_Type"; CommandType[CommandType["CloseDevice_Type"] = 2] = "CloseDevice_Type"; CommandType[CommandType["GetDeviceCount_Type"] = 3] = "GetDeviceCount_Type"; CommandType[CommandType["GetDeviceDescription_Type"] = 4] = "GetDeviceDescription_Type"; CommandType[CommandType["CaptureFingerData_Type"] = 5] = "CaptureFingerData_Type"; CommandType[CommandType["StartCapture_Type"] = 6] = "StartCapture_Type"; CommandType[CommandType["StopCapture_Type"] = 7] = "StopCapture_Type"; CommandType[CommandType["GeneralizeTemplate_Type"] = 8] = "GeneralizeTemplate_Type"; CommandType[CommandType["Verify_Type"] = 9] = "Verify_Type"; CommandType[CommandType["SetOption_Type"] = 10] = "SetOption_Type"; CommandType[CommandType["BmpToRaw_Type"] = 11] = "BmpToRaw_Type"; CommandType[CommandType["BmpToWSQ_Type"] = 12] = "BmpToWSQ_Type"; CommandType[CommandType["BmpToISO_Type"] = 13] = "BmpToISO_Type"; CommandType[CommandType["BmpToANSI_Type"] = 14] = "BmpToANSI_Type"; CommandType[CommandType["CID_Init_Type"] = 15] = "CID_Init_Type"; CommandType[CommandType["CID_Close_Type"] = 16] = "CID_Close_Type"; CommandType[CommandType["CID_GetChannelCount_Type"] = 17] = "CID_GetChannelCount_Type"; CommandType[CommandType["CID_BeginCapture_Type"] = 18] = "CID_BeginCapture_Type"; CommandType[CommandType["CID_GetFPRawData_Type"] = 19] = "CID_GetFPRawData_Type"; CommandType[CommandType["CID_GetFPBmpData_Type"] = 20] = "CID_GetFPBmpData_Type"; CommandType[CommandType["CID_EndCapture_Type"] = 21] = "CID_EndCapture_Type"; CommandType[CommandType["CID_GetVersion_Type"] = 22] = "CID_GetVersion_Type"; CommandType[CommandType["CID_GetDesc_Type"] = 23] = "CID_GetDesc_Type"; CommandType[CommandType["CID_Alg_GetVersion_Type"] = 25] = "CID_Alg_GetVersion_Type"; CommandType[CommandType["CID_Alg_Begin_Type"] = 26] = "CID_Alg_Begin_Type"; CommandType[CommandType["CID_Alg_FeatureExtract_Type"] = 27] = "CID_Alg_FeatureExtract_Type"; CommandType[CommandType["CID_Alg_FeatureMatch_Type"] = 28] = "CID_Alg_FeatureMatch_Type"; CommandType[CommandType["CID_Alg_ImageMatch_Type"] = 29] = "CID_Alg_ImageMatch_Type"; CommandType[CommandType["CID_Alg_GetQualityScore_Type"] = 32] = "CID_Alg_GetQualityScore_Type"; CommandType[CommandType["CID_Alg_End_Type"] = 35] = "CID_Alg_End_Type"; CommandType[CommandType["TrustLink_GetDeviceInfo_Type"] = 49] = "TrustLink_GetDeviceInfo_Type"; CommandType[CommandType["ARA_ReadIDCard_Type"] = 50] = "ARA_ReadIDCard_Type"; CommandType[CommandType["ARA_FeaConv_Type"] = 51] = "ARA_FeaConv_Type"; CommandType[CommandType["ARA_GetCurrentDeviceList_Type"] = 53] = "ARA_GetCurrentDeviceList_Type"; CommandType[CommandType["FRO900_OpenDevice_Type"] = 64] = "FRO900_OpenDevice_Type"; CommandType[CommandType["FRO900_CloseDevice_Type"] = 65] = "FRO900_CloseDevice_Type"; CommandType[CommandType["FRO900_GetDeviceCount_Type"] = 66] = "FRO900_GetDeviceCount_Type"; CommandType[CommandType["FRO900_CaptureFingerPrintData_Type"] = 67] = "FRO900_CaptureFingerPrintData_Type"; CommandType[CommandType["FRO900_GeneralizeTemplate_Type"] = 68] = "FRO900_GeneralizeTemplate_Type"; CommandType[CommandType["FRO900_Verify_Type"] = 69] = "FRO900_Verify_Type"; CommandType[CommandType["Iris_InitDevice_Type"] = 80] = "Iris_InitDevice_Type"; CommandType[CommandType["Iris_ReleaseDevice_type"] = 81] = "Iris_ReleaseDevice_type"; CommandType[CommandType["Iris_StartCapture_Type"] = 82] = "Iris_StartCapture_Type"; CommandType[CommandType["Iris_StartCapture2_Type"] = 83] = "Iris_StartCapture2_Type"; CommandType[CommandType["Iris_StopCapture_Type"] = 84] = "Iris_StopCapture_Type"; CommandType[CommandType["Iris_SetOptions_Type"] = 86] = "Iris_SetOptions_Type"; CommandType[CommandType["Iris_StartVerify_Type"] = 87] = "Iris_StartVerify_Type"; CommandType[CommandType["Iris_StartVerify2_Type"] = 88] = "Iris_StartVerify2_Type"; CommandType[CommandType["Iris_StopVerify_Type"] = 89] = "Iris_StopVerify_Type"; CommandType[CommandType["Iris_StartFastCapture_Type"] = 90] = "Iris_StartFastCapture_Type"; CommandType[CommandType["Iris_StartFastCapture2_Type"] = 91] = "Iris_StartFastCapture2_Type"; CommandType[CommandType["FingerKey_OpenDevice_Type"] = 96] = "FingerKey_OpenDevice_Type"; CommandType[CommandType["FingerKey_CloseDevice_Type"] = 97] = "FingerKey_CloseDevice_Type"; CommandType[CommandType["FingerKey_GetDeviceInformation_Type"] = 99] = "FingerKey_GetDeviceInformation_Type"; CommandType[CommandType["FingerKey_CaptureFingerData_Type"] = 100] = "FingerKey_CaptureFingerData_Type"; CommandType[CommandType["FingerKey_ImportFingerPrint_Type"] = 101] = "FingerKey_ImportFingerPrint_Type"; CommandType[CommandType["Camera_InitDevice_Type"] = 112] = "Camera_InitDevice_Type"; CommandType[CommandType["Camera_ReleaseDevice_Type"] = 113] = "Camera_ReleaseDevice_Type"; CommandType[CommandType["Camera_StartCapture_Type"] = 114] = "Camera_StartCapture_Type"; CommandType[CommandType["Camera_StopCapture_Type"] = 115] = "Camera_StopCapture_Type"; CommandType[CommandType["Camera_SetOption_Type"] = 116] = "Camera_SetOption_Type"; })(CommandType || (CommandType = {})); var FingerPosition; (function (FingerPosition) { FingerPosition[FingerPosition["UNKNOWN"] = 0] = "UNKNOWN"; FingerPosition[FingerPosition["RIGHT_THUMB"] = 1] = "RIGHT_THUMB"; FingerPosition[FingerPosition["RIGHT_INDEX"] = 2] = "RIGHT_INDEX"; FingerPosition[FingerPosition["RIGHT_MIDDLE"] = 3] = "RIGHT_MIDDLE"; FingerPosition[FingerPosition["RIGHT_RING"] = 4] = "RIGHT_RING"; FingerPosition[FingerPosition["RIGHT_LITTLE"] = 5] = "RIGHT_LITTLE"; FingerPosition[FingerPosition["LEFT_THUMB"] = 6] = "LEFT_THUMB"; FingerPosition[FingerPosition["LEFT_INDEX"] = 7] = "LEFT_INDEX"; FingerPosition[FingerPosition["LEFT_MIDDLE"] = 8] = "LEFT_MIDDLE"; FingerPosition[FingerPosition["LEFT_RING"] = 9] = "LEFT_RING"; FingerPosition[FingerPosition["LEFT_LITTLE"] = 10] = "LEFT_LITTLE"; FingerPosition[FingerPosition["THUMB_TWO"] = 21] = "THUMB_TWO"; FingerPosition[FingerPosition["LEFT_FOUR"] = 22] = "LEFT_FOUR"; FingerPosition[FingerPosition["RIGHT_FOUR"] = 23] = "RIGHT_FOUR"; })(FingerPosition || (FingerPosition = {})); var FRO900_MissFinger; (function (FRO900_MissFinger) { FRO900_MissFinger[FRO900_MissFinger["NO_FINGER_MISS"] = 0] = "NO_FINGER_MISS"; FRO900_MissFinger[FRO900_MissFinger["MISS_FINGER_INDEX"] = 1] = "MISS_FINGER_INDEX"; FRO900_MissFinger[FRO900_MissFinger["MISS_FINGER_MIDDLE"] = 2] = "MISS_FINGER_MIDDLE"; FRO900_MissFinger[FRO900_MissFinger["MISS_FINGER_RING"] = 4] = "MISS_FINGER_RING"; FRO900_MissFinger[FRO900_MissFinger["MISS_FINGER_LITTLE"] = 8] = "MISS_FINGER_LITTLE"; })(FRO900_MissFinger || (FRO900_MissFinger = {})); var ID_FingerPosition; (function (ID_FingerPosition) { ID_FingerPosition[ID_FingerPosition["UNKNOWN"] = 99] = "UNKNOWN"; ID_FingerPosition[ID_FingerPosition["RIGHT_THUMB"] = 11] = "RIGHT_THUMB"; ID_FingerPosition[ID_FingerPosition["RIGHT_INDEX"] = 12] = "RIGHT_INDEX"; ID_FingerPosition[ID_FingerPosition["RIGHT_MIDDLE"] = 13] = "RIGHT_MIDDLE"; ID_FingerPosition[ID_FingerPosition["RIGHT_RING"] = 14] = "RIGHT_RING"; ID_FingerPosition[ID_FingerPosition["RIGHT_LITTLE"] = 15] = "RIGHT_LITTLE"; ID_FingerPosition[ID_FingerPosition["LEFT_THUMB"] = 16] = "LEFT_THUMB"; ID_FingerPosition[ID_FingerPosition["LEFT_INDEX"] = 17] = "LEFT_INDEX"; ID_FingerPosition[ID_FingerPosition["LEFT_MIDDLE"] = 18] = "LEFT_MIDDLE"; ID_FingerPosition[ID_FingerPosition["LEFT_RING"] = 19] = "LEFT_RING"; ID_FingerPosition[ID_FingerPosition["LEFT_LITTLE"] = 20] = "LEFT_LITTLE"; })(ID_FingerPosition || (ID_FingerPosition = {})); var CompressionType; (function (CompressionType) { CompressionType[CompressionType["UnCompressed"] = 0] = "UnCompressed"; CompressionType[CompressionType["BitPacked"] = 1] = "BitPacked"; CompressionType[CompressionType["WSQ"] = 2] = "WSQ"; CompressionType[CompressionType["JPEG"] = 3] = "JPEG"; CompressionType[CompressionType["JPEG2000"] = 4] = "JPEG2000"; CompressionType[CompressionType["PNG"] = 5] = "PNG"; })(CompressionType || (CompressionType = {})); var SecurityLevel; (function (SecurityLevel) { SecurityLevel[SecurityLevel["Level_1"] = 1] = "Level_1"; SecurityLevel[SecurityLevel["Level_2"] = 2] = "Level_2"; SecurityLevel[SecurityLevel["Level_3"] = 3] = "Level_3"; SecurityLevel[SecurityLevel["Level_4"] = 4] = "Level_4"; SecurityLevel[SecurityLevel["Level_5"] = 5] = "Level_5"; })(SecurityLevel || (SecurityLevel = {})); var ImageFormatType; (function (ImageFormatType) { ImageFormatType[ImageFormatType["IRaw"] = 1] = "IRaw"; ImageFormatType[ImageFormatType["IBmp"] = 2] = "IBmp"; ImageFormatType[ImageFormatType["IISO"] = 3] = "IISO"; ImageFormatType[ImageFormatType["IANSI"] = 4] = "IANSI"; })(ImageFormatType || (ImageFormatType = {})); var FeatureFormatType; (function (FeatureFormatType) { FeatureFormatType[FeatureFormatType["FBione"] = 1] = "FBione"; FeatureFormatType[FeatureFormatType["FISO"] = 2] = "FISO"; FeatureFormatType[FeatureFormatType["FANSI"] = 3] = "FANSI"; FeatureFormatType[FeatureFormatType["FIDCard"] = 4] = "FIDCard"; })(FeatureFormatType || (FeatureFormatType = {})); var CIDDeviceType; (function (CIDDeviceType) { CIDDeviceType[CIDDeviceType["CID3000TC"] = 0] = "CID3000TC"; CIDDeviceType[CIDDeviceType["CID4000"] = 1] = "CID4000"; CIDDeviceType[CIDDeviceType["CID5000"] = 2] = "CID5000"; CIDDeviceType[CIDDeviceType["CID7000"] = 3] = "CID7000"; CIDDeviceType[CIDDeviceType["CID3000"] = 4] = "CID3000"; CIDDeviceType[CIDDeviceType["CID7000R"] = 5] = "CID7000R"; })(CIDDeviceType || (CIDDeviceType = {})); var IrisDeviceType; (function (IrisDeviceType) { IrisDeviceType[IrisDeviceType["IR100"] = 1] = "IR100"; IrisDeviceType[IrisDeviceType["IR200"] = 2] = "IR200"; })(IrisDeviceType || (IrisDeviceType = {})); var IrisCaptureMode; (function (IrisCaptureMode) { IrisCaptureMode[IrisCaptureMode["Two_Eyes"] = 1] = "Two_Eyes"; IrisCaptureMode[IrisCaptureMode["Left_Eye"] = 2] = "Left_Eye"; IrisCaptureMode[IrisCaptureMode["Right_Eye"] = 3] = "Right_Eye"; })(IrisCaptureMode || (IrisCaptureMode = {})); var IDCardType; (function (IDCardType) { IDCardType[IDCardType["IDCard_People"] = 1] = "IDCard_People"; IDCardType[IDCardType["IDCard_GAT"] = 2] = "IDCard_GAT"; IDCardType[IDCardType["IDCard_Foreign"] = 3] = "IDCard_Foreign"; })(IDCardType || (IDCardType = {})); var Camera_Device_List; (function (Camera_Device_List) { Camera_Device_List[Camera_Device_List["FC200V"] = 1] = "FC200V"; Camera_Device_List[Camera_Device_List["FC200H"] = 2] = "FC200H"; Camera_Device_List[Camera_Device_List["FC205"] = 3] = "FC205"; Camera_Device_List[Camera_Device_List["CID7000"] = 11] = "CID7000"; })(Camera_Device_List || (Camera_Device_List = {})); ; var NOT_CONNECT = -1; var Client = (function () { function Client() { this.url = 'ws://127.0.0.1:4397/aratek'; this.ws = null; this.isConnect = false; } Client.prototype.SendMessage = function (msg) { if (this.isConnect) { this.ws.send(msg); } }; Client.prototype.OpenDevice = function (index) { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.OpenDevice_Type, "Index": index }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.CloseDevice = function () { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.CloseDevice_Type }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.GetDeviceCount = function () { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.GetDeviceCount_Type }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.GetDeviceDescription = function (index) { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.GetDeviceDescription_Type, "Index": index }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.CaptureFingerData = function (image_format, feature_format, timeout, fingerposition, compression_type, device_id, factor) { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.CaptureFingerData_Type, "Image_Format": image_format, "Feature_Format": feature_format, "TimeOut": timeout, "Finger_Position": fingerposition, "Compression_Type": compression_type, "Device_ID": device_id, "Factor": factor }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.StartCapture = function (feature_format, fingerposition) { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.StartCapture_Type, "Feature_Format": feature_format, "Finger_Position": fingerposition }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.StopCapture = function () { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.StopCapture_Type }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.GeneralizeTemplate = function (fea1, fea2, fea3) { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.GeneralizeTemplate_Type, "Feature_1": fea1, "Feature_2": fea2, "Feature_3": fea3 }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.Verify = function (fea1, fea2, security_level) { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.Verify_Type, "Feature_1": fea1, "Feature_2": fea2, "Security_Level": security_level }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.SetOption = function (LED_index, LED_status) { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.SetOption_Type, "LED_Index": LED_index, "LED_Status": LED_status }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.BmpToRaw = function (bmp_imagedata, image_width, image_height) { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.BmpToRaw_Type, "Bmp_ImageData": bmp_imagedata, "Image_Width": image_width, "Image_Height": image_height }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.BmpToWSQ = function (bmp_imagedata, image_width, image_height, dpi, bitrate) { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.BmpToWSQ_Type, "Bmp_ImageData": bmp_imagedata, "Image_Width": image_width, "Image_Height": image_height, "DPI": dpi, "Bitrate": bitrate }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.BmpToISO = function (bmp_imagedata, image_width, image_height, fingerposition, compression_type, deviceid) { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.BmpToISO_Type, "Bmp_ImageData": bmp_imagedata, "Image_Width": image_width, "Image_Height": image_height, "Finger_Position": fingerposition, "Compression_Type": compression_type, "Device_ID": deviceid }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.BmpToANSI = function (bmp_imagedata, image_width, image_height, fingerposition, compression_type, deviceid) { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.BmpToANSI_Type, "Bmp_ImageData": bmp_imagedata, "Image_Width": image_width, "Image_Height": image_height, "Finger_Position": fingerposition, "Compression_Type": compression_type, "Device_ID": deviceid }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.CID_Init = function (devicetype, my) { if (my.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.CID_Init_Type, "DeviceType": devicetype }; let butBegin = document.getElementById("connect_server"); butBegin.style.display = "none"; let closeG = document.getElementById("closeG"); closeG.style.display = "block"; let onceGgin = document.getElementById("onceGgin"); onceGgin.style.display = "none"; let zhiwentip = document.getElementById("zhiwentip"); zhiwentip.style.display = "block"; let zhiwentipok = document.getElementById("zhiwentipok"); zhiwentipok.style.display = "none"; let zhiwentipno = document.getElementById("zhiwentipno"); zhiwentipno.style.display = "none"; // console.log(butBegin) // butBegin.innerText = "点击结束"; // butBegin.style.backgroundColor = "#E6A23C"; my.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.CID_Close = function () { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.CID_Close_Type }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.CID_GetChannelCount = function () { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.CID_GetChannelCount_Type }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.CID_BeginCapture = function (nChannel) { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.CID_BeginCapture_Type, "nChannel": nChannel }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.CID_GetFPRawData = function (nChannel) { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.CID_GetFPRawData_Type, "nChannel": nChannel }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.CID_GetFPBmpData = function (nChannel) { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.CID_GetFPBmpData_Type, "nChannel": nChannel }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.CID_EndCapture = function (nChannel) { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.CID_EndCapture_Type, "nChannel": nChannel }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.CID_GetVersion = function () { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.CID_GetVersion_Type }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.CID_GetDesc = function () { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.CID_GetDesc_Type }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.CID_Alg_GetVersion = function () { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.CID_Alg_GetVersion_Type }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.CID_Alg_Begin = function () { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.CID_Alg_Begin_Type }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.CID_Alg_FeatureExtract = function (fingerposition, image_rawdata) { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.CID_Alg_FeatureExtract_Type, "FingerPosition": fingerposition, "Image_RawData": image_rawdata }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.CID_Alg_FeatureMatch = function (featuredata1, featuredata2) { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.CID_Alg_FeatureMatch_Type, "FeatureData1": featuredata1, "FeatureData2": featuredata2 }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.CID_Alg_ImageMatch = function (image_rawdata, featuredata) { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.CID_Alg_ImageMatch_Type, "RawImageData": image_rawdata, "FeatureData": featuredata }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.CID_Alg_GetQualityScore = function (image_rawdata) { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.CID_Alg_GetQualityScore_Type, "RawImageData": image_rawdata }; // console.log(cmd_json) // return this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.CID_Alg_End = function () { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.CID_Alg_End_Type }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.ARA_ReadIDCard = function () { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.ARA_ReadIDCard_Type }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.TrustLink_GetDeviceInfo = function () { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.TrustLink_GetDeviceInfo_Type }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.ARA_FeaConv = function (feasrc, feasrc_fm, feadst_fm) { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.ARA_FeaConv_Type, "Fea_Src_Data": feasrc, "Fea_Src_Format": feasrc_fm, "Fea_Dst_Format": feadst_fm }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.ARA_GetCurrentDeviceList = function () { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.ARA_GetCurrentDeviceList_Type }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.FRO900_OpenDevice = function (index) { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.FRO900_OpenDevice_Type, "Index": index }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.FRO900_GetDeviceCount = function () { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.FRO900_GetDeviceCount_Type }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.FRO900_CaptureFingerPrintData = function (fingerposition, imageformat, featureformat, compressiontype, factor, missfinger) { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.FRO900_CaptureFingerPrintData_Type, "Finger_Position": fingerposition, "Image_Format": imageformat, "Feature_Format": featureformat, "Compression_Type": compressiontype, "Factor": factor, "Miss_Finger_Position": missfinger }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.FRO900_CloseDevice = function () { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.FRO900_CloseDevice_Type }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.FRO900_GeneralizeTemplate = function (fea1, fea2, fea3) { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.FRO900_GeneralizeTemplate_Type, "Feature_1": fea1, "Feature_2": fea2, "Feature_3": fea3 }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.FRO900_Verify = function (fea1, fea2, security_level) { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.FRO900_Verify_Type, "Feature_1": fea1, "Feature_2": fea2, "Security_Level": security_level }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.Iris_InitDevice = function (devicetype) { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.Iris_InitDevice_Type, "DeviceType": devicetype }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.Iris_StartCapture = function () { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.Iris_StartCapture_Type }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.Iris_StartFastCapture = function () { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.Iris_StartFastCapture_Type }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.Iris_StopCapture = function () { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.Iris_StopCapture_Type }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.Iris_StartVerify = function (timeout, leftdata, rightdata) { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.Iris_StartVerify_Type, "Timeout": timeout, "LeftEye_FeaData": leftdata, "RightEye_FeaData": rightdata }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.Iris_StopVerify = function () { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.Iris_StopVerify_Type }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.Iris_ReleaseDevice = function () { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.Iris_ReleaseDevice_type }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.Iris_SetOptions = function (enrothresh) { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.Iris_SetOptions_Type, "EnrollThresh": enrothresh }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.FingerKey_OpenDevice = function () { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.FingerKey_OpenDevice_Type, }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.FingerKey_CloseDevice = function () { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.FingerKey_CloseDevice_Type }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.FingerKey_GetDeviceInformation = function () { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.FingerKey_GetDeviceInformation_Type }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.FingerKey_CaptureFingerData = function (fingerposition, imageformat, featureformat, timeout) { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.FingerKey_CaptureFingerData_Type, "Image_Format": imageformat, "Feature_Format": featureformat, "TimeOut": timeout, "Finger_Position": fingerposition }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.FingerKey_ImportFingerPrint = function (fingerposition, allfeature) { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.FingerKey_ImportFingerPrint_Type, "Finger_Position": fingerposition, "AllFeatureData": allfeature }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.Camera_InitDevice = function (devicetype) { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.Camera_InitDevice_Type, "DeviceType": devicetype }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.Camera_ReleaseDevice = function () { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.Camera_ReleaseDevice_Type }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.Camera_StartCapture = function () { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.Camera_StartCapture_Type }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.Camera_StopCapture = function () { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.Camera_StopCapture_Type }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.Camera_SetOption = function (livedetectvalue) { if (this.isConnect == false) { console.log("Unconnected service"); return NOT_CONNECT; } var cmd_json = { "RequestType": CommandType.Camera_SetOption_Type, "LiveDetectSetting": livedetectvalue }; this.SendMessage(JSON.stringify(cmd_json)); }; Client.prototype.beginFn; // 添加异步设备初始化,因为websocket需要时间来启动 Client.prototype.Connect_Server = function () { var thisws = this; this.ws = new WebSocket(this.url); this.ws.onopen = function () { // console.log("Connect Success"); // alert("Connect Success"); thisws.isConnect = true; let data = thisws.beginFn, my = thisws;//循环连接设备 let openequipment = function (beginFn, that) { if (beginFn.fn(beginFn.CID5000, that) == -1) { setTimeout(function () { openequipment(data, my); }, 2000); } } openequipment(data, my); }; this.ws.onmessage = function (ev) { var data = JSON.parse(ev.data); var responsetype = data.ResponseType; // console.log(responsetype, " :::") switch (responsetype) { case CommandType.OpenDevice_Type: if (thisws.OnOpenDevice) { thisws.OnOpenDevice(data.ErrorCode, data.ErrorMessage); } break; case CommandType.CloseDevice_Type: if (thisws.OnCloseDevice) { thisws.OnCloseDevice(data.ErrorCode, data.ErrorMessage); } break; case CommandType.GetDeviceCount_Type: if (thisws.OnGetDeviceCount) { thisws.OnGetDeviceCount(data.ErrorCode, data.ErrorMessage, data.Count); } break; case CommandType.GetDeviceDescription_Type: var deviceinfo = { sn: data.SN, manufacturer: data.Manufacturer, productname: data.ProductName, productmodel: data.ProductModel, fw_version: data.FW_Version, hw_version: data.HW_Version, image_width: data.Image_Width, iamge_height: data.Image_Height, dpi: data.DPI, device_id: data.Device_ID }; if (thisws.OnGetDeviceDescription) { thisws.OnGetDeviceDescription(data.ErrorCode, data.ErrorMessage, deviceinfo); } break; case CommandType.CaptureFingerData_Type: var capimage = { image_format: data.Image_Format, image_data: data.Image_Data, feature_format: data.Feature_Format, feature_data: data.Feature_Data, quality: data.Image_Quality, NFIQ: data.Image_NFIQ }; if (thisws.OnCaptureFingerData) { thisws.OnCaptureFingerData(data.ErrorCode, data.ErrorMessage, capimage); } break; case CommandType.StartCapture_Type: var startimage = { image_format: ImageFormatType.IBmp, image_data: data.Image_Data, feature_format: data.Feature_Format, feature_data: data.Feature_Data, quality: data.Image_Quality, NFIQ: data.Image_NFIQ }; if (thisws.OnStartCapture) { thisws.OnStartCapture(data.ErrorCode, data.ErrorMessage, startimage); } break; case CommandType.StopCapture_Type: if (thisws.OnStopCapture) { thisws.OnStopCapture(data.ErrorCode, data.ErrorMessage); } break; case CommandType.GeneralizeTemplate_Type: if (thisws.OnGeneralizeTemplate) { thisws.OnGeneralizeTemplate(data.ErrorCode, data.ErrorMessage, data.Template_Data); } break; case CommandType.Verify_Type: if (thisws.OnVerify) { thisws.OnVerify(data.ErrorCode, data.ErrorMessage, data.Verify_Score, data.Verify_Result); } break; case CommandType.SetOption_Type: if (thisws.OnSetOption) { thisws.OnSetOption(data.ErrorCode, data.ErrorMessage); } break; case CommandType.BmpToRaw_Type: if (thisws.OnBmpToRaw) { thisws.OnBmpToRaw(data.ErrorCode, data.ErrorMessage, data.Raw_ImageData); } break; case CommandType.BmpToWSQ_Type: if (thisws.OnBmpToWSQ) { thisws.OnBmpToWSQ(data.ErrorCode, data.ErrorMessage, data.WSQ_ImageData); } break; case CommandType.BmpToISO_Type: if (thisws.OnBmpToISO) { thisws.OnBmpToISO(data.ErrorCode, data.ErrorMessage, data.ISO_ImageData); } break; case CommandType.BmpToANSI_Type: if (thisws.OnBmpToANSI) { thisws.OnBmpToANSI(data.ErrorCode, data.ErrorMessage, data.ANSI_ImageData); } break; case CommandType.CID_Init_Type: if (thisws.OnCID_Init) { thisws.OnCID_Init(data.ErrorCode, data.ErrorMessage); } break; case CommandType.CID_Close_Type: if (thisws.OnCID_Close) { thisws.OnCID_Close(data.ErrorCode, data.ErrorMessage); } break; case CommandType.CID_GetChannelCount_Type: if (thisws.OnCID_GetCount) { thisws.OnCID_GetCount(data.ErrorCode, data.ErrorMessage, data.Count); } break; case CommandType.CID_BeginCapture_Type: if (thisws.OnCID_BeginCapture) { thisws.OnCID_BeginCapture(data.ErrorCode, data.ErrorMessage); } break; case CommandType.CID_GetFPRawData_Type: if (thisws.OnCID_GetRawData) { thisws.OnCID_GetRawData(data.ErrorCode, data.ErrorMessage, data.RawData, data.FeaData); } break; case CommandType.CID_GetFPBmpData_Type: if (thisws.OnCID_GetBmpData) { thisws.OnCID_GetBmpData(data.ErrorCode, data.ErrorMessage, data.BmpData, data.FeaData); } break; case CommandType.CID_EndCapture_Type: if (thisws.OnCID_EndCapture) { thisws.OnCID_EndCapture(data.ErrorCode, data.ErrorMessage); } break; case CommandType.CID_GetVersion_Type: if (thisws.OnCID_GetVersion) { thisws.OnCID_GetVersion(data.ErrorCode, data.ErrorMessage, data.Version); } break; case CommandType.CID_GetDesc_Type: if (thisws.OnCID_GetDesc) { thisws.OnCID_GetDesc(data.ErrorCode, data.ErrorMessage, data.Description); } break; case CommandType.CID_Alg_GetVersion_Type: if (thisws.OnCID_Alg_GetVersion) { thisws.OnCID_Alg_GetVersion(data.ErrorCode, data.ErrorMessage, data.Version); } break; case CommandType.CID_Alg_Begin_Type: if (thisws.OnCID_Alg_Begin) { thisws.OnCID_Alg_Begin(data.ErrorCode, data.ErrorMessage); } break; case CommandType.CID_Alg_FeatureExtract_Type: if (thisws.OnCID_Alg_FeatureExtract) { thisws.OnCID_Alg_FeatureExtract(data.ErrorCode, data.ErrorMessage, data.FeatureData); } break; case CommandType.CID_Alg_FeatureMatch_Type: if (thisws.OnCID_Alg_FeatureMatch) { thisws.OnCID_Alg_FeatureMatch(data.ErrorCode, data.ErrorMessage, data.Similarity); } break; case CommandType.CID_Alg_ImageMatch_Type: if (thisws.OnCID_Alg_ImageMatch) { thisws.OnCID_Alg_ImageMatch(data.ErrorCode, data.ErrorMessage, data.Similarity); } break; case CommandType.CID_Alg_GetQualityScore_Type: if (thisws.OnCID_Alg_GetQualityScore) { thisws.OnCID_Alg_GetQualityScore(data.ErrorCode, data.ErrorMessage, data.Score); } break; case CommandType.CID_Alg_End_Type: if (thisws.OnCID_Alg_End) { thisws.OnCID_Alg_End(data.ErrorCode, data.ErrorMessage); } break; case CommandType.TrustLink_GetDeviceInfo_Type: if (thisws.OnTrustLink_GetDeviceInfo) { thisws.OnTrustLink_GetDeviceInfo(data.ErrorCode, data.ErrorMessage, data.MACAdress, data.IPAdress, data.HostName); } break; case CommandType.ARA_FeaConv_Type: if (thisws.OnARA_FeaConv) { thisws.OnARA_FeaConv(data.ErrorCode, data.ErrorMessage, data.Fea_Dst_Data); } break; case CommandType.ARA_GetCurrentDeviceList_Type: if (thisws.OnARA_GetCurrentDeviceList) { thisws.OnARA_GetCurrentDeviceList(data.ErrorCode, data.ErrorMessage, data.List); } break; case CommandType.FRO900_OpenDevice_Type: if (thisws.OnFRO900_OpenDevice) { thisws.OnFRO900_OpenDevice(data.ErrorCode, data.ErrorMessage); } break; case CommandType.FRO900_GetDeviceCount_Type: if (thisws.OnFRO900_GetDeviceCount) { thisws.OnFRO900_GetDeviceCount(data.ErrorCode, data.ErrorMessage, data.Count); } break; case CommandType.FRO900_CaptureFingerPrintData_Type: if (data.PreviewImg != null) { if (thisws.OnFRO900_CaptureFingerPrintData) { thisws.OnFRO900_CaptureFingerPrintData(data.ErrorCode, data.ErrorMessage, null, null, null, null, data.PreviewImg); } } else { var FRO900_Capture_image_1 = { image_format: data.Image_Format, image_data: data.Image_Data_1, feature_format: data.Feature_Format, feature_data: data.Feature_Data_1, quality: data.Image_Quality_1, NFIQ: data.Image_NFIQ_1 }; var FRO900_Capture_image_2 = { image_format: data.Image_Format, image_data: data.Image_Data_2, feature_format: data.Feature_Format, feature_data: data.Feature_Data_2, quality: data.Image_Quality_2, NFIQ: data.Image_NFIQ_2 }; var FRO900_Capture_image_3 = { image_format: data.Image_Format, image_data: data.Image_Data_3, feature_format: data.Feature_Format, feature_data: data.Feature_Data_3, quality: data.Image_Quality_3, NFIQ: data.Image_NFIQ_3 }; var FRO900_Capture_image_4 = { image_format: data.Image_Format, image_data: data.Image_Data_4, feature_format: data.Feature_Format, feature_data: data.Feature_Data_4, quality: data.Image_Quality_4, NFIQ: data.Image_NFIQ_4 }; if (thisws.OnFRO900_CaptureFingerPrintData) { thisws.OnFRO900_CaptureFingerPrintData(data.ErrorCode, data.ErrorMessage, FRO900_Capture_image_1, FRO900_Capture_image_2, FRO900_Capture_image_3, FRO900_Capture_image_4, null); } } break; case CommandType.FRO900_CloseDevice_Type: if (thisws.OnFRO900_OpenDevice) { thisws.OnFRO900_OpenDevice(data.ErrorCode, data.ErrorMessage); } break; case CommandType.FRO900_GeneralizeTemplate_Type: if (thisws.OnGeneralizeTemplate) { thisws.OnFRO900_GeneralizeTemplate(data.ErrorCode, data.ErrorMessage, data.Template_Data); } break; case CommandType.FRO900_Verify_Type: if (thisws.OnVerify) { thisws.OnFRO900_Verify(data.ErrorCode, data.ErrorMessage, data.Verify_Score, data.Verify_Result); } break; case CommandType.Iris_InitDevice_Type: if (thisws.OnIris_InitDevice) { thisws.OnIris_InitDevice(data.ErrorCode, data.ErrorMessage); } break; case CommandType.Iris_StartCapture_Type: if (thisws.OnIris_StartCapture) { thisws.OnIris_StartCapture(data.ErrorCode, data.ErrorMessage, data.Face_Image, data.Distance); } break; case CommandType.Iris_StartCapture2_Type: if (thisws.OnIris_StartCapture2) { thisws.OnIris_StartCapture2(data.ErrorCode, data.ErrorMessage, data.Left_Eye_Image, data.Left_Eye_Data, data.Right_Eye_Image, data.Right_Eye_Data); } break; case CommandType.Iris_StartFastCapture_Type: if (thisws.OnIris_StartCapture) { thisws.OnIris_StartCapture(data.ErrorCode, data.ErrorMessage, data.Face_Image, data.Distance); } break; case CommandType.Iris_StartFastCapture2_Type: if (thisws.OnIris_StartCapture2) { thisws.OnIris_StartCapture2(data.ErrorCode, data.ErrorMessage, data.Left_Eye_Image, data.Left_Eye_Data, data.Right_Eye_Image, data.Right_Eye_Data); } break; case CommandType.Iris_StopCapture_Type: if (thisws.OnIris_StopCapture) { thisws.OnIris_StopCapture(data.ErrorCode, data.ErrorMessage); } break; case CommandType.Iris_StartVerify_Type: if (thisws.OnIris_StartVerify) { thisws.OnIris_StartVerify(data.ErrorCode, data.ErrorMessage, data.Face_Image, data.Distance); } break; case CommandType.Iris_StartVerify2_Type: if (thisws.OnIris_StartVerify2) { thisws.OnIris_StartVerify2(data.ErrorCode, data.ErrorMessage, data.Verify_Result); } break; case CommandType.Iris_StopVerify_Type: if (thisws.OnIris_StopVerify) { thisws.OnIris_StopVerify(data.ErrorCode, data.ErrorMessage); } break; case CommandType.Iris_ReleaseDevice_type: if (thisws.OnIris_ReleaseDevice) { thisws.OnIris_ReleaseDevice(data.ErrorCode, data.ErrorMessage); } break; case CommandType.Iris_SetOptions_Type: if (thisws.OnIris_SetOptions) { thisws.OnIris_SetOptions(data.ErrorCode, data.ErrorMessage); } break; case CommandType.ARA_ReadIDCard_Type: var infodata = { chinese_name: data.CNName, sex: data.Sex, birth: data.Birth, idnum: data.IDNum, expdatebegin: data.ExpDateBegin, expdateend: data.ExpDateEnd, authority: data.Authority, english_name: data.ENName, country: data.Country, version: data.Version, address: data.Address, passnum: data.PassNum, issuecount: data.IssueCount, nation: data.Nation, newaddress: data.NewAddress, feature1: data.Feature1, feature2: data.Feature2, photodata: data.PhotoData, }; if (thisws.OnARA_ReadIDCard) { thisws.OnARA_ReadIDCard(data.ErrorCode, data.ErrorMessage, data.CardType, infodata); } break; case CommandType.FingerKey_OpenDevice_Type: if (thisws.OnFingerKey_OpenDevice) { thisws.OnFingerKey_OpenDevice(data.ErrorCode, data.ErrorMessage); } break; case CommandType.FingerKey_CloseDevice_Type: if (thisws.OnFingerKey_CloseDevice) { thisws.OnFingerKey_CloseDevice(data.ErrorCode, data.ErrorMessage); } break; case CommandType.FingerKey_GetDeviceInformation_Type: var keyinfo = { manufacturer: data.Manufacturer, issuer: data.Issuer, label: data.Label, sn: data.SN, hwver: data.HWVer, fwver: data.FWVer, }; if (thisws.OnFingerKey_GetDeviceInformation) { thisws.OnFingerKey_GetDeviceInformation(data.ErrorCode, data.ErrorMessage, keyinfo); } break; case CommandType.FingerKey_CaptureFingerData_Type: if (thisws.OnFingerKey_CaptureFingerData) { thisws.OnFingerKey_CaptureFingerData(data.ErrorCode, data.ErrorMessage, data.Image_Data, data.Feature_Data, data.Image_Quality); } break; case CommandType.FingerKey_ImportFingerPrint_Type: if (thisws.OnFingerKey_ImportFingerPrint) { thisws.OnFingerKey_ImportFingerPrint(data.ErrorCode, data.ErrorMessage); } break; case CommandType.Camera_InitDevice_Type: if (thisws.OnCamera_InitDevice) { thisws.OnCamera_InitDevice(data.ErrorCode, data.ErrorMessage); } break; case CommandType.Camera_ReleaseDevice_Type: if (thisws.OnCamera_ReleaseDevice) { thisws.OnCamera_ReleaseDevice(data.ErrorCode, data.ErrorMessage); } break; case CommandType.Camera_StartCapture_Type: if (thisws.OnCamera_StartCapture) { thisws.OnCamera_StartCapture(data.ErrorCode, data.ErrorMessage, data.ImageData, data.LiveDetect, data.FaceDetect, data.FaceQuality); } break; case CommandType.Camera_StopCapture_Type: if (thisws.OnCamera_StopCapture) { thisws.OnCamera_StopCapture(data.ErrorCode, data.ErrorMessage); } break; case CommandType.Camera_SetOption_Type: if (thisws.OnCamera_SetOption) { thisws.OnCamera_SetOption(data.ErrorCode, data.ErrorMessage); } break; default: if (thisws.OnOtherError) { thisws.OnOtherError(data.ResponseType, data.ErrorCode, data.ErrorMessage); } break; } }; this.ws.onclose = function () { thisws.isConnect = false; alert("未连接设备,请检查指纹驱动是否开启(或重启驱动再次尝试)") console.log("Disconnect"); }; }; Client.prototype.Disconnect_Server = function () { var thisws = this; this.ws.close(); }; return Client; }()); public/zhiwenDemo/app.css
New file @@ -0,0 +1,121 @@ html, body { width: 100%; height: 174px; font-family: "Segoe UI", sans-serif; padding: 0 !important; margin-left: 0 !important; margin-right: 0 !important; margin-bottom: 0 !important; } span { font-style: italic; } #zhiwenOur { width: 100%; min-width: 208px; height: 174px; display: flex; align-items: center; justify-content: space-around; flex-direction: column; } #main { width: 100%; height: 100%; display: flex; align-items: center; justify-content: space-around; } #imgs { width: 100%; height: 180px; /* border: 1px dashed #fff; */ /* border-image:url(/img/zhiwen/zhi.png) 30 300 round; */ display: flex; align-items: center; justify-content: space-around; } #img { border-radius: 6px; border: 1px dashed rgb(209, 209, 209); /* width: 180px; height: 180px; */ height: 182px; width: 138px; position: relative; top: 6px; } img[src=""], img:not([src]) { opacity: 0.9; } #butDiv { width: 100%; height: 180px; display: flex; align-items: center; justify-content: space-around; } #down { width: 100%; height: 20px; display: flex; align-items: center; justify-content: space-around; } #zhiwentip { font-size: 12px; position: relative; top: 20px; display: none; color: #606266; } #zhiwentipok { font-size: 12px; position: relative; top: 20px; display: none; color: #606266; } #zhiwentipno { font-size: 12px; position: relative; top: 20px; display: none; color: #606266; } #connect_server { width: 66px; height: 40px; border: none; background-color: #409eff; border-radius: 5px; color: #fff; position: relative; left: 13px; display: none; } #closeG { width: 66px; height: 40px; border: none; background-color: #e6a23c; border-radius: 5px; color: #fff; display: none; position: relative; left: 13px; } #onceGgin { width: 66px; height: 40px; border: none; background-color: #409eff; border-radius: 5px; color: #fff; display: none; position: relative; left: 13px; } public/zhiwenDemo/app.js
New file @@ -0,0 +1,2420 @@ var operate_model; var client = new Client(); var device_id; var dpi; var feature1; var feature2; var feature3; var flag = 0; var bmpdata; var imagewidth = 0; var imageheight = 0; var LED = 0; var Status = 0; var begin_cap = false; var show_img_index = 0; var CID_img_1; var CID_img_2; var CID_fea_1; var CID_fea_2; var ImageMatch = false; var CID_score_thresh; var language = 1; var MultiFinger = 0; var Iris_capture_mode = 1; var Fkey_fea1; var Fkey_fea2; var Fkey_fea3; var Fkey_fea4; var Fkey_fea5; var Fkey_fea6; var Fkey_capcount = 0; var butERRoR = 0; var butTime; var isBegin = false; var imgSRC;//图片指纹信息 var imgBMP;//BMP格式指纹信息 var CID_img_raw;//RAW格式指纹信息 var featuredatas;//特征值 var featuredatasNum;//完整度 var isoks = false; var isOver = false;//控制是否完成本次指纹采集 function changelanguage_trustfinger() { language = language ^ 1; document.getElementById("change_language").innerHTML = change_description[language]; document.getElementById("title").innerHTML = title_trustfinger_description[language]; document.getElementById("link").innerHTML = link_description[language]; document.getElementById("connect_server").innerHTML = connect_description[language]; document.getElementById("open_device").innerHTML = open_description[language]; document.getElementById("close_device").innerHTML = close_description[language]; document.getElementById("device_count").innerHTML = device_count_description[language]; document.getElementById("device_desc").innerHTML = device_desc_description[language]; document.getElementById("capture1").innerHTML = cap1_description[language]; document.getElementById("capture2").innerHTML = cap2_description[language]; document.getElementById("capture3").innerHTML = cap3_description[language]; document.getElementById("generalize").innerHTML = gen_description[language]; document.getElementById("verify").innerHTML = verify_description[language]; document.getElementById("start").innerHTML = startcap_description[language]; document.getElementById("end").innerHTML = endcap_description[language]; if (Status == 1) { if (LED == 1) { document.getElementById("red").innerHTML = close_red_description[language]; document.getElementById("green").innerHTML = open_green_description[language]; } else { document.getElementById("red").innerHTML = open_red_description[language]; document.getElementById("green").innerHTML = close_green_description[language]; } } else { document.getElementById("red").innerHTML = open_red_description[language]; document.getElementById("green").innerHTML = open_green_description[language]; } document.getElementById("b2r").innerHTML = b2r_description[language]; document.getElementById("b2wsq").innerHTML = b2w_description[language]; document.getElementById("b2iso").innerHTML = b2i_description[language]; document.getElementById("b2ansi").innerHTML = b2a_description[language]; } function changelanguage_CID() { language = language ^ 1; document.getElementById("change_language").innerHTML = change_description[language]; document.getElementById("title").innerHTML = title_CID_description[language]; document.getElementById("link").innerHTML = link_description[language]; document.getElementById("connect_server").innerHTML = connect_description[language]; document.getElementById("open_device").innerHTML = init_description[language]; document.getElementById("close_device").innerHTML = close_description[language]; document.getElementById("device_count").innerHTML = device_count_description[language]; document.getElementById("device_desc").innerHTML = device_desc_description[language]; document.getElementById("cap1").innerHTML = cap1_description[language]; document.getElementById("cap2").innerHTML = cap2_description[language]; document.getElementById("ext1").innerHTML = extract1_description[language]; document.getElementById("ext2").innerHTML = extract2_description[language]; document.getElementById("feaverify").innerHTML = feature_verify_description[language]; document.getElementById("imgverify").innerHTML = image_verify_description[language]; document.getElementById("start").innerHTML = startcap_description[language]; document.getElementById("end").innerHTML = endcap_description[language]; } function changelanguage_FRO900() { language = language ^ 1; document.getElementById("change_language").innerHTML = change_description[language]; document.getElementById("title").innerHTML = title_FRO900_description[language]; document.getElementById("link").innerHTML = link_description[language]; document.getElementById("connect_server").innerHTML = connect_description[language]; document.getElementById("open_device").innerHTML = open_description[language]; document.getElementById("close_device").innerHTML = close_description[language]; document.getElementById("device_count").innerHTML = device_count_description[language]; document.getElementById("capture1").innerHTML = cap1_description[language]; document.getElementById("capture2").innerHTML = cap2_description[language]; document.getElementById("capture3").innerHTML = cap3_description[language]; document.getElementById("generalize").innerHTML = gen_description[language]; document.getElementById("verify").innerHTML = verify_description[language]; document.getElementById("capture_left").innerHTML = FRO900_capture_left_4[language]; document.getElementById("capture_right").innerHTML = FRO900_capture_right_4[language]; document.getElementById("capture_thumb").innerHTML = FRO900_capture_thumb_2[language]; } function changelanguage_Iris() { language = language ^ 1; document.getElementById("change_language").innerHTML = change_description[language]; document.getElementById("title").innerHTML = title_FRO900_description[language]; document.getElementById("link").innerHTML = link_description[language]; document.getElementById("connect_server").innerHTML = connect_description[language]; document.getElementById("open_device").innerHTML = init_description[language]; document.getElementById("release_device").innerHTML = Iris_release_device[language]; document.getElementById("startcap").innerHTML = Iris_start_cap[language]; document.getElementById("stopcap").innerHTML = Iris_stop_cap[language]; document.getElementById("startver").innerHTML = Iris_start_ver[language]; document.getElementById("stopver").innerHTML = Iris_stop_ver[language]; document.getElementById("distance_desc").innerHTML = Iris_distance_desc[language]; } window.onload = function () { client.OnOpenDevice = function (code, msg) { if (code == 0) { if (language) { alert("打开设备成功"); } else { alert("Open Success"); } } else { if (language) { alert("打开设备失败," + code + " " + msg); } else { alert("Open Failed," + code + " " + msg); } } }; client.OnCloseDevice = function (code, msg) { if (code == 0) { if (language) { console.log("关闭设备成功OnCloseDevice"); } else { alert("Close Success"); } } else { if (language) { alert("关闭设备失败," + code + " " + msg); } else { alert("Close Failed," + code + " " + msg); } } }; client.OnGetDeviceCount = function (code, msg, count) { if (code == 0) { if (language) { alert("设备数量为:" + count); } else { alert("Device count:" + count); } } else { if (language) { alert("获取设备数量失败," + code + " " + msg); } else { alert("Get Device Count Failed," + code + " " + msg); } } }; client.OnGetDeviceDescription = function (code, msg, info) { if (code == 0) { alert("Serial Number:" + info.sn + "\r\n" + "Manufacturer Name:" + info.manufacturer + "\r\n" + "Product Name:" + info.productname); device_id = info.device_id; imagewidth = info.image_width; imageheight = info.iamge_height; dpi = info.dpi; } else { if (language) { alert("获取设备信息失败," + code + " " + msg); } else { alert("Get Device Description Failed," + code + " " + msg); } } }; client.OnCaptureFingerData = function (code, msg, image) { if (code == 0) { if (image.image_format == ImageFormatType.IBmp) { if (flag % 3 == 0) { var image_area = document.getElementById("img3"); image_area.src = "data:image/bmp;base64," + image.image_data; } else if (flag % 3 == 1) { var image_area = document.getElementById("img1"); image_area.src = "data:image/bmp;base64," + image.image_data; } else { var image_area = document.getElementById("img2"); image_area.src = "data:image/bmp;base64," + image.image_data; } bmpdata = image.image_data; } if (flag % 3 == 0) { feature3 = image.feature_data; } else if (flag % 3 == 1) { feature1 = image.feature_data; } else { feature2 = image.feature_data; } } else { if (language) { alert("采集失败," + code + " " + msg); } else { alert("Capture Failed," + code + " " + msg); } } }; client.OnStartCapture = function (code, msg, image) { if (code == 0 || code == -211) { var image_area = document.getElementById("img1"); image_area.src = "data:image/bmp;base64," + image.image_data; } else { if (language) { alert("开始预览失败," + code + " " + msg); } else { alert("Start Preview Failed," + code + " " + msg); } } }; client.OnStopCapture = function (code, msg) { if (code == 0) { console.log("Stop Success"); } else { if (language) { alert("停止预览失败," + code + " " + msg); } else { alert("Stop Preview Failed," + code + " " + msg); } } }; client.OnGeneralizeTemplate = function (code, msg, template) { if (code == 0) { if (language) { alert("合成模板成功"); } else { alert("Generalize Success"); } var img_text = document.getElementById("imgdata"); img_text.value = template; } else { if (language) { alert("合成模板失败," + code + " " + msg); } else { alert("Generalize Failed," + code + " " + msg); } } }; client.OnVerify = function (code, msg, score, result) { if (code == 0) { if (result == 0) { if (language) { alert("比对结果为不匹配"); } else { alert("Mismatch"); } } else { if (language) { alert("比对成功,分数为" + score); } else { alert("Matching Success,Score is" + " " + score); } } } else { if (language) { alert("比对失败," + code + " " + msg); } else { alert("Match Failed," + code + " " + msg); } } }; client.OnSetOption = function (code, msg) { if (code == 0) { console.log("Set LED Success"); var red_button = document.getElementById("red"); var green_button = document.getElementById("green"); if (LED == 1) { if (Status == 1) { green_button.disabled = true; red_button.innerHTML = close_red_description[language]; } else { green_button.disabled = false; red_button.innerHTML = open_red_description[language]; } } else if (LED == 0) { if (Status == 1) { red_button.disabled = true; green_button.innerHTML = close_green_description[language]; } else { red_button.disabled = false; green_button.innerHTML = open_green_description[language]; } } } else { if (language) { alert("LED灯操作失败," + code + " " + msg); } else { alert("Set LED Failed," + code + " " + msg); } var red_button = document.getElementById("red"); var green_button = document.getElementById("green"); red_button.disabled = false; green_button.disabled = false; red_button.innerHTML = open_red_description[language]; green_button.innerHTML = open_green_description[language]; LED = 0; Status = 0; } }; client.OnBmpToRaw = function (code, msg, imagedata) { // console.log(code, msg, "BMP格式转换成RAW"); if (code == 0) { client.CID_Alg_GetQualityScore(imagedata); CID_img_raw = imagedata; } else { client.CID_EndCapture(0); begin_cap = false; alert("格式转换失败," + code + " " + msg); } }; // client.OnBmpToRaw = function (code, msg, imagedata) { // // console.log(code) // console.log(code, msg, "BMP格式转换成RAW"); // if (code == 0) { // if (operate_model == 1) { // if (ImageMatch) { // client.CID_Alg_ImageMatch(imagedata, CID_fea_2); // ImageMatch = false; // } // else { // client.CID_Alg_FeatureExtract(ID_FingerPosition.UNKNOWN, imagedata); // } // } // else if (operate_model == 2) { // client.CID_Alg_GetQualityScore(imagedata); // // console.log(imagedata) // CID_img_raw = imagedata; // } // else { // if (language) { // alert("格式转换成功"); // var img_text = document.getElementById("imgdata"); // img_text.value = imagedata; // } // else { // alert("Format conversion Success"); // var img_text = document.getElementById("imgdata"); // img_text.value = imagedata; // } // } // } // else { // if (operate_model == 2) { // client.CID_EndCapture(0); // begin_cap = false; // } // if (language) { // alert("格式转换失败," + code + " " + msg); // } // else { // alert("Format conversion Failed," + code + " " + msg); // } // } // }; client.OnBmpToWSQ = function (code, msg, imagedata) { if (code == 0) { if (language) { alert("格式转换成功"); var img_text = document.getElementById("imgdata"); img_text.value = imagedata; } else { alert("Format conversion Success"); var img_text = document.getElementById("imgdata"); img_text.value = imagedata; } } else { if (language) { alert("格式转换失败," + code + " " + msg); } else { alert("Format conversion Failed," + code + " " + msg); } } }; client.OnBmpToISO = function (code, msg, imagedata) { if (code == 0) { if (language) { alert("格式转换成功"); var img_text = document.getElementById("imgdata"); img_text.value = imagedata; } else { alert("Format conversion Success"); var img_text = document.getElementById("imgdata"); img_text.value = imagedata; } } else { if (language) { alert("格式转换失败," + code + " " + msg); } else { alert("Format conversion Failed," + code + " " + msg); } } }; client.OnBmpToANSI = function (code, msg, imagedata) { if (code == 0) { if (language) { alert("格式转换成功"); var img_text = document.getElementById("imgdata"); img_text.value = imagedata; } else { alert("Format conversion Success"); var img_text = document.getElementById("imgdata"); img_text.value = imagedata; } } else { if (language) { alert("格式转换失败," + code + " " + msg); } else { alert("Format conversion Failed," + code + " " + msg); } } }; client.OnCID_Init = function (code, msg) { if (code == 1) { client.CID_Alg_Begin(); } else { if (language) { // alert("设备初始化发生错误 错误码:" + code); } else { alert("Init Device Error ErrorCode:" + code); } } }; client.OnCID_Close = function (code, msg) { if (code == 1) { if (language) { // console.log("关闭设备成功OnCID_Close"); } else { alert(msg); } } else { if (language) { console.log("关闭设备发生错误 错误码:" + code); } else { alert("Close Device Error ErrorCode:" + code); } } }; client.OnCID_GetCount = function (code, msg, count) { if (code == 1) { if (language) { alert("设备数量:" + count); } else { alert("Device Count:" + count); } } else { if (language) { alert("获取设备数量发生错误 错误码:" + code); } else { alert("Get Device Count Error ErrorCode:" + code); } } }; client.OnCID_GetDesc = function (code, msg, desc) { if (code == 1) { if (language) { alert("设备信息:" + desc); } else { alert("Device Description:" + desc); } } else { if (language) { alert("获取设备信息发生错误 错误码:" + code); } else { alert("Get Device Description Error ErrorCode:" + code); } } }; client.OnCID_BeginCapture = function (code, msg) { if (code == 1) { client.CID_GetFPBmpData(0); } else { if (language) { alert("开始采集发生错误 错误码:" + code); } else { alert("Begin Capture Error ErrorCode:" + code); } } }; client.OnCID_GetBmpData = function (code, msg, imagedata, feadata) { // console.log(feadata) if (code == 1) { switch (show_img_index) { case 0: var image_area = document.getElementById("img"); image_area.src = "data:image/bmp;base64," + imagedata; imgSRC = "data:image/bmp;base64," + imagedata; imgBMP = imagedata; break; case 1: var image_area1 = document.getElementById("img1"); image_area1.src = "data:image/bmp;base64," + imagedata; CID_img_1 = imagedata; break; case 2: var image_area2 = document.getElementById("img2"); image_area2.src = "data:image/bmp;base64," + imagedata; CID_img_2 = imagedata; break; } if (begin_cap) { client.BmpToRaw(imagedata, 256, 360); } } else { client.CID_EndCapture(0); begin_cap = false; if (language) { // console.log("采集发生错误 错误码:" + code); } else { alert("GetBmpData Error ErrorCode:" + code); } } }; client.OnCID_EndCapture = function (code, msg) { if (code == 1) { if (begin_cap) { client.CID_BeginCapture(0); } } else { begin_cap = false; if (language) { // console.log("手动关闭 错误码:" + code); } else { alert("End Capture Error ErrorCode:" + code); } } }; client.OnCID_Alg_FeatureExtract = function (code, msg, featuredata) { if (code == 1) { // console.log(show_img_index, "show_img_indexshow_img_indexshow_img_index") switch (show_img_index) { case 0: // var fea0_text = document.getElementById("Fea1"); // fea0_text.value = featuredata; // 输出特征值 featuredatas = featuredata; // closeGfn(); // console.log(featuredatas) isoks = true; isOver = true; break; case 1: CID_fea_1 = featuredata; var fea1_text = document.getElementById("Fea1"); fea1_text.value = featuredata; break; case 2: CID_fea_2 = featuredata; var fea2_text = document.getElementById("Fea2"); fea2_text.value = featuredata; break; } // if (language) { // console.log("特征提取成功"); // let butBegin = document.getElementById("connect_server"); // butBegin.innerText = "重新录制"; // butBegin.style.backgroundColor = "#409EFF"; isoks = true; isOver = true; client.CID_Close(); let butBegin = document.getElementById("connect_server"); butBegin.style.display = "none" let closeGs = document.getElementById("closeG"); closeGs.style.display = "none" let onceGgin = document.getElementById("onceGgin"); onceGgin.style.display = "block" let zhiwentip = document.getElementById("zhiwentip"); zhiwentip.style.display = "none"; let zhiwentipok = document.getElementById("zhiwentipok"); zhiwentipok.style.display = "block"; let zhiwentipno = document.getElementById("zhiwentipno"); zhiwentipno.style.display = "none"; } else { if (language) { alert("特征提取发生错误 错误码:" + code); } else { alert("Extract Feature Failed ErrorCode:" + code); } } }; client.OnCID_Alg_Begin = function (code, msg) { if (code == 1) { if (language) { // console.log("初始化成功"); show_img_index = 0; begin_cap = true; operate_model = 2; client.CID_BeginCapture(0); } else { alert("Init Successfully"); } } else { if (language) { // console.log("算法初始化发生错误 错误码:" + code); } else { alert("Init Algorithm Failed ErrorCode:" + code); } } }; client.OnCID_Alg_FeatureMatch = function (code, msg, similarity) { if (code == 1) { if (language) { alert("比对成功 相似度:" + similarity); } else { alert("Matching Success Match Similarity:" + similarity); } } else { if (language) { alert("比对发生错误 错误码:" + code); } else { alert("Matching Failed ErrorCode:" + code); } } }; client.OnCID_Alg_ImageMatch = function (code, msg, similarity) { if (code == 1) { if (language) { alert("比对成功 相似度:" + similarity); } else { alert("Matching Success Match Similarity:" + similarity); } } else { if (language) { alert("比对发生错误 错误码:" + code); } else { alert("Matching Failed ErrorCode:" + code); } } }; client.OnCID_Alg_GetQualityScore = function (code, msg, score) { //停止获取 // console.log(code, score, "停止?"); if (code == 1) { if (operate_model == 2) { // var s = document.getElementById("score"); // s.innerText = score.toString(); if (score >= 60) { begin_cap = false; isoks = true; isOver = true; client.CID_EndCapture(0); // console.log(ID_FingerPosition.UNKNOWN, 'ID_FingerPosition.UNKNOWN') client.CID_Alg_FeatureExtract(ID_FingerPosition.UNKNOWN, CID_img_raw); } else { client.CID_EndCapture(0); } } } else if (code == -9 && operate_model == 2) { client.CID_EndCapture(0); } else { if (operate_model == 2) { client.CID_EndCapture(0); begin_cap = false; } if (language) { // alert("获取质量分数发生错误 错误码:" + code); } else { alert("Get quality score failed ErrorCode:" + code); } } }; client.OnTrustLink_GetDeviceInfo = function (code, msg, macadress, ipadress, hostname) { if (code != 0) { alert(msg); } else { alert("MACAdress:" + macadress + "\r\n" + "IPAdress:" + ipadress + "\r\n" + "HostName:" + hostname); } }; client.OnARA_FeaConv = function (code, msg, feadata) { if (code != 0) { alert(msg); } else { var fea1_text = document.getElementById("Fea1"); fea1_text.value = feadata; // 输出特征值 // console.log(feadata) } }; client.OnARA_GetCurrentDeviceList = function (code, msg, list) { if (code != 0) { alert(msg); } else { if (list != null) { var size = list.length; var dev_list = ""; for (var i = 0; i < size; i++) { dev_list += "Device Name:"; dev_list += list[i].DeviceName; dev_list += "\r\n"; dev_list += "Device Information:"; dev_list += list[i].DeviceInfo; dev_list += "\r\n"; dev_list += "Device Number:"; dev_list += list[i].ConnectNum; dev_list += "\r\n"; } alert(dev_list); } } }; client.OnARA_ReadIDCard = function (code, msg, cardtype, info) { if (code == 0) { switch (cardtype) { case IDCardType.IDCard_People: document.all['CardType'].value = "中华人民共和国居民身份证"; document.all['Name'].value = info.chinese_name; document.all['Sex'].value = info.sex; document.all['Nation'].value = info.nation; document.all['Born'].value = info.birth; document.all['Address'].value = info.address; document.all['NewAddress'].value = info.newaddress; document.all['CardNo'].value = info.idnum; document.all['Police'].value = info.authority; document.all['ActivityLFrom'].value = info.expdatebegin; document.all['ActivityLTo'].value = info.expdateend; if (info.feature1 != undefined || info.feature2 != undefined) { document.all['FPInfo1'].value = info.feature1; document.all['FPInfo2'].value = info.feature2; } var img1 = document.getElementById("imgPre"); img1.src = "data:image/bmp;base64," + info.photodata; break; case IDCardType.IDCard_GAT: document.all['CardType'].value = "中华人民共和国港澳台居民居住证"; document.all['Name'].value = info.chinese_name; document.all['Sex'].value = info.sex; document.all['Born'].value = info.birth; document.all['CardNo'].value = info.idnum; document.all['ActivityLFrom'].value = info.expdatebegin; document.all['ActivityLTo'].value = info.expdateend; document.all['Police'].value = info.authority; document.all['Address'].value = info.address; document.all['PassNo'].value = info.passnum; document.all['IssueCount'].value = info.issuecount; if (info.feature1 != undefined || info.feature2 != undefined) { document.all['FPInfo1'].value = info.feature1; document.all['FPInfo2'].value = info.feature2; } var img2 = document.getElementById("imgPre"); img2.src = "data:image/bmp;base64," + info.photodata; break; case IDCardType.IDCard_Foreign: document.all['CardType'].value = "中华人民共和国外国人永久居留身份证"; document.all['Name'].value = info.chinese_name; document.all['Sex'].value = info.sex; document.all['Born'].value = info.birth; document.all['CardNo'].value = info.idnum; document.all['ActivityLFrom'].value = info.expdatebegin; document.all['ActivityLTo'].value = info.expdateend; document.all['Police'].value = info.authority; document.all['EnglishName'].value = info.english_name; document.all['Country'].value = info.country; document.all['Version'].value = info.version; if (info.feature1 != undefined || info.feature2 != undefined) { document.all['FPInfo1'].value = info.feature1; document.all['FPInfo2'].value = info.feature2; } var img3 = document.getElementById("imgPre"); img3.src = "data:image/bmp;base64," + info.photodata; break; } } else { if (code == 232) { client.ARA_ReadIDCard(); } else { if (language) { alert("读卡失败," + code + " " + msg); } else { alert("Read card failed," + code + " " + msg); } } } }; client.OnFRO900_OpenDevice = function (code, msg) { if (code == 0) { if (language) { alert("打开设备成功"); } else { alert("Open Success"); } } else { if (language) { alert("打开设备失败," + code + " " + msg); } else { alert("Open Failed," + code + " " + msg); } } }; client.OnFRO900_GetDeviceCount = function (code, msg, count) { if (code == 0) { if (language) { alert("设备数量为:" + count); } else { alert("Device count:" + count); } } else { if (language) { alert("获取设备数量失败," + code + " " + msg); } else { alert("Get Device Count Failed," + code + " " + msg); } } }; client.OnFRO900_CaptureFingerPrintData = function (code, msg, image1, image2, image3, image4, previewimg) { if (code != 0) { if (language) { alert("采集失败," + code + " " + msg); } else { alert("Capture Failed," + code + " " + msg); } } else { if (previewimg != null) { var preimage_area = document.getElementById("preimg"); preimage_area.src = "data:image/bmp;base64," + previewimg; } else { if (MultiFinger == 0) { if (image1.image_format == ImageFormatType.IBmp) { if (flag % 3 == 0) { var image_area = document.getElementById("img3"); image_area.src = "data:image/bmp;base64," + image1.image_data; } else if (flag % 3 == 1) { var image_area = document.getElementById("img1"); image_area.src = "data:image/bmp;base64," + image1.image_data; } else { var image_area = document.getElementById("img2"); image_area.src = "data:image/bmp;base64," + image1.image_data; } } if (flag % 3 == 0) { feature3 = image1.feature_data; } else if (flag % 3 == 1) { feature1 = image1.feature_data; } else { feature2 = image1.feature_data; } var fea1_text = document.getElementById("imgdata"); fea1_text.value = image1.feature_data; } else if (MultiFinger == 1) { if (image1.image_format == ImageFormatType.IBmp) { if (image1.image_data != undefined) { var image_area1 = document.getElementById("img4"); image_area1.src = "data:image/bmp;base64," + image1.image_data; } if (image2.image_data != undefined) { var image_area2 = document.getElementById("img3"); image_area2.src = "data:image/bmp;base64," + image2.image_data; } if (image3.image_data != undefined) { var image_area3 = document.getElementById("img2"); image_area3.src = "data:image/bmp;base64," + image3.image_data; } if (image4.image_data != undefined) { var image_area4 = document.getElementById("img1"); image_area4.src = "data:image/bmp;base64," + image4.image_data; } } } else if (MultiFinger == 2) { if (image1.image_format == ImageFormatType.IBmp) { if (image1.image_data != undefined) { var image_area1 = document.getElementById("img1"); image_area1.src = "data:image/bmp;base64," + image1.image_data; } if (image2.image_data != undefined) { var image_area2 = document.getElementById("img2"); image_area2.src = "data:image/bmp;base64," + image2.image_data; } if (image3.image_data != undefined) { var image_area3 = document.getElementById("img3"); image_area3.src = "data:image/bmp;base64," + image3.image_data; } if (image4.image_data != undefined) { var image_area4 = document.getElementById("img4"); image_area4.src = "data:image/bmp;base64," + image4.image_data; } } } else if (MultiFinger == 3) { if (image1.image_format == ImageFormatType.IBmp) { var image_area1 = document.getElementById("img1"); image_area1.src = "data:image/bmp;base64," + image1.image_data; var image_area2 = document.getElementById("img2"); image_area2.src = "data:image/bmp;base64," + image2.image_data; } } } } }; client.OnFRO900_CloseDevice = function (code, msg) { if (code == 0) { if (language) { console.log("关闭设备成功OnFRO900_CloseDevice"); } else { alert("Close Success"); } } else { if (language) { alert("关闭设备失败," + code + " " + msg); } else { alert("Close Failed," + code + " " + msg); } } }; client.OnFRO900_GeneralizeTemplate = function (code, msg, template) { if (code == 0) { if (language) { alert("合成模板成功"); } else { alert("Generalize Success"); } var fea1_text = document.getElementById("imgdata"); fea1_text.value = template; } else { if (language) { alert("合成模板失败," + code + " " + msg); } else { alert("Generalize Failed," + code + " " + msg); } } }; client.OnFRO900_Verify = function (code, msg, score, result) { if (code == 0) { if (result == 0) { if (language) { alert("比对结果为不匹配"); } else { alert("Mismatch"); } } else { if (language) { alert("比对成功,分数为" + score); } else { alert("Matching Success,Score is" + " " + score); } } } else { if (language) { alert("比对失败," + code + " " + msg); } else { alert("Match Failed," + code + " " + msg); } } }; client.OnIris_InitDevice = function (code, msg) { if (code == 0) { alert("Init Success"); } else { alert("Init fail," + code + " " + msg); } }; client.OnIris_ReleaseDevice = function (code, msg) { if (code == 0) { alert("Release Success"); } else { alert("Release fail," + code + " " + msg); } }; client.OnIris_StartCapture = function (code, msg, faceimg, distance) { if (code == 0) { var image_area = document.getElementById("img_face"); image_area.src = "data:image/jpg;base64," + faceimg; var d = document.getElementById("distance"); d.innerText = distance.toString(); } else { alert("Capture fail," + code + " " + msg); } }; client.OnIris_StartCapture2 = function (code, msg, left_eye_img, left_eye_data, right_eye_img, right_eye_data) { if (code == 0) { var image_area_l = document.getElementById("img_left"); image_area_l.src = "data:image/jpg;base64," + left_eye_img; var image_area_r = document.getElementById("img_right"); image_area_r.src = "data:image/jpg;base64," + right_eye_img; var left_text = document.getElementById("LeftData"); left_text.value = left_eye_data; var right_text = document.getElementById("RightData"); right_text.value = right_eye_data; alert("Capture Success"); } else { alert("Capture fail," + code + " " + msg); } }; client.OnIris_StopCapture = function (code, msg) { if (code == 0) { alert("Stop Success"); } else { alert("Stop fail," + code + " " + msg); } }; client.OnIris_SetOptions = function (code, msg) { if (code == 0) { alert("Set Success"); } else { alert("Set fail," + code + " " + msg); } }; client.OnIris_StartVerify = function (code, msg, faceimg, distance) { if (code == 0) { var image_area = document.getElementById("face_img"); image_area.src = "data:image/jpg;base64," + faceimg; var d = document.getElementById("distance"); d.innerText = distance.toString(); } else { alert("Verify fail," + code + " " + msg); } }; client.OnIris_StartVerify2 = function (code, msg, result) { if (code == 0) { if (result) { alert("Verify Success"); } } else { alert("Verify fail," + code + " " + msg); } }; client.OnIris_StopVerify = function (code, msg) { if (code == 0) { alert("Stop Success"); } else { alert("Stop fail," + code + " " + msg); } }; client.OnFingerKey_OpenDevice = function (code, msg) { alert(msg); }; client.OnFingerKey_CloseDevice = function (code, msg) { alert(msg); }; client.OnFingerKey_GetDeviceInformation = function (code, msg, info) { if (code == 0) { alert("Serial Number:" + info.sn + "\r\n" + "Manufacturer Name:" + info.manufacturer + "\r\n" + "Issuer Name:" + info.issuer + "\r\n" + "Label:" + info.label + "\r\n" + "Hardware Version:" + info.hwver + "\r\n" + "Firmware Version:" + info.fwver); } else { alert(msg); } }; client.OnFingerKey_CaptureFingerData = function (code, msg, imagedata, feadata, quality) { if (code == 0) { switch (Fkey_capcount % 6) { case 1: var image_area1 = document.getElementById("img1"); image_area1.src = "data:image/bmp;base64," + imagedata; Fkey_fea1 = feadata; break; case 2: var image_area2 = document.getElementById("img2"); image_area2.src = "data:image/bmp;base64," + imagedata; Fkey_fea2 = feadata; break; case 3: var image_area3 = document.getElementById("img3"); image_area3.src = "data:image/bmp;base64," + imagedata; Fkey_fea3 = feadata; break; case 4: var image_area4 = document.getElementById("img4"); image_area4.src = "data:image/bmp;base64," + imagedata; Fkey_fea4 = feadata; break; case 5: var image_area5 = document.getElementById("img5"); image_area5.src = "data:image/bmp;base64," + imagedata; Fkey_fea5 = feadata; break; case 0: var image_area6 = document.getElementById("img6"); image_area6.src = "data:image/bmp;base64," + imagedata; Fkey_fea6 = feadata; break; } } else { alert(msg); } }; client.OnFingerKey_ImportFingerPrint = function (code, msg) { if (code == 0) { alert("Import Success"); } else { alert("Import fail," + code + " " + msg); } }; client.OnCamera_InitDevice = function (code, msg) { if (code == 0) { alert("Init Success"); } else { alert("Init fail," + code + " " + msg); } }; client.OnCamera_ReleaseDevice = function (code, msg) { if (code == 0) { alert("Release Success"); } else { alert("Release fail," + code + " " + msg); } }; client.OnCamera_StartCapture = function (code, msg, imagedata, livedetect, facedetect, facequality) { if (code == 0) { var image_area = document.getElementById("camera_face"); image_area.src = "data:image/jpg;base64," + imagedata; var p1 = document.getElementById("livedetect"); p1.innerText = livedetect.toString(); var p2 = document.getElementById("facedetect"); p2.innerText = facedetect.toString(); var p3 = document.getElementById("facequality"); p3.innerText = facequality.toString(); } else { alert("Capture fail," + code + " " + msg); } }; client.OnCamera_StopCapture = function (code, msg) { if (code == 0) { alert("Stop Success"); } else { alert("Stop fail," + code + " " + msg); } }; client.OnOtherError = function (type, code, msg) { if (language) { alert("其他错误!\r\n" + "错误类型:" + type + "\r\n" + "错误代码:" + code + "\r\n" + "错误信息:" + msg); } else { alert("Other error!\r\n" + "Error type:" + type + "\r\n" + "Error code:" + code + "\r\n" + "Error Message:" + msg); } }; }; function settiems() { butERRoR = 1; if (butTime) { } else { butTime = setTimeout(function () { butERRoR = 0; butTime = undefined; }, 800) } } function connect() {//开始录制 if (butERRoR == 0) { client.Connect_Server(); isBegin = true; // setTimeout(res => { // LIVESCAN_Init(); // }, 1000) } else { console.log("不可点击开始录制") } settiems(); } function onceGgin() {//重新录制 if (butERRoR == 0) { // console.log('agin') client.Connect_Server(); isBegin = true; } else { console.log("不可点击重新录制") } settiems(); } function closeGfn() {//取消录制 if (butERRoR == 0) { // console.log('closeG') client.CID_Close(); isoks = false; isOver = false; let butBegin = document.getElementById("connect_server"); butBegin.style.display = "block" let closeGs = document.getElementById("closeG"); closeGs.style.display = "none" let zhiwentip = document.getElementById("zhiwentip"); zhiwentip.style.display = "none"; let zhiwentipok = document.getElementById("zhiwentipok"); zhiwentipok.style.display = "none"; let zhiwentipno = document.getElementById("zhiwentipno"); zhiwentipno.style.display = "block"; let onceGgin = document.getElementById("onceGgin"); onceGgin.style.display = "none"; isBegin = false; } else { console.log("不可点击取消录制") } settiems(); } function open_device() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } client.OpenDevice(0); } function close_device() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } client.CloseDevice(); } function get_device_count() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } client.GetDeviceCount(); } function get_device_desc() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } client.GetDeviceDescription(0); } function capturefinger1() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } if (device_id == null) { if (language) { alert("请先点击\"获取设备信息\"按钮"); } else { alert("Please click \"Get Device Description\" button first"); } return; } flag = 1; client.CaptureFingerData(ImageFormatType.IBmp, FeatureFormatType.FBione, 3, FingerPosition.UNKNOWN, CompressionType.UnCompressed, device_id, 5); } function capturefinger2() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } if (device_id == null) { if (language) { alert("请先点击\"获取设备信息\"按钮"); } else { alert("Please click \"Get Device Description\" button first"); } return; } flag = 2; client.CaptureFingerData(ImageFormatType.IBmp, FeatureFormatType.FBione, 3, FingerPosition.UNKNOWN, CompressionType.UnCompressed, device_id, 5); } function capturefinger3() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } if (device_id == null) { if (language) { alert("请先点击\"获取设备信息\"按钮"); } else { alert("Please click \"Get Device Description\" button first"); } return; } flag = 3; client.CaptureFingerData(ImageFormatType.IBmp, FeatureFormatType.FBione, 3, FingerPosition.UNKNOWN, CompressionType.UnCompressed, device_id, 5); } function generalizetemp() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } if (feature1 == null || feature2 == null || feature3 == null) { if (language) { alert("请先采集三张图像"); } else { alert("Please capture fingerprint three times first"); } return; } client.GeneralizeTemplate(feature1, feature2, feature3); } function verify() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } if (feature2 == null || feature3 == null) { if (language) { alert("请先采集图像2和3"); } else { alert("Please capture fingerprint 2 and 3 first"); } return; } client.Verify(feature2, feature3, SecurityLevel.Level_4); } function start() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } client.StartCapture(FeatureFormatType.FBione, FingerPosition.UNKNOWN); } function end() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } client.StopCapture(); } function bmp2raw() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } if (bmpdata == null) { if (language) { alert("请先点击\"采集图像1\"按钮"); } else { alert("Please click \"Capture Fingerprint 1\" button first"); } return; } if (imagewidth == 0) { if (language) { alert("请先点击\"获取设备信息\"按钮"); } else { alert("Please click \"Get Device Description\" button first"); } return; } client.BmpToRaw(bmpdata, imagewidth, imageheight); } function bmp2wsq() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } if (bmpdata == null) { if (language) { alert("请先点击\"采集图像1\"按钮"); } else { alert("Please click \"Capture Fingerprint 1\" button first"); } return; } var bitrate = 0.75; if (imagewidth == 0) { if (language) { alert("请先点击\"获取设备信息\"按钮"); } else { alert("Please click \"Get Device Description\" button first"); } return; } client.BmpToWSQ(bmpdata, imagewidth, imageheight, dpi, bitrate); } function bmp2iso() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } if (bmpdata == null) { if (language) { alert("请先点击\"采集图像1\"按钮"); } else { alert("Please click \"Capture Fingerprint 1\" button first"); } return; } if (device_id == null) { if (language) { alert("请先点击\"获取设备信息\"按钮"); } else { alert("Please click \"Get Device Description\" button first"); } return; } client.BmpToISO(bmpdata, imagewidth, imageheight, FingerPosition.UNKNOWN, CompressionType.UnCompressed, device_id); } function bmp2ansi() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } if (bmpdata == null) { if (language) { alert("请先点击\"采集图像1\"按钮"); } else { alert("Please click \"Capture Fingerprint 1\" button first"); } return; } if (device_id == null) { if (language) { alert("请先点击\"获取设备信息\"按钮"); } else { alert("Please click \"Get Device Description\" button first"); } return; } client.BmpToANSI(bmpdata, imagewidth, imageheight, FingerPosition.UNKNOWN, CompressionType.UnCompressed, device_id); } function operate_red() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } LED = 1; Status = Status ^ 1; client.SetOption(LED, Status); } function operate_green() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } LED = 0; Status = Status ^ 1; client.SetOption(LED, Status); } client.beginFn = {//添加异步设备初始化,因为websocket需要时间来启动 fn: client.CID_Init, CID5000: CIDDeviceType.CID5000, }; function LIVESCAN_Init() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } var obj = document.getElementById("device_select"); var device; // if (obj.selectedIndex == 0) { // device = CIDDeviceType.CID4000; // } // else if (obj.selectedIndex == 1) { // device = CIDDeviceType.CID5000; // } // else if (obj.selectedIndex == 2) { // device = CIDDeviceType.CID7000; // } // else if (obj.selectedIndex == 3) { // device = CIDDeviceType.CID3000TC; // } // else if (obj.selectedIndex == 4) { // device = CIDDeviceType.CID3000; // } // else if (obj.selectedIndex == 5) { // device = CIDDeviceType.CID7000R; // } device = CIDDeviceType.CID5000; client.CID_Init(device); } function LIVESCAN_Close() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } client.CID_Close(); } function LIVESCAN_GetChannelCount() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } client.CID_GetChannelCount(); } function LIVESCAN_GetDesc() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } client.CID_GetDesc(); } function LIVESCAN_BeginCapture() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } var s = document.getElementById("score_thresh"); CID_score_thresh = s.value; if (parseInt(CID_score_thresh) > 100 || parseInt(CID_score_thresh) < 1) { if (language) { alert("分数阈值范围为1到100"); } else { alert("Score thresholds range from 1 to 100"); } return; } else { show_img_index = 0; begin_cap = true; operate_model = 2; client.CID_BeginCapture(0); } } function LIVESCAN_EndCapture() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } begin_cap = false; } function CID_Cap1() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } begin_cap = false; show_img_index = 1; client.CID_BeginCapture(0); } function CID_Ext1() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } if (CID_img_1 == null) { alert("请先采集图像"); } show_img_index = 1; operate_model = 1; client.BmpToRaw(CID_img_1, 256, 360); } function CID_Cap2() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } begin_cap = false; show_img_index = 2; client.CID_BeginCapture(0); } function CID_Ext2() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } if (CID_img_2 == null) { alert("请先采集图像"); } show_img_index = 2; operate_model = 1; client.BmpToRaw(CID_img_2, 256, 360); } function FP_FeatureMatch() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } if (CID_fea_1 == null || CID_fea_2 == null) { alert("请先提取特征"); } else { client.CID_Alg_FeatureMatch(CID_fea_1, CID_fea_2); } } function FP_ImageMatch() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } if (CID_img_1 == null) { alert("请先采集图像"); } if (CID_fea_2 == null) { alert("请先提取特征"); } operate_model = 1; ImageMatch = true; client.BmpToRaw(CID_img_1, 256, 360); } function TrustLink_GetDeviceInfo() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } client.TrustLink_GetDeviceInfo(); } function FRO900_opendevice() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } client.FRO900_OpenDevice(0); } function FRO900_get_device_count() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } client.FRO900_GetDeviceCount(); } function FRO900_capturefinger1() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } flag = 1; MultiFinger = 0; client.FRO900_CaptureFingerPrintData(FingerPosition.LEFT_INDEX, ImageFormatType.IBmp, FeatureFormatType.FBione, CompressionType.JPEG, 5, FRO900_MissFinger.NO_FINGER_MISS); } function FRO900_closedevice() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } client.FRO900_CloseDevice(); } function FRO900_capturefinger2() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } flag = 2; MultiFinger = 0; client.FRO900_CaptureFingerPrintData(FingerPosition.LEFT_INDEX, ImageFormatType.IBmp, FeatureFormatType.FBione, CompressionType.UnCompressed, 5, 0); } function FRO900_capturefinger3() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } flag = 3; MultiFinger = 0; client.FRO900_CaptureFingerPrintData(FingerPosition.LEFT_INDEX, ImageFormatType.IBmp, FeatureFormatType.FBione, CompressionType.UnCompressed, 5, 0); } function FRO900_capture_left4() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } var img = document.getElementById("img1"); img.src = null; img = document.getElementById("img2"); img.src = null; img = document.getElementById("img3"); img.src = null; img = document.getElementById("img4"); img.src = null; MultiFinger = 1; client.FRO900_CaptureFingerPrintData(FingerPosition.LEFT_FOUR, ImageFormatType.IBmp, FeatureFormatType.FBione, CompressionType.UnCompressed, 0, FRO900_MissFinger.NO_FINGER_MISS); } function FRO900_capture_right4() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } var img = document.getElementById("img1"); img.src = null; img = document.getElementById("img2"); img.src = null; img = document.getElementById("img3"); img.src = null; img = document.getElementById("img4"); img.src = null; MultiFinger = 2; client.FRO900_CaptureFingerPrintData(FingerPosition.RIGHT_FOUR, ImageFormatType.IBmp, FeatureFormatType.FBione, CompressionType.UnCompressed, 0, FRO900_MissFinger.NO_FINGER_MISS); } function FRO900_capture_thumb2() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } var img = document.getElementById("img1"); img.src = null; img = document.getElementById("img2"); img.src = null; img = document.getElementById("img3"); img.src = null; img = document.getElementById("img4"); img.src = null; MultiFinger = 3; client.FRO900_CaptureFingerPrintData(FingerPosition.THUMB_TWO, ImageFormatType.IBmp, FeatureFormatType.FBione, CompressionType.UnCompressed, 0, FRO900_MissFinger.NO_FINGER_MISS); } function FRO900_generalizetemp() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } if (feature1 == null || feature2 == null || feature3 == null) { if (language) { alert("请先采集三张图像"); } else { alert("Please capture fingerprint three times first"); } return; } client.FRO900_GeneralizeTemplate(feature1, feature2, feature3); } function FRO900_verify() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } if (feature2 == null || feature3 == null) { if (language) { alert("请先采集图像2和3"); } else { alert("Please capture fingerprint 2 and 3 first"); } return; } client.FRO900_Verify(feature2, feature3, SecurityLevel.Level_3); } function Iris_Initdevice() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } var obj = document.getElementById("device_select"); var device; if (obj.selectedIndex == 0) { device = IrisDeviceType.IR100; } else if (obj.selectedIndex == 1) { device = IrisDeviceType.IR200; } client.Iris_InitDevice(device); } function Iris_StartCapture() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } client.Iris_StartCapture(); Iris_capture_mode = 1; } function Iris_StartFastCapture() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } client.Iris_StartFastCapture(); Iris_capture_mode = 1; } function Iris_Releasedevice() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } client.Iris_ReleaseDevice(); } function Iris_StopCapture() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } client.Iris_StopCapture(); } function Iris_SetOptions() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } var thresh = document.getElementById("enthresh"); var t = thresh.value; client.Iris_SetOptions(parseInt(t)); } function Iris_StartVerify() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } var leftdata = "beKQlZX/f3KShsxITQ2Tk5c1fO7OXFh587e37Vl57+6vhlBR97q6HQ1i8jod/fqATVUXOqjd3yIABP/+smlVGQWFkfrurzUCiM1d1bMqYu7/EwD/7kwUEevu3HhwAYOuCE1FFyD83f8CAATGpqLGTRkxAqK601AA7u/MEBEz+WnqihQxY+eXh2xJecqvNDTvywME/PibA0VctLj7byyYklH/7gl5+o4NfXlISNXWpoWVsT4OSuu9FBHlppIRVf56TV9GZPSUnNbSsrt7anld1dNzfUUBAHk9heZiYiJdxYcyEiIIBAUV1f/+7qqqSF1dXVEyIqK2l5WVVUUFBcrqap4OVnY2Pj58acnFRmZ03NSSFOyOhrowMDnFwrZ+XETlhn/xgIKPXUljt7wIEPP/fEiSh8VdOTnuhhNT6u4RFc15YxdW19PZ2dmZiQmJqeHh4cOKisZFbyYVeXnw4sZdfG15TT+TkiVtfOrGETnjp5enzFl77q40tetDBhT4+CslMzcxITMz+ysDl5VdeTg7e7OT0P6/kJWVONLQmZG6+pJoqoaHFVlZ/T0VEWrqIBWHxaCAlZe/fzqipuZAQUUTMsaGSElNEZKShXVu7t54eHrXt/fdeWvvLTX96+MHhry6AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADNv8="; var rightdata = "ldSiAUzqsoKUXEBAePqm91fd/rqXlzhor1dZeP7760/kSF39uIiXh0Bof7rGxZMaSIWVmftvavrbnoUlAJKQe5V4eq+HhDE6ov/daCqX120pElLP7YQcf5G0ZGvqWFhqAAAEEZE5a3p7+v7vbQQAALPv7n/7+u7/twVi+v8RUd+yFd1oaO+XWWi2t4NNHTTy8hBL76cLyOhxFQ0MFvLKCXi96mg51e2uOwhIVf//91UQAggQIOrqv//vABDVf1KSszM3Nazuzs7uXE1Nbm1Fxc3u7u5qOXz4eBkFre/va2kqqu7/3d09MxOXhYCC6mpq7u6nh5cREBBAxMXVlZX3/8rq8+P63NTQ+NPR0trb60teHF5OTIyMmv7+/NjQ3ppSkpYsBGOztW3L2XklJDbCwBA1Ne3uU9Wtanq3hwAYfecsSMjIxsaG1NxMDS0uJianoeDq28rN2djY6Px4+vr6ykBhe76mR1Xc6rIV3Chpp9dZqPbjg00cpPLyEU+vpUPKXXg4OyqCx809NTF/c399OTqml9UFeX+3EEzuGFhqp9UiEBn96//f/Wn7/7aCSH2dlZemAUBoqqKGRAAAWHq+t51IQGh6trfXXf26tpedaG23WUj++vvrXR18/rIzv7e3AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADNv8="; client.Iris_StartVerify(5, leftdata, rightdata); } function Iris_StopVerify() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } client.Iris_StopVerify(); } function clearForm() { document.all['Name'].value = ''; document.all['Sex'].value = ''; document.all['Nation'].value = ''; document.all['Born'].value = ''; document.all['Address'].value = ''; document.all['NewAddress'].value = ''; document.all['CardNo'].value = ''; document.all['Police'].value = ''; document.all['ActivityLFrom'].value = ''; document.all['ActivityLTo'].value = ''; var img = document.getElementById("imgPre"); img.src = ""; document.all['CardType'].value = ''; document.all['PassNo'].value = ''; document.all["IssueCount"].value = ''; document.all["EnglishName"].value = ''; document.all['Country'].value = ''; document.all['Version'].value = ''; document.all['FPInfo1'].value = ''; document.all['FPInfo2'].value = ''; } function ReadCard() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } clearForm(); client.ARA_ReadIDCard(); } function FingerKey_opendevice() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } client.FingerKey_OpenDevice(); } function FingerKey_closedevice() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } client.FingerKey_CloseDevice(); } function FingerKey_get_device_info() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } client.FingerKey_GetDeviceInformation(); } function FingerKey_capturefinger() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } Fkey_capcount++; client.FingerKey_CaptureFingerData(FingerPosition.UNKNOWN, ImageFormatType.IBmp, FeatureFormatType.FBione, 3); } function FingerKey_importfingerprint() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } if (Fkey_capcount < 6) { alert("请采集六次以上"); } var allfea = Fkey_fea1 + "\r\n" + Fkey_fea2 + "\r\n" + Fkey_fea3 + "\r\n" + Fkey_fea4 + "\r\n" + Fkey_fea5 + "\r\n" + Fkey_fea6; client.FingerKey_ImportFingerPrint(FingerPosition.LEFT_THUMB, allfea); } function Camera_Initdevice() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } var obj = document.getElementById("Camera_select"); if (obj.selectedIndex == 3) { client.Camera_InitDevice(Camera_Device_List.CID7000); } else { client.Camera_InitDevice(obj.selectedIndex + 1); } } function Camera_Releasedevice() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } client.Camera_ReleaseDevice(); } function Camera_StartCapture() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } client.Camera_StartCapture(); } function Camera_StopCapture() { if (!client.isConnect) { if (language) { alert("助手程序未连接"); } else { alert("Assistant Program is not connected"); } return; } client.Camera_StopCapture(); } function outZhiwenData() {//输出 iframe let d = { imgSRC: imgSRC,//图片指纹信息 imgBMP: imgBMP,//BMP格式指纹信息 CID_img_raw: CID_img_raw,//RAW格式指纹信息 featuredata: featuredatas,//特征值 isoks: isOver//是否完成采集指纹 } return d; } function setZhiwenData(val) {//输入 iframe isOver = val.isoks//是否完成采集指纹 if (val.clear) { let zhiwentip = document.getElementById("zhiwentip"); zhiwentip.style.display = "none"; let zhiwentipok = document.getElementById("zhiwentipok"); zhiwentipok.style.display = "none"; let zhiwentipno = document.getElementById("zhiwentipno"); zhiwentipno.style.display = "none"; let butBegin = document.getElementById("connect_server"); butBegin.style.display = "none"; let closeG = document.getElementById("closeG"); closeG.style.display = "none"; let onceGgin = document.getElementById("onceGgin"); onceGgin.style.display = "none"; imgSRC = '';//图片指纹信息 imgBMP = '';//BMP格式指纹信息 // CID_img_raw = val.CID_img_raw;//RAW格式指纹信息 featuredatas = '';//特征值 var image_area = document.getElementById("img"); image_area.src = './1png.png'; if (isBegin) { client.CID_Close(); isBegin = false; } return; } if (isOver) { imgSRC = "data:image/bmp;base64," + val.imgBMP;//图片指纹信息 imgBMP = val.imgBMP;//BMP格式指纹信息 // CID_img_raw = val.CID_img_raw;//RAW格式指纹信息 featuredatas = val.featuredatas;//特征值 let zhiwentip = document.getElementById("zhiwentip"); zhiwentip.style.display = "none"; let zhiwentipok = document.getElementById("zhiwentipok"); zhiwentipok.style.display = "block"; let zhiwentipno = document.getElementById("zhiwentipno"); zhiwentipno.style.display = "none"; var image_area = document.getElementById("img"); image_area.src = imgSRC; let butBegin = document.getElementById("connect_server"); butBegin.style.display = "none"; let closeG = document.getElementById("closeG"); closeG.style.display = "none"; let onceGgin = document.getElementById("onceGgin"); onceGgin.style.display = "block"; } else { let zhiwentip = document.getElementById("zhiwentip"); zhiwentip.style.display = "none"; let zhiwentipok = document.getElementById("zhiwentipok"); zhiwentipok.style.display = "none"; let zhiwentipno = document.getElementById("zhiwentipno"); zhiwentipno.style.display = "block"; var image_area = document.getElementById("img"); image_area.src = './1png.png'; let butBegin = document.getElementById("connect_server"); butBegin.style.display = "block"; let closeG = document.getElementById("closeG"); closeG.style.display = "none"; let onceGgin = document.getElementById("onceGgin"); onceGgin.style.display = "none"; } return isOver; } public/zhiwenDemo/debug.log
New file @@ -0,0 +1 @@ [1027/165052.032:ERROR:exit_code_watcher_win.cc(87)] Failed to wait for process exit or stop event public/zhiwenDemo/language.js
New file @@ -0,0 +1,39 @@ var change_description = ["切换为中文", "Change to English"]; var link_description = ["Open Assistant Program", "打开设备管理助手"]; var connect_description = ["Connect Assistant Program", "连接助手程序"]; var open_description = ["Open Device", "打开设备"]; var close_description = ["Close Device", "关闭设备"]; var device_count_description = ["Get Device Count", "获取设备数量"]; var device_desc_description = ["Get Device Description", "获取设备信息"]; var cap1_description = ["Capture Fingerprint 1", "采集图像1"]; var cap2_description = ["Capture Fingerprint 2", "采集图像2"]; var cap3_description = ["Capture Fingerprint 3", "采集图像3"]; var gen_description = ["Generalize a Template", "合成模板"]; var verify_description = ["Match Fingerprint 2 and Fingerprint 3", "图像2、3比对"]; var startcap_description = ["Start Preview", "开始预览"]; var endcap_description = ["End Preview", "结束预览"]; var open_red_description = ["Open Red LED", "打开红灯"]; var close_red_description = ["Close Red LED", "关闭红灯"]; var open_green_description = ["Open Green LED", "打开绿灯"]; var close_green_description = ["Close Green LED", "关闭绿灯"]; var b2r_description = ["BMP To RAW", "BMP格式转RAW格式"]; var b2w_description = ["BMP To WSQ", "BMP格式转WSQ格式"]; var b2i_description = ["BMP To ISO", "BMP格式转ISO格式"]; var b2a_description = ["BMP To ANSI", "BMP格式转ANSI格式"]; var title_trustfinger_description = ["The Demo of Aratek Device Management Assistant(TrustFinger)", "亚略特设备管理助手Demo(TrustFinger)"]; var init_description = ["Init Device", "设备初始化"]; var extract1_description = ["Extract Fingerprint 1 Features", "提取图像1特征"]; var extract2_description = ["Extract Fingerprint 2 Features", "提取图像2特征"]; var feature_verify_description = ["Match Feature 1 and Feature 2", "特征1与特征2比对"]; var image_verify_description = ["Match Fingerprint 1 and Feature 2", "图像1与特征2比对"]; var title_CID_description = ["The Demo of Aratek Device Management Assistant(CID)", "亚略特设备管理助手Demo(CID)"]; var FRO900_capture_left_4 = ["Collect left-hand", "采集左手四指"]; var FRO900_capture_right_4 = ["Collect right-hand", "采集右手四指"]; var FRO900_capture_thumb_2 = ["Collect two thumbs", "采集双手拇指"]; var title_FRO900_description = ["The Demo of Aratek Device Management Assistant(FRO900)", "亚略特设备管理助手Demo(FRO900)"]; var Iris_release_device = ["Release Device", "设备释放"]; var Iris_start_cap = ["Start Capture", "开始采集"]; var Iris_stop_cap = ["Stop Capture", "结束采集"]; var Iris_distance_desc = ["Distance:", "距离:"]; var Iris_start_ver = ["Start Verify", "开始比对"]; var Iris_stop_ver = ["Stop Verify", "结束比对"]; src/api/examapi/examination.js
@@ -48,3 +48,11 @@ } }) } export const getNowTime = () => { return request({ url: '/api/exampaper/getdate/', method: 'get', }) } src/api/qiandao/qiandao.js
New file @@ -0,0 +1,30 @@ import request from '@/router/axios'; export const getList = (current, size, params) => { return request({ url: '/api/trainingRegistration/page', method: 'get', params: { ...params, current, size, } }) } export const upData = (params) => { return request({ url: '/api/blade-user/updateUserInfo', method: 'post', data: params }) } export const getZhiwen = (id) => { return request({ url: '/api/blade-user/details', method: 'get', params: { id } }) } src/permission.js
@@ -48,6 +48,15 @@ })(), group: router.$avueRouter.group || [] }); } // console.log(store.state.user.userInfo) if (store.state.user.userInfo.role_name == "培训公司管理员") { next(); setTimeout(() => { next({ path: '/qiandao' }) }, 20); return; } next() } src/router/page/index.js
@@ -12,6 +12,17 @@ } }, { path: '/qiandao', name: '签到', component: () => import( /* webpackChunkName: "page" */ '@/views/qiandao/index'), meta: { keepAlive: true, isTab: false, isAuth: false } }, { path: '/lock', name: '锁屏页', component: () => src/router/views/index.js
@@ -166,6 +166,19 @@ import ( /* webpackChunkName: "views" */ '@/views/singleperformance/index') }] }, // { // path: '/qiandao', // redirect: '/qiandao/index', // component: Layout, // children: [{ // path: 'index', // name: '考试签到', // meta: { // i18n: 'index', // }, // component: () => // import( /* webpackChunkName: "views" */ '@/views/qiandao/index') // }] // }, ] src/store/getters.js
@@ -33,5 +33,10 @@ scoreId: state => state.exam.scoreId, examUserData: state => state.exam.examUserData, // 签到 cardInfor: state => state.exam.cardInfor, haveCardid: state => state.exam.haveCardid, useZhiWen: state => state.exam.useZhiWen, } export default getters src/store/modules/exam.js
@@ -17,7 +17,16 @@ name: 'incorrectRecord' }) || {}, examUserData: {}, // 签到 scoreId: '', cardInfor: {}, haveCardid: false, useZhiWen: function (fn, vals) { //读取指纹实例 let val = vals || ""; var winzhiwen = document.getElementById("zhiwen").contentWindow; return winzhiwen[fn](val); }, }, actions: { // 设置题目信息 @@ -53,6 +62,13 @@ } }, mutations: { // 签到 setCardInfor(state, data) { state.cardInfor = data; }, setCardidState(state, data) { state.haveCardid = data; }, // 重置考试id赋值 SetScoreId(state, data) { window.localStorage.setItem("scoreId", data) src/styles/element-ui.scss
@@ -91,6 +91,9 @@ font-size: x-large !important; } .examine_body * { font-size: medium !important; } .el-form-item__error { font-size: 18px !important; } @@ -158,6 +161,14 @@ .exam-card-body { .subject-box-card { width: 100% !important; // overflow-x: hidden; // overflow-y: scroll; // max-height: 530px; } .subject_main { overflow-x: hidden; overflow-y: scroll; max-height: 530px; } div { font-size: 38px !important; @@ -229,3 +240,15 @@ .subject-title-content.titlesss { font-weight: 700 !important; } // .el-form-item__content { // width: 122px !important; // } .avue-crud__search .el-form-item--small.el-form-item .el-form-item__content { width: 122px !important; } .formsss .basic-container__card { height: 100% !important; } src/views/exam/startexam.vue
@@ -2,7 +2,7 @@ * @Author: Morpheus * @Date: 2021-07-31 16:31:54 * @Last Modified by: liu * @Last Modified time: 2021-10-09 16:08:06 * @Last Modified time: 2021-11-22 11:59:02 * menu-name 考试管理 */ <template> @@ -43,7 +43,7 @@ <script> import { mapState } from "vuex"; import { getExamDetail } from "@/api/examapi/examination"; import { getExamDetail, getNowTime } from "@/api/examapi/examination"; import { updateApplyStatus } from "@/api/examapi/applyexam"; export default { data() { @@ -149,10 +149,12 @@ var data = res.data.data[0]; // console.log(data,333); //当前时间 var nowD = new Date(), var nowD, startD = new Date(data.startTime), //考试截止时间 endD = new Date(data.endTime); getNowTime().then((res) => { nowD = new Date(res.data.data); //对比时间 //getTime() 方法可返回距 1970 年 1 月 1 日之间的毫秒数。 if (nowD.getTime() > startD.getTime()) { @@ -206,6 +208,7 @@ ]; that.$store.commit("SetexamUserData", that.option.data[0]); } }); }, (error) => { src/views/qiandao/forms.vue
New file @@ -0,0 +1,243 @@ <template> <basic-container class="formsss"> <div class="formssstitle">身份证信息</div> <avue-form ref="form" v-model="obj" :option="option" @reset-change="emptytChange" > <!-- @submit="submit" --> <template slot-scope="{ type, disabled }" slot="imgs"> <div class="imgss"> <img :src="obj.imgs" alt="" /> </div> </template> <template slot-scope="{ type, disabled }" slot="fingerprintForm"> <div class="zhiwenMain"> <iframe id="zhiwen" ref="zhiwen" src="/zhiwenDemo/CID.html" frameborder="0" width="100%" height="100%" name="zhiwen" ></iframe> </div> </template> </avue-form> </basic-container> </template> <script> import CertCtl from "./sfzJS"; import { mapGetters } from "vuex"; export default { computed: { ...mapGetters(["userInfo", "cardInfor", "haveCardid", "useZhiWen"]), }, mounted() { // console.log(CertCtl); try { // 开始连接设备 //调用对应的连接方法,并赋值给result this.cardShebei = CertCtl.connect(); //如果result为空,代表读卡插件未启动 if (this.cardShebei == "") { console.log("未启动读卡插件!"); } else { //result页面回显 console.log("ok!"); } } catch (e) {} if (this.intTime) { clearInterval(this.intTime); this.setIntervals(); } else { this.setIntervals(); } }, data() { return { cardShebei: "", intTime: "", //自动获取身份证; obj: {}, option: { // mockBtn: true, // submitText: "完成", // printBtn: true, submitBtn: false, disabled: true, column: [ { label: "姓名", prop: "name", }, { label: "性别", prop: "sex", }, { label: "民族", prop: "national", }, { label: "出生日期", prop: "birthday", }, { label: "照片", prop: "imgs", // listType: "picture-img", // type: "upload", // disabled: true, }, { label: "指纹", prop: "fingerprintForm", }, { label: "身份号码", prop: "id", }, { label: "签发机关", prop: "qfjg", }, { label: "起始日期", prop: "yxqstart", }, { label: "截止日期", prop: "yxqend", }, { label: "住址", prop: "certAddress", span: 24, }, // { // label: "最新住址", // prop: "address", // }, ], }, }; }, methods: { setIntervals: function () { let that = this; this.intTime = setInterval(function () { if (!that.haveCardid) { //定时读卡 let result = CertCtl.readCert(); if (result == "") { console.log("未启动读卡插件!"); } else { var resultObj = eval("(" + result + ")"); //resultFlag为0代表读卡成功 if (resultObj.resultFlag == "0") { //回显相关数据 // console.log(resultObj, 123); const data = resultObj.resultContent; //赋值数据 that.obj = { name: data.partyName, national: data.nation, certAddress: data.certAddress, sex: data.certType == 0 ? "未知" : data.certType == 1 ? "男" : data.certType == 2 ? "女" : data.certType == 9 ? "未说明" : "未能识别", imgs: "data:image/bmp;base64," + data.identityPic, yxqend: data.expDate.slice(0, 4) + "-" + data.expDate.slice(4, 6) + "-" + data.expDate.slice(6, 8), yxqstart: data.effDate.slice(0, 4) + "-" + data.effDate.slice(4, 6) + "-" + data.effDate.slice(6, 8), birthday: data.bornDay.slice(0, 4) + "-" + data.bornDay.slice(4, 6) + "-" + data.bornDay.slice(6, 8), id: data.certNumber, qfjg: data.certOrg, }; that.$store.commit("setCardInfor", that.obj); that.$store.commit("setCardidState", true); } else if (resultObj.resultFlag == "-1") { if (resultObj.errorMsg == "端口打开失败") { console.log("读卡器未连接"); } else { // console.log(resultObj.errorMsg); //无卡片提醒 } } else if (resultObj.resultFlag == "-2") { console.log(resultObj.errorMsg); } } } }, 1000); }, emptytChange() { this.$store.commit("setCardidState", false); let zhiwen = { featuredatas: "", imgBMP: "", url: "", isoks: false, clear: true, }; this.useZhiWen("setZhiwenData", zhiwen); this.$message.success("清空身份证数据"); }, // useZhiWen: function (fn, vals) { // //读取指纹实例 // let val = vals || ""; // var winzhiwen = document.getElementById("zhiwen").contentWindow; // return winzhiwen[fn](val); // }, }, beforeDestroy() { clearInterval(this.intTime); this.intTime = null; }, }; </script> <style lang="scss" scoped> .zhiwenMain { width: 100%; height: 220px; // border: 1px solid rgba($color: #d3d3d3, $alpha: 1); } .formsss { height: 100% !important; } .imgss { height: 182px; width: 138px; border: 1px solid rgba($color: #d3d3d3, $alpha: 1); border-radius: 5px; img { width: 100%; height: 100%; } } </style> src/views/qiandao/index.vue
New file @@ -0,0 +1,127 @@ <template> <div id="examine"> <div class="examine_heard"> 保安员考试系统-签到 <div class="e_h_right"> <img src="http://nx.baibaodun.cn:80/assets/images/username-person.png" alt="" /> <span> {{ userName }} </span> <div @click="logout">退出登录</div> </div> </div> <div class="examine_body"> <div class="e_m_left"> <forms></forms> </div> <div class="e_m_right"> <tables></tables> </div> </div> </div> </template> <script> import { mapGetters } from "vuex"; import { resetRouter } from "@/router/router"; import tables from "./tables.vue"; import forms from "./forms.vue"; export default { data() { return { userName: "", }; }, components: { tables, forms, }, computed: { ...mapGetters(["userInfo"]), }, watch: { userInfo() { // console.log(userInfo); }, }, mounted() { this.userName = this.userInfo.account; }, methods: { logout() { this.$confirm(this.$t("logoutTip"), this.$t("tip"), { confirmButtonText: this.$t("submitText"), cancelButtonText: this.$t("cancelText"), type: "warning", }).then(() => { this.$store.dispatch("LogOut").then(() => { resetRouter(); this.$router.push({ path: "/login" }); }); }); }, }, }; </script> <style lang="scss"> #examine { width: 100%; height: 100%; overflow: hidden; box-sizing: border-box; .examine_heard { background-color: #25aff3; width: 100%; padding-left: 30px; box-sizing: border-box; height: 50px; color: #ffffff; font-size: 24px; line-height: 50px; .e_h_right { float: right; margin-right: 20px; img { display: inline-block; vertical-align: middle; } span { font-style: normal; color: #ffffff; font-size: 16px; line-height: 50px; display: inline-block; margin: 0; padding-left: 4px; } div { display: inline; margin-left: 15px; color: #ffffff; font-size: 16px; line-height: 50px; } } } .examine_body { width: 100%; height: calc(100% - 50px); box-sizing: border-box; display: flex; align-items: center; justify-content: center; position: relative; .e_m_left { width: 47%; height: 100%; } .e_m_right { width: 53%; height: 100%; // border: 1px solid red; } } } </style> src/views/qiandao/sfzJS.js
New file @@ -0,0 +1,676 @@ var clearFormData = ''; var urls = ''; //创建读卡控件 var CertCtl = new IDCertCtl(); //身份证读卡控件创建 function IDCertCtl(clearForms) { clearFormData = clearForms; //创建用于与服务交换数据的对象 this.xhr = createXmlHttp(); this.type = "CertCtl"; this.height = 0; this.width = 0; //连接 this.connect = CertCtl_connect; //断开 this.disconnect = CertCtl_disconnect; //获取状态 this.getStatus = CertCtl_getStatus; //读卡 this.readCert = CertCtl_readCert; //读IC卡序列号 this.readICCardSN = CertCtl_readICCardSN; //读身份证物理卡号 this.readIDCardSN = CertCtl_readIDCardSN; //读安全模块接口 this.getSAMID = CertCtl_getSAMID; //读M1卡扇区内容 this.readM1Card = CertCtl_readM1Card; //写M1卡扇区内容 this.writeM1Card = CertCtl_writeM1Card; //处理CPU卡APDU指令 this.handleAPDUCMD = CertCtl_handleAPDUCMD; //设置项目识别码 //this.setProgramCode = CertCtl_setProgramCode; //核验项目识别码 this.checkProgramCode = CertCtl_checkProgramCode; this.Routon_Mute = CertCtl_RoutonMute; this.clearForms = clearFormData; } //创建XMLHttpRequest 对象,用于在后台与服务器交换数据 function createXmlHttp() { var xmlHttp = null; //根据window.XMLHttpRequest对象是否存在使用不同的创建方式 if (window.XMLHttpRequest) { xmlHttp = new XMLHttpRequest(); //FireFox、Opera等浏览器支持的创建方式 } else if (window.ActiveXObject) { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");//IE浏览器支持的创建方式 } xmlHttp.withCredentials = false; return xmlHttp; } //连接方法 function CertCtl_connect() { var result = ""; var iParam1 = "1"; //创建请求 第一个参数是代表以post方式发送;第二个是请求端口和地址;第三个表示是否异步 CertCtl.xhr.open("POST", "http://127.0.0.1:18889/api/connect", false); // CertCtl.xhr.open("POST", urls, false); //发送请求 try { CertCtl.xhr.send(); } catch (e) { } //返回值readyState 0: 请求未初始化 // 1: 服务器连接已建立 // 2:请求已接收 // 3: 请求处理中 // 4: 请求已完成,且响应已就绪 //返回值status 200: "OK" // 404: 未找到页面 //当返回值readyState为4且status为200时,为查询成功 if (CertCtl.xhr.readyState == 4 && CertCtl.xhr.status == 200) { result = CertCtl.xhr.responseText; CertCtl.xhr.readyState = 1; } return result; } //断开方法 function CertCtl_disconnect() { var result = ""; //创建请求 第一个参数是代表以post方式发送;第二个是请求端口和地址;第三个表示是否异步 CertCtl.xhr.open("POST", "http://127.0.0.1:18889/api/disconnect", false); //发送请求 try { CertCtl.xhr.send(); } catch (e) { } if (CertCtl.xhr.readyState == 4 && CertCtl.xhr.status == 200) { result = CertCtl.xhr.responseText; CertCtl.xhr.readyState = 1; } return result; } //获取状态方法 function CertCtl_getStatus() { var result = ""; //创建请求 第一个参数是代表以post方式发送;第二个是请求端口和地址;第三个表示是否异步 CertCtl.xhr.open("POST", "http://127.0.0.1:18889/api/getStatus", false); //发送请求 try { CertCtl.xhr.send(); } catch (e) { } if (CertCtl.xhr.readyState == 4 && CertCtl.xhr.status == 200) { result = CertCtl.xhr.responseText; CertCtl.xhr.readyState = 1; } return result; } //执行读卡操作 function CertCtl_readCert() { var result = ""; try { //创建请求 第一个参数是代表以post方式发送;第二个是请求端口和地址;第三个表示是否异步 CertCtl.xhr.open("POST", "http://127.0.0.1:18889/api/readCard", false); //readCard读卡,不生成正反面仿复印件 //CertCtl.xhr.open("POST", "http://127.0.0.1:18889/api/readCert", false); //readCert读卡,生成正反面仿复印件 //发送请求 CertCtl.xhr.send(); if (CertCtl.xhr.readyState == 4 && CertCtl.xhr.status == 200) { result = CertCtl.xhr.responseText; CertCtl.xhr.readyState = 1; } } catch (e) { } return result; } //获取IC卡序列号 function CertCtl_readICCardSN() { var result = ""; //创建请求 第一个参数是代表以post方式发送;第二个是请求端口和地址;第三个表示是否异步 CertCtl.xhr.open("POST", "http://127.0.0.1:18889/api/readICCardSN", false); //发送请求 try { CertCtl.xhr.send(); } catch (e) { } if (CertCtl.xhr.readyState == 4 && CertCtl.xhr.status == 200) { result = CertCtl.xhr.responseText; CertCtl.xhr.readyState = 1; } return result; } //获取身份证物理卡号 function CertCtl_readIDCardSN() { var result = ""; //创建请求 第一个参数是代表以post方式发送;第二个是请求端口和地址;第三个表示是否异步 CertCtl.xhr.open("POST", "http://127.0.0.1:18889/api/readIDCardSN", false); //发送请求 try { CertCtl.xhr.send(); } catch (e) { } if (CertCtl.xhr.readyState == 4 && CertCtl.xhr.status == 200) { result = CertCtl.xhr.responseText; CertCtl.xhr.readyState = 1; } return result; } //获取SAMID function CertCtl_getSAMID() { var result = ""; //创建请求 第一个参数是代表以post方式发送;第二个是请求端口和地址;第三个表示是否异步 //getSAMID 获取的SAMID,格式为:05032013102800015247360103645891 //getSAMIDStr 获取SAMID,格式为:05.03-20131028-0001524736-0103645891 CertCtl.xhr.open("POST", "http://127.0.0.1:18889/api/getSAMIDStr", false); //发送请求 try { CertCtl.xhr.send(); } catch (e) { } if (CertCtl.xhr.readyState == 4 && CertCtl.xhr.status == 200) { result = CertCtl.xhr.responseText; CertCtl.xhr.readyState = 1; } return result; } //读M1卡扇区内容 function CertCtl_readM1Card() { var result = ""; var sid = "1"; var bid = "1"; var keyType = "1"; var key = "ffffffffffff"; if (document.getElementById("input_sid").value != "") { sid = document.getElementById("input_sid").value; } if (document.getElementById("input_bid").value != "") { bid = document.getElementById("input_bid").value; } if (document.getElementById("input_keytype").value != "") { keyType = document.getElementById("input_keytype").value; } if (document.getElementById("input_key").value != "") { key = document.getElementById("input_key").value; } //创建请求 第一个参数是代表以post方式发送;第二个是请求端口和地址;第三个表示是否异步 CertCtl.xhr.open("POST", "http://127.0.0.1:18889/api/readM1Card?" + "SID=" + sid + "&BID=" + bid + "&KEYTYPE=" + keyType + "&KEY=" + key, false); //发送请求 try { CertCtl.xhr.send(); } catch (e) { } if (CertCtl.xhr.readyState == 4 && CertCtl.xhr.status == 200) { result = CertCtl.xhr.responseText; CertCtl.xhr.readyState = 1; } return result; } //写M1卡扇区内容 function CertCtl_writeM1Card() { var result = ""; var sid = "1"; var bid = "1"; var keyType = "1"; var key = "ffffffffffff"; var data = "00000000000000000000000000000000"; if (document.getElementById("input_sid").value != "") { sid = document.getElementById("input_sid").value; } if (document.getElementById("input_bid").value != "") { bid = document.getElementById("input_bid").value; } if (document.getElementById("input_keytype").value != "") { keyType = document.getElementById("input_keytype").value; } if (document.getElementById("input_key").value != "") { key = document.getElementById("input_key").value; } if (document.getElementById("cmd").value != "") { data = document.getElementById("cmd").value; } //创建请求 第一个参数是代表以post方式发送;第二个是请求端口和地址;第三个表示是否异步 CertCtl.xhr.open("POST", "http://127.0.0.1:18889/api/writeM1Card?" + "SID=" + sid + "&BID=" + bid + "&KEYTYPE=" + keyType + "&KEY=" + key + "&DATA=" + data, false); //CertCtl.xhr.open("POST", "http://127.0.0.1:18889/api/writeM1Card?"+"SID="+sid+"&BID="+bid+"&KEYTYPE="+keyType+"&KEY="+key+"&DATA="+data, false); //发送请求 try { CertCtl.xhr.send(); } catch (e) { } if (CertCtl.xhr.readyState == 4 && CertCtl.xhr.status == 200) { result = CertCtl.xhr.responseText; CertCtl.xhr.readyState = 1; } return result; } //处理CPU卡APDU指令 function CertCtl_handleAPDUCMD() { //var cmd = "00A4000000"; //基本命令(测试用):选择MF下的根目录,返回值为:6F15840E315041592E5359532E4444463031A5038801019000 var cmd = ""; if (document.getElementById("cmd").value != "") { cmd = document.getElementById("cmd").value; } //创建请求 第一个参数是代表以post方式发送;第二个是请求端口和地址;第三个表示是否异步 CertCtl.xhr.open("POST", "http://127.0.0.1:18889/api/handleAPDUCMD?" + "APDUCMD=" + cmd, false); //发送请求 try { CertCtl.xhr.send(); } catch (e) { } if (CertCtl.xhr.readyState == 4 && CertCtl.xhr.status == 200) { result = CertCtl.xhr.responseText; CertCtl.xhr.readyState = 1; } return result; } /* //设置项目识别码 function CertCtl_setProgramCode(){ var programData = ""; if(document.getElementById("programData").value != "") { programData = document.getElementById("programData").value; } //创建请求 第一个参数是代表以post方式发送;第二个是请求端口和地址;第三个表示是否异步 CertCtl.xhr.open("POST", "http://127.0.0.1:18889/api/setProgramCode?"+"PROGRAMCODE="+programData, false); //发送请求 try { CertCtl.xhr.send(); } catch (e) { } if (CertCtl.xhr.readyState == 4 && CertCtl.xhr.status == 200) { result = CertCtl.xhr.responseText; CertCtl.xhr.readyState = 1; } return result; } */ //核验项目识别码 function CertCtl_checkProgramCode() { var programData = ""; if (document.getElementById("programData").value != "") { programData = document.getElementById("programData").value; } //创建请求 第一个参数是代表以post方式发送;第二个是请求端口和地址;第三个表示是否异步 CertCtl.xhr.open("POST", "http://127.0.0.1:18889/api/checkProgramCode?" + "PROGRAMCODE=" + programData, false); //发送请求 try { CertCtl.xhr.send(); } catch (e) { } if (CertCtl.xhr.readyState == 4 && CertCtl.xhr.status == 200) { result = CertCtl.xhr.responseText; CertCtl.xhr.readyState = 1; } return result; } //关闭声音 function CertCtl_RoutonMute() { var result = ""; var IsMute = false; //false - 开声音(默认开), true - 关声音 //创建请求 第一个参数是代表以post方式发送;第二个是请求端口和地址;第三个表示是否异步 CertCtl.xhr.open("POST", "http://127.0.0.1:18889/api/Routon_Mute?" + "ISMUTE=" + IsMute, false); //发送请求 try { CertCtl.xhr.send(); } catch (e) { } if (CertCtl.xhr.readyState == 4 && CertCtl.xhr.status == 200) { result = CertCtl.xhr.responseText; CertCtl.xhr.readyState = 1; } return result; } //转为Json格式 function toJson(str) { //var obj = JSON.parse(str); //return obj; return eval('(' + str + ')'); } //清空页面上显示的内容 function clearForm() { clearFormData(); //对应控件的值全部清空 // document.getElementById("timeElapsed").value = ""; // document.getElementById("certType").value = ""; // document.getElementById("timeElapsed").value = ""; // document.getElementById("venderId").value = ""; // document.getElementById("signature").value = ""; // document.getElementById("partyName").value = ""; // document.getElementById("gender").value = ""; // document.getElementById("nation").value = ""; // document.getElementById("bornDay").value = ""; // document.getElementById("certAddress").value = ""; // document.getElementById("certNumber").value = ""; // document.getElementById("certOrg").value = ""; // document.getElementById("effDate").value = ""; // document.getElementById("expDate").value = ""; // document.getElementById("result").value = ""; // document.getElementById("HeadPic").src = ""; // document.getElementById("PhotoDisplay").src = ""; //document.getElementById("programData").value = ""; //document.getElementById("input_sid").value = ""; //document.getElementById("input_bid").value = ""; //document.getElementById("input_keytype").value = ""; //document.getElementById("input_key").value = ""; //document.getElementById("data").value = ""; //document.getElementById("ACardResult").value = ""; } //连接方法 function connect() { //清空页面 clearForm(); try { //调用对应的连接方法,并赋值给result var result = CertCtl.connect(); //如果result为空,代表读卡插件未启动 if (result == "") { alert("未启动读卡插件!") } else { //result页面回显 document.getElementById("result").value = result; } } catch (e) { } } //断开连接方法 function disconnect() { //清空页面 clearForm(); try { //调用对应的断开连接方法,并赋值给result var result = CertCtl.disconnect(); //如果result为空,代表读卡插件未启动 if (result == "") { alert("未启动读卡插件!") } else { //result页面回显 document.getElementById("result").value = result; } } catch (e) { } } //获取状态方法 function getStatus() { //清空页面 clearForm(); try { //调用对应的获取状态方法,并赋值给result var result = CertCtl.getStatus(); //如果result为空,代表读卡插件未启动 if (result == "") { alert("未启动读卡插件!") } else { //result页面回显 document.getElementById("result").value = result; } } catch (e) { } } //读卡方法 function readCert() { //清空页面 clearForm(); //开始时间 var startDt = new Date(); //调用对应的读卡方法 var result = CertCtl.readCert(); //如果result为空,代表读卡插件未启动 if (result == "") { alert("未启动读卡插件!") } else { //结束时间 var endDt = new Date(); //读卡时间回显 document.getElementById("timeElapsed").value = (endDt.getTime() - startDt.getTime()) + "毫秒"; document.getElementById("result").value = result; //var resultObj = toJson(result); //result = result.replace("\"resultFlag\":","\"resultFlag\":\"true\""); //格式化result //var resultObj = $.parseJSON(result);//windows10上面无法解析 var resultObj = eval('(' + result + ')'); //resultFlag为0代表读卡成功 if (resultObj.resultFlag == "0") { //回显相关数据 document.getElementById("signature").value = resultObj.signature; document.getElementById("venderId").value = resultObj.venderId; document.getElementById("certType").value = resultObj.resultContent.certType; document.getElementById("partyName").value = resultObj.resultContent.partyName; document.getElementById("gender").value = resultObj.resultContent.gender; document.getElementById("nation").value = resultObj.resultContent.nation; document.getElementById("bornDay").value = resultObj.resultContent.bornDay; document.getElementById("certAddress").value = resultObj.resultContent.certAddress; document.getElementById("certNumber").value = resultObj.resultContent.certNumber; document.getElementById("certOrg").value = resultObj.resultContent.certOrg; document.getElementById("effDate").value = resultObj.resultContent.effDate; document.getElementById("expDate").value = resultObj.resultContent.expDate; document.getElementById("HeadPic").src = "data:image/jpeg;base64," + resultObj.resultContent.identityPic; document.getElementById("PhotoDisplay").src = "data:image/jpeg;base64," + resultObj.resultContent.identityPrintPic; } else if (resultObj.resultFlag == "-1") { if (resultObj.errorMsg == "端口打开失败") { alert("读卡器未连接"); } else { alert(resultObj.errorMsg); } } else if (resultObj.resultFlag == "-2") { alert(resultObj.errorMsg); } } } function readICCardSN() { //清空页面 clearForm(); try { //调用对应的获取状态方法,并赋值给result //CertCtl.Routon_Mute(); var result = CertCtl.readICCardSN(); //如果result为空,代表读卡插件未启动 if (result == "") { alert("未启动读卡插件!") } else { //result页面回显 document.getElementById("result").value = result; } } catch (e) { } } function readIDCardSN() { //清空页面 clearForm(); try { //调用对应的获取状态方法,并赋值给result var result = CertCtl.readIDCardSN(); //如果result为空,代表读卡插件未启动 if (result == "") { alert("未启动读卡插件!") } else { //result页面回显 document.getElementById("result").value = result; } } catch (e) { } } function getSAMID() { //清空页面 clearForm(); try { //调用对应的获取状态方法,并赋值给result var result = CertCtl.getSAMID(); //如果result为空,代表读卡插件未启动 if (result == "") { alert("未启动读卡插件!") } else { //result页面回显 document.getElementById("result").value = result; } } catch (e) { } } function readM1Card() { //清空页面 clearForm(); try { //调用对应的获取状态方法,并赋值给result var result = CertCtl.readM1Card(); //如果result为空,代表读卡插件未启动 if (result == "") { alert("未启动读卡插件!") } else { //result页面回显 document.getElementById("ACardResult").value = result; } } catch (e) { } } function writeM1Card() { //清空页面 clearForm(); try { //调用对应的获取状态方法,并赋值给result var result = CertCtl.writeM1Card(); //如果result为空,代表读卡插件未启动 if (result == "") { alert("未启动读卡插件!") } else { //result页面回显 document.getElementById("ACardResult").value = result; } } catch (e) { } } function handleAPDUCMD() { //清空页面 clearForm(); try { //调用对应的获取状态方法,并赋值给result var result = CertCtl.handleAPDUCMD(); //如果result为空,代表读卡插件未启动 if (result == "") { alert("未启动读卡插件!") } else { //result页面回显 document.getElementById("ACardResult").value = result; } } catch (e) { } } /* function setProgramCode() { //清空页面 clearForm(); try { //调用对应的获取状态方法,并赋值给result var result = CertCtl.setProgramCode(); //如果result为空,代表读卡插件未启动 if (result == "") { alert("未启动读卡插件!") } else { //result页面回显 document.getElementById("ACardResult").value = result; } } catch (e) { } } */ /* 检测输入内容 function check() { var programCode = document.getElementById("programData").value; if(programCode == "") { alert("项目码不能为空"); return false; } else if(programCode.length != 8) { alert("项目码为8个字符"); return false; } else { for(var i=0; i<programCode.length; i++) { if(!(programCode.charCodeAt(i)>='0'.charCodeAt() && programCode.charCodeAt(i)<='9'.charCodeAt()) && !(programCode.charCodeAt(i)>='a'.charCodeAt() && programCode.charCodeAt(i)<='z'.charCodeAt()) && !(programCode.charCodeAt(i)>='A'.charCodeAt() && programCode.charCodeAt(i)<='Z'.charCodeAt()) ) { alert("项目码只能包含英文字母和数字"); return false; } } } return true; } */ function checkProgramCode() { //清空页面 clearForm(); try { //调用对应的获取状态方法,并赋值给result var result = CertCtl.checkProgramCode(); //如果result为空,代表读卡插件未启动 if (result == "") { alert("未启动读卡插件!") } else { //result页面回显 document.getElementById("ACardResult").value = result; } } catch (e) { } } export default CertCtl; src/views/qiandao/tables.vue
New file @@ -0,0 +1,408 @@ <template> <basic-container class="tablesss"> <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" :search.sync="search" ref="crud" @row-del="rowDel" v-model="form" :permission="permissionList" @row-update="rowUpdate" @row-save="rowSave" :before-open="beforeOpen" @filter="filterChange" @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad" > <template slot-scope="{ type, size, row }" slot="menu"> <el-button icon="icon-zhengjian" :size="size" :type="type" class="zhengJian-icon" @click.stop="rowUps(row)" >更新</el-button > </template> </avue-crud> </basic-container> </template> <script> import { mapGetters } from "vuex"; import { getList, upData, getZhiwen } from "@/api/qiandao/qiandao"; export default { data() { return { page: { pageSize: 10, currentPage: 1, total: 0, }, query: {}, data: [], form: {}, search: {}, option: { // card: true, // tip: false, // searchSize: "mini", searchMenuSpan: 6, height: "auto", index: true, // selectable: (row, index) => { // console.log(row, index); // if (row.auditStatus == 4 && row.cancel == 1) { // return true; // } else { // return false; // } // }, labelWidth: "120", menuWidth: 200, align: "center", menuWidth: 90, refreshBtn: false, columnBtn: false, emptyBtnText: " ", searchBtnText: " ", searchShowBtn: false, // reserveSelection: true, // selection: true, column: [ { label: "姓名", prop: "realName", search: true, searchSpan: 5, searchLabelWidth: 49, width: 70, }, { label: "公司", prop: "deptName", search: true, searchSpan: 6, searchLabelWidth: 54, }, { label: "身份证号码", prop: "idCardNo", search: true, searchSpan: 7, searchLabelWidth: 97, // searchRange: true, // searchValue: this.getuserid(), width: 180, }, ], delBtn: false, editBtn: false, addBtn: false, }, }; }, computed: { ...mapGetters([ "userInfo", "cardInfor", "permission", "haveCardid", "useZhiWen", ]), permissionList() { return { addBtn: this.vaildData(this.permission.notice_add, false), viewBtn: this.vaildData(this.permission.notice_view, false), delBtn: this.vaildData(this.permission.notice_delete, false), editBtn: this.vaildData(this.permission.notice_edit, false), }; }, }, watch: { haveCardid() { if (this.haveCardid) { this.onLoad( this.page, { idCardNo: this.cardInfor.id, }, "shibie" ); this.search["idCardNo"] = this.cardInfor.id; } }, }, mounted() { // console.log(1545); // if (window.name == "baoming") { // let old = JSON.parse(window.localStorage.getItem("baoming")); // this.choiceName = old; // console.log(old); // console.log("刷新"); // } else { // window.name = "baoming"; // console.log("不刷新"); // } }, methods: { // getuserid() { // console.log(12345); // console.log(this.haveCardid); // if (this.haveCardid) { // return this.cardInfor.id; // } else { // return; // } // }, rowUps(row, msg) { let zhiwenData = this.useZhiWen("outZhiwenData"); let card = this.cardInfor; // console.log(card); // console.log(row); // console.log(zhiwenData); if (this.haveCardid) { if (msg == "once") { this.getZhiwen(row); return; } // console.log(zhiwenData, 456); if ( zhiwenData.imgSRC != "" && zhiwenData.imgSRC != undefined && zhiwenData.imgBMP != "" && zhiwenData.imgBMP != undefined && zhiwenData.featuredata != "" && zhiwenData.featuredata != undefined && zhiwenData.isoks ) { // console.log("存在指纹"); row.realName = card.name; row.cardid = card.id; row.sex = card.sex == "男" ? "1" : card.sex == "女" ? "2" : "3"; row.nation = card.national; row.registered = card.certAddress; row.fingerprint = zhiwenData.imgBMP; row.myPicture = zhiwenData.featuredata; this.upDataMain(row); } else { this.msg("warning", "无指纹信息,请添加指纹信息后重试!"); } } else { this.msg("warning", "请读取身份证后重试!"); } }, getZhiwen(row) { let that = this; getZhiwen(row.userId).then((res) => { // console.log(res); let zhiwen = { featuredatas: res.data.data.myPicture, imgBMP: res.data.data.fingerprint, // url: row.fingerprint, isoks: false, }; if ( zhiwen.featuredatas != "" && zhiwen.featuredatas != undefined && zhiwen.imgBMP != "" && zhiwen.imgBMP != undefined ) { zhiwen.isoks = true; that.useZhiWen("setZhiwenData", zhiwen); that.rowUps(row); } else { // useZhiwen(); zhiwen.isoks = false; that.useZhiWen("setZhiwenData", zhiwen); that.msg("warning", "无指纹信息,请添加指纹信息后更新!"); // 若无指纹,提醒要录入指纹,再手动点击更新; } }); }, upDataMain(row) { let b = { id: row.userId, realName: row.realName, cardid: row.cardid, sex: row.sex, nation: row.nation, registered: row.registered, fingerprint: row.fingerprint, myPicture: row.myPicture, }; upData(b).then((res) => { const data = res.data; // console.log(data); if (data.code == 200) { this.msg("success", data.msg); } else { this.msg("warning", data.msg); } }); }, sizeChange(val) { this.page.pageSize = val; }, currentChange(val) { this.page.currentPage = val; }, rowSave(form, done, loading) { // var that = this; // adddata(form).then( // (res) => { // this.onLoad(this.page); // if (res.data.data == 201) { // this.$message({ // type: "warning", // message: "已报名,不能重复报名", // }); // } else if (res.data.data == 201) { // this.$message({ // type: "warning", // message: "报名失败", // }); // } else { // this.$message({ // type: "success", // message: "报名成功", // }); // } // done(); // }, // (error) => { // window.console.log(error); // loading(); // } // ); }, searchChange(params, done) { this.query = params; this.page.currentPage = 1; this.onLoad(this.page, params); done(); }, searchReset() { // console.log(5454); this.query = {}; this.onLoad(this.page); this.search["cardid"] = ""; }, rowUpdate(row, index, done, loading) { // update(row).then( // () => { // this.onLoad(this.page); // this.$message({ // type: "success", // message: "操作成功!", // }); // done(); // }, // (error) => { // window.console.log(error); // loading(); // } // ); }, rowDel(row) { // this.$confirm("确定将选择数据删除?", { // confirmButtonText: "确定", // cancelButtonText: "取消", // type: "warning", // }) // .then(() => { // return remove(row.id); // }) // .then(() => { // this.onLoad(this.page); // this.$message({ // type: "success", // message: "操作成功!", // }); // }); }, selectionChange(list) { // this.selectionList = list; // this.choiceName = []; // // console.log(window.name); // for (let k in list) { // this.choiceName.push({ // label: list[k].realName, // value: list[k].id, // }); // } // window.localStorage.setItem("baoming", JSON.stringify(this.choiceName)); // console.log(this.choiceName); }, refreshChange() { this.onLoad(this.page, this.query); }, msg: function (type, msg) { this.$message({ message: msg, type: type, }); }, onLoad(page, params = {}, shibie) { params["auditStatus"] = "1"; params["cancel"] = "1"; params["isExam"] = "1"; let values = Object.assign(params, this.query); // console.log(values); if (values.realName || values.deptName || values.idCardNo) { // // console.log(values, 1); } else { // // console.log(values, 2); this.data = []; this.page.total = 0; // return; } getList(page.currentPage, page.pageSize, values).then((res) => { // console.log(res); const data = res.data.data; this.page.total = data.total; this.data = data.records; // // console.log(this.data); if (shibie == "shibie") { if (data.total == 0) { this.msg("warning", "查无此人"); let zhiwen = { featuredatas: "", imgBMP: "", url: "", isoks: false, }; this.useZhiWen("setZhiwenData", zhiwen); } else if (data.total == 1) { //查询出一个人 将数据覆盖 // console.log(value[0]) this.rowUps(data.records[0], "once"); } else { this.msg("warning", "查无此人"); let zhiwen = { featuredatas: "", imgBMP: "", url: "", isoks: false, }; this.useZhiWen("setZhiwenData", zhiwen); this.msg("warning", "查询出多人,请选择对应人员更新!"); } } this.loading = false; }); }, }, }; </script> <style> </style> src/views/startexam/index.vue
@@ -55,6 +55,7 @@ subjectIds.length }}题,合计100分) </div> <div class="subject_main"> <!-- 题目内容 --> <choices ref="choices" v-show="this.query.type === 0" /> @@ -107,6 +108,7 @@ > </div> </div> </div> </el-col> </el-row> <el-dialog @@ -131,10 +133,10 @@ v-for="(value, index) in subjectIds" :style="{ background: value.color }" :key="index" @click="toSubject(value.everyID, value.type, index)" > {{ index + 1 }} </el-button> --> <el-button circle @click="toSubject(value.everyID, value.type, index)" v-for="(value, index) in subjectIds" :style="{ background: value.color, color: value.fontColor }" :key="index" @@ -1048,8 +1050,9 @@ $fontSize2: 20px; $fontSize3: 40px; .subject-box { margin-top: 50px; margin-top: 25px; margin-left: 20px; height: 100%; } .subject-box-card { font-size: 28px;