unify-external-plugin-platform 0.0.3-81 → 0.0.3-82

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -83188,8 +83188,8 @@ var scanner_cameravue_type_template_id_00e9072f_scoped_true_render = function re
83188
83188
  };
83189
83189
  var scanner_cameravue_type_template_id_00e9072f_scoped_true_staticRenderFns = [];
83190
83190
 
83191
- ;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-85.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[4]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./packages/scanner/scanner-camera/src/component/scanner-camera-component.vue?vue&type=template&id=1d5723dd&
83192
- var scanner_camera_componentvue_type_template_id_1d5723dd_render = function render() {
83191
+ ;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-85.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[4]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./packages/scanner/scanner-camera/src/component/scanner-camera-component.vue?vue&type=template&id=3fc2d979&
83192
+ var scanner_camera_componentvue_type_template_id_3fc2d979_render = function render() {
83193
83193
  var _vm = this,
83194
83194
  _c = _vm._self._c;
83195
83195
  return _c('div', {
@@ -83323,7 +83323,7 @@ var scanner_camera_componentvue_type_template_id_1d5723dd_render = function rend
83323
83323
  }
83324
83324
  }, [_vm._v("旋转180°")])], 1)], 1) : _vm._e(), _vm._t("action")]], 2)])]);
83325
83325
  };
83326
- var scanner_camera_componentvue_type_template_id_1d5723dd_staticRenderFns = [];
83326
+ var scanner_camera_componentvue_type_template_id_3fc2d979_staticRenderFns = [];
83327
83327
 
83328
83328
  ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js
