提交 4081030f authored 作者: 羊富学's avatar 羊富学

贝因美识别

上级 622a64cb
......@@ -75,52 +75,56 @@ Page({
src: res.tempFilePath
})
wx.request({
url: 'https://www.7856.work:4433/clear_fuzzy_detect/', //目标检测+判断清晰模糊接口 测试地址
// url: 'https://tj5.cc:4433/object/',
// url:'https://ai.china315net.com:35437/object/',
url: 'https://www.7856.work:4433/api/Bym_upload/',
method: 'POST',
data: {
base
base: base,
labelCodejson: 'BeiyinmeiAi'
},
success: async()=> {
console.log('识别二维码成功');
// 原图(默认放大两倍)
const photo1 = await that.handleTakePoto(wx.createCameraContext(), 1)
// 放大图(四倍)
// await new Promise((resovle) => {
// setTimeout(() => {
// resovle()
// },300)
// })
console.log('5555');
const photo2 = await that.handleTakePoto(wx.createCameraContext(), 4, {
flash: 'on'
})
console.log(photo2.tempImagePath, 'photo1');
// this.setData({
// src:photo2.tempImagePath
// })
// 原图base64
const base64_1 = wx
.getFileSystemManager().readFileSync(photo1.tempImagePath, 'base64')
// 放大四倍图 base64
const base64_2 = wx
.getFileSystemManager().readFileSync(photo2.tempImagePath, 'base64')
// 请求接口
Promise.all([that.handleApiCheck(base64_1, 'small'), that.handleApiCheck(base64_2, 'big')])
.then(value => {
let pageType = 'error'
const result1 = value[0],
result2 = value[1]
// data.result == 2 为真
if (result1.data.result == 2 && result2.data.result == 2) {
pageType = 'success'
}
that.setData({
showPage: pageType
})
success: async (result) => {
if (result.data.codeinfo) {
console.log('识别二维码成功',result.data.codeinfo,result);
// 原图(默认放大两倍)
const photo1 = await that.handleTakePoto(wx.createCameraContext(), 1)
// 放大图(四倍)
// await new Promise((resovle) => {
// setTimeout(() => {
// resovle()
// },300)
// })
console.log('5555');
const photo2 = await that.handleTakePoto(wx.createCameraContext(), 4, {
flash: 'on'
})
console.log(photo2.tempImagePath, 'photo1');
// this.setData({
// src:photo2.tempImagePath
// })
// 原图base64
const base64_1 = wx
.getFileSystemManager().readFileSync(photo1.tempImagePath, 'base64')
// 放大四倍图 base64
const base64_2 = wx
.getFileSystemManager().readFileSync(photo2.tempImagePath, 'base64')
// 请求接口
Promise.all([that.handleApiCheck(base64_1, 'small'), that.handleApiCheck(base64_2, 'big')])
.then(value => {
let pageType = 'error'
const result1 = value[0],
result2 = value[1]
// data.result == 2 为真
if (result1.data.result == 2 && result2.data.result == 2) {
pageType = 'success'
}
that.setData({
showPage: pageType
})
})
} else {
tag = true
}
},
fail(err) {
tag = true
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论