sale-client 3.4.96 → 3.4.97

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.
@@ -0,0 +1,1034 @@
1
+ <template>
2
+ <modal :show.sync="show" v-ref:modal backdrop="false" width="1439px" style="height:auto">
3
+ <header slot="modal-header">
4
+ <div class="header">
5
+ <span class="glyphicon glyphicon-remove-circle close" style="margin-top: 35px;margin-right: 30px" @click="close"></span>
6
+ <h4 class="title">高拍仪</h4>
7
+ </div>
8
+ </header>
9
+ <article slot="modal-body" class="form-control" style="padding: 0px">
10
+ <div class="form-group">
11
+ <div class="operation-group">
12
+ <strong class="operation" style="margin-top: 2px">视频操作:</strong>
13
+ <select id="DeviceName" name="D1" @change= "ChangeDevice()">
14
+ </select>
15
+ <select id="Resolution" name="D2" @change= "ChangeResolution()">
16
+ </select>
17
+ <button class="btn btn-info photo" @click="bb()">拍照</button>
18
+ <button class="btn btn-info" @click="cam_switch(1)">打开视频</button>
19
+ <button class="btn btn-info" @click="CloseVideo()">关闭视频</button>
20
+ <textarea id="base64" v-show="false" @change="base64change()"></textarea>
21
+ <div style="display: inline-block;margin-left: 570px">
22
+ <strong class="operation">读取身份证:</strong>
23
+ <button class="btn btn-info readIDCard" @click=openidcard()>打开身份证模块</button>
24
+ <button class="btn btn-info readIDCard" @click=Begin()>读身份证</button>
25
+ <button class="btn btn-default stop" @click=Stop()>停止读卡</button>
26
+ </div>
27
+ </div>
28
+ <div class="showInfo">
29
+ <IMG ID="Base64IMG" src="" class="img"></IMG>
30
+ <button style="position: absolute;buttom:-10px;left:0px;" @click="splitsimg">旋转</button>
31
+ <textarea id="Console" disabled="disabled"></textarea>
32
+ <div style="width: 640px;height: 400px;" id='ActiveXDivOne'>
33
+ </div>
34
+ </div>
35
+ <div class="IdCard">
36
+ <div class="auto IdInputDiv" style="margin-top: 20px"><strong class="IdHint">姓&emsp;&emsp;名</strong><input size=49 id="Name" class="IdInput"></div>
37
+ <div class="auto IdInputDiv" ><strong class="IdHint">性&emsp;&emsp;别</strong><input type="text" size=49 id="Sex" class="IdInput"></div>
38
+ <div class="auto IdInputDiv" ><strong class="IdHint">民&emsp;&emsp;族</strong><input type="text" size=49 id="Nation" class="IdInput"></div>
39
+ <div class="auto IdInputDiv"><strong class="IdHint">出&emsp;&emsp;生</strong><input type="text" size=49 id="Born" class="IdInput"></div>
40
+ <div class="auto IdInputDiv"><strong class="IdHint">地&emsp;&emsp;址</strong><input type="text" size=49 id="Address" class="IdInput"></div>
41
+ <div class="auto IdInputDiv"><strong class="IdHint">身份证号</strong><input type="text" size=49 id="CardNo" class="IdInput"></div>
42
+ <div class="auto IdInputDiv"><strong class="IdHint">签发机关</strong><input type="text" size=49 id="Police" class="IdInput"></div>
43
+ <div class="auto IdInputDiv"><strong class="IdHint">期限起始</strong><input type="text" size=49 id="ActivityLFrom" class="IdInput"></div>
44
+ <div class="auto IdInputDiv"><strong class="IdHint">期限失效</strong><input type="text" size=49 id="ActivityLTo" class="IdInput"></div>
45
+ <div class="auto IdInputDiv"><strong class="IdHint">设&emsp;备ID</strong><input type="text" size=49 id="DeviceNo" class="IdInput"></div>
46
+ <div class="auto IdInputDiv" style="float: left"><strong class="IdHint">照片编码</strong><TEXTAREA id="PhotoBuffer"style="width: 400px;height: 92px"></TEXTAREA>
47
+ </div>
48
+ <div class="auto IdInputDiv" style="float: left"><strong class="IdHint">照&emsp;&emsp;片</strong><IMG style="width: 130px; height:169px" id=PhotoDisplay />
49
+ </div>
50
+ <div class="auto IdInputDiv" style="padding-top:45%;padding-left:35%">
51
+ <button class="btn btn-info" style="width: max-content" @click="confirmIdCard">确定</button>
52
+ </div>
53
+ </div>
54
+ <!--<div style="display: inline-block;margin-top: 5px;margin-left: 5px;height: 640px;float: left;">-->
55
+ <!--<IMG id="IMG3" src="" style="width:300px;height:160px;display: block">-->
56
+ <!--<button class="btn btn-success" @click="DelPDF3()">删除图片</button>-->
57
+ <!--<IMG id="IMG2" src="" style="width:300px;height:160px;display: block">-->
58
+ <!--<button class="btn btn-success" @click="DelPDF2()">删除图片</button>-->
59
+ <!--<IMG id="IMG1" src="" style="width:300px;height:160px;display: block">-->
60
+ <!--<button class="btn btn-success" @click="DelPDF1()">删除图片</button>-->
61
+ <!--</div>-->
62
+ </div>
63
+ </article>
64
+ <footer slot="modal-footer" class="modal-footer">
65
+ <!--<button type="button" class="btn btn-default" @click='close'>取消</button>-->
66
+ <!--<button type="button" class="btn btn-success" @click='confirm(filename)'>确认</button>-->
67
+ </footer>
68
+ </modal>
69
+ </template>
70
+
71
+ <script>
72
+ import * as hignmeter from './js/hignmeter'
73
+ let ws
74
+ let server_addr = 'ws://127.0.0.1:18888'// 本机端口地址
75
+ export default {
76
+ title: '高拍仪',
77
+ data () {
78
+ return {
79
+ cameraurl: '',
80
+ jd: 'transform:rotate(0deg)',
81
+ degs: 0
82
+ }
83
+ },
84
+ props: ['show'],
85
+ methods: {
86
+ splitsimg () {
87
+ this.degs += 90
88
+ this.jd = `transform:rotate(${this.degs}deg)`
89
+ },
90
+ // 页面load消息
91
+ onLoad () {
92
+ return new Promise((resolve, reject) => {
93
+ if (ws) {
94
+ resolve()
95
+ }
96
+ // output("正在连接:" + server_addr);
97
+ ws = new WebSocket(server_addr)
98
+ ws.onopen = (evt) => {
99
+ if (this.connected) {
100
+ resolve()
101
+ }
102
+ this.connected = true
103
+ this.output('已经连接到服务器')
104
+ // 打开视频
105
+ this.cam_switch(1)
106
+ // 打开自动裁边
107
+ resolve()
108
+ }
109
+ ws.onclose = (evt) => {
110
+ if (!this.connected) {
111
+ window.location.href = 'FLShell://'
112
+ setTimeout('this.onLoad()', 3)
113
+ } else {
114
+ this.output('已断开服务器连接')
115
+ this.connected = false
116
+ }
117
+ ws = null
118
+ reject(new Error('连接失败'))
119
+ }
120
+ ws.onmessage = (evt) => {
121
+ if (evt.data.length === 0) {
122
+ return
123
+ }
124
+ if (typeof evt.data === 'string') {
125
+ let msg = JSON.parse(evt.data)
126
+ if (msg.err && msg.err !== 0) {
127
+ this.output('错误 - ' + msg.err + ', ' + msg.msg)
128
+ reject('错误 - ' + msg.err + ', ' + msg.msg)
129
+ } else if (msg.msg) {
130
+ this.output(msg.msg)
131
+ }
132
+
133
+ if (msg.user_data) {
134
+ this.callback[msg.user_data](msg)
135
+ if (typeof msg.user_data === 'number') {
136
+ this.callback[msg.user_data] = undefined
137
+ }
138
+ }
139
+ } else {
140
+ let file = new FileReader()
141
+ file.onload = (evt) => {
142
+ if (evt.target.readyState == FileReader.DONE) {
143
+ let data = new Uint8Array(evt.target.result)
144
+ if (data[0] == this.SVR_BIN_MSG.CAP_FRAME) {
145
+ return this.drawImage(data)
146
+ }
147
+ }
148
+ }
149
+
150
+ file.readAsArrayBuffer(evt.data)
151
+ }
152
+ }
153
+ let canvas = document.getElementById('cam')
154
+ canvas.onmousedown = (e) => {
155
+ canvas.style.cursor = 'crosshair'
156
+
157
+ this.clicked = true
158
+
159
+ this.sendMsg(this.CLT_MSG.PRESET_MOUSEDOWN, {origX: e.layerX, origY: e.layerY}, function (msg) {
160
+ if (msg.err !== 0) { }
161
+ })
162
+ }
163
+
164
+ canvas.onmousemove = (e) => {
165
+ if (!this.clicked) {
166
+ canvas.style.cursor = 'default'
167
+ return
168
+ }
169
+ canvas.style.cursor = 'crosshair'
170
+
171
+ this.sendMsg(this.CLT_MSG.PRESET_MOUSEMOVE, {offx: e.layerX, offy: e.layerY}, (msg) => {
172
+ if (msg.err !== 0) { }
173
+ })
174
+ }
175
+
176
+ onmouseout = canvas.onmouseup = (e) => {
177
+ canvas.style.cursor = 'default'
178
+ if (!this.clicked) { return }
179
+
180
+ this.sendMsg(this.CLT_MSG.PRESET_MOUSEUP, {offx: e.layerX, offy: e.layerY}, (msg) => {
181
+ if (msg.err !== 0) {
182
+
183
+ }
184
+ })
185
+ this.clicked = false
186
+ }
187
+ })
188
+ },
189
+ // 打开视频
190
+
191
+ // 打开视频
192
+ cam_switch () {
193
+ hignmeter.StartVideo()
194
+ },
195
+ base64change () {
196
+ setTimeout(() => {
197
+ let str = document.getElementById('base64').value
198
+ this.$dispatch('photo-finish', str)
199
+ }, 1000)
200
+ },
201
+ // 关闭视频
202
+ CloseVideo () {
203
+ hignmeter.CloseVideo()
204
+ },
205
+ ChangeDevice() {
206
+ hignmeter.ChangeDevice()
207
+ },
208
+ ChangeResolution() {
209
+ hignmeter.ChangeResolution()
210
+ },
211
+ // //获取初始化结果
212
+ // GetInitRet(){
213
+ // if(this.iswaiting) return
214
+ // this.iswaiting = true
215
+ // this.sendMsg(this.CLT_MSG.GET_EVENT,(msg)=> {
216
+ // if(msg.err !== 0){
217
+ // this.iswaiting = false
218
+ // return
219
+ // }
220
+ // let event = msg.event
221
+ // switch(event){
222
+ // case 2:
223
+ // this.output("设备连接中断,请重新连接后再次打开视频。");
224
+ // break
225
+ //
226
+ // case 1:
227
+ // this.output("初始化成功");
228
+ // break;
229
+ //
230
+ // case 0:
231
+ // this.output("设备非法");
232
+ // break
233
+ // }
234
+ // this.iswaiting = false
235
+ // })
236
+ // },
237
+ // //获取PID
238
+ // GetPid(){
239
+ // if(this.iswaiting) return
240
+ // this.iswaiting = true
241
+ // this.sendMsg(this.CLT_MSG.GET_PID, (msg) => {
242
+ // if(msg.err !== 0) {
243
+ // this.iswaiting = false
244
+ // return
245
+ // }
246
+ //
247
+ // this.output("pid : " + msg.pid)
248
+ // this.iswaiting = false
249
+ // })
250
+ // },
251
+ // //获取分辨率
252
+ // GetFbl(){
253
+ // if(this.iswaiting) return
254
+ // this.iswaiting = true;
255
+ // this.sendMsg(this.CLT_MSG.GET_FBL, (msg) => {
256
+ // if(msg.err !== 0) {
257
+ // this.iswaiting = false;
258
+ // return;
259
+ // }
260
+ //
261
+ // this.output("分辨率 : " + msg.fbl);
262
+ // this.iswaiting = false
263
+ // });
264
+ // },
265
+ // //设置分辨率
266
+ // SetResolution(){
267
+ // if(this.iswaiting) return
268
+ // this.iswaiting = true
269
+ // let first = false
270
+ // let second = false
271
+ // this.sendMsg(this.CLT_MSG.SET_MJPG, {isMJPG:1},(msg) => { //设置MJPG格式
272
+ // if(msg.err !== 0) {
273
+ // first = true
274
+ // if(first == true && second == true){
275
+ // this.iswaiting = false
276
+ // return
277
+ // }
278
+ // }
279
+ // this.output("MJPG : " + 1)
280
+ // first = true
281
+ // if(first == true && second == true){
282
+ // this.iswaiting = false
283
+ // }
284
+ // })
285
+ // this.sendMsg(this.CLT_MSG.SET_FBL, {width:800,height:600},(msg) => { //设置分辨率
286
+ // if(msg.err !== 0) {
287
+ // second = true
288
+ // if(first == true && second == true){
289
+ // this.iswaiting = false
290
+ // }
291
+ // return
292
+ // }
293
+ // this.output("设置分辨率 : width=" + 800 + ",height=" + 600)
294
+ // second = true
295
+ // if(first == true && second == true){
296
+ // this.iswaiting = false
297
+ // }
298
+ // })
299
+ // },
300
+ // //设置视频旋转方向
301
+ // SetOrientation(){
302
+ // let oriT = 0
303
+ // // 设置转动 0 正常 1 上下转 2 左转 3 右转
304
+ // if(this.iswaiting){
305
+ // return
306
+ // }
307
+ // this.iswaiting = true
308
+ // oriT = 2
309
+ // if(oriT == 1){
310
+ // this.rotanumber = 2
311
+ // }else if(oriT == 2){
312
+ // this.rotanumber = 3
313
+ // }else if(oriT == 3){
314
+ // this.rotanumber = 1
315
+ // }
316
+ // this.sendMsg(this.CLT_MSG.SET_TURN, {turn:oriT},(msg) => {
317
+ // if(msg.err !== 0) {
318
+ // this.iswaiting = false
319
+ // return
320
+ // }
321
+ //
322
+ // this.output("设置旋转 : turn=" + oriT)
323
+ // this.iswaiting = false
324
+ // });
325
+ // },
326
+ // //设置视频旋转方向
327
+ // SetLeft(){
328
+ // // 设置转动 0 正常 1 上下转 2 左转 3 右转
329
+ // if(this.iswaiting) return
330
+ // this.iswaiting = true
331
+ // this.rotanumber--;
332
+ // let T = 0;
333
+ // if(this.rotanumber%4 == 0){
334
+ // T = 0;
335
+ // }else if(this.rotanumber%4 == -1 || this.rotanumber%4 == 3){
336
+ // T = 2;
337
+ // }else if(this.rotanumber%4 == -2 || this.rotanumber%4 == 2){
338
+ // T = 1;
339
+ // }else if(this.rotanumber%4 == -3 || this.rotanumber%4 == 1){
340
+ // T = 3
341
+ // }
342
+ // this.sendMsg(this.CLT_MSG.SET_TURN, {turn:T},(msg) => {
343
+ // if(msg.err !== 0) {
344
+ // this.iswaiting = false
345
+ // return
346
+ // }
347
+ // this.output("设置旋转 : turn=" + T)
348
+ // this.iswaiting = false
349
+ // })
350
+ // },
351
+ // //设置视频旋转方向
352
+ // SetRight(){
353
+ // // 设置转动 0 正常 1 上下转 2 左转 3 右转
354
+ // if(this.iswaiting) return
355
+ // this.iswaiting = true
356
+ // this.rotanumber++;
357
+ // var T = 0;
358
+ // if(this.rotanumber%4 == 0){
359
+ // T = 0
360
+ // }else if(this.rotanumber%4 == 1 || this.rotanumber%4 == -3){
361
+ // T = 3
362
+ // }else if(this.rotanumber%4 == 2 || this.rotanumber%4 == -2){
363
+ // T = 1
364
+ // }else if(this.rotanumber%4 == 3 || this.rotanumber%4 == -1){
365
+ // T = 2
366
+ // }
367
+ // this.sendMsg(this.CLT_MSG.SET_TURN, {turn:T},(msg) => {
368
+ // if(msg.err !== 0) {
369
+ // this.iswaiting = false
370
+ // return
371
+ // }
372
+ //
373
+ // this.output("设置旋转 : turn=" + T)
374
+ // this.iswaiting = false
375
+ // })
376
+ // },
377
+ // 设置截图保存的jpg格式压缩质量
378
+ SetQuality () {
379
+ if (this.iswaiting) return
380
+ this.iswaiting = true
381
+ this.sendMsg(this.CLT_MSG.SET_QUALITY, {quality: 50}, (msg) => {
382
+ if (msg.err !== 0) {
383
+ this.iswaiting = false
384
+ return
385
+ }
386
+ this.output('设置拍照图片质量 : quality=' + 50)
387
+ this.iswaiting = false
388
+ })
389
+ },
390
+ // 设置自动裁边开启
391
+ SetAutoCutOn () {
392
+ console.log('设置自动采编')
393
+ if (this.iswaiting) return
394
+ this.iswaiting = true
395
+ this.sendMsg(this.CLT_MSG.SET_AUTOCROP, {open: 1}, (msg) => {
396
+ if (msg.err !== 0) {
397
+ this.iswaiting = false
398
+ return
399
+ }
400
+ this.output('设置自动裁边 : open=' + 1)
401
+ this.iswaiting = false
402
+ })
403
+ },
404
+ // 设置自动裁边关闭
405
+ SetAutoCutOff () {
406
+ if (this.iswaiting) return
407
+ this.iswaiting = true
408
+ this.sendMsg(this.CLT_MSG.SET_AUTOCROP, {open: 0}, (msg) => {
409
+ if (msg.err !== 0) {
410
+ this.iswaiting = false
411
+ return
412
+ }
413
+ this.output('设置自动裁边 : open=' + 0)
414
+ this.iswaiting = false
415
+ })
416
+ },
417
+ // //设置预设框选
418
+ // SetBox(){
419
+ // if(this.iswaiting) return
420
+ // this.iswaiting = true
421
+ // this.resetx = 20
422
+ // this.resety = 20
423
+ // this.resetwidth = 300
424
+ // this.resetheight = 400
425
+ // this.sendMsg(this.CLT_MSG.SET_PREST, {left:this.resetx, top:this.resety, width:this.resetwidth, height:this.resetheight},(msg) =>{
426
+ // if(msg.err !== 0) {
427
+ // this.iswaiting = false
428
+ // return
429
+ // }
430
+ // this.output("设置预设框选 : left=" + this.resetx + ",top=" + this.resety + ",width=" + this.resetwidth + ",height=" + this.resetheight);
431
+ // this.iswaiting = false;
432
+ // })
433
+ // },
434
+ // //获取当前预设框选参数
435
+ // ShowResetInfo(){
436
+ // if(this.iswaiting) return
437
+ // this.iswaiting = true
438
+ // this.sendMsg(this.CLT_MSG.GET_PREST_INFO, (msg) => {
439
+ // if(msg.err !== 0) {
440
+ // this.iswaiting = false
441
+ // return
442
+ // }
443
+ // this.output("当前预设 : " + msg.prest_info)
444
+ // this.iswaiting = false
445
+ // })
446
+ // },
447
+ // 取消预设框选
448
+ ResetBox () {
449
+ if (this.iswaiting) return
450
+ this.iswaiting = true
451
+ this.sendMsg(this.CLT_MSG.SET_PREST, {left: 0, top: 0, width: 0, height: 0}, (msg) => {
452
+ if (msg.err !== 0) {
453
+ this.iswaiting = false
454
+ return
455
+ }
456
+ this.resetx = 0
457
+ this.resety = 0
458
+ this.resetwidth = 0
459
+ this.resetheight = 0
460
+ this.output('取消预设框选')
461
+ this.iswaiting = false
462
+ })
463
+ },
464
+ // //视频格式弹窗
465
+ // FormatDlg(){
466
+ // if(this.iswaiting) return
467
+ // this.iswaiting = true
468
+ // this.sendMsg(this.CLT_MSG.FORMAT_DLG,(msg) => {
469
+ // if(msg.err !== 0) {
470
+ // this.iswaiting = false;
471
+ // return
472
+ // }
473
+ // this.iswaiting = false;
474
+ // })
475
+ // },
476
+ // //视频属性弹窗
477
+ // PropertyDlg(){
478
+ // if(this.iswaiting) return
479
+ // this.iswaiting = true
480
+ // this.sendMsg(this.CLT_MSG.PROPERTY_DLG,(msg) => {
481
+ // if(msg.err !== 0) {
482
+ // this.iswaiting = false;
483
+ // return
484
+ // }
485
+ // this.iswaiting = false;
486
+ // })
487
+ // },
488
+ // //设置颜色模式 只针对截图
489
+ bb () {
490
+
491
+ hignmeter.Capture()
492
+ },
493
+ // 内存截图
494
+ bbase64 () {
495
+ if (this.iswaiting) return
496
+ this.iswaiting = true
497
+ this.sendMsg(this.CLT_MSG.GET_PICTURE_MEM, {turn: 0}, (msg) => {
498
+ if (msg.err !== 0) {
499
+ this.iswaiting = false
500
+ return
501
+ }
502
+ let s = 'data:image/jpg;base64,' + msg.base64str
503
+ document.getElementById('Base64IMG').src = s// 网页预览图片
504
+ alert(s)
505
+ this.output('base64 长度 : ' + s.length)
506
+ this.iswaiting = false
507
+ })
508
+ },
509
+ // base64编码测试
510
+ TestBase64 () {
511
+ if (this.iswaiting) return
512
+ this.iswaiting = true
513
+ this.sendMsg(this.CLT_MSG.TEST_BASE64, {code: '123456789'}, (msg) => {
514
+ if (msg.err !== 0) {
515
+ this.iswaiting = false
516
+ return
517
+ }
518
+ this.output('base64 内容 : ' + msg.base64str)
519
+ this.iswaiting = false
520
+ })
521
+ },
522
+ // //开启去底色
523
+ // bbStartClean(){
524
+ // if(this.iswaiting) return;
525
+ // this.iswaiting = true;
526
+ // this.sendMsg(this.CLT_MSG.SET_CLEAN_PARAM,{param1:280,param2:1.15,param3:8},(msg) => {
527
+ // if(msg.err !== 0){
528
+ // this.iswaiting = false
529
+ // return
530
+ // }
531
+ // this.output("去底色: " + 280 + "," + 1.15 + "," + 8)
532
+ // this.iswaiting = false
533
+ // })
534
+ // },
535
+ // //关闭去底色
536
+ // bbCloseClean(){
537
+ // if(this.iswaiting) return
538
+ // this.iswaiting = true
539
+ // this.sendMsg(this.CLT_MSG.SET_CLEAN_PARAM,{param1:-1},(msg) => {
540
+ // if(msg.err !== 0){
541
+ // this.iswaiting = false;
542
+ // return
543
+ // }
544
+ // this.output("去底色: " + -1);
545
+ // this.iswaiting = false;
546
+ // });
547
+ // },
548
+ // //设置制作PDF临时目录
549
+ // SetPDFPath(){
550
+ // if(this.iswaiting) return
551
+ // this.iswaiting = true
552
+ // this.sendMsg(this.CLT_MSG.SET_TEMPDIR,{path:"d:\\tp\\temp"},(msg) => {
553
+ // if(msg.err !== 0){
554
+ // this.iswaiting = false
555
+ // return
556
+ // }
557
+ // this.output("设置PDF路径: " + "d:\\tp\\temp")
558
+ // this.iswaiting = false
559
+ // })
560
+ // },
561
+ // //开始制作PDF
562
+ // BeginPDF(){
563
+ // if(this.iswaiting) return
564
+ // this.iswaiting = true
565
+ // this.sendMsg(this.CLT_MSG.BEGIN_PDF,(msg) => {
566
+ // if(msg.err !== 0){
567
+ // this.iswaiting = false
568
+ // return
569
+ // }
570
+ // this.output("开始制作PDF")
571
+ // this.iswaiting = false
572
+ // })
573
+ // },
574
+ // //PDF截图 保存到PDF临时目录
575
+ // GetPDF(){
576
+ // if(this.iswaiting) return
577
+ // this.iswaiting = true
578
+ // this.sendMsg(this.CLT_MSG.GET_PDF_PICTURES,{turn:0},(msg) => {
579
+ // if(msg.err !== 0){
580
+ // this.iswaiting = false
581
+ // return
582
+ // }
583
+ // // let s = "file://" + msg.path
584
+ // let s = "data:image/jpg;base64," + msg.base64str;
585
+ // document.getElementById("IMG1").src= null;
586
+ // document.getElementById("IMG1").src= document.getElementById("IMG2").src;
587
+ //
588
+ // document.getElementById("IMG2").src= null;
589
+ // document.getElementById("IMG2").src= document.getElementById("IMG3").src;
590
+ //
591
+ // document.getElementById("IMG3").src= null;
592
+ // document.getElementById("IMG3").src= s;
593
+ // this.output("PDF 文件 : " + msg.path + ",PDF文件 BASE64码长度:" + msg.base64str.length);
594
+ // this.iswaiting = false;
595
+ // })
596
+ // },
597
+ // // 结束制作PDF
598
+ // EndPDF(){
599
+ // if(this.iswaiting) return
600
+ // this.iswaiting = true
601
+ // this.sendMsg(this.CLT_MSG.END_PDF_PICTURES,{path:"D:\\tp\\1234.pdf"},(msg) => {
602
+ // if(msg.err !== 0){
603
+ // this.iswaiting = false
604
+ // return
605
+ // }
606
+ // this.output("结束PDF PDF文件:" + "D:\\tp\\1234.pdf");
607
+ // this.iswaiting = false;
608
+ // })
609
+ // },
610
+ // //PDF文件转码成BASE64文件 适合所有格式文件 非PDF也可使用
611
+ // PDFtoBASE64(){
612
+ // if(this.iswaiting) return
613
+ // this.iswaiting = true
614
+ // this.sendMsg(this.CLT_MSG.PDF_TO_BASE64,{src:"D:\\tp\\1234.pdf",des:"D:\\tp\\temp\\1234.txt"},(msg) => {
615
+ // if(msg.err !== 0){
616
+ // this.iswaiting = false
617
+ // if(msg.err == 108){return this.output("读文件错误")}
618
+ // if(msg.err == 109){return this.output("写文件错误")}
619
+ // }
620
+ // this.output("文件 :" + "D:\\tp\\1234.pdf" + "转成base64 :" + "D:\\tp\\temp\\1234.txt");
621
+ // this.iswaiting = false
622
+ // })
623
+ // },
624
+ // //base64文件转成PDF文件 适合所有文件 非PDF文件也可使用
625
+ // BASE64toPDF(){
626
+ // if(this.iswaiting) return
627
+ // this.iswaiting = true
628
+ // this.sendMsg(this.CLT_MSG.BASE64_TO_PDF,{src:"D:\\tp\\temp\\1234.txt",des:"D:\\tp\\pdfpdf.pdf"},(msg) => {
629
+ // if(msg.err !== 0){
630
+ // this.iswaiting = false;
631
+ // if(msg.err == 108){return this.output("读文件错误")}
632
+ // if(msg.err == 109){return this.output("写文件错误")}
633
+ // }
634
+ // this.output("base64文件: " + "D:\\tp\\temp\\1234.txt" + "转成:" + "D:\\tp\\pdfpdf.pdf")
635
+ // this.iswaiting = false
636
+ // })
637
+ // },
638
+ // //PDF文件转成BASE64码字符串 适合所有文件 非PDF文件也可使用
639
+ // PDFtoBASE64Str(){
640
+ // if(this.iswaiting) return
641
+ // this.iswaiting = true
642
+ // this.sendMsg(this.CLT_MSG.PDF_TO_BASE64_STR,{file:"D:\\tp\\pdfpdf.pdf"},(msg) => {
643
+ // if(msg.err !== 0){
644
+ // this.iswaiting = false
645
+ // if(msg.err == 108){return this.output("读文件错误")}
646
+ // }
647
+ // alert(msg.base64str)
648
+ // this.output("文件 BASE64 长度: " + msg.base64str.length)
649
+ // this.iswaiting = false
650
+ // })
651
+ // },
652
+ // //打印图片
653
+ // printimage(){
654
+ // if(this.iswaiting) return
655
+ // this.iswaiting = true
656
+ // this.sendMsg(this.CLT_MSG.PRINT_IMAGE,{file:"D:\\tp\\1234.jpg"},(msg) => {
657
+ // if(msg.err !== 0){ //错误消息可以不用处理 在config.js中已经有了统一的打印处理 在output函数中设置打印位置
658
+ // this.iswaiting = false;
659
+ // if(msg.err == 112){return this.output("开启打印机错误");}
660
+ // if(msg.err == 111){return this.output("请检查打印机纸张");}
661
+ // if(msg.err == 110){return this.output("没有默认打印机");}
662
+ // }
663
+ // this.output("打印作业号: " + msg.print_no);
664
+ // this.iswaiting = false;
665
+ // })
666
+ // },
667
+ // //显示错误弹窗
668
+ // ShowErrorInfo(){
669
+ // if(this.iswaiting) return
670
+ // this.iswaiting = true
671
+ // this.sendMsg(this.CLT_MSG.SHOW_ERROR_BOX,{on:1},(msg) => {
672
+ // if(msg.err !== 0){
673
+ // this.iswaiting = false
674
+ // return
675
+ // }
676
+ // this.output("错误提示开关:" + 1)
677
+ // this.iswaiting = false;
678
+ // })
679
+ // },
680
+ // //删除制作PDF的图片文件
681
+ // DelPDF3(){
682
+ // if(this.iswaiting) return
683
+ // this.iswaiting = true
684
+ // this.sendMsg(this.CLT_MSG.DEL_PICTURE_PDF,{file:1},(msg) => {
685
+ // if(msg.err !== 0){
686
+ // this.iswaiting = false
687
+ // return
688
+ // }
689
+ // this.output("删除PDF图片文件成功")
690
+ // this.iswaiting = false
691
+ // })
692
+ // document.getElementById("IMG3").src= null;
693
+ // document.getElementById("IMG3").src= document.getElementById("IMG2").src;
694
+ //
695
+ // document.getElementById("IMG2").src= null;
696
+ // document.getElementById("IMG2").src= document.getElementById("IMG1").src;
697
+ //
698
+ // document.getElementById("IMG1").src= null;
699
+ // },
700
+ // //删除制作PDF的临时图片文件
701
+ // DelPDF2(){
702
+ // if(this.iswaiting) return
703
+ // this.iswaiting = true
704
+ // this.sendMsg(this.CLT_MSG.DEL_PICTURE_PDF,{file:2},(msg) => {
705
+ // if(msg.err !== 0){
706
+ // this.iswaiting = false
707
+ // return
708
+ // }
709
+ // this.output("删除PDF图片文件成功")
710
+ // this.iswaiting = false
711
+ // })
712
+ // document.getElementById("IMG2").src= null;
713
+ // document.getElementById("IMG2").src= document.getElementById("IMG1").src;
714
+ // document.getElementById("IMG1").src= null;
715
+ // },
716
+ // //删除制作PDF的临时图片文件
717
+ // DelPDF1(){
718
+ // if(this.iswaiting) return
719
+ // this.iswaiting = true
720
+ // this.sendMsg(this.CLT_MSG.DEL_PICTURE_PDF,{file:3},(msg) => {
721
+ // if(msg.err !== 0){
722
+ // this.iswaiting = false;
723
+ // return
724
+ // }
725
+ // this.output("删除PDF图片文件成功")
726
+ // this.iswaiting = false
727
+ // })
728
+ // document.getElementById("IMG1").src= null;
729
+ // },
730
+ // //人证对比
731
+ // IDCardCompare(){
732
+ // if(this.iswaiting) return
733
+ // this.iswaiting = true
734
+ // let send = {file1:"D:\\1.jpg",file2:"D:\\2.jpg"}
735
+ // this.sendMsg(this.CLT_MSG.IDCARD_COMPARE,send,(msg) => {
736
+ // if(msg.err !== 0){
737
+ // this.iswaiting = false
738
+ // return
739
+ // }
740
+ // this.output("对比完成:" + send.file1 + "与" + send.file2 + "相似度"+ msg.cmpresult)
741
+ // this.iswaiting = false
742
+ // })
743
+ // },
744
+ ReadIDCard () {
745
+ return this.sendMsg(this.CLT_MSG.READ_IDCARD, (msg) => {
746
+ if (msg.err !== 0) { return }
747
+ this.setText(msg)
748
+ this.output('单读卡')
749
+ })
750
+ },
751
+ // 读身份证
752
+ Begin () {
753
+ hignmeter.funGetICValues()
754
+ },
755
+ openidcard (){
756
+ hignmeter.funStartIC()
757
+ },
758
+ // 停止读身份证
759
+ Stop () {
760
+ this.sendMsg(this.CLT_MSG.STOP_READ_IDCARD, (msg) => {
761
+ if (msg.err !== 0) { return }
762
+ this.output('停止读卡')
763
+ })
764
+ },
765
+ // //横向复印
766
+ // HCopy(){
767
+ // this.sendMsg(this.CLT_MSG.HCOPY_IDCARD, {copy_path:"D:\\"},(msg) => {
768
+ // if(msg.err !== 0){return}
769
+ // document.getElementById("IDCardDisplay").src = "data:image/jpg;base64," + msg.hcopy
770
+ // this.sendMsg(this.CLT_MSG.PRINT_IMAGE,{file:msg.filename},(msg2) => {
771
+ // if(msg2.err !== 0){ return}
772
+ // his.output("打印作业号: " + msg2.print_no)
773
+ // })
774
+ // this.output("横向复印" + msg.filename)
775
+ // })
776
+ // },
777
+ // //竖向复印
778
+ // VCopy(){
779
+ // this.sendMsg(this.CLT_MSG.VCOPY_IDCARD, {copy_path:"D:\\"},(msg) => {
780
+ // if(msg.err !== 0){return}
781
+ // document.getElementById("IDCardDisplay").src = "data:image/jpg;base64," + msg.vcopy;
782
+ // this.sendMsg(this.CLT_MSG.PRINT_IMAGE,{file:msg.filename},(msg2) => {
783
+ // if(msg2.err !== 0){ return}
784
+ // this.output("打印作业号: " + msg2.print_no)
785
+ // })
786
+ // this.output("竖向复印" + msg.filename)
787
+ // })
788
+ // },
789
+ // //正面复印
790
+ // PCopy(){
791
+ // this.sendMsg(this.CLT_MSG.PCOPY_IDCARD, {copy_path:"D:\\"},(msg) => {
792
+ // if(msg.err !== 0){return}
793
+ // document.getElementById("IDCardDisplay").src = "data:image/jpg;base64," + msg.pcopy
794
+ // this.sendMsg(this.CLT_MSG.PRINT_IMAGE,{file:msg.filename},(msg2) => {
795
+ // if(msg2.err !== 0){ return}
796
+ // this.output("打印作业号: " + msg2.print_no)
797
+ // })
798
+ // this.output("正面复印" + msg.filename)
799
+ // })
800
+ // },
801
+ // //反面复印
802
+ // NCopy(){
803
+ // this.sendMsg(this.CLT_MSG.NCOPY_IDCARD, {copy_path:"D:\\"},(msg) => {
804
+ // if(msg.err !== 0){return}
805
+ // document.getElementById("IDCardDisplay").src = "data:image/jpg;base64," + msg.ncopy
806
+ // this.sendMsg(this.CLT_MSG.PRINT_IMAGE,{file:msg.filename},(msg2) => {
807
+ // if(msg2.err !== 0){ return}
808
+ // this.output("打印作业号: " + msg2.print_no)
809
+ // })
810
+ // this.output("反面复印" + msg.filename)
811
+ // })
812
+ // },
813
+ // 视频帧绘制函数
814
+ drawImage (data) {
815
+ // 校验视频是否在一定时间内的
816
+ if (!this.checkTimestamp(data[2] * 256 + data[1])) {
817
+ return
818
+ }
819
+ // 视频帧头有时间戳 注意偏移 和 大小端处理
820
+ let width = data[this.base_offset + 1] * 256 + data[this.base_offset]
821
+ let height = data[this.base_offset + 3] * 256 + data[this.base_offset + 2]
822
+
823
+ let cam = document.getElementById('cam')
824
+ let context = cam.getContext('2d')
825
+ if (this.orgdrawwidth != width || this.orgdrawheight != height) {
826
+ this.orgdrawwidth = width
827
+ this.orgdrawheight = height
828
+ cam.height = cam.height
829
+ }
830
+
831
+ let image = context.createImageData(width, height)
832
+ for (let n = 0; n != height; ++n) {
833
+ for (let m = 0; m != width; ++m) {
834
+ let image_offset = ((height - n - 1) * width + m) * 4
835
+ let data_offset = (n * width + m) * 3 + this.base_offset + 4
836
+ image.data[image_offset] = data[data_offset + 2]
837
+ image.data[image_offset + 1] = data[data_offset + 1]
838
+ image.data[image_offset + 2] = data[data_offset]
839
+ image.data[image_offset + 3] = 255
840
+ }
841
+ }
842
+ context.putImageData(image, 0, 0)
843
+ },
844
+ checkTimestamp (svr_time) {
845
+ let myDate = new Date()
846
+ let clt_time = myDate.getSeconds() * 1000 + myDate.getMilliseconds()
847
+ if (clt_time < svr_time) {
848
+ clt_time += 60 * 1000
849
+ }
850
+ return clt_time - svr_time < 3000
851
+ },
852
+ sendMsg (proto, msg, cb) {
853
+ if (!ws) {
854
+ return
855
+ }
856
+
857
+ if (typeof msg !== 'object') {
858
+ if (typeof msg === 'function') {
859
+ cb = msg
860
+ msg = {}
861
+ } else {
862
+ msg = {}
863
+ }
864
+ }
865
+
866
+ msg.proto = proto
867
+ if (typeof cb === 'function') {
868
+ this.callback[++this.context] = cb
869
+ msg.user_data = this.context
870
+ }
871
+
872
+ ws.send(JSON.stringify(msg))
873
+ },
874
+ output (content) {
875
+ if (content.length == 0) { return }
876
+ let console = document.getElementById('Console')
877
+ console.value += content
878
+ console.value += '\r'
879
+ console.scrollTop = console.scrollHeight
880
+ },
881
+ // 显示读到的身份证信息
882
+ setText (msg) {
883
+ document.getElementById('Name').value = msg.strName
884
+ document.getElementById('Sex').value = msg.strSex
885
+ document.getElementById('Nation').value = msg.strNation
886
+ document.getElementById('Born').value = msg.strBirth
887
+ document.getElementById('Address').value = msg.strAddress
888
+ document.getElementById('CardNo').value = msg.strID
889
+ document.getElementById('Police').value = msg.strOrg
890
+ document.getElementById('ActivityLFrom').value = msg.strVaildityfrom
891
+ document.getElementById('ActivityLTo').value = msg.strVaildityto
892
+ document.getElementById('DeviceNo').value = msg.strName
893
+ document.getElementById('PhotoBuffer').value = msg.base64BMP
894
+ document.getElementById('PhotoDisplay').src = 'data:image/jpg;base64,' + msg.base64BMP
895
+ this.IdCardInfo = msg
896
+ },
897
+ close () {
898
+ this.show = !this.show
899
+ if (this.isopen) {
900
+ this.CloseVideo()
901
+ }
902
+ },
903
+ confirmIdCard () {
904
+ let param = this.IdCardInfo
905
+ this.$emit('confirminfo', param)
906
+ this.IdCardInfo = {}
907
+ }
908
+ },
909
+ ready () {
910
+ hignmeter.loadActiveX()
911
+ }
912
+ }
913
+ </script>
914
+
915
+ <style scoped>
916
+ .modal-bk{
917
+ border-radius:18px 0;
918
+ }
919
+ .header{
920
+ background-color: #d8e9f3;
921
+ height: 88px;
922
+ }
923
+ .title{
924
+ position: absolute;
925
+ font-family:PingFang-SC-Bold;
926
+ font-size:36px;
927
+ color: #666666;
928
+ margin-top: 32px;
929
+ margin-left: 665.5px;
930
+ margin-bottom: 0px;
931
+ }
932
+ .operation{
933
+ font-family:PingFang-SC-Medium;
934
+ font-size: 22px;
935
+ color:#666666;
936
+ line-height: 5px;
937
+ }
938
+ .operation-group{
939
+ margin-left: 36px;
940
+ margin-top: 20px;
941
+ }
942
+ .photo{
943
+ font-family: PingFang-SC-Medium;
944
+ font-size: 20px;
945
+ color: #ffffff;
946
+ margin-left: 20px;
947
+ border-radius: 4px;
948
+ background-color: #2fadf5;
949
+ height: 32px;
950
+ width: 92px;
951
+ line-height:12px;
952
+ }
953
+ .readIDCard{
954
+ font-family: PingFang-SC-Medium;
955
+ font-size: 20px;
956
+ color: #ffffff;
957
+ border-radius: 4px;
958
+ background-color: #2fadf5;
959
+ margin-left: 20px;
960
+ width: 120px;
961
+ height: 32px;
962
+ line-height: 12px;
963
+ }
964
+ .stop{
965
+ border-radius: 4px;
966
+ border: 1px solid #2fadf5;
967
+ font-family: PingFang-SC-Medium;
968
+ font-size: 20px;
969
+ color: #2fadf5;
970
+ width: 120px;
971
+ height: 32px;
972
+ line-height: 12px;
973
+ }
974
+ .showInfo{
975
+ float: left;
976
+ width: 640px;
977
+ display: inline-block;
978
+ margin-top: 20px;
979
+ margin-left: 36px;
980
+ }
981
+ #Console{
982
+ margin-left: 18px;
983
+ border-radius: 4px;
984
+ border: 1px solid #b5b5b5;
985
+ height:300px;
986
+ width:322px;
987
+ resize:none;
988
+ background-color: #f6f6f6;
989
+ }
990
+ .img{
991
+ height:300px;
992
+ width:300px;
993
+ float: left;
994
+ border-radius: 4px;
995
+ border: 1px solid #b5b5b5;
996
+ }
997
+ #cam{
998
+ border-radius: 4px;
999
+ border:1px solid #b5b5b5;
1000
+ display: inline-block
1001
+ }
1002
+ .IdCard{
1003
+ height: 950px;
1004
+ width: 692px;
1005
+ display: inline-block;
1006
+ border-radius: 20px;
1007
+ background-color: #fafafa;
1008
+ border: 1px solid #d8f1ff;
1009
+ margin-left: 40px;
1010
+ margin-top: 20px;
1011
+ }
1012
+ .IdInput{
1013
+ border-radius: 4px;
1014
+ border: 1px solid #939393;
1015
+ width: 400px;
1016
+ height: 38px;
1017
+ margin-left: 20px;
1018
+ }
1019
+ .IdInputDiv{
1020
+ margin-top: 20px;
1021
+ margin-left: 100px;
1022
+ }
1023
+ .IdHint{
1024
+ font-family: PingFang-SC-Medium;
1025
+ font-size: 18px;
1026
+ color: #7e7c81;
1027
+ }
1028
+ #PhotoBuffer,#PhotoDisplay{
1029
+ border-radius: 4px;
1030
+ background-color: #ffffff;
1031
+ border: 1px solid #939393;
1032
+ margin-left: 20px;
1033
+ }
1034
+ </style>