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

贝因美识别

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