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