CRM_26-08-05#story#9126,车辆管理、服务商管理系统需求
This commit is contained in:
@@ -457,6 +457,7 @@
|
||||
<camera-guide
|
||||
:visible="cameraGuideVisible"
|
||||
:type="cameraGuideType"
|
||||
:stream="cameraStream"
|
||||
@confirm="onCameraConfirm"
|
||||
@cancel="onCameraCancel"
|
||||
@fallback="onCameraFallback"
|
||||
@@ -512,6 +513,7 @@ export default {
|
||||
imageUrl: require('@/assets/arr_right.png'),
|
||||
cameraGuideVisible: false, // 拍摄引导弹层显示
|
||||
cameraGuideType: 'front', // 当前拍摄槽位 front/back/car
|
||||
cameraStream: null, // 探测成功的相机流,交给 CameraGuide 复用
|
||||
vehicleLicenseFrontList: [],
|
||||
vehicleLicenseBackList: [],
|
||||
vehicleLicenseCarPhotoList: [],
|
||||
@@ -954,9 +956,10 @@ export default {
|
||||
return
|
||||
}
|
||||
try {
|
||||
// 前置真实探测相机可用性,避免进入拍摄引导页后黑屏;拿到流立即释放
|
||||
// 前置真实探测相机可用性;探测成功的流直接交给 CameraGuide 复用,
|
||||
// 避免 iOS 上 stop 后立即二次 getUserMedia 拿到不渲染的“死流”(黑屏)
|
||||
const stream = await navigator.mediaDevices.getUserMedia({ video: { facingMode: 'environment' }, audio: false })
|
||||
stream.getTracks().forEach(t => t.stop())
|
||||
this.cameraStream = stream
|
||||
this.cameraGuideVisible = true
|
||||
} catch (e) {
|
||||
console.warn('probe getUserMedia error:', e && (e.name || e.message || e))
|
||||
@@ -968,6 +971,7 @@ export default {
|
||||
},
|
||||
handleCameraFail(e) { // 相机不可用统一处理:权限类弹确认框,其他异常提示后由用户点击触发相册(保证点击手势有效)
|
||||
this.cameraGuideVisible = false
|
||||
this.cameraStream = null
|
||||
if (this.isCameraPermissionError(e)) {
|
||||
Dialog.confirm({
|
||||
title: '提示',
|
||||
@@ -1002,6 +1006,7 @@ export default {
|
||||
},
|
||||
onCameraConfirm({ blob, dataURL }) { // 拍摄确认:构造 {file, content} 走现有压缩→上传→OCR 链路
|
||||
this.cameraGuideVisible = false
|
||||
this.cameraStream = null
|
||||
const type = this.cameraGuideType
|
||||
const file = new File([blob], `vehicle_license_${type}_${Date.now()}.jpg`, { type: 'image/jpeg' })
|
||||
const fileItem = { file, content: dataURL }
|
||||
@@ -1021,6 +1026,7 @@ export default {
|
||||
},
|
||||
onCameraCancel() { // 返回放弃
|
||||
this.cameraGuideVisible = false
|
||||
this.cameraStream = null
|
||||
},
|
||||
onCameraFallback(e) { // CameraGuide 内 getUserMedia 失败(前置探测已通过,概率极低):按异常类型统一处理
|
||||
this.handleCameraFail(e)
|
||||
|
||||
Reference in New Issue
Block a user