材料站领料出库orc识别
This commit is contained in:
parent
aa8e3f7dfa
commit
b7bbf03e27
|
|
@ -1,11 +1,11 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="page-container">
|
<view class="page-container">
|
||||||
<view>
|
<!-- <view>
|
||||||
<live-pusher v-once id="livePusher" ref="livePusher" class="livePusher" mode="FHD" beauty="0" whiteness="0"
|
<live-pusher v-once id="livePusher" ref="livePusher" class="livePusher" mode="FHD" beauty="0" whiteness="0"
|
||||||
device-position="back" :auto-focus="false" :muted="true" :enable-camera="true" :enable-mic="true"
|
device-position="back" :auto-focus="false" :muted="true" :enable-camera="true" :enable-mic="true"
|
||||||
:zoom="true" :style="[{height: '450rpx' ,width:'750rpx'}]">
|
:zoom="true" :style="[{height: '450rpx' ,width:'750rpx'}]">
|
||||||
</live-pusher>
|
</live-pusher>
|
||||||
</view>
|
</view> -->
|
||||||
<view class="table-list-item">
|
<view class="table-list-item">
|
||||||
<view class="scan-btn" @click="handleInstruct('shutter')">
|
<view class="scan-btn" @click="handleInstruct('shutter')">
|
||||||
<text style="color: #FFF;">开始识别</text>
|
<text style="color: #FFF;">开始识别</text>
|
||||||
|
|
@ -114,22 +114,53 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
//截屏
|
|
||||||
handleInstruct(instruct) {
|
handleInstruct() {
|
||||||
if (this.ready) {
|
uni.showActionSheet({
|
||||||
this.ready = false
|
itemList: ['拍照', '从相册选择'],
|
||||||
this.livePusher.snapshot({
|
success: (res) => {
|
||||||
success: async (res) => {
|
if (res.tapIndex === 0) {
|
||||||
console.log('拍照成功', res)
|
this.getCamera()
|
||||||
this.ready = true
|
} else if (res.tapIndex === 1) {
|
||||||
let base64 = await this.imgToBase64(res.message.tempImagePath)
|
// 从相册选择
|
||||||
// console.log('base64', base64)
|
this.getPhoto()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.error('操作菜单选择失败:', err)
|
||||||
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
getCamera() {
|
||||||
|
console.log(1)
|
||||||
|
navigator.camera.getPicture(this.onCameraSuccess, this.onCameraError, {
|
||||||
|
quality: 50,
|
||||||
|
destinationType: window.Camera.DestinationType.DATA_URL,
|
||||||
|
sourceType: window.Camera.PictureSourceType.CAMERA,
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getPhoto() {
|
||||||
|
console.log(2)
|
||||||
|
navigator.camera.getPicture(this.onCameraSuccess, this.onCameraError, {
|
||||||
|
quality: 50,
|
||||||
|
destinationType: window.Camera.DestinationType.DATA_URL,
|
||||||
|
sourceType: window.Camera.PictureSourceType.SAVEDPHOTOALBUM,
|
||||||
|
})
|
||||||
|
},
|
||||||
|
onCameraError(message) {
|
||||||
|
console.log(message)
|
||||||
|
},
|
||||||
|
onCameraSuccess(file) {
|
||||||
|
// const file1 = "data:image/jpeg;base64," + file;
|
||||||
|
const file1 = file
|
||||||
let params = {
|
let params = {
|
||||||
image: base64,
|
image: file1,
|
||||||
jiju_type: '',
|
jiju_type: '',
|
||||||
auth_lic:
|
auth_lic:
|
||||||
'xIWDlaDVdijcBB4mjhGCPYk5Kvk8tHZJbUn+vW+ih15+MYx98e/PXyBmKL5gFcWMPznLgDA15QuSAnZQSLddwdy9HkZgtuQDEEZZ351Eyb1eiDUccUnyoSGIrNimbx5TooBNNPYqU4qJeFrPJXAqjBHzRrxoBxuR2CEGKQPgHC4=',
|
'xIWDlaDVdijcBB4mjhGCPYk5Kvk8tHZJbUn+vW+ih15+MYx98e/PXyBmKL5gFcWMPznLgDA15QuSAnZQSLddwdy9HkZgtuQDEEZZ351Eyb1eiDUccUnyoSGIrNimbx5TooBNNPYqU4qJeFrPJXAqjBHzRrxoBxuR2CEGKQPgHC4=',
|
||||||
}
|
}
|
||||||
|
|
||||||
uni.request({
|
uni.request({
|
||||||
url: '/material/app/ocr/getOcrCode',
|
url: '/material/app/ocr/getOcrCode',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
|
|
@ -138,27 +169,74 @@
|
||||||
'Content-Type': 'application/json', // 根据后端要求设置请求头,常见的 POST 请求数据格式为 JSON
|
'Content-Type': 'application/json', // 根据后端要求设置请求头,常见的 POST 请求数据格式为 JSON
|
||||||
},
|
},
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
console.log('88888888', res)
|
const { data: resData } = res
|
||||||
if (res.data.code == 200 && res.data.data.data.result) {
|
|
||||||
|
if (resData.data.data.result) {
|
||||||
this.queryCodeParams.maCode = res.data.data.data.result
|
this.queryCodeParams.maCode = res.data.data.data.result
|
||||||
this.getCode()
|
this.getCode()
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({ title: '扫描失败!', icon: 'none' })
|
uni.showToast({
|
||||||
|
title: '扫描失败!' ,
|
||||||
|
icon: 'none',
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
fail: (err) => {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: err,
|
title: '请求失败:' + err.errMsg,
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
|
||||||
//this.$emit('getImage', res.message.tempImagePath)
|
|
||||||
},
|
|
||||||
})
|
//截屏
|
||||||
}
|
// handleInstruct(instruct) {
|
||||||
},
|
// if (this.ready) {
|
||||||
|
// this.ready = false
|
||||||
|
// this.livePusher.snapshot({
|
||||||
|
// success: async (res) => {
|
||||||
|
// console.log('拍照成功', res)
|
||||||
|
// this.ready = true
|
||||||
|
// let base64 = await this.imgToBase64(res.message.tempImagePath)
|
||||||
|
// // console.log('base64', base64)
|
||||||
|
// let params = {
|
||||||
|
// image: base64,
|
||||||
|
// jiju_type: '',
|
||||||
|
// auth_lic:
|
||||||
|
// 'xIWDlaDVdijcBB4mjhGCPYk5Kvk8tHZJbUn+vW+ih15+MYx98e/PXyBmKL5gFcWMPznLgDA15QuSAnZQSLddwdy9HkZgtuQDEEZZ351Eyb1eiDUccUnyoSGIrNimbx5TooBNNPYqU4qJeFrPJXAqjBHzRrxoBxuR2CEGKQPgHC4=',
|
||||||
|
// }
|
||||||
|
// uni.request({
|
||||||
|
// url: '/material/app/ocr/getOcrCode',
|
||||||
|
// method: 'post',
|
||||||
|
// data: params,
|
||||||
|
// header: {
|
||||||
|
// 'Content-Type': 'application/json', // 根据后端要求设置请求头,常见的 POST 请求数据格式为 JSON
|
||||||
|
// },
|
||||||
|
// success: (res) => {
|
||||||
|
// console.log('88888888', res)
|
||||||
|
// if (res.data.code == 200 && res.data.data.data.result) {
|
||||||
|
// this.queryCodeParams.maCode = res.data.data.data.result
|
||||||
|
// this.getCode()
|
||||||
|
// } else {
|
||||||
|
// uni.showToast({ title: '扫描失败!', icon: 'none' })
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// fail: (err) => {
|
||||||
|
// uni.showToast({
|
||||||
|
// title: err,
|
||||||
|
// icon: 'none',
|
||||||
|
// })
|
||||||
|
// },
|
||||||
|
// })
|
||||||
|
|
||||||
|
// //this.$emit('getImage', res.message.tempImagePath)
|
||||||
|
// },
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
|
||||||
imgToBase64(filePath) {
|
imgToBase64(filePath) {
|
||||||
// return new Promise((resolve, reject) => {
|
// return new Promise((resolve, reject) => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue