unify-external-plugin-platform 0.0.3-69 → 0.0.3-70
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=
|
|
83182
|
-
var
|
|
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=31866b44&
|
|
83182
|
+
var scanner_camera_componentvue_type_template_id_31866b44_render = function render() {
|
|
83183
83183
|
var _vm = this,
|
|
83184
83184
|
_c = _vm._self._c;
|
|
83185
83185
|
return _c('div', {
|
|
@@ -83207,7 +83207,12 @@ var scanner_camera_componentvue_type_template_id_0caf60ba_scoped_true_render = f
|
|
|
83207
83207
|
domProps: {
|
|
83208
83208
|
"muted": true
|
|
83209
83209
|
}
|
|
83210
|
-
}) : _c('
|
|
83210
|
+
}) : _c('div', {
|
|
83211
|
+
staticClass: "camera-container",
|
|
83212
|
+
class: {
|
|
83213
|
+
'select-mode': _vm.isSelectAreaMode && _vm.machineType === 5
|
|
83214
|
+
}
|
|
83215
|
+
}, [_c('img', {
|
|
83211
83216
|
staticStyle: {
|
|
83212
83217
|
"max-width": "800px",
|
|
83213
83218
|
"max-height": "600px",
|
|
@@ -83217,8 +83222,20 @@ var scanner_camera_componentvue_type_template_id_0caf60ba_scoped_true_render = f
|
|
|
83217
83222
|
attrs: {
|
|
83218
83223
|
"id": "photo",
|
|
83219
83224
|
"src": _vm.scannerVideoSrc
|
|
83225
|
+
},
|
|
83226
|
+
on: {
|
|
83227
|
+
"mousedown": _vm.handleMouseDown,
|
|
83228
|
+
"mousemove": _vm.handleMouseMove,
|
|
83229
|
+
"mouseup": _vm.handleMouseUp,
|
|
83230
|
+
"mouseleave": _vm.handleMouseLeave
|
|
83231
|
+
}
|
|
83232
|
+
}), _vm.isSelectAreaMode && _vm.isSelecting ? _c('div', {
|
|
83233
|
+
staticClass: "selection-box",
|
|
83234
|
+
style: _vm.selectBoxStyle,
|
|
83235
|
+
attrs: {
|
|
83236
|
+
"id": "selection-box"
|
|
83220
83237
|
}
|
|
83221
|
-
})]) : _c('div', {
|
|
83238
|
+
}) : _vm._e()])]) : _c('div', {
|
|
83222
83239
|
staticClass: "load-error"
|
|
83223
83240
|
}, [_c('i', {
|
|
83224
83241
|
staticClass: "el-icon-s-cooperation"
|
|
@@ -83260,9 +83277,43 @@ var scanner_camera_componentvue_type_template_id_0caf60ba_scoped_true_render = f
|
|
|
83260
83277
|
}
|
|
83261
83278
|
}
|
|
83262
83279
|
}, [_vm._v(_vm._s(item.label))]) : _vm._e()];
|
|
83263
|
-
}), _vm.
|
|
83280
|
+
}), _vm.machineType === 5 ? _c('el-dropdown', {
|
|
83281
|
+
attrs: {
|
|
83282
|
+
"size": "small"
|
|
83283
|
+
},
|
|
83284
|
+
on: {
|
|
83285
|
+
"command": _vm.handleRotateCommand
|
|
83286
|
+
}
|
|
83287
|
+
}, [_c('el-button', {
|
|
83288
|
+
staticStyle: {
|
|
83289
|
+
"margin-left": "10px"
|
|
83290
|
+
},
|
|
83291
|
+
attrs: {
|
|
83292
|
+
"type": "primary",
|
|
83293
|
+
"size": "small"
|
|
83294
|
+
}
|
|
83295
|
+
}, [_vm._v(" 旋转"), _c('i', {
|
|
83296
|
+
staticClass: "el-icon-arrow-down el-icon--right"
|
|
83297
|
+
})]), _c('el-dropdown-menu', {
|
|
83298
|
+
attrs: {
|
|
83299
|
+
"slot": "dropdown"
|
|
83300
|
+
},
|
|
83301
|
+
slot: "dropdown"
|
|
83302
|
+
}, [_c('el-dropdown-item', {
|
|
83303
|
+
attrs: {
|
|
83304
|
+
"command": "rotate-left"
|
|
83305
|
+
}
|
|
83306
|
+
}, [_vm._v("左旋90°")]), _c('el-dropdown-item', {
|
|
83307
|
+
attrs: {
|
|
83308
|
+
"command": "rotate-right"
|
|
83309
|
+
}
|
|
83310
|
+
}, [_vm._v("右旋90°")]), _c('el-dropdown-item', {
|
|
83311
|
+
attrs: {
|
|
83312
|
+
"command": "rotate-180"
|
|
83313
|
+
}
|
|
83314
|
+
}, [_vm._v("旋转180°")])], 1)], 1) : _vm._e(), _vm._t("action")]], 2)])]);
|
|
83264
83315
|
};
|
|
83265
|
-
var
|
|
83316
|
+
var scanner_camera_componentvue_type_template_id_31866b44_staticRenderFns = [];
|
|
83266
83317
|
|
|
83267
83318
|
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js
|
|
83268
83319
|
function _typeof(obj) {
|
|
@@ -83402,6 +83453,8 @@ var ELoamMethodCode;
|
|
|
83402
83453
|
/** 关闭摄像头*/
|
|
83403
83454
|
ELoamMethodCode["StopMainCamera"] = "stopMainCamera";
|
|
83404
83455
|
ELoamMethodCode["StopSecondaryCamera"] = "stopSecondaryCamera";
|
|
83456
|
+
/** 框选拍照 */
|
|
83457
|
+
ELoamMethodCode["ScannerCameraSelectArea"] = "ScannerCameraSelectArea";
|
|
83405
83458
|
})(ELoamMethodCode || (ELoamMethodCode = {}));
|
|
83406
83459
|
const ELoamMethodDesc = {
|
|
83407
83460
|
[ELoamMethodCode.ScannerMainCamera_Base64]: '扫描',
|
|
@@ -83503,10 +83556,10 @@ class ELoamPassService {
|
|
|
83503
83556
|
deskewval: "0",
|
|
83504
83557
|
camidx: "0",
|
|
83505
83558
|
ColorMode: "0",
|
|
83506
|
-
quality: "0"
|
|
83507
|
-
bIsPrint1to1: "0"
|
|
83559
|
+
quality: "0"
|
|
83508
83560
|
};
|
|
83509
|
-
|
|
83561
|
+
url = this.baseServiceUrl + '/video=grabimage?' + JSON.stringify(param);
|
|
83562
|
+
requestType = 'get';
|
|
83510
83563
|
}
|
|
83511
83564
|
break;
|
|
83512
83565
|
case ELoamMethodCode.ScannerSecondaryCamera_Base64:
|
|
@@ -83514,8 +83567,7 @@ class ELoamPassService {
|
|
|
83514
83567
|
url = this.baseLinuxServiceUrl + '/getPic?filepath=/tmp';
|
|
83515
83568
|
requestType = 'get';
|
|
83516
83569
|
} else {
|
|
83517
|
-
|
|
83518
|
-
param = {
|
|
83570
|
+
const grabImageData = {
|
|
83519
83571
|
filepath: "",
|
|
83520
83572
|
rotate: "0",
|
|
83521
83573
|
deskew: "0",
|
|
@@ -83525,7 +83577,8 @@ class ELoamPassService {
|
|
|
83525
83577
|
quality: "0",
|
|
83526
83578
|
bIsPrint1to1: "0"
|
|
83527
83579
|
};
|
|
83528
|
-
|
|
83580
|
+
url = this.baseServiceUrl + '/video=grabimage?' + JSON.stringify(grabImageData);
|
|
83581
|
+
requestType = 'get';
|
|
83529
83582
|
}
|
|
83530
83583
|
break;
|
|
83531
83584
|
case ELoamMethodCode.StopMainCamera:
|
|
@@ -83565,6 +83618,30 @@ class ELoamPassService {
|
|
|
83565
83618
|
param = data;
|
|
83566
83619
|
requestType = 'post';
|
|
83567
83620
|
break;
|
|
83621
|
+
case ELoamMethodCode.ScannerCameraSelectArea:
|
|
83622
|
+
// 框选拍照
|
|
83623
|
+
if (this._isLinux) {
|
|
83624
|
+
url = `${this.baseLinuxServiceUrl}/selectImageArea`;
|
|
83625
|
+
param = {
|
|
83626
|
+
filepath: data.filepath || '/tmp/select.jpg',
|
|
83627
|
+
left: data.left,
|
|
83628
|
+
top: data.top,
|
|
83629
|
+
right: data.right,
|
|
83630
|
+
bottom: data.bottom
|
|
83631
|
+
};
|
|
83632
|
+
requestType = 'post';
|
|
83633
|
+
} else {
|
|
83634
|
+
url = this.baseServiceUrl + '/select=imagearea';
|
|
83635
|
+
param = {
|
|
83636
|
+
filepath: data.filepath || 'base64',
|
|
83637
|
+
left: data.left.toString(),
|
|
83638
|
+
top: data.top.toString(),
|
|
83639
|
+
right: data.right.toString(),
|
|
83640
|
+
bottom: data.bottom.toString()
|
|
83641
|
+
};
|
|
83642
|
+
requestType = 'post';
|
|
83643
|
+
}
|
|
83644
|
+
break;
|
|
83568
83645
|
}
|
|
83569
83646
|
let res = await CustomAxios[requestType](url, param);
|
|
83570
83647
|
return res;
|
|
@@ -83703,6 +83780,27 @@ class ELoamPassService {
|
|
|
83703
83780
|
const res = await ELoamPassService.read(ELoamMethodCode.FaceAuth, param);
|
|
83704
83781
|
return res.data;
|
|
83705
83782
|
}
|
|
83783
|
+
/**
|
|
83784
|
+
* 框选拍照
|
|
83785
|
+
* @param coords 框选坐标 {left, top, right, bottom}
|
|
83786
|
+
* @param filepath 保存路径(可选)
|
|
83787
|
+
* @returns 图片base64
|
|
83788
|
+
*/
|
|
83789
|
+
static async scanBySelectArea(coords, filepath) {
|
|
83790
|
+
const data = {
|
|
83791
|
+
filepath: filepath || (this._isLinux ? '/tmp/select.jpg' : 'base64'),
|
|
83792
|
+
left: coords.left,
|
|
83793
|
+
top: coords.top,
|
|
83794
|
+
right: coords.right,
|
|
83795
|
+
bottom: coords.bottom
|
|
83796
|
+
};
|
|
83797
|
+
const res = await ELoamPassService.read(ELoamMethodCode.ScannerCameraSelectArea, data);
|
|
83798
|
+
if (this._isLinux) {
|
|
83799
|
+
return res.data?.img || res.data;
|
|
83800
|
+
} else {
|
|
83801
|
+
return res.base64 || res.photoBase64;
|
|
83802
|
+
}
|
|
83803
|
+
}
|
|
83706
83804
|
}
|
|
83707
83805
|
_defineProperty(ELoamPassService, "baseServiceUrl", 'http://127.0.0.1:38088');
|
|
83708
83806
|
_defineProperty(ELoamPassService, "baseLinuxServiceUrl", 'http://127.0.0.1:6543');
|
|
@@ -85175,11 +85273,14 @@ const BEGIN_DATA = 'data:image/jpg;base64,';
|
|
|
85175
85273
|
name: '照片',
|
|
85176
85274
|
value: 1
|
|
85177
85275
|
}],
|
|
85178
|
-
deskewStatus:
|
|
85276
|
+
deskewStatus: 0,
|
|
85179
85277
|
rotateDeg: 0,
|
|
85180
85278
|
buttonList: [{
|
|
85181
85279
|
label: '拍照',
|
|
85182
85280
|
name: 'take-pictures'
|
|
85281
|
+
}, {
|
|
85282
|
+
label: '框选拍照',
|
|
85283
|
+
name: 'take-select-area'
|
|
85183
85284
|
}, {
|
|
85184
85285
|
label: '图片合并',
|
|
85185
85286
|
name: 'take-pictures-merge'
|
|
@@ -85189,9 +85290,6 @@ const BEGIN_DATA = 'data:image/jpg;base64,';
|
|
|
85189
85290
|
}, {
|
|
85190
85291
|
label: '纠偏裁边',
|
|
85191
85292
|
name: 'open-deskew'
|
|
85192
|
-
}, {
|
|
85193
|
-
label: '旋转',
|
|
85194
|
-
name: 'rotate-video'
|
|
85195
85293
|
}, {
|
|
85196
85294
|
label: '关闭',
|
|
85197
85295
|
name: 'close'
|
|
@@ -85199,7 +85297,18 @@ const BEGIN_DATA = 'data:image/jpg;base64,';
|
|
|
85199
85297
|
_isLinux: String(navigator.platform).indexOf("Linux") > -1,
|
|
85200
85298
|
eloamLinuxFrameTimer: {},
|
|
85201
85299
|
mergeImageList: [],
|
|
85202
|
-
defaultVideoStream: null
|
|
85300
|
+
defaultVideoStream: null,
|
|
85301
|
+
// 框选相关 - 参考 liangtian.html 的实现
|
|
85302
|
+
isSelecting: false,
|
|
85303
|
+
selectStartPos: null,
|
|
85304
|
+
selectEndPos: null,
|
|
85305
|
+
selectBoxStyle: {},
|
|
85306
|
+
zoomScaleVal: 1,
|
|
85307
|
+
zoomScaleX: 1,
|
|
85308
|
+
// X轴缩放比例
|
|
85309
|
+
zoomScaleY: 1,
|
|
85310
|
+
// Y轴缩放比例
|
|
85311
|
+
isSelectAreaMode: false
|
|
85203
85312
|
};
|
|
85204
85313
|
},
|
|
85205
85314
|
watch: {
|
|
@@ -85217,11 +85326,22 @@ const BEGIN_DATA = 'data:image/jpg;base64,';
|
|
|
85217
85326
|
console.log('良田失败=>', res);
|
|
85218
85327
|
});
|
|
85219
85328
|
}
|
|
85329
|
+
// 图片加载完成后重新计算缩放比例
|
|
85330
|
+
if (this.isSelectAreaMode && this.machineType === 5) {
|
|
85331
|
+
this.$nextTick(() => {
|
|
85332
|
+
setTimeout(() => {
|
|
85333
|
+
this.calculateZoomScale();
|
|
85334
|
+
}, 500);
|
|
85335
|
+
});
|
|
85336
|
+
}
|
|
85220
85337
|
}
|
|
85221
85338
|
},
|
|
85222
85339
|
'machineType': function () {
|
|
85223
85340
|
this.loadSuccess = true;
|
|
85224
85341
|
this.scannerVideoSrc = '';
|
|
85342
|
+
// 重置框选模式
|
|
85343
|
+
this.isSelectAreaMode = false;
|
|
85344
|
+
this.isSelecting = false;
|
|
85225
85345
|
let handleName = this.camera === 1 ? 'start-vice' : 'start-main';
|
|
85226
85346
|
this.handleAction(handleName);
|
|
85227
85347
|
}
|
|
@@ -85302,6 +85422,7 @@ const BEGIN_DATA = 'data:image/jpg;base64,';
|
|
|
85302
85422
|
{
|
|
85303
85423
|
// 良田
|
|
85304
85424
|
let type = this.camera === 0 ? 'main' : 'vice';
|
|
85425
|
+
console.log('this.deskewStatus', this.deskewStatus);
|
|
85305
85426
|
const res = await ELoamPassService.scanByCamera(type, this.deskewStatus);
|
|
85306
85427
|
if (res) {
|
|
85307
85428
|
let path = res;
|
|
@@ -85509,10 +85630,11 @@ const BEGIN_DATA = 'data:image/jpg;base64,';
|
|
|
85509
85630
|
case 'take-pictures-merge':
|
|
85510
85631
|
case 'take-idCard-pictures-merge':
|
|
85511
85632
|
case 'open-deskew': // 纠偏裁边
|
|
85512
|
-
case 'rotate-video':
|
|
85513
85633
|
case 'close':
|
|
85634
|
+
case 'take-select-area':
|
|
85635
|
+
// 框选拍照
|
|
85514
85636
|
return this.machineType === 5;
|
|
85515
|
-
//
|
|
85637
|
+
// 良田显示
|
|
85516
85638
|
case 'take-pictures':
|
|
85517
85639
|
return true;
|
|
85518
85640
|
// 拍照按钮始终显示
|
|
@@ -85542,32 +85664,268 @@ const BEGIN_DATA = 'data:image/jpg;base64,';
|
|
|
85542
85664
|
// 合并拍照身份证
|
|
85543
85665
|
this.takePictureMerge('1');
|
|
85544
85666
|
break;
|
|
85545
|
-
case 'rotate-video':
|
|
85546
|
-
if (String(navigator.platform).indexOf("Linux") > -1) {
|
|
85547
|
-
this.rotateDeg += 90;
|
|
85548
|
-
if (this.rotateDeg === 360) this.rotateDeg = 0;
|
|
85549
|
-
} else {
|
|
85550
|
-
this.rotateDeg = 90;
|
|
85551
|
-
}
|
|
85552
|
-
ELoamPassService.read(ELoamMethodCode.ScannerCameraRotate, this.rotateDeg); // 选装
|
|
85553
|
-
break;
|
|
85554
85667
|
case 'open-deskew':
|
|
85668
|
+
// 如果当前在框选模式,先退出框选模式
|
|
85669
|
+
if (this.isSelectAreaMode) {
|
|
85670
|
+
this.isSelectAreaMode = false;
|
|
85671
|
+
this.isSelecting = false;
|
|
85672
|
+
this.$message.info('已退出框选模式(纠偏裁边与框选拍照不能同时使用)');
|
|
85673
|
+
}
|
|
85555
85674
|
this.deskewStatus = this.deskewStatus === '1' ? '0' : '1';
|
|
85556
85675
|
ELoamPassService.read(ELoamMethodCode.ScannerCameraDeskew_Base64, this.deskewStatus); // 开启纠偏裁边
|
|
85557
85676
|
break;
|
|
85677
|
+
case 'take-select-area':
|
|
85678
|
+
// 如果纠偏裁边已开启,提示用户
|
|
85679
|
+
if (this.deskewStatus === '1') {
|
|
85680
|
+
this.$message.warning('请先关闭纠偏裁边后再使用框选拍照');
|
|
85681
|
+
return;
|
|
85682
|
+
}
|
|
85683
|
+
this.toggleSelectAreaMode(); // 框选拍照模式
|
|
85684
|
+
break;
|
|
85558
85685
|
case 'close':
|
|
85559
85686
|
await ELoamPassService.stopCamera(this.camera === 0);
|
|
85560
85687
|
break;
|
|
85561
85688
|
}
|
|
85689
|
+
},
|
|
85690
|
+
/**
|
|
85691
|
+
* 处理旋转命令
|
|
85692
|
+
* @param command 旋转命令:rotate-left(左旋90°), rotate-right(右旋90°), rotate-180(旋转180°)
|
|
85693
|
+
*/
|
|
85694
|
+
handleRotateCommand(command) {
|
|
85695
|
+
if (this.machineType !== 5) return; // 仅良田支持旋转
|
|
85696
|
+
|
|
85697
|
+
const isLinux = String(navigator.platform).indexOf("Linux") > -1;
|
|
85698
|
+
switch (command) {
|
|
85699
|
+
case 'rotate-left':
|
|
85700
|
+
// 左旋90°
|
|
85701
|
+
if (isLinux) {
|
|
85702
|
+
// Linux系统:累加旋转角度
|
|
85703
|
+
this.rotateDeg -= 90;
|
|
85704
|
+
if (this.rotateDeg <= -360) this.rotateDeg = 0;
|
|
85705
|
+
// 转换为正角度
|
|
85706
|
+
let positiveDeg = this.rotateDeg < 0 ? 360 + this.rotateDeg : this.rotateDeg;
|
|
85707
|
+
ELoamPassService.read(ELoamMethodCode.ScannerCameraRotate, positiveDeg);
|
|
85708
|
+
} else {
|
|
85709
|
+
// Windows系统:直接设置角度
|
|
85710
|
+
this.rotateDeg = 270;
|
|
85711
|
+
ELoamPassService.read(ELoamMethodCode.ScannerCameraRotate, this.rotateDeg);
|
|
85712
|
+
}
|
|
85713
|
+
break;
|
|
85714
|
+
case 'rotate-right':
|
|
85715
|
+
// 右旋90°
|
|
85716
|
+
if (isLinux) {
|
|
85717
|
+
// Linux系统:累加旋转角度
|
|
85718
|
+
this.rotateDeg += 90;
|
|
85719
|
+
if (this.rotateDeg >= 360) this.rotateDeg = 0;
|
|
85720
|
+
ELoamPassService.read(ELoamMethodCode.ScannerCameraRotate, this.rotateDeg);
|
|
85721
|
+
} else {
|
|
85722
|
+
// Windows系统:直接设置角度
|
|
85723
|
+
this.rotateDeg = 90;
|
|
85724
|
+
ELoamPassService.read(ELoamMethodCode.ScannerCameraRotate, this.rotateDeg);
|
|
85725
|
+
}
|
|
85726
|
+
break;
|
|
85727
|
+
case 'rotate-180':
|
|
85728
|
+
// 旋转180°
|
|
85729
|
+
if (isLinux) {
|
|
85730
|
+
// Linux系统:累加旋转角度
|
|
85731
|
+
this.rotateDeg += 180;
|
|
85732
|
+
if (this.rotateDeg >= 360) this.rotateDeg = this.rotateDeg - 360;
|
|
85733
|
+
ELoamPassService.read(ELoamMethodCode.ScannerCameraRotate, this.rotateDeg);
|
|
85734
|
+
} else {
|
|
85735
|
+
// Windows系统:直接设置角度
|
|
85736
|
+
this.rotateDeg = 180;
|
|
85737
|
+
ELoamPassService.read(ELoamMethodCode.ScannerCameraRotate, this.rotateDeg);
|
|
85738
|
+
}
|
|
85739
|
+
break;
|
|
85740
|
+
}
|
|
85741
|
+
},
|
|
85742
|
+
/**
|
|
85743
|
+
* 切换框选拍照模式
|
|
85744
|
+
*/
|
|
85745
|
+
async toggleSelectAreaMode() {
|
|
85746
|
+
if (this.machineType !== 5) {
|
|
85747
|
+
this.$message.warning('框选拍照仅支持良田高拍仪');
|
|
85748
|
+
return;
|
|
85749
|
+
}
|
|
85750
|
+
this.isSelectAreaMode = !this.isSelectAreaMode;
|
|
85751
|
+
if (this.isSelectAreaMode) {
|
|
85752
|
+
this.$message.success('已进入框选模式,正在校准坐标...');
|
|
85753
|
+
// 先拍一张照片用于校准坐标
|
|
85754
|
+
await this.calibrateZoomScale();
|
|
85755
|
+
} else {
|
|
85756
|
+
this.$message.info('已退出框选模式');
|
|
85757
|
+
this.isSelecting = false;
|
|
85758
|
+
}
|
|
85759
|
+
},
|
|
85760
|
+
/**
|
|
85761
|
+
* 校准缩放比例 - 完全参考 liangtian.html 的实现
|
|
85762
|
+
*/
|
|
85763
|
+
async calibrateZoomScale() {
|
|
85764
|
+
try {
|
|
85765
|
+
const type = this.camera === 0 ? 'main' : 'vice';
|
|
85766
|
+
// 先拍一张照片获取真实图片
|
|
85767
|
+
const res = await ELoamPassService.scanByCamera(type, '0', false);
|
|
85768
|
+
if (res) {
|
|
85769
|
+
// 创建临时图片获取真实尺寸
|
|
85770
|
+
const tempImg = new Image();
|
|
85771
|
+
tempImg.onload = () => {
|
|
85772
|
+
const sourceWidth = tempImg.naturalWidth;
|
|
85773
|
+
const sourceHeight = tempImg.naturalHeight;
|
|
85774
|
+
|
|
85775
|
+
// 获取显示尺寸
|
|
85776
|
+
const img = document.getElementById('photo');
|
|
85777
|
+
const displayWidth = img ? img.clientWidth : 800;
|
|
85778
|
+
const displayHeight = img ? img.clientHeight : 600;
|
|
85779
|
+
console.log('源图片尺寸:', sourceWidth, 'x', sourceHeight);
|
|
85780
|
+
console.log('显示尺寸:', displayWidth, 'x', displayHeight);
|
|
85781
|
+
|
|
85782
|
+
// 分别计算 X 和 Y 方向的缩放比例
|
|
85783
|
+
this.zoomScaleX = sourceWidth / displayWidth;
|
|
85784
|
+
this.zoomScaleY = sourceHeight / displayHeight;
|
|
85785
|
+
|
|
85786
|
+
// 保持兼容性
|
|
85787
|
+
this.zoomScaleVal = this.zoomScaleX;
|
|
85788
|
+
console.log('X轴缩放比例:', this.zoomScaleX);
|
|
85789
|
+
console.log('Y轴缩放比例:', this.zoomScaleY);
|
|
85790
|
+
this.$message.success('坐标校准完成,可以开始框选');
|
|
85791
|
+
};
|
|
85792
|
+
tempImg.src = `${BEGIN_DATA}${res}`;
|
|
85793
|
+
}
|
|
85794
|
+
} catch (err) {
|
|
85795
|
+
console.error('坐标校准失败:', err);
|
|
85796
|
+
this.$message.error('坐标校准失败,请重试');
|
|
85797
|
+
}
|
|
85798
|
+
},
|
|
85799
|
+
/**
|
|
85800
|
+
* 鼠标按下 - 开始框选
|
|
85801
|
+
*/
|
|
85802
|
+
handleMouseDown(e) {
|
|
85803
|
+
if (!this.isSelectAreaMode || this.machineType !== 5) return;
|
|
85804
|
+
this.isSelecting = true;
|
|
85805
|
+
this.selectStartPos = {
|
|
85806
|
+
x: e.offsetX,
|
|
85807
|
+
y: e.offsetY
|
|
85808
|
+
};
|
|
85809
|
+
e.preventDefault();
|
|
85810
|
+
},
|
|
85811
|
+
/**
|
|
85812
|
+
* 鼠标移动 - 更新框选框
|
|
85813
|
+
*/
|
|
85814
|
+
handleMouseMove(e) {
|
|
85815
|
+
if (!this.isSelectAreaMode || !this.isSelecting) return;
|
|
85816
|
+
const endX = e.offsetX;
|
|
85817
|
+
const endY = e.offsetY;
|
|
85818
|
+
|
|
85819
|
+
// 计算框选框的位置和大小(使用相对于图片的坐标)
|
|
85820
|
+
const startX = this.selectStartPos.x;
|
|
85821
|
+
const startY = this.selectStartPos.y;
|
|
85822
|
+
const left = Math.min(startX, endX);
|
|
85823
|
+
const top = Math.min(startY, endY);
|
|
85824
|
+
const width = Math.abs(endX - startX);
|
|
85825
|
+
const height = Math.abs(endY - startY);
|
|
85826
|
+
|
|
85827
|
+
// 使用绝对定位(相对于 camera-container)
|
|
85828
|
+
this.selectBoxStyle = {
|
|
85829
|
+
left: left + 'px',
|
|
85830
|
+
top: top + 'px',
|
|
85831
|
+
width: width + 'px',
|
|
85832
|
+
height: height + 'px',
|
|
85833
|
+
display: 'block'
|
|
85834
|
+
};
|
|
85835
|
+
this.selectEndPos = {
|
|
85836
|
+
x: endX,
|
|
85837
|
+
y: endY
|
|
85838
|
+
};
|
|
85839
|
+
e.preventDefault();
|
|
85840
|
+
},
|
|
85841
|
+
/**
|
|
85842
|
+
* 鼠标松开 - 完成框选并拍照
|
|
85843
|
+
*/
|
|
85844
|
+
async handleMouseUp(e) {
|
|
85845
|
+
if (!this.isSelectAreaMode || !this.isSelecting) return;
|
|
85846
|
+
this.isSelecting = false;
|
|
85847
|
+
const endX = e.offsetX;
|
|
85848
|
+
const endY = e.offsetY;
|
|
85849
|
+
console.log('框选起始位置:', this.selectStartPos);
|
|
85850
|
+
console.log('框选结束位置:', {
|
|
85851
|
+
x: endX,
|
|
85852
|
+
y: endY
|
|
85853
|
+
});
|
|
85854
|
+
console.log('使用缩放比例:', this.zoomScaleVal);
|
|
85855
|
+
|
|
85856
|
+
// 使用独立的 X/Y 缩放比例进行坐标转换
|
|
85857
|
+
const x1 = Math.round(this.selectStartPos.x * this.zoomScaleX);
|
|
85858
|
+
const y1 = Math.round(this.selectStartPos.y * this.zoomScaleY);
|
|
85859
|
+
const x2 = Math.round(endX * this.zoomScaleX);
|
|
85860
|
+
const y2 = Math.round(endY * this.zoomScaleY);
|
|
85861
|
+
console.log('转换前坐标:', {
|
|
85862
|
+
x1,
|
|
85863
|
+
y1,
|
|
85864
|
+
x2,
|
|
85865
|
+
y2
|
|
85866
|
+
});
|
|
85867
|
+
console.log('使用缩放比例 - X:', this.zoomScaleX, 'Y:', this.zoomScaleY);
|
|
85868
|
+
|
|
85869
|
+
// liangtian.html 中的坐标排序逻辑
|
|
85870
|
+
let res_left = Math.min(x1, x2);
|
|
85871
|
+
let res_top = Math.min(y1, y2);
|
|
85872
|
+
let res_right = Math.max(x1, x2);
|
|
85873
|
+
let res_bottom = Math.max(y1, y2);
|
|
85874
|
+
console.log('排序后坐标:', {
|
|
85875
|
+
res_left,
|
|
85876
|
+
res_top,
|
|
85877
|
+
res_right,
|
|
85878
|
+
res_bottom
|
|
85879
|
+
});
|
|
85880
|
+
|
|
85881
|
+
// 验证框选范围
|
|
85882
|
+
if (res_left === res_right || res_top === res_bottom || res_right - res_left < 10 || res_bottom - res_top < 10) {
|
|
85883
|
+
this.$message.warning('框选范围过小,请重新框选');
|
|
85884
|
+
return;
|
|
85885
|
+
}
|
|
85886
|
+
try {
|
|
85887
|
+
// 使用 liangtian.html 的坐标命名方式
|
|
85888
|
+
const coords = {
|
|
85889
|
+
left: res_left.toString(),
|
|
85890
|
+
top: res_top.toString(),
|
|
85891
|
+
right: res_right.toString(),
|
|
85892
|
+
bottom: res_bottom.toString()
|
|
85893
|
+
};
|
|
85894
|
+
console.log('发送到设备的坐标:', coords);
|
|
85895
|
+
const res = await ELoamPassService.scanBySelectArea(coords);
|
|
85896
|
+
if (res) {
|
|
85897
|
+
this.$emit('send-scanner-result', `${BEGIN_DATA}${res}`);
|
|
85898
|
+
this.$message.success('框选拍照成功,可继续框选或点击"框选拍照"退出');
|
|
85899
|
+
} else {
|
|
85900
|
+
this.$message.error('框选拍照失败');
|
|
85901
|
+
}
|
|
85902
|
+
} catch (err) {
|
|
85903
|
+
console.error('框选拍照出错:', err);
|
|
85904
|
+
this.$message.error('框选拍照出错,请检查设备连接');
|
|
85905
|
+
}
|
|
85906
|
+
|
|
85907
|
+
// 重置选择状态,但保持框选模式开启,支持多次框选
|
|
85908
|
+
this.isSelecting = false;
|
|
85909
|
+
this.selectBoxStyle = {};
|
|
85910
|
+
e.preventDefault();
|
|
85911
|
+
},
|
|
85912
|
+
/**
|
|
85913
|
+
* 鼠标离开 - 取消框选
|
|
85914
|
+
*/
|
|
85915
|
+
handleMouseLeave() {
|
|
85916
|
+
if (this.isSelectAreaMode && this.isSelecting) {
|
|
85917
|
+
this.isSelecting = false;
|
|
85918
|
+
this.selectBoxStyle = {};
|
|
85919
|
+
}
|
|
85562
85920
|
}
|
|
85563
85921
|
}
|
|
85564
85922
|
});
|
|
85565
85923
|
;// CONCATENATED MODULE: ./packages/scanner/scanner-camera/src/component/scanner-camera-component.vue?vue&type=script&lang=js&
|
|
85566
85924
|
/* harmony default export */ var component_scanner_camera_componentvue_type_script_lang_js_ = (scanner_camera_componentvue_type_script_lang_js_);
|
|
85567
|
-
;// 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=
|
|
85925
|
+
;// 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=31866b44&prod&lang=scss&
|
|
85568
85926
|
// extracted by mini-css-extract-plugin
|
|
85569
85927
|
|
|
85570
|
-
;// CONCATENATED MODULE: ./packages/scanner/scanner-camera/src/component/scanner-camera-component.vue?vue&type=style&index=0&id=
|
|
85928
|
+
;// CONCATENATED MODULE: ./packages/scanner/scanner-camera/src/component/scanner-camera-component.vue?vue&type=style&index=0&id=31866b44&prod&lang=scss&
|
|
85571
85929
|
|
|
85572
85930
|
;// CONCATENATED MODULE: ./packages/scanner/scanner-camera/src/component/scanner-camera-component.vue
|
|
85573
85931
|
|
|
@@ -85580,11 +85938,11 @@ const BEGIN_DATA = 'data:image/jpg;base64,';
|
|
|
85580
85938
|
|
|
85581
85939
|
var scanner_camera_component_component = normalizeComponent(
|
|
85582
85940
|
component_scanner_camera_componentvue_type_script_lang_js_,
|
|
85583
|
-
|
|
85584
|
-
|
|
85941
|
+
scanner_camera_componentvue_type_template_id_31866b44_render,
|
|
85942
|
+
scanner_camera_componentvue_type_template_id_31866b44_staticRenderFns,
|
|
85585
85943
|
false,
|
|
85586
85944
|
null,
|
|
85587
|
-
|
|
85945
|
+
null,
|
|
85588
85946
|
null
|
|
85589
85947
|
|
|
85590
85948
|
)
|