83329
83329
  function _typeof(obj) {
@@ -86095,6 +86095,647 @@ _defineProperty(ViisanPluginService, "secondaryCameraDevNum", -1);
86095
86095
  _defineProperty(ViisanPluginService, "cachedDevInfos", []);
86096
86096
  _defineProperty(ViisanPluginService, "reqIdCounter", 0);
86097
86097
  _defineProperty(ViisanPluginService, "previewFrameCallback", null);
86098
+ ;// CONCATENATED MODULE: ./packages/service/external-plugins/ewp-plugin-socket.service.ts
86099
+
86100
+
86101
+ /**
86102
+ * 沃斯德人证交互终端
86103
+ * E窗通WEBSOCKET服务
86104
+ *
86105
+ * */
86106
+
86107
+ var EWindowPassMethodCode;
86108
+ (function (EWindowPassMethodCode) {
86109
+ /** 读取社保卡 */
86110
+ EWindowPassMethodCode["iReadCardBas"] = "iReadCardBas";
86111
+ /** 获取签名*/
86112
+ EWindowPassMethodCode["GetSignName_Base64"] = "GetSignName_Base64";
86113
+ /** 读取二代身份证 */
86114
+ EWindowPassMethodCode["ReadIDCard_Base64"] = "ReadIDCard_Base64";
86115
+ /** 人证比对 */
86116
+ EWindowPassMethodCode["FaceValidateWithIdCard_Base64"] = "FaceValidateWithIdCard_Base64";
86117
+ /** 获取指纹 */
86118
+ EWindowPassMethodCode["FingerPrint_Base64"] = "FingerPrint_Base64";
86119
+ /** 读取二代身份证(新版统一外接设备插件平台) */
86120
+ EWindowPassMethodCode["iReadIdentityCard"] = "iReadIdentityCard";
86121
+ /** 开启视频预览(新版统一外接设备插件平台) */
86122
+ EWindowPassMethodCode["VideoStart"] = "VideoStart";
86123
+ /** 关闭视频预览 */
86124
+ EWindowPassMethodCode["VideoStop"] = "VideoStop";
86125
+ /** 拍摄抓图 */
86126
+ EWindowPassMethodCode["VideoGetImage"] = "VideoGetImage";
86127
+ /** 旋转图像 */
86128
+ EWindowPassMethodCode["VideoRotate"] = "VideoRotate";
86129
+ /** 实时视频流(设备异步推送帧,非请求应答) */
86130
+ EWindowPassMethodCode["VideoStream"] = "VideoStream";
86131
+ })(EWindowPassMethodCode || (EWindowPassMethodCode = {}));
86132
+ const EWindowPassMethodDesc = {
86133
+ [EWindowPassMethodCode.iReadCardBas]: '读取社保卡',
86134
+ [EWindowPassMethodCode.GetSignName_Base64]: '获取签名',
86135
+ [EWindowPassMethodCode.ReadIDCard_Base64]: '读取二代身份证',
86136
+ [EWindowPassMethodCode.FaceValidateWithIdCard_Base64]: '人证比对',
86137
+ [EWindowPassMethodCode.FingerPrint_Base64]: '获取指纹',
86138
+ [EWindowPassMethodCode.iReadIdentityCard]: '读取二代身份证信息',
86139
+ [EWindowPassMethodCode.VideoStart]: '开启视频预览',
86140
+ [EWindowPassMethodCode.VideoStop]: '关闭视频预览',
86141
+ [EWindowPassMethodCode.VideoGetImage]: '拍摄抓图',
86142
+ [EWindowPassMethodCode.VideoRotate]: '旋转图像'
86143
+ };
86144
+ class EWindowPassService {
86145
+ /** 摄像头WebSocket连接(预览需长连接接收帧推送,与read()的短连接相互独立) */
86146
+
86147
+ /** 摄像头建连Promise(防止并发重复建连) */
86148
+
86149
+ /** 摄像头待响应的请求(同一时间仅一个) */
86150
+
86151
+ /** 预览帧回调(VideoStream帧数据) */
86152
+
86153
+ /** 是否处于预览中(单任务模式标记,预览期间禁止其他指令) */
86154
+
86155
+ static startConnect(method) {
86156
+ if (this.ws && this.ws.readyState === WebSocket.CONNECTING) {
86157
+ return this;
86158
+ }
86159
+ let webSocketUrl = '';
86160
+ switch (method) {
86161
+ case EWindowPassMethodCode.FingerPrint_Base64:
86162
+ webSocketUrl = this.fingerPrintBasWebSocketUrl;
86163
+ break;
86164
+ default:
86165
+ webSocketUrl = this.iReadCardBasWebSocketUrl;
86166
+ break;
86167
+ }
86168
+ const ws = new WebSocket(webSocketUrl);
86169
+ let resolved;
86170
+ const onConnect = new Promise(resolve => {
86171
+ resolved = resolve;
86172
+ });
86173
+ ws.onopen = () => {
86174
+ resolved(true);
86175
+ };
86176
+ ws.onmessage = event => {
86177
+ if (method === EWindowPassMethodCode.FingerPrint_Base64) {
86178
+ // 指纹后端返回的是string
86179
+ event = {
86180
+ ...event,
86181
+ data: JSON.stringify({
86182
+ fingerPrintInfo: event.data
86183
+ })
86184
+ };
86185
+ }
86186
+ this.handleMessage(event);
86187
+ };
86188
+ ws.onclose = () => this.handleClose();
86189
+ ws.onerror = () => this.handleError();
86190
+ this.ws = ws;
86191
+ return onConnect;
86192
+ }
86193
+ static handleError() {
86194
+ for (const type in this.requestStore) {
86195
+ this.requestStore.forEach(({
86196
+ reject
86197
+ }) => {
86198
+ reject('handleError');
86199
+ });
86200
+ }
86201
+ throw Error('统一插件平台E窗通设备功能加载失败');
86202
+ }
86203
+ static handleClose() {
86204
+ for (const type in this.requestStore) {
86205
+ this.requestStore.forEach(({
86206
+ reject
86207
+ }) => {
86208
+ reject('close');
86209
+ });
86210
+ }
86211
+ }
86212
+ static handleMessage(msg) {
86213
+ let data = '';
86214
+ try {
86215
+ data = JSON.parse(msg.data);
86216
+ } catch (e) {
86217
+ data = '';
86218
+ }
86219
+ this.requestStore.forEach(({
86220
+ resolve
86221
+ }) => {
86222
+ resolve(data);
86223
+ });
86224
+ this.requestStore = [];
86225
+ this.ws.close();
86226
+ }
86227
+ static async read(method) {
86228
+ if (this.previewActive) {
86229
+ // 单任务模式:预览期间调用其他指令会导致设备驱动闪退,直接拦截
86230
+ throw Error('高拍仪预览进行中,请先关闭预览后再操作其他设备功能');
86231
+ }
86232
+ await this.startConnect(method);
86233
+ const methodDesc = EWindowPassMethodDesc[method];
86234
+ if (this.ws.readyState === 1) {
86235
+ if (method !== EWindowPassMethodCode.FingerPrint_Base64) console.log(methodDesc + '连接成功');
86236
+ let jsonString;
86237
+ // outTimes:超时时间(秒)
86238
+ switch (method) {
86239
+ case EWindowPassMethodCode.ReadIDCard_Base64:
86240
+ // cardReader:0 读卡器-USB;1 读卡器-COM
86241
+ jsonString = JSON.stringify({
86242
+ method,
86243
+ args: {
86244
+ outTimes: 30,
86245
+ cardReader: 1
86246
+ }
86247
+ });
86248
+ break;
86249
+ case EWindowPassMethodCode.FaceValidateWithIdCard_Base64:
86250
+ // cardReader:0 读卡器-USB;1 读卡器-COM
86251
+ jsonString = JSON.stringify({
86252
+ method,
86253
+ args: {
86254
+ outTimes: 30,
86255
+ cardReader: 1,
86256
+ cameraType: 0
86257
+ }
86258
+ });
86259
+ break;
86260
+ case EWindowPassMethodCode.iReadCardBas:
86261
+ // icType:1接触卡;2非接触卡;3自动(接触优先);4自动(非接优先)
86262
+ jsonString = JSON.stringify({
86263
+ method,
86264
+ args: {
86265
+ icType: '1'
86266
+ }
86267
+ });
86268
+ break;
86269
+ case EWindowPassMethodCode.iReadIdentityCard:
86270
+ // 新版统一外接设备插件平台接口,无参数
86271
+ jsonString = JSON.stringify({
86272
+ method,
86273
+ args: {}
86274
+ });
86275
+ break;
86276
+ case EWindowPassMethodCode.FingerPrint_Base64:
86277
+ // 获取指纹:getimgae,颜色(0黑色 1红色), 质量(默认0), 图像大小(288,360),类型(0民用,1公安)
86278
+ jsonString = 'getimgae,1,0,288,0';
86279
+ break;
86280
+ default:
86281
+ jsonString = JSON.stringify({
86282
+ method,
86283
+ args: {
86284
+ outTimes: 30
86285
+ }
86286
+ });
86287
+ break;
86288
+ }
86289
+ this.ws.send(jsonString);
86290
+ return new Promise((resolve, reject) => {
86291
+ if (!this.requestStore) {
86292
+ this.requestStore = [];
86293
+ }
86294
+ this.requestStore.push({
86295
+ resolve,
86296
+ reject
86297
+ });
86298
+ });
86299
+ } else {
86300
+ throw Error('统一插件平台' + methodDesc + '未准备完成');
86301
+ }
86302
+ }
86303
+ /**
86304
+ * 读取二代身份证(兼容新版统一外接设备插件平台iReadIdentityCard接口)
86305
+ * 优先使用新版iReadIdentityCard指令,失败时自动改用旧版ReadIDCard_Base64指令
86306
+ * */
86307
+ static async idCardRead(method = EWindowPassMethodCode.ReadIDCard_Base64) {
86308
+ try {
86309
+ return await EWindowPassService.newIdCardRead();
86310
+ } catch (e) {
86311
+ // 新版指令读取失败(设备服务为旧版或暂不可用),改用旧版ReadIDCard_Base64指令读取
86312
+ console.log('新版接口读取二代身份证失败,尝试旧版E窗通接口==>', e);
86313
+ return await EWindowPassService.oldIdCardRead();
86314
+ }
86315
+ }
86316
+ /**
86317
+ * 读取二代身份证-旧版E窗通指令(ReadIDCard_Base64)
86318
+ * */
86319
+ static async oldIdCardRead() {
86320
+ const readData = await EWindowPassService.read(EWindowPassMethodCode.ReadIDCard_Base64);
86321
+ console.log('读取二代身份证==>', readData);
86322
+ if (!readData) {
86323
+ throw Error('未匹配可用的E窗通读取设备');
86324
+ }
86325
+ if (readData.retVal !== 0) {
86326
+ throw Error("读取二代身份证失败,返回值:" + readData.retVal + ",错误信息:" + readData.errMsg);
86327
+ }
86328
+ const idInfo = readData.idInfo.data;
86329
+ const {
86330
+ name,
86331
+ sex,
86332
+ birthday,
86333
+ address,
86334
+ id_num,
86335
+ nations
86336
+ } = idInfo;
86337
+ const IDCardData = {
86338
+ info: {
86339
+ name,
86340
+ sex,
86341
+ birthday: birthday.replace('-', '').replace('-', ''),
86342
+ address,
86343
+ cardId: id_num,
86344
+ nation: nations
86345
+ },
86346
+ headImage: readData.idPhotoPicBase64
86347
+ };
86348
+ console.log('读取二代身份证结果==>', IDCardData);
86349
+ return IDCardData;
86350
+ }
86351
+ /**
86352
+ * 读取二代身份证-新版统一外接设备插件平台指令(iReadIdentityCard)
86353
+ * 返回:{method:'iReadIdentityCard',retVal:0,errMsg:'',idCardInfo:'二代证信息',photoBase64,photoFrontBase64,photoBackBase64}
86354
+ * */
86355
+ static async newIdCardRead() {
86356
+ const readData = await EWindowPassService.read(EWindowPassMethodCode.iReadIdentityCard);
86357
+ console.log('读取二代身份证(新版接口)==>', readData);
86358
+ if (!readData) {
86359
+ throw Error('未匹配可用的E窗通读取设备');
86360
+ }
86361
+ if (readData.retVal !== 0) {
86362
+ throw Error("读取二代身份证失败,返回值:" + readData.retVal + ",错误信息:" + readData.errMsg);
86363
+ }
86364
+ // 各字段:姓名|性别|民族|出生日期|住址|身份证号|签发机关|签发日期|有效期至
86365
+ const idInfoArray = (readData.idCardInfo || '').split('|');
86366
+ const birthday = (idInfoArray[3] || '').replace('-', '').replace('-', '');
86367
+ const IDCardData = {
86368
+ info: {
86369
+ name: idInfoArray[0],
86370
+ sex: idInfoArray[1],
86371
+ birthday,
86372
+ address: idInfoArray[4],
86373
+ cardId: idInfoArray[5],
86374
+ nation: idInfoArray[2],
86375
+ police: idInfoArray[6],
86376
+ validStart: idInfoArray[7],
86377
+ validEnd: idInfoArray[8]
86378
+ },
86379
+ headImage: readData.photoBase64
86380
+ };
86381
+ console.log('读取二代身份证结果==>', IDCardData);
86382
+ return IDCardData;
86383
+ }
86384
+ /**
86385
+ * 人证比对
86386
+ */
86387
+ static async faceValidateWithIdCardRead() {
86388
+ const readData = await EWindowPassService.read(EWindowPassMethodCode.FaceValidateWithIdCard_Base64);
86389
+ console.log('人证比对==>', readData);
86390
+ if (!readData) {
86391
+ throw Error('未匹配可用的E窗通读取设备');
86392
+ }
86393
+ if (readData.retVal !== 0) {
86394
+ throw Error("人证比对失败,返回值:" + readData.retVal + ",错误信息:" + readData.errMsg);
86395
+ }
86396
+ const idInfo = readData.idInfo.data;
86397
+ const {
86398
+ name,
86399
+ sex,
86400
+ birth,
86401
+ address,
86402
+ idNo,
86403
+ nation
86404
+ } = idInfo;
86405
+ const IDCardData = {
86406
+ idCard: {
86407
+ info: {
86408
+ name,
86409
+ sex,
86410
+ birthday: birth.replace('-', '').replace('-', ''),
86411
+ address,
86412
+ cardId: idNo,
86413
+ nation
86414
+ },
86415
+ headImage: readData.idPhotoBase64
86416
+ },
86417
+ faceimg: readData.scenceBase64
86418
+ };
86419
+ console.log('人证比对结果==>', IDCardData);
86420
+ return IDCardData;
86421
+ }
86422
+ /** 读取社保卡 */
86423
+ static async socialSecurityCardRead() {
86424
+ const readData = await EWindowPassService.read(EWindowPassMethodCode.iReadCardBas);
86425
+ if (!readData) {
86426
+ throw Error('未匹配可用的E窗通读取设备');
86427
+ }
86428
+ if (readData.retVal !== 0) {
86429
+ throw Error("读取社保卡基本信息失败,返回值:" + readData.retVal + ",错误信息:" + readData.outInfo);
86430
+ }
86431
+ // 返回数据:330100|350781196403072943|W57681892|331100D10600000300657BCF88899F8E|张三|3B6D000000815444368660330100286BCF|1.00|2020-08-12|2030-08-12|1|SN00000000|(邮编|身份证号|卡号|社会保障号码|姓名|...不知道是什么信息了)
86432
+ const outInfo = readData.outInfo;
86433
+ const outInfoArray = outInfo.split('|');
86434
+ const cardId = outInfoArray[1];
86435
+ const birthday = IdCardCommonUtils.getBirthdayByIdNumber(cardId).replace('-', '').replace('-', '');
86436
+ const sex = IdCardCommonUtils.getGenderByIdNumber(cardId);
86437
+ const IDCardData = {
86438
+ info: {
86439
+ name: outInfoArray[4],
86440
+ sex,
86441
+ birthday,
86442
+ address: '',
86443
+ cardId
86444
+ },
86445
+ headImage: ''
86446
+ };
86447
+ console.log('读取社保卡==>', readData);
86448
+ return IDCardData;
86449
+ }
86450
+ /** 获取签名-base64 */
86451
+ static async signNameRead() {
86452
+ const readData = await EWindowPassService.read(EWindowPassMethodCode.GetSignName_Base64);
86453
+ if (!readData) {
86454
+ throw Error('未匹配可用的E窗通读取设备');
86455
+ }
86456
+ if (readData.retVal !== 0) {
86457
+ throw Error("读取签名失败,返回值:" + readData.retVal + ",错误信息:" + readData.errMsg);
86458
+ }
86459
+ console.log('获取签名==>', readData);
86460
+ return readData.signPicBase64;
86461
+ }
86462
+ /** 获取指纹*/
86463
+ static async fingerPrintRead() {
86464
+ let timeOver = 30;
86465
+ async function readFingerPrint() {
86466
+ const readData = await EWindowPassService.read(EWindowPassMethodCode.FingerPrint_Base64);
86467
+ if (!readData) {
86468
+ throw Error('未匹配可用的E窗通读取设备');
86469
+ }
86470
+ let list = readData.fingerPrintInfo.split("|");
86471
+ console.log(list);
86472
+ let ret = Number(list[1]);
86473
+ if (ret > 1) {
86474
+ if (timeOver > 0) {
86475
+ timeOver--;
86476
+ return await readFingerPrint();
86477
+ } else {
86478
+ return {
86479
+ status: 'error',
86480
+ data: '已超时,请重新操作,按压指纹'
86481
+ };
86482
+ }
86483
+ } else {
86484
+ return {
86485
+ status: 'success',
86486
+ data: readData.fingerPrintInfo
86487
+ };
86488
+ }
86489
+ }
86490
+ let {
86491
+ status,
86492
+ data
86493
+ } = await readFingerPrint();
86494
+ if (status === 'error') {
86495
+ throw Error(data);
86496
+ } else {
86497
+ let [method, result, quality, image, featureCode] = data.split('|');
86498
+ // getimgae|1|68|......|......
86499
+ // method:方法,result:返回的状态,quality:指纹图片质量,image:图片base64,featureCode:指纹特征码
86500
+ return {
86501
+ method,
86502
+ result,
86503
+ quality,
86504
+ image,
86505
+ featureCode
86506
+ };
86507
+ }
86508
+ }
86509
+ // ==================== 高拍仪(图像设备简洁版) ====================
86510
+ // 协议说明(对照E窗通测试专用.html摄像简洁版章节):
86511
+ // VideoStart:开启预览(cameraNo:1-文档摄像头/主头,2-人像摄像头/副头;isEdgeDetection:0-不裁切,1-自动裁切),
86512
+ // 成功后设备在同一条连接上持续推送VideoStream帧,连接必须保持;
86513
+ // VideoGetImage:拍摄抓图(预览开启后调用,返回imgBase64,预览保持可连续拍摄);
86514
+ // VideoStop:关闭预览(离开页面、切换摄像头/裁剪方式时调用);
86515
+ // 设备为单任务模式:预览期间禁止调用读卡/签名等其他指令,否则驱动会闪退,read()中已做拦截。
86516
+ /**
86517
+ * 建立(或复用)摄像头WebSocket长连接
86518
+ */
86519
+ static connectCamera() {
86520
+ if (!this.cameraConnectPromise) {
86521
+ this.cameraConnectPromise = new Promise((resolve, reject) => {
86522
+ const ws = new WebSocket(this.iReadCardBasWebSocketUrl);
86523
+ this.cameraWs = ws;
86524
+ ws.onopen = () => resolve(ws);
86525
+ ws.onmessage = event => this.handleCameraMessage(event);
86526
+ ws.onclose = () => {
86527
+ this.cameraWs = null;
86528
+ this.cameraConnectPromise = null;
86529
+ this.previewActive = false;
86530
+ this.failCameraPending(new Error('摄像头连接已关闭'));
86531
+ };
86532
+ ws.onerror = () => {
86533
+ this.cameraWs = null;
86534
+ this.cameraConnectPromise = null;
86535
+ this.previewActive = false;
86536
+ this.failCameraPending(new Error('摄像头连接异常'));
86537
+ reject(new Error('统一插件平台E窗通摄像头功能加载失败'));
86538
+ };
86539
+ });
86540
+ }
86541
+ return this.cameraConnectPromise;
86542
+ }
86543
+ /**
86544
+ * 处理摄像头连接返回消息
86545
+ * VideoStream(预览帧)为设备异步推送,直接交给预览回调,不占用请求应答通道;
86546
+ * 其余消息视为上一次请求的应答(拍摄/旋转的应答会插在帧流中间到达,按method分流)。
86547
+ */
86548
+ static handleCameraMessage(event) {
86549
+ let data;
86550
+ try {
86551
+ data = JSON.parse(event.data);
86552
+ } catch (e) {
86553
+ console.warn('收到无法解析的摄像头消息:', event.data);
86554
+ return;
86555
+ }
86556
+ if (data.method === EWindowPassMethodCode.VideoStream) {
86557
+ if (this.streamHandler && data.imgBase64) {
86558
+ this.streamHandler(data.imgBase64);
86559
+ }
86560
+ return;
86561
+ }
86562
+ if (this.cameraPending) {
86563
+ const pending = this.cameraPending;
86564
+ this.cameraPending = null;
86565
+ clearTimeout(pending.timer);
86566
+ pending.resolve(data);
86567
+ } else {
86568
+ console.warn('收到未预期的摄像头返回:', data);
86569
+ }
86570
+ }
86571
+ /** 使当前摄像头待响应的请求失败(连接断开/异常时兜底) */
86572
+ static failCameraPending(err) {
86573
+ if (this.cameraPending) {
86574
+ const pending = this.cameraPending;
86575
+ this.cameraPending = null;
86576
+ clearTimeout(pending.timer);
86577
+ pending.reject(err);
86578
+ }
86579
+ }
86580
+ /**
86581
+ * 摄像头核心请求方法:建立连接 -> 发送JSON指令 -> 等待返回(预览期间连接保持不断开)
86582
+ */
86583
+ static cameraRequest(method, args = {}, timeout = 30 * 1000) {
86584
+ if (this.cameraPending) {
86585
+ return Promise.reject(new Error('上一次摄像头请求尚未返回,请勿并发调用'));
86586
+ }
86587
+ return this.connectCamera().then(ws => {
86588
+ return new Promise((resolve, reject) => {
86589
+ const timer = setTimeout(() => {
86590
+ this.cameraPending = null;
86591
+ reject(new Error('调用' + (EWindowPassMethodDesc[method] || method) + '超时(' + timeout / 1000 + '秒)'));
86592
+ }, timeout);
86593
+ this.cameraPending = {
86594
+ resolve,
86595
+ reject,
86596
+ timer
86597
+ };
86598
+ const jsonString = JSON.stringify({
86599
+ method,
86600
+ args
86601
+ });
86602
+ console.log((EWindowPassMethodDesc[method] || method) + '请求:', jsonString);
86603
+ ws.send(jsonString);
86604
+ });
86605
+ });
86606
+ }
86607
+ /**
86608
+ * 开启摄像头预览(主头/副头)
86609
+ * @param type 'main'-文档摄像头(主头);'vice'-人像摄像头(副头)
86610
+ * @param isEdgeDetection 裁剪方式:0-不裁切;1-自动裁切(开启预览时设定,切换裁剪方式需重新开启预览)
86611
+ */
86612
+ static async turnOnTheCamera(type = 'main', isEdgeDetection = 0) {
86613
+ // 切换摄像头/裁剪方式:先无条件发送VideoStop关闭当前预览(避免设备端残留预览导致切换失败),失败时忽略继续
86614
+ try {
86615
+ await this.videoStop();
86616
+ } catch (e) {
86617
+ // 未在预览中或关闭失败时忽略,继续重新开启
86618
+ }
86619
+ const cameraNo = type === 'vice' ? 2 : 1;
86620
+ await this.videoStart(cameraNo, isEdgeDetection);
86621
+ }
86622
+ /**
86623
+ * 开启视频预览(成功后设备在同一条连接上持续推送VideoStream帧,需先订阅onVideoStream)
86624
+ * @param cameraNo 摄像头编号:1-文档摄像头;2-人像摄像头
86625
+ * @param isEdgeDetection 裁剪方式:0-不裁切;1-自动裁切
86626
+ */
86627
+ static async videoStart(cameraNo = 1, isEdgeDetection = 0) {
86628
+ const readData = await EWindowPassService.cameraRequest(EWindowPassMethodCode.VideoStart, {
86629
+ cameraNo,
86630
+ isEdgeDetection
86631
+ });
86632
+ console.log('开启视频预览==>', readData);
86633
+ if (!readData) {
86634
+ throw Error('未匹配可用的E窗通读取设备');
86635
+ }
86636
+ if (readData.retVal !== 0) {
86637
+ throw Error("开启视频预览失败,返回值:" + readData.retVal + ",错误信息:" + readData.errMsg);
86638
+ }
86639
+ this.previewActive = true;
86640
+ }
86641
+ /**
86642
+ * 订阅实时视频流(开启预览后设备持续推送帧数据)
86643
+ * @param handler 回调,参数为每帧图片Base64数据(渲染时拼接 data:image/jpeg;base64,)
86644
+ */
86645
+ static onVideoStream(handler) {
86646
+ this.streamHandler = handler;
86647
+ }
86648
+ /** 取消订阅实时视频流 */
86649
+ static offVideoStream() {
86650
+ this.streamHandler = null;
86651
+ }
86652
+ /**
86653
+ * 拍照(预览中抓取当前画面,返回图片Base64数据;预览保持不断开,可连续拍摄)
86654
+ * @param type 'main'-文档摄像头;'vice'-人像摄像头(拍照作用于当前预览画面,仅保持与组件调用习惯一致)
86655
+ */
86656
+ static async scanByCamera(type = 'main') {
86657
+ return await this.videoGetImage();
86658
+ }
86659
+ /**
86660
+ * 拍摄抓图(须在预览开启后调用)
86661
+ * @param imagePath 设备端保存路径(如 D:\test.png)
86662
+ * @returns 图片Base64数据
86663
+ */
86664
+ static async videoGetImage(imagePath = 'D:\\test.png') {
86665
+ if (!this.previewActive) {
86666
+ throw Error('请先开启摄像头预览');
86667
+ }
86668
+ const readData = await EWindowPassService.cameraRequest(EWindowPassMethodCode.VideoGetImage, {
86669
+ imagePath
86670
+ });
86671
+ console.log('拍摄抓图==>', readData);
86672
+ if (!readData) {
86673
+ throw Error('未匹配可用的E窗通读取设备');
86674
+ }
86675
+ if (readData.retVal !== 0) {
86676
+ throw Error("拍摄抓图失败,返回值:" + readData.retVal + ",错误信息:" + readData.errMsg);
86677
+ }
86678
+ return readData.imgBase64;
86679
+ }
86680
+ /**
86681
+ * 关闭视频预览(停止帧推送;切换摄像头/裁剪方式时由turnOnTheCamera先行调用)
86682
+ * 无论当前是否处于预览状态都会发送指令,设备未在预览时会返回失败(retVal!==0)
86683
+ */
86684
+ static async videoStop() {
86685
+ const readData = await EWindowPassService.cameraRequest(EWindowPassMethodCode.VideoStop);
86686
+ console.log('关闭视频预览==>', readData);
86687
+ if (!readData) {
86688
+ throw Error('未匹配可用的E窗通读取设备');
86689
+ }
86690
+ if (readData.retVal !== 0) {
86691
+ throw Error("关闭视频预览失败,返回值:" + readData.retVal + ",错误信息:" + readData.errMsg);
86692
+ }
86693
+ this.previewActive = false;
86694
+ }
86695
+ /**
86696
+ * 关闭摄像头(离开页面/点关闭按钮时调用:关闭预览、取消帧订阅并断开摄像头连接)
86697
+ */
86698
+ static async stopCamera() {
86699
+ if (this.cameraWs && this.previewActive) {
86700
+ try {
86701
+ await this.videoStop();
86702
+ } catch (e) {
86703
+ // 忽略关闭预览异常,继续清理连接
86704
+ }
86705
+ }
86706
+ this.offVideoStream();
86707
+ if (this.cameraWs) {
86708
+ try {
86709
+ this.cameraWs.close();
86710
+ } catch (e) {
86711
+ // 忽略关闭异常
86712
+ }
86713
+ this.cameraWs = null;
86714
+ }
86715
+ this.cameraConnectPromise = null;
86716
+ this.previewActive = false;
86717
+ }
86718
+ /** 旋转图像(旋转当前预览画面) */
86719
+ static async videoRotate() {
86720
+ const readData = await EWindowPassService.cameraRequest(EWindowPassMethodCode.VideoRotate);
86721
+ console.log('旋转图像==>', readData);
86722
+ if (!readData) {
86723
+ throw Error('未匹配可用的E窗通读取设备');
86724
+ }
86725
+ if (readData.retVal !== 0) {
86726
+ throw Error("旋转图像失败,返回值:" + readData.retVal + ",错误信息:" + readData.errMsg);
86727
+ }
86728
+ }
86729
+ }
86730
+ _defineProperty(EWindowPassService, "iReadCardBasWebSocketUrl", 'ws://127.0.0.1:5847');
86731
+ _defineProperty(EWindowPassService, "fingerPrintBasWebSocketUrl", 'ws://127.0.0.1:9000');
86732
+ _defineProperty(EWindowPassService, "ws", void 0);
86733
+ _defineProperty(EWindowPassService, "requestStore", []);
86734
+ _defineProperty(EWindowPassService, "cameraWs", null);
86735
+ _defineProperty(EWindowPassService, "cameraConnectPromise", null);
86736
+ _defineProperty(EWindowPassService, "cameraPending", null);
86737
+ _defineProperty(EWindowPassService, "streamHandler", null);
86738
+ _defineProperty(EWindowPassService, "previewActive", false);
86098
86739
  ;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-85.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./packages/scanner/scanner-camera/src/component/scanner-camera-component.vue?vue&type=script&lang=js&
86099
86740
 
86100
86741
 
@@ -86106,12 +86747,13 @@ _defineProperty(ViisanPluginService, "previewFrameCallback", null);
86106
86747
 
86107
86748
 
86108
86749
 
86750
+
86109
86751
  const BEGIN_DATA = 'data:image/jpg;base64,';
86110
86752
  /* harmony default export */ var scanner_camera_componentvue_type_script_lang_js_ = ({
86111
86753
  name: "scanner-camera-component",
86112
86754
  props: {
86113
86755
  /**
86114
- * 高拍仪型号 0-捷宇;3:方正高影仪;4:紫图速拍仪;5-良田;6-国产一体机;7-赞采;8-汉王高拍仪;9-本机摄像头拍照;10-维山高拍仪
86756
+ * 高拍仪型号 0-捷宇;3:方正高影仪;4:紫图速拍仪;5-良田;6-国产一体机;7-赞采;8-汉王高拍仪;9-本机摄像头拍照;10-维山高拍仪;11-沃斯德人证交互终端
86115
86757
  */
86116
86758
  machineType: {
86117
86759
  //
@@ -86223,6 +86865,8 @@ const BEGIN_DATA = 'data:image/jpg;base64,';
86223
86865
  }
86224
86866
  // 清理维山高拍仪预览轮询
86225
86867
  this.stopViisanPreview();
86868
+ // 清理沃斯德人证交互终端预览
86869
+ this.stopEwpPreview();
86226
86870
  },
86227
86871
  methods: {
86228
86872
  // 浏览器标签页关闭
@@ -86252,6 +86896,10 @@ const BEGIN_DATA = 'data:image/jpg;base64,';
86252
86896
  this.stopViisanPreview();
86253
86897
  await ViisanPluginService.stopCamera(this.camera === 0);
86254
86898
  break;
86899
+ case 11:
86900
+ // 沃斯德人证交互终端
86901
+ await this.stopEwpPreview();
86902
+ break;
86255
86903
  }
86256
86904
  },
86257
86905
  /**
@@ -86333,6 +86981,18 @@ const BEGIN_DATA = 'data:image/jpg;base64,';
86333
86981
  }
86334
86982
  break;
86335
86983
  }
86984
+ case 11:
86985
+ {
86986
+ // 沃斯德人证交互终端(拍照作用于当前预览画面,预览保持可连续拍)
86987
+ let type = this.camera === 0 ? 'main' : 'vice';
86988
+ let res = await EWindowPassService.scanByCamera(type);
86989
+ if (res) {
86990
+ this.$emit('send-scanner-result', `${BEGIN_DATA}${res}`);
86991
+ } else {
86992
+ this.$message.error('拍照出错,请检查设备是否连接成功');
86993
+ }
86994
+ break;
86995
+ }
86336
86996
  }
86337
86997
  },
86338
86998
  /**
@@ -86386,6 +87046,10 @@ const BEGIN_DATA = 'data:image/jpg;base64,';
86386
87046
  // 开启视频预览帧轮询(每 300ms 获取一帧)
86387
87047
  this.startViisanPreview();
86388
87048
  break;
87049
+ case 11:
87050
+ // 沃斯德人证交互终端(主头-文档摄像头)
87051
+ await this.startEwpPreview('main');
87052
+ break;
86389
87053
  }
86390
87054
  },
86391
87055
  async getEloamFrame() {
@@ -86416,6 +87080,23 @@ const BEGIN_DATA = 'data:image/jpg;base64,';
86416
87080
  ViisanPluginService.setPreviewFrameCallback(null);
86417
87081
  ViisanPluginService.stopVideoPreview();
86418
87082
  },
87083
+ /**
87084
+ * 沃斯德人证交互终端 - 开启视频预览
87085
+ * 先设置预览帧回调再开启预览(已在预览中服务内部会自动先关闭再开启,支持切换主/副头)
87086
+ */
87087
+ startEwpPreview(type) {
87088
+ EWindowPassService.onVideoStream(imgBase64 => {
87089
+ this.scannerVideoSrc = `${BEGIN_DATA}${imgBase64}`;
87090
+ });
87091
+ return EWindowPassService.turnOnTheCamera(type);
87092
+ },
87093
+ /**
87094
+ * 沃斯德人证交互终端 - 关闭视频预览并断开连接
87095
+ */
87096
+ stopEwpPreview() {
87097
+ EWindowPassService.offVideoStream();
87098
+ return EWindowPassService.stopCamera();
87099
+ },
86419
87100
  /**
86420
87101
  * 启动电脑默认摄像头
86421
87102
  * @param type 'main' 主摄像头, 'vice' 副摄像头
@@ -86520,6 +87201,10 @@ const BEGIN_DATA = 'data:image/jpg;base64,';
86520
87201
  await ViisanPluginService.turnOnTheCamera('vice');
86521
87202
  this.startViisanPreview();
86522
87203
  break;
87204
+ case 11:
87205
+ // 沃斯德人证交互终端(副头-人像摄像头,切换前先VideoStop关闭当前预览再开启)
87206
+ await this.startEwpPreview('vice');
87207
+ break;
86523
87208
  }
86524
87209
  },
86525
87210
  async takePictureMerge(type) {
@@ -86836,10 +87521,10 @@ const BEGIN_DATA = 'data:image/jpg;base64,';
86836
87521
  });
86837
87522
  ;// CONCATENATED MODULE: ./packages/scanner/scanner-camera/src/component/scanner-camera-component.vue?vue&type=script&lang=js&
86838
87523
  /* harmony default export */ var component_scanner_camera_componentvue_type_script_lang_js_ = (scanner_camera_componentvue_type_script_lang_js_);
86839
- ;// CONCATENATED MODULE: ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-67.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-67.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-67.use[2]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-67.use[3]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./packages/scanner/scanner-camera/src/component/scanner-camera-component.vue?vue&type=style&index=0&id=1d5723dd&prod&lang=scss&
87524
+ ;// CONCATENATED MODULE: ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-67.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-67.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-67.use[2]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-67.use[3]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./packages/scanner/scanner-camera/src/component/scanner-camera-component.vue?vue&type=style&index=0&id=3fc2d979&prod&lang=scss&
86840
87525
  // extracted by mini-css-extract-plugin
86841
87526
 
86842
- ;// CONCATENATED MODULE: ./packages/scanner/scanner-camera/src/component/scanner-camera-component.vue?vue&type=style&index=0&id=1d5723dd&prod&lang=scss&
87527
+ ;// CONCATENATED MODULE: ./packages/scanner/scanner-camera/src/component/scanner-camera-component.vue?vue&type=style&index=0&id=3fc2d979&prod&lang=scss&
86843
87528
 
86844
87529
  ;// CONCATENATED MODULE: ./packages/scanner/scanner-camera/src/component/scanner-camera-component.vue
86845
87530
 
@@ -86852,8 +87537,8 @@ const BEGIN_DATA = 'data:image/jpg;base64,';
86852
87537
 
86853
87538
  var scanner_camera_component_component = normalizeComponent(
86854
87539
  component_scanner_camera_componentvue_type_script_lang_js_,
86855
- scanner_camera_componentvue_type_template_id_1d5723dd_render,
86856
- scanner_camera_componentvue_type_template_id_1d5723dd_staticRenderFns,
87540
+ scanner_camera_componentvue_type_template_id_3fc2d979_render,
87541
+ scanner_camera_componentvue_type_template_id_3fc2d979_staticRenderFns,
86857
87542
  false,
86858
87543
  null,
86859
87544
  null,
@@ -87273,124 +87958,15 @@ class CameraReadService {
87273
87958
  }
87274
87959
  _defineProperty(CameraReadService, "cameraWebSocketUrl", 'ws://127.0.0.1:8152/SXTManage');
87275
87960
  _defineProperty(CameraReadService, "ws", void 0);
87276
- _defineProperty(CameraReadService, "requestStore", []);
87277
- class SignReadService {
87278
- static startConnect(signMode) {
87279
- if (this.ws && this.ws.readyState === WebSocket.CONNECTING) {
87280
- return this;
87281
- }
87282
- let webSocketUrl = this.signWebSocketUrl;
87283
- if (signMode === PluginApiType.hwSign) {
87284
- webSocketUrl = this.hwSignWebSocketUrl;
87285
- }
87286
- const ws = new WebSocket(webSocketUrl);
87287
- let resolved;
87288
- const onConnect = new Promise(resolve => {
87289
- resolved = resolve;
87290
- });
87291
- ws.onopen = () => {
87292
- resolved(true);
87293
- };
87294
- ws.onmessage = event => this.handleMessage(event);
87295
- ws.onclose = () => this.handleClose();
87296
- ws.onerror = () => this.handleError();
87297
- this.ws = ws;
87298
- return onConnect;
87299
- }
87300
- static handleError() {
87301
- for (const type in this.requestStore) {
87302
- this.requestStore.forEach(({
87303
- reject
87304
- }) => {
87305
- reject('handleError');
87306
- });
87307
- }
87308
- throw Error('统一插件平台签字板加载失败');
87309
- }
87310
- static handleClose() {
87311
- for (const type in this.requestStore) {
87312
- this.requestStore.forEach(({
87313
- reject
87314
- }) => {
87315
- reject('close');
87316
- });
87317
- }
87318
- }
87319
- static handleMessage(msg) {
87320
- let data = msg.data;
87321
- this.requestStore.forEach(({
87322
- resolve
87323
- }) => {
87324
- resolve(data);
87325
- });
87326
- this.requestStore = [];
87327
- this.ws.close();
87328
- }
87329
- static async read(signMode = PluginApiType.ywSign) {
87330
- await this.startConnect(signMode);
87331
- if (this.ws.readyState === 1) {
87332
- console.log('签字板连接成功');
87333
- this.ws.send(signMode);
87334
- return new Promise((resolve, reject) => {
87335
- if (!this.requestStore) {
87336
- this.requestStore = [];
87337
- }
87338
- this.requestStore.push({
87339
- resolve,
87340
- reject
87341
- });
87342
- });
87343
- } else {
87344
- throw Error('统一插件平台签字板未准备完成');
87345
- }
87346
- }
87347
- }
87348
- _defineProperty(SignReadService, "signWebSocketUrl", 'ws://127.0.0.1:8152/chromeManage');
87349
- _defineProperty(SignReadService, "hwSignWebSocketUrl", 'ws://127.0.0.1:8152/HWSIGNManage');
87350
- _defineProperty(SignReadService, "ws", void 0);
87351
- _defineProperty(SignReadService, "requestStore", []);
87352
- ;// CONCATENATED MODULE: ./packages/service/external-plugins/ewp-plugin-socket.service.ts
87353
-
87354
-
87355
- /**
87356
- * 沃斯德人证交互终端
87357
- * E窗通WEBSOCKET服务
87358
- *
87359
- * */
87360
-
87361
- var EWindowPassMethodCode;
87362
- (function (EWindowPassMethodCode) {
87363
- /** 读取社保卡 */
87364
- EWindowPassMethodCode["iReadCardBas"] = "iReadCardBas";
87365
- /** 获取签名*/
87366
- EWindowPassMethodCode["GetSignName_Base64"] = "GetSignName_Base64";
87367
- /** 读取二代身份证 */
87368
- EWindowPassMethodCode["ReadIDCard_Base64"] = "ReadIDCard_Base64";
87369
- /** 人证比对 */
87370
- EWindowPassMethodCode["FaceValidateWithIdCard_Base64"] = "FaceValidateWithIdCard_Base64";
87371
- /** 获取指纹 */
87372
- EWindowPassMethodCode["FingerPrint_Base64"] = "FingerPrint_Base64";
87373
- })(EWindowPassMethodCode || (EWindowPassMethodCode = {}));
87374
- const EWindowPassMethodDesc = {
87375
- [EWindowPassMethodCode.iReadCardBas]: '读取社保卡',
87376
- [EWindowPassMethodCode.GetSignName_Base64]: '获取签名',
87377
- [EWindowPassMethodCode.ReadIDCard_Base64]: '读取二代身份证',
87378
- [EWindowPassMethodCode.FaceValidateWithIdCard_Base64]: '人证比对',
87379
- [EWindowPassMethodCode.FingerPrint_Base64]: '获取指纹'
87380
- };
87381
- class EWindowPassService {
87382
- static startConnect(method) {
87383
- if (this.ws && this.ws.readyState === WebSocket.CONNECTING) {
87384
- return this;
87385
- }
87386
- let webSocketUrl = '';
87387
- switch (method) {
87388
- case EWindowPassMethodCode.FingerPrint_Base64:
87389
- webSocketUrl = this.fingerPrintBasWebSocketUrl;
87390
- break;
87391
- default:
87392
- webSocketUrl = this.iReadCardBasWebSocketUrl;
87393
- break;
87961
+ _defineProperty(CameraReadService, "requestStore", []);
87962
+ class SignReadService {
87963
+ static startConnect(signMode) {
87964
+ if (this.ws && this.ws.readyState === WebSocket.CONNECTING) {
87965
+ return this;
87966
+ }
87967
+ let webSocketUrl = this.signWebSocketUrl;
87968
+ if (signMode === PluginApiType.hwSign) {
87969
+ webSocketUrl = this.hwSignWebSocketUrl;
87394
87970
  }
87395
87971
  const ws = new WebSocket(webSocketUrl);
87396
87972
  let resolved;
@@ -87400,18 +87976,7 @@ class EWindowPassService {
87400
87976
  ws.onopen = () => {
87401
87977
  resolved(true);
87402
87978
  };
87403
- ws.onmessage = event => {
87404
- if (method === EWindowPassMethodCode.FingerPrint_Base64) {
87405
- // 指纹后端返回的是string
87406
- event = {
87407
- ...event,
87408
- data: JSON.stringify({
87409
- fingerPrintInfo: event.data
87410
- })
87411
- };
87412
- }
87413
- this.handleMessage(event);
87414
- };
87979
+ ws.onmessage = event => this.handleMessage(event);
87415
87980
  ws.onclose = () => this.handleClose();
87416
87981
  ws.onerror = () => this.handleError();
87417
87982
  this.ws = ws;
@@ -87425,7 +87990,7 @@ class EWindowPassService {
87425
87990
  reject('handleError');
87426
87991
  });
87427
87992
  }
87428
- throw Error('统一插件平台E窗通设备功能加载失败');
87993
+ throw Error('统一插件平台签字板加载失败');
87429
87994
  }
87430
87995
  static handleClose() {
87431
87996
  for (const type in this.requestStore) {
@@ -87437,12 +88002,7 @@ class EWindowPassService {
87437
88002
  }
87438
88003
  }
87439
88004
  static handleMessage(msg) {
87440
- let data = '';
87441
- try {
87442
- data = JSON.parse(msg.data);
87443
- } catch (e) {
87444
- data = '';
87445
- }
88005
+ let data = msg.data;
87446
88006
  this.requestStore.forEach(({
87447
88007
  resolve
87448
88008
  }) => {
@@ -87451,58 +88011,11 @@ class EWindowPassService {
87451
88011
  this.requestStore = [];
87452
88012
  this.ws.close();
87453
88013
  }
87454
- static async read(method) {
87455
- await this.startConnect(method);
87456
- const methodDesc = EWindowPassMethodDesc[method];
88014
+ static async read(signMode = PluginApiType.ywSign) {
88015
+ await this.startConnect(signMode);
87457
88016
  if (this.ws.readyState === 1) {
87458
- if (method !== EWindowPassMethodCode.FingerPrint_Base64) console.log(methodDesc + '连接成功');
87459
- let jsonString;
87460
- // outTimes:超时时间(秒)
87461
- switch (method) {
87462
- case EWindowPassMethodCode.ReadIDCard_Base64:
87463
- // cardReader:0 读卡器-USB;1 读卡器-COM
87464
- jsonString = JSON.stringify({
87465
- method,
87466
- args: {
87467
- outTimes: 30,
87468
- cardReader: 1
87469
- }
87470
- });
87471
- break;
87472
- case EWindowPassMethodCode.FaceValidateWithIdCard_Base64:
87473
- // cardReader:0 读卡器-USB;1 读卡器-COM
87474
- jsonString = JSON.stringify({
87475
- method,
87476
- args: {
87477
- outTimes: 30,
87478
- cardReader: 1,
87479
- cameraType: 0
87480
- }
87481
- });
87482
- break;
87483
- case EWindowPassMethodCode.iReadCardBas:
87484
- // icType:1接触卡;2非接触卡;3自动(接触优先);4自动(非接优先)
87485
- jsonString = JSON.stringify({
87486
- method,
87487
- args: {
87488
- icType: '1'
87489
- }
87490
- });
87491
- break;
87492
- case EWindowPassMethodCode.FingerPrint_Base64:
87493
- // 获取指纹:getimgae,颜色(0黑色 1红色), 质量(默认0), 图像大小(288,360),类型(0民用,1公安)
87494
- jsonString = 'getimgae,1,0,288,0';
87495
- break;
87496
- default:
87497
- jsonString = JSON.stringify({
87498
- method,
87499
- args: {
87500
- outTimes: 30
87501
- }
87502
- });
87503
- break;
87504
- }
87505
- this.ws.send(jsonString);
88017
+ console.log('签字板连接成功');
88018
+ this.ws.send(signMode);
87506
88019
  return new Promise((resolve, reject) => {
87507
88020
  if (!this.requestStore) {
87508
88021
  this.requestStore = [];
@@ -87513,174 +88026,14 @@ class EWindowPassService {
87513
88026
  });
87514
88027
  });
87515
88028
  } else {
87516
- throw Error('统一插件平台' + methodDesc + '未准备完成');
87517
- }
87518
- }
87519
- /**
87520
- * 读取二代身份证
87521
- * */
87522
- static async idCardRead(method = EWindowPassMethodCode.ReadIDCard_Base64) {
87523
- const readData = await EWindowPassService.read(EWindowPassMethodCode.ReadIDCard_Base64);
87524
- console.log('读取二代身份证==>', readData);
87525
- if (!readData) {
87526
- throw Error('未匹配可用的E窗通读取设备');
87527
- }
87528
- if (readData.retVal !== 0) {
87529
- throw Error("读取二代身份证失败,返回值:" + readData.retVal + ",错误信息:" + readData.errMsg);
87530
- }
87531
- const idInfo = readData.idInfo.data;
87532
- const {
87533
- name,
87534
- sex,
87535
- birthday,
87536
- address,
87537
- id_num,
87538
- nations
87539
- } = idInfo;
87540
- const IDCardData = {
87541
- info: {
87542
- name,
87543
- sex,
87544
- birthday: birthday.replace('-', '').replace('-', ''),
87545
- address,
87546
- cardId: id_num,
87547
- nation: nations
87548
- },
87549
- headImage: readData.idPhotoPicBase64
87550
- };
87551
- console.log('读取二代身份证结果==>', IDCardData);
87552
- return IDCardData;
87553
- }
87554
- /**
87555
- * 人证比对
87556
- */
87557
- static async faceValidateWithIdCardRead() {
87558
- const readData = await EWindowPassService.read(EWindowPassMethodCode.FaceValidateWithIdCard_Base64);
87559
- console.log('人证比对==>', readData);
87560
- if (!readData) {
87561
- throw Error('未匹配可用的E窗通读取设备');
87562
- }
87563
- if (readData.retVal !== 0) {
87564
- throw Error("人证比对失败,返回值:" + readData.retVal + ",错误信息:" + readData.errMsg);
87565
- }
87566
- const idInfo = readData.idInfo.data;
87567
- const {
87568
- name,
87569
- sex,
87570
- birth,
87571
- address,
87572
- idNo,
87573
- nation
87574
- } = idInfo;
87575
- const IDCardData = {
87576
- idCard: {
87577
- info: {
87578
- name,
87579
- sex,
87580
- birthday: birth.replace('-', '').replace('-', ''),
87581
- address,
87582
- cardId: idNo,
87583
- nation
87584
- },
87585
- headImage: readData.idPhotoBase64
87586
- },
87587
- faceimg: readData.scenceBase64
87588
- };
87589
- console.log('人证比对结果==>', IDCardData);
87590
- return IDCardData;
87591
- }
87592
- /** 读取社保卡 */
87593
- static async socialSecurityCardRead() {
87594
- const readData = await EWindowPassService.read(EWindowPassMethodCode.iReadCardBas);
87595
- if (!readData) {
87596
- throw Error('未匹配可用的E窗通读取设备');
87597
- }
87598
- if (readData.retVal !== 0) {
87599
- throw Error("读取社保卡基本信息失败,返回值:" + readData.retVal + ",错误信息:" + readData.outInfo);
87600
- }
87601
- // 返回数据:330100|350781196403072943|W57681892|331100D10600000300657BCF88899F8E|张三|3B6D000000815444368660330100286BCF|1.00|2020-08-12|2030-08-12|1|SN00000000|(邮编|身份证号|卡号|社会保障号码|姓名|...不知道是什么信息了)
87602
- const outInfo = readData.outInfo;
87603
- const outInfoArray = outInfo.split('|');
87604
- const cardId = outInfoArray[1];
87605
- const birthday = IdCardCommonUtils.getBirthdayByIdNumber(cardId).replace('-', '').replace('-', '');
87606
- const sex = IdCardCommonUtils.getGenderByIdNumber(cardId);
87607
- const IDCardData = {
87608
- info: {
87609
- name: outInfoArray[4],
87610
- sex,
87611
- birthday,
87612
- address: '',
87613
- cardId
87614
- },
87615
- headImage: ''
87616
- };
87617
- console.log('读取社保卡==>', readData);
87618
- return IDCardData;
87619
- }
87620
- /** 获取签名-base64 */
87621
- static async signNameRead() {
87622
- const readData = await EWindowPassService.read(EWindowPassMethodCode.GetSignName_Base64);
87623
- if (!readData) {
87624
- throw Error('未匹配可用的E窗通读取设备');
87625
- }
87626
- if (readData.retVal !== 0) {
87627
- throw Error("读取签名失败,返回值:" + readData.retVal + ",错误信息:" + readData.errMsg);
87628
- }
87629
- console.log('获取签名==>', readData);
87630
- return readData.signPicBase64;
87631
- }
87632
- /** 获取指纹*/
87633
- static async fingerPrintRead() {
87634
- let timeOver = 30;
87635
- async function readFingerPrint() {
87636
- const readData = await EWindowPassService.read(EWindowPassMethodCode.FingerPrint_Base64);
87637
- if (!readData) {
87638
- throw Error('未匹配可用的E窗通读取设备');
87639
- }
87640
- let list = readData.fingerPrintInfo.split("|");
87641
- console.log(list);
87642
- let ret = Number(list[1]);
87643
- if (ret > 1) {
87644
- if (timeOver > 0) {
87645
- timeOver--;
87646
- return await readFingerPrint();
87647
- } else {
87648
- return {
87649
- status: 'error',
87650
- data: '已超时,请重新操作,按压指纹'
87651
- };
87652
- }
87653
- } else {
87654
- return {
87655
- status: 'success',
87656
- data: readData.fingerPrintInfo
87657
- };
87658
- }
87659
- }
87660
- let {
87661
- status,
87662
- data
87663
- } = await readFingerPrint();
87664
- if (status === 'error') {
87665
- throw Error(data);
87666
- } else {
87667
- let [method, result, quality, image, featureCode] = data.split('|');
87668
- // getimgae|1|68|......|......
87669
- // method:方法,result:返回的状态,quality:指纹图片质量,image:图片base64,featureCode:指纹特征码
87670
- return {
87671
- method,
87672
- result,
87673
- quality,
87674
- image,
87675
- featureCode
87676
- };
88029
+ throw Error('统一插件平台签字板未准备完成');
87677
88030
  }
87678
88031
  }
87679
88032
  }
87680
- _defineProperty(EWindowPassService, "iReadCardBasWebSocketUrl", 'ws://127.0.0.1:5847');
87681
- _defineProperty(EWindowPassService, "fingerPrintBasWebSocketUrl", 'ws://127.0.0.1:9000');
87682
- _defineProperty(EWindowPassService, "ws", void 0);
87683
- _defineProperty(EWindowPassService, "requestStore", []);
88033
+ _defineProperty(SignReadService, "signWebSocketUrl", 'ws://127.0.0.1:8152/chromeManage');
88034
+ _defineProperty(SignReadService, "hwSignWebSocketUrl", 'ws://127.0.0.1:8152/HWSIGNManage');
88035
+ _defineProperty(SignReadService, "ws", void 0);
88036
+ _defineProperty(SignReadService, "requestStore", []);
87684
88037
  ;// CONCATENATED MODULE: ./packages/service/external-plugins/huada-plugin-socket.service.ts
87685
88038
 
87686
88039