//识别车辆号牌
identifyImg() {
this.carShow = false;
//选取图片
lj.chooseImage({
count: 1,
success: (res) => {
console.log("res", res);
lj.showLoading({
mask: true,
title: "识别中...",
});
uni.uploadFile({
url: `${recognise}/baiduAPI/getLicense`,
// file: res?.tempFiles[0],
filePath:res?.tempFilePaths[0],//注意这里要用filePath,不然真机不行
name: "file",
// header:{
// 'content-type':'multipart/form-data'
// },
fail:(err)=>{
lj.hideLoading();
},
success: (res) => {
console.log("上传1", res);
console.log("上传2", JSON.parse(res.data));
if (JSON.parse(res.data)?.resMap?.data?.number) {
this.form.vehicleNumber = JSON.parse(
res.data
)?.resMap?.data?.number;
const maps = {
blue: "蓝",
green: "绿",
yellow: "黄",
};
this.form.vehicleNumberColor =
maps[JSON.parse(res.data)?.resMap?.data?.color];
this.form.vehicleNumberColorShow =
this.vehicleNumberColorColumns.find(
(item) => item.value === this.form.vehicleNumberColor
)?.label;
this.$forceUpdate();
this.vehicleNumberChange();
lj.hideLoading();
} else {
lj.hideLoading();
lj.showToast({
title: "识别失败",
duration: 2000,
icon: "none",
});
}
},
});
},
});
},
网友评论