|
@@ -319,71 +319,78 @@
|
|
|
console.log('this.confirmData',this.confirmData)
|
|
|
},
|
|
|
getPic(){
|
|
|
+ // let that = this;
|
|
|
+ // ocr.ocrVehicleNo((ret) => {
|
|
|
+ // if (ret.success){
|
|
|
+ // that.confirmData.vehicleNo = ret.vehicleNo;
|
|
|
+ // that.confirmData.carImg = 'data:image/png;base64,' + ret.imageBase64;
|
|
|
+ // this.$u.api.tencentBase64Upload({
|
|
|
+ // base64: ret.imageBase64,
|
|
|
+ // suffix: 'png'
|
|
|
+ // })
|
|
|
+ // .then(res=>{
|
|
|
+ // that.confirmData.vehicleImage = res.data.url;
|
|
|
+ // }).catch(err=>{});
|
|
|
+ // }else {
|
|
|
+ // plus.nativeUI.toast('识别失败');
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+
|
|
|
let that = this;
|
|
|
- ocr.ocrVehicleNo((ret) => {
|
|
|
- if (ret.success){
|
|
|
- that.confirmData.vehicleNo = ret.vehicleNo;
|
|
|
- that.confirmData.carImg = 'data:image/png;base64,' + ret.imageBase64;
|
|
|
- this.$u.api.tencentBase64Upload({
|
|
|
- base64: ret.imageBase64,
|
|
|
- suffix: 'png'
|
|
|
- })
|
|
|
- .then(res=>{
|
|
|
- that.confirmData.vehicleImage = res.data.url;
|
|
|
- }).catch(err=>{});
|
|
|
- }else {
|
|
|
- plus.nativeUI.toast('识别失败');
|
|
|
+ uni.chooseImage({
|
|
|
+ count: 1, //默认9
|
|
|
+ sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
|
|
|
+ sourceType: ['camera'], //
|
|
|
+ success: function (res) {
|
|
|
+ console.log('img',res)
|
|
|
+ that.confirmData.carImg = res.tempFilePaths[0];
|
|
|
+ uni.showLoading({});
|
|
|
+ const tempFilePaths = res.tempFilePaths;
|
|
|
+ // 若多选,需循环调用uni.uploadFile ,因微信小程序只支持单文件上传
|
|
|
+ uni.uploadFile({
|
|
|
+ url: `${that.config.fileUrl}/tencent/ocr`,
|
|
|
+ filePath: tempFilePaths[0],
|
|
|
+ name: 'file',
|
|
|
+ formData: {
|
|
|
+ 'isUpload': '1' // 上传附带参数
|
|
|
+ },
|
|
|
+ success: (res) => {
|
|
|
+ // 根据接口具体返回格式 赋值具体对应url
|
|
|
+ // alert(uploadFileRes.data);
|
|
|
+ let resobj=eval("("+res.data+")");
|
|
|
+ uni.hideLoading();
|
|
|
+ if(resobj.code==200){
|
|
|
+ console.log(resobj);
|
|
|
+ //#ifdef APP-PLUS
|
|
|
+ speak(resobj.data.vehicleNo);
|
|
|
+ //#endif
|
|
|
+ that.confirmData.vehicleNo = resobj.data.vehicleNo;
|
|
|
+ that.confirmData.vehicleClor = resobj.data.vehicleClor;
|
|
|
+ that.confirmData.vehicleImage = resobj.data.url;
|
|
|
+ that.confirmData.carImg = 'data:image/png;base64,' + resobj.data.imageBase64;
|
|
|
+ this.$u.api.tencentBase64Upload({
|
|
|
+ base64: resobj.data.imageBase64,
|
|
|
+ suffix: 'png'
|
|
|
+ })
|
|
|
+ console.log('that.confirmData',that.confirmData);
|
|
|
+ }else{
|
|
|
+ that.$refs.uToast.show({
|
|
|
+ title: resobj.msg,
|
|
|
+ type: 'error'
|
|
|
+ });
|
|
|
+ };
|
|
|
+ console.log('resobj',resobj);
|
|
|
+ },
|
|
|
+ fail: (err) => {
|
|
|
+ that.$refs.uToast.show({
|
|
|
+ title:err.msg,
|
|
|
+ type: 'error'
|
|
|
+ });
|
|
|
+ uni.hideLoading();
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
});
|
|
|
- // uni.chooseImage({
|
|
|
- // count: 1, //默认9
|
|
|
- // sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
|
|
|
- // sourceType: ['camera'], //
|
|
|
- // success: function (res) {
|
|
|
- // console.log('img',res)
|
|
|
- // that.confirmData.carImg = res.tempFilePaths[0];
|
|
|
- // uni.showLoading({});
|
|
|
- // const tempFilePaths = res.tempFilePaths;
|
|
|
- // // 若多选,需循环调用uni.uploadFile ,因微信小程序只支持单文件上传
|
|
|
- // uni.uploadFile({
|
|
|
- // url: `${that.config.fileUrl}/baidu/ocr`,
|
|
|
- // filePath: tempFilePaths[0],
|
|
|
- // name: 'file',
|
|
|
- // formData: {
|
|
|
- // 'isUpload': '1' // 上传附带参数
|
|
|
- // },
|
|
|
- // success: (res) => {
|
|
|
- // // 根据接口具体返回格式 赋值具体对应url
|
|
|
- // // alert(uploadFileRes.data);
|
|
|
- // let resobj=eval("("+res.data+")");
|
|
|
- // uni.hideLoading();
|
|
|
- // if(resobj.code==200){
|
|
|
- // console.log(resobj);
|
|
|
- // //#ifdef APP-PLUS
|
|
|
- // speak(resobj.data.vehicleNo);
|
|
|
- // //#endif
|
|
|
- // that.confirmData.vehicleNo = resobj.data.vehicleNo;
|
|
|
- // that.confirmData.vehicleClor = resobj.data.vehicleClor;
|
|
|
- // that.confirmData.vehicleImage = resobj.data.url;
|
|
|
- // console.log('that.confirmData',that.confirmData);
|
|
|
- // }else{
|
|
|
- // that.$refs.uToast.show({
|
|
|
- // title: resobj.msg,
|
|
|
- // type: 'error'
|
|
|
- // });
|
|
|
- // };
|
|
|
- // console.log('resobj',resobj);
|
|
|
- // },
|
|
|
- // fail: (err) => {
|
|
|
- // that.$refs.uToast.show({
|
|
|
- // title:err.msg,
|
|
|
- // type: 'error'
|
|
|
- // });
|
|
|
- // uni.hideLoading();
|
|
|
- // }
|
|
|
- // });
|
|
|
- // }
|
|
|
- // });
|
|
|
},
|
|
|
confirmIn(){
|
|
|
let files = [];
|