From 16bbe24e5bd95f3d10a67b0255edd94b9bff1b50 Mon Sep 17 00:00:00 2001 From: zhangyouji Date: Mon, 5 Feb 2024 16:16:23 +0800 Subject: [PATCH] OCR --- .../pages/components/price-select-tab.vue | 76 +++++++++++++++++++ api/user.js | 12 +++ 2 files changed, 88 insertions(+) create mode 100644 api/user.js diff --git a/BagStation/pages/components/price-select-tab.vue b/BagStation/pages/components/price-select-tab.vue index 5ee9568..3e39e21 100644 --- a/BagStation/pages/components/price-select-tab.vue +++ b/BagStation/pages/components/price-select-tab.vue @@ -188,6 +188,18 @@ + + + 车牌识别 + + + 拍照 + + + + + + 优惠 @@ -377,6 +389,7 @@ import oilOssApi from '@/api/oil-oss.js' import utils from '@/utils/encode' import oilInterfacesApi from '@/api/oil-interfaces.js' + import user from '@/api/user.js' export default { props: { channelList: { @@ -598,6 +611,69 @@ } }, methods: { + srcPhoto(){ + let _that = this + uni.chooseImage({ + count: 1, //默认9 + sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 + sourceType: ['camera'], // 只能拍照 + success: function(res) { + console.log(res) + // uni.showLoading({ + // title: '识别中', + // mask: true + // }); + uni.saveImageToPhotosAlbum({ + filePath: res.tempFilePaths[0], + success: function (file) { + console.log('save success',res,file); + + const JSESSIONID = utils.uuid() + uni.uploadFile({ + url: 'http://uat.xingoil.com/oil-oss/obejct/uploadFile', + filePath: res.tempFilePaths[0], + formData: { + ossKey: 'xingyou', + pathKey: 'certificate', + encrypt: 'PUBLIC', + }, + name: 'file', + header: { + "Content-Type": "multipart/form-data", + "Authorization": uni.getStorageSync('Authorization'), + 'dataSources': 'MP', + "imei": uni.getStorageSync('unionid'), + "openId": uni.getStorageSync('openid'), + 'JSESSIONID': JSESSIONID, + 'token': utils.md5Salt(JSESSIONID) + }, + success(e) { + uni.hideLoading() + console.log('进入2') + console.log(e) + // let obj = JSON.parse(e.data), + // url = obj.data.publicUrl + // user.carNoIdentify(data).then((res) => { + // console.log(res) + // let obj = JSON.parse(res.data) + // console.log(obj) + // }) + },fail(res){ + uni.hideLoading() + console.log(res,'fail') + } + }) + + } + }); + + + + } + }) + + + }, typeChenk() { return this.channelList[this.activeCur]?.secondChannelCode && this.thirdPartyDynamicData.includes(this .channelList[this.activeCur].secondChannelCode) diff --git a/api/user.js b/api/user.js new file mode 100644 index 0000000..1c36a8e --- /dev/null +++ b/api/user.js @@ -0,0 +1,12 @@ +import request from '@/utils/request' +const service_name = "user" +const group_name = "oilCustomerInfo" +export default{ + carNoIdentify(data) { //图片上传-ORC识别 + return request({ + url: `/${service_name}/${group_name}/carNoIdentify`, + method: 'post', + data: data + }) + }, +} \ No newline at end of file