提交 313080e6 authored 作者: 常超凡's avatar 常超凡

新的提交

上级 06316cc9
...@@ -22,71 +22,12 @@ Page({ ...@@ -22,71 +22,12 @@ Page({
onLoad(options) { onLoad(options) {
this.cameraContext = wx.createCameraContext() this.cameraContext = wx.createCameraContext()
this.cameraContext.setZoom({ this.cameraContext.setZoom({
zoom: 2 zoom: 1
}) })
this.cameraFrame() this.cameraFrame()
// this.cameraFrameApi() // this.cameraFrameApi()
}, },
// 视频流(后端校验二维码)
cameraFrameApi() {
let flag = true
const that = this
const listener = this.cameraContext.onCameraFrame((frame) => {
if (flag) {
flag = false
that.setData({
width: frame.width,
height: frame.height,
})
wx.canvasPutImageData({
canvasId: 'myCanvas',
width: frame.width,
height: frame.height,
data: new Uint8ClampedArray(frame.data),
success(rew) {
console.log(rew, 99);
wx.canvasToTempFilePath({
canvasId: 'myCanvas',
x: frame.width / 2 - 150,
y: frame.height / 2 - 150,
width: 300,
height: 300,
destWidth: 300,
destHeight: 300,
quality: 'high',
fileType: 'jpg',
success(path) {
console.log(path.tempFilePath, 66);
const base = wx.getFileSystemManager().readFileSync(path.tempFilePath, 'base64')
that.setData({
src: 'data:image/jpeg;base64,' + base
})
wx.request({
url: 'https://ai.tj5.cc:35437/object/',
method: "POST",
data: {
base
},
success(g) {
console.log(g, 'cccc');
flag = true
}
})
},
fail(rr) {
console.log(rr, 5555);
}
})
},
fail(err) {
console.log(err);
}
})
}
})
listener.start()
},
// 视频流(前端判断二维码) // 视频流(前端判断二维码)
cameraFrame() { cameraFrame() {
...@@ -101,7 +42,7 @@ Page({ ...@@ -101,7 +42,7 @@ Page({
await wx.canvasPutImageData({ await wx.canvasPutImageData({
canvasId: 'myCanvas', canvasId: 'myCanvas',
x:0, x:0,
y:0, y:-frame.height/5,
width: frame.width, width: frame.width,
height: frame.height, height: frame.height,
data: new Uint8ClampedArray(frame.data), data: new Uint8ClampedArray(frame.data),
...@@ -117,19 +58,22 @@ Page({ ...@@ -117,19 +58,22 @@ Page({
}) })
const base = fileSystem.readFileSync(fileData.tempFilePath, 'base64') const base = fileSystem.readFileSync(fileData.tempFilePath, 'base64')
const qr_result = await that.handleCodeAnalysis(base) const qr_result = await that.handleCodeAnalysis(base)
console.log('qr_result',flag,5555,qr_result.data.codeinfo);
// 前端校验取消 // 前端校验取消
// const data = new Uint8ClampedArray(frame.data); // const data = new Uint8ClampedArray(frame.data);
// // const nData = data.slice(data.length / 4, data.length / 4 * 3) // // const nData = data.slice(data.length / 4, data.length / 4 * 3)
// const qr_result = qrcode.decodefrank(frame.width, frame.height, data) // const qr_result = qrcode.decodefrank(frame.width, frame.height, data)
if (qr_result?.codeinfo) { // console.log('qe_result',qr_result)
// console.log('qr_result.data.codeinfo',qr_result.data.codeinfo)
if (qr_result.data.codeinfo) {
that.setData({ that.setData({
height: frame.height, height: frame.height,
width: frame.width width: frame.width
}) })
// 原图(默认放大两倍) // 原图(默认放大两倍)
const photo1 = await that.handleTakePoto() const photo1 = await that.handleTakePoto(that.cameraContext, 1)
// 放大图(四倍) // 放大图(四倍)
const photo2 = await that.handleTakePoto(that.cameraContext, 4) const photo2 = await that.handleTakePoto(that.cameraContext, 4,{flash:'on'})
// 原图base64 // 原图base64
const base64_1 = fileSystem.readFileSync(photo1.tempImagePath, 'base64') const base64_1 = fileSystem.readFileSync(photo1.tempImagePath, 'base64')
...@@ -151,7 +95,9 @@ Page({ ...@@ -151,7 +95,9 @@ Page({
}) })
}) })
} else { } else {
flag = true setTimeout(() => {
flag = true
},750)
} }
} }
...@@ -161,6 +107,7 @@ Page({ ...@@ -161,6 +107,7 @@ Page({
// 后端接口解析二维码 // 后端接口解析二维码
handleCodeAnalysis(base64) { handleCodeAnalysis(base64) {
// console.log('base',base64)
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
wx.request({ wx.request({
url: 'https://www.7856.work:4433/api/Bym_upload/', url: 'https://www.7856.work:4433/api/Bym_upload/',
...@@ -185,6 +132,7 @@ Page({ ...@@ -185,6 +132,7 @@ Page({
zoom zoom
}) })
return await context.takePhoto({ return await context.takePhoto({
flash:param?.flash || 'off',
quality: param?.quality || 'high', quality: param?.quality || 'high',
selfieMirror: param?.selfieMirror || false, selfieMirror: param?.selfieMirror || false,
}) })
......
<!--pages/beiyinmei/beiyinmei.wxml--> <!--pages/beiyinmei/beiyinmei.wxml-->
<view wx:if="{{!showPage}}" style="height: 100vh;width: 100vw;position: relative;z-index: 99;"> <view wx:if="{{!showPage}}" style="height: 100vh;width: 100vw;position: relative;z-index: 99;">
<camera device-position="back" frame-size="medium" flash="off" style="width: 100%; height: 100%;" mode="normal"> <camera device-position="back" frame-size="medium" flash="auto" style="width: 100%; height: 100%;" mode="normal">
<view class="prompt"> <view class="prompt">
<image src="/assets/imgs/拍照框.png" style="width: 40%;" mode="widthFix" /> <image src="/assets/imgs/拍照框.png" style="width: 25%;" mode="widthFix" />
<text>请把二维码放置拍照框内</text> <text>请把二维码放置拍照框内</text>
</view> </view>
</camera> </camera>
...@@ -23,6 +23,6 @@ ...@@ -23,6 +23,6 @@
</view> </view>
</view> </view>
<view style="visibility: hidden;position: fixed;top: 9999px;left: 0px;"> <view style="visibility: hidden;position: fixed;top: 99999px;left: 0px;">
<canvas canvas-id="myCanvas" id="myCanvas" style="width:400px;height: 400px;" /> <canvas canvas-id="myCanvas" id="myCanvas" style="width:400px;height: 400px;" />
</view> </view>
...@@ -7,7 +7,7 @@ var take_Count = 0; ...@@ -7,7 +7,7 @@ var take_Count = 0;
Page({ Page({
// 页面的初始数据 // 页面的初始数据
data: { data: {
progressNumber:0, //拍照页面进度展示 progressNumber: 0, //拍照页面进度展示
image: '', image: '',
windowWidth: '', windowWidth: '',
windowHeight: '', windowHeight: '',
...@@ -64,7 +64,7 @@ Page({ ...@@ -64,7 +64,7 @@ Page({
}, },
onLoad: function (options) { onLoad: function (options) {
const param = options.param; const param = options.param;
console.log('param1',param) console.log('param1', param)
wx.setStorage({ wx.setStorage({
key: 'param', key: 'param',
data: param data: param
...@@ -72,25 +72,26 @@ Page({ ...@@ -72,25 +72,26 @@ Page({
var that = this var that = this
this.Sounds(); this.Sounds();
const dongtaishuju_chuan = wx.getStorageSync('dongtaishuju') const dongtaishuju_chuan = wx.getStorageSync('dongtaishuju')
switch (dongtaishuju_chuan) { //注释长时间不拍照
case 1: // switch (dongtaishuju_chuan) {
this.Countone_Time(); // case 1:
break; // this.Countone_Time();
case 2: // break;
this.Counttwo_Time(); // case 2:
break; // this.Counttwo_Time();
case 3: // break;
this.Countthree_Time(); // case 3:
break; // this.Countthree_Time();
default: // break;
console.log('不等于1,2,3次') // default:
this.setData({ // console.log('不等于1,2,3次')
longtime_state: true // this.setData({
}) // longtime_state: true
} // })
// }
var nCounter = 0 var nCounter = 0
const labelInfo = JSON.parse(wx.getStorageSync('extraData')) const labelInfo = JSON.parse(wx.getStorageSync('extraData'))
// console.log('labelInfo', labelInfo) // console.log('labelInfo', labelInfo)
if (labelInfo) { if (labelInfo) {
const labelCode = labelInfo.cpid_jm || labelInfo.cpid const labelCode = labelInfo.cpid_jm || labelInfo.cpid
...@@ -139,50 +140,53 @@ Page({ ...@@ -139,50 +140,53 @@ Page({
height: frame.height, //512 381 height: frame.height, //512 381
data: clamped, data: clamped,
success: (res) => { success: (res) => {
var inter = setInterval(function () { // var inter = setInterval(function () {
that.setData({ // that.setData({
smsFlag: true, // smsFlag: true,
sendTime: that.data.snsMsgWait, // sendTime: that.data.snsMsgWait,
snsMsgWait: that.data.snsMsgWait - 1 // snsMsgWait: that.data.snsMsgWait - 1
}); // });
if (that.data.snsMsgWait === -6 && !that.data.take_state && that.data.longtime_state === true) { // console.log('that.data.snsMsgWait', that.data.snsMsgWait)
let fail_text = '长时间不拍照1' // console.log('that.data.take_state', that.data.take_state)
// console.log('fail_text', fail_text) // console.log('that.data.longtime_state', that.data.longtime_state)
that.setData({ // if (that.data.snsMsgWait === -6 && !that.data.take_state && that.data.longtime_state === true) {
longTimeTakephoto: true // let fail_text = '长时间不拍照1'
}) // // console.log('fail_text', fail_text)
// console.log('that.data.takephoto',that.data.takephoto) // that.setData({
if (fail_text !== '' && that.data.takephoto !== 'succes') { // longTimeTakephoto: true
// console.log('进行第一次拍照') // })
that.takePhoto() // // console.log('that.data.takephoto',that.data.takephoto)
let take_photo_1 = '长时间不拍照2' // if (fail_text !== '' && that.data.takephoto !== 'succes') {
let takephoto = 'succes' // // console.log('进行第一次拍照')
that.setData({ // that.takePhoto()
take_photo_1, // let take_photo_1 = '长时间不拍照2'
takephoto // let takephoto = 'succes'
}); // that.setData({
} // take_photo_1,
// console.log('that.data.takephoto',that.data.takephoto) // takephoto
if (fail_text !== '' && that.data.takephoto === 'succes' && that.data.all_state !== true) { // });
setTimeout(() => { // }
// console.log('进行第二次拍照') // // console.log('that.data.takephoto',that.data.takephoto)
that.takePhoto2() // if (fail_text !== '' && that.data.takephoto === 'succes' && that.data.all_state !== true) {
}, 3500) // setTimeout(() => {
let take_state = true // // console.log('进行第二次拍照')
that.setData({ // that.takePhoto2()
take_state, // }, 3500)
all_state: true // let take_state = true
}); // that.setData({
} // take_state,
} // all_state: true
if (that.data.snsMsgWait < 0) { // });
clearInterval(inter) // }
that.setData({ // }
snsMsgWait: -5, // if (that.data.snsMsgWait < 0) {
snsFlag: false // clearInterval(inter)
}) // that.setData({
} // snsMsgWait: -5,
}, 1000); // snsFlag: false
// })
// }
// }, 1000);
// 转换临时文件 // 转换临时文件
wx.canvasToTempFilePath({ wx.canvasToTempFilePath({
canvasId: 'myCanvas', canvasId: 'myCanvas',
...@@ -199,22 +203,26 @@ Page({ ...@@ -199,22 +203,26 @@ Page({
// console.log('成功成功成功') // console.log('成功成功成功')
//进行编码 //进行编码
const base = wx.getFileSystemManager().readFileSync(res.tempFilePath, 'base64') const base = wx.getFileSystemManager().readFileSync(res.tempFilePath, 'base64')
console.log('base',base) // console.log('base',base)
that.setData({ that.setData({
src: res.tempFilePath src: res.tempFilePath
}); });
wx.request({ wx.request({
url: 'https://ai.tj5.cc:35437/object/', // url: 'https://ai.tj5.cc:35437/object/',
// url: 'https://tj5.cc:4433/object/', url: 'https://www.7856.work:4433/clear_fuzzy_detect/', //目标检测+判断清晰模糊接口
// url:'https://ai.china315net.com:35437/object/', // url:'https://ai.china315net.com:35437/object/',
method: "POST", method: "POST",
data: { data: {
base base
}, },
success: (res) => { success: (res) => {
console.log('res.data', res.data)
var result = res.data.result; var result = res.data.result;
var coord = res.data.coord[0][5]
console.log('coord', coord)
var minindex = -1; var minindex = -1;
var mindistance = 2; var mindistance = 2;
console.log('length', result.length)
for (var i = 0; i < result.length; i++) { for (var i = 0; i < result.length; i++) {
var sublist = result[i]; var sublist = result[i];
var distance = Math.abs(sublist[0] - 0.5) + Math.abs(sublist[1] - 0.5); var distance = Math.abs(sublist[0] - 0.5) + Math.abs(sublist[1] - 0.5);
...@@ -254,7 +262,12 @@ Page({ ...@@ -254,7 +262,12 @@ Page({
}) })
status = 'true' status = 'true'
// console.log('that.data.takephoto', that.data.takephoto) // console.log('that.data.takephoto', that.data.takephoto)
if (text == text && that.data.takephoto !== 'succes' && that.data.take_photo_1 === '') { if (coord != 0) {
wx.showToast({
title: '当前位置模糊,请找合适的位置',
})
}
if (text == text && that.data.takephoto !== 'succes' && that.data.take_photo_1 === '' && coord === 0) {
// console.log('大框参数完成进行拍照') // console.log('大框参数完成进行拍照')
that.takePhoto(); that.takePhoto();
let takephoto = 'succes' let takephoto = 'succes'
...@@ -436,35 +449,35 @@ Page({ ...@@ -436,35 +449,35 @@ Page({
res_errMsg: res_errMsg res_errMsg: res_errMsg
}) })
wx.removeStorageSync('res_errMsg') wx.removeStorageSync('res_errMsg')
//倒计时 //倒计时注释倒计时
var inter = setInterval(function () { // var inter = setInterval(function () {
that.setData({ // that.setData({
smsFlag: true, // smsFlag: true,
sendTime: that.data.snsMsgWait_1, // sendTime: that.data.snsMsgWait_1,
snsMsgWait_1: that.data.snsMsgWait_1 - 1 // snsMsgWait_1: that.data.snsMsgWait_1 - 1
}); // });
if (that.data.snsMsgWait_1 === -6 && res_errMsg != '') { // if (that.data.snsMsgWait_1 === -6 && res_errMsg != '') {
// console.log('长时间未响应') // // console.log('长时间未响应')
setTimeout(() => { // setTimeout(() => {
that.takePhoto2() // that.takePhoto2()
}, 2500) // }, 2500)
that.setData({ // that.setData({
longtime_state: true // longtime_state: true
}) // })
} // }
if (that.data.snsMsgWait_1 < 0) { // if (that.data.snsMsgWait_1 < 0) {
clearInterval(inter) // clearInterval(inter)
that.setData({ // that.setData({
snsMsgWait_1: -5, // snsMsgWait_1: -5,
snsFlag: false // snsFlag: false
}) // })
// console.log('that.data.snsMsgWait_2', that.data.snsMsgWait_1) // // console.log('that.data.snsMsgWait_2', that.data.snsMsgWait_1)
} // }
}.bind(that), 1000); // }.bind(that), 1000);
let camera_state = res.errMsg // let camera_state = res.errMsg
that.setData({ // that.setData({
camera_state // camera_state
}) // })
}, },
fail: function (res) { fail: function (res) {
console.log("" + res); console.log("" + res);
...@@ -527,7 +540,7 @@ Page({ ...@@ -527,7 +540,7 @@ Page({
// 设置拍照进度条 // 设置拍照进度条
this.setData({ this.setData({
progressNumber:50, progressNumber: 50,
}) })
var that = this var that = this
...@@ -620,7 +633,7 @@ Page({ ...@@ -620,7 +633,7 @@ Page({
if (res.errMsg.indexOf('timeout') !== -1) { if (res.errMsg.indexOf('timeout') !== -1) {
// console.log('请求超时') // console.log('请求超时')
const datajson = '码解析失败' const datajson = '码解析失败'
console.log('datajson1',datajson) console.log('datajson1', datajson)
wx.setStorage({ wx.setStorage({
key: 'datajson', key: 'datajson',
data: datajson data: datajson
...@@ -631,7 +644,7 @@ Page({ ...@@ -631,7 +644,7 @@ Page({
if (!res.data) { if (!res.data) {
// console.log('网络请求没有返回任何数据') // console.log('网络请求没有返回任何数据')
const datajson = '码解析失败' const datajson = '码解析失败'
console.log('datajson1',datajson) console.log('datajson1', datajson)
wx.setStorage({ wx.setStorage({
key: 'datajson', key: 'datajson',
data: datajson data: datajson
...@@ -646,12 +659,12 @@ Page({ ...@@ -646,12 +659,12 @@ Page({
// url: 'https://tj5.cc:4433/classify16/', // url: 'https://tj5.cc:4433/classify16/',
method: "POST", method: "POST",
data: { data: {
'image_type': 20, 'image_type': 50,
'base': base, 'base': base,
}, },
success: (res) => { success: (res) => {
let result_value = res.data.result let result_value = res.data.result
console.log('result_value',result_value) console.log('result_value', result_value)
let yuan_file = res.data.image_path let yuan_file = res.data.image_path
// console.log('yuan_file', yuan_file) // console.log('yuan_file', yuan_file)
wx.setStorage({ wx.setStorage({
...@@ -671,7 +684,7 @@ Page({ ...@@ -671,7 +684,7 @@ Page({
// console.log('hint_phone', hint_phone) // console.log('hint_phone', hint_phone)
} else { } else {
console.log('不等于14分类') console.log('不等于14分类')
console.log('result_value',result_value) console.log('result_value', result_value)
let hint_phone = result_value let hint_phone = result_value
wx.setStorage({ wx.setStorage({
key: 'hint_phone', key: 'hint_phone',
...@@ -750,9 +763,10 @@ Page({ ...@@ -750,9 +763,10 @@ Page({
// console.log('takePhoto2') // console.log('takePhoto2')
// 设置拍照进度条 // 设置拍照进度条
this.setData({ this.setData({
progressNumber:100, progressNumber: 100,
}) })
const that = this; const that = this;
function isIOS() { function isIOS() {
let system = wx.getSystemInfoSync().system let system = wx.getSystemInfoSync().system
return system.indexOf('iOS') !== -1 return system.indexOf('iOS') !== -1
...@@ -791,7 +805,7 @@ Page({ ...@@ -791,7 +805,7 @@ Page({
this.setData({ this.setData({
bigfileimage: res.tempImagePath, bigfileimage: res.tempImagePath,
}); });
wx.navigateTo({ wx.navigateTo({
url: '../upload/upload?path=' + that.data.bigfileimage + '&char=0' url: '../upload/upload?path=' + that.data.bigfileimage + '&char=0'
}); });
...@@ -829,12 +843,11 @@ Page({ ...@@ -829,12 +843,11 @@ Page({
// } // }
// console.log('手机型号',phone_model) // console.log('手机型号',phone_model)
let phone_list= ['NOH-AN00','NOH-AN01','OCE-AN10','JAD-AL00','LNA-AL00','NOP-AN00','NOH-AL10','ABR-AL80','MNA-AL00','JAD-AL50','ABR-AL00','ABR-AL90','ABR-AL60','ABR-AL60','NOH-AN50'] let phone_list = ['NOH-AN00', 'NOH-AN01', 'OCE-AN10', 'JAD-AL00', 'LNA-AL00', 'NOP-AN00', 'NOH-AL10', 'ABR-AL80', 'MNA-AL00', 'JAD-AL50', 'ABR-AL00', 'ABR-AL90', 'ABR-AL60', 'ABR-AL60', 'NOH-AN50']
if(phone_list.includes(phone_model)){ if (phone_list.includes(phone_model)) {
// console.log('特殊手机型号') // console.log('特殊手机型号')
timeS = 850 timeS = 850
} } else if (benchmarkLevel > 40) {
else if (benchmarkLevel > 40) {
timeS = 350; timeS = 350;
} else if (benchmarkLevel > 30) { } else if (benchmarkLevel > 30) {
timeS = 380; timeS = 380;
...@@ -849,9 +862,9 @@ Page({ ...@@ -849,9 +862,9 @@ Page({
} }
}, },
takePhotoZoom: function (one_zoom,timeS) { takePhotoZoom: function (one_zoom, timeS) {
console.log('one_zoom',one_zoom) console.log('one_zoom', one_zoom)
console.log('timeS',timeS) console.log('timeS', timeS)
var that = this var that = this
that.ctx.setZoom({ that.ctx.setZoom({
zoom: one_zoom, zoom: one_zoom,
...@@ -917,105 +930,107 @@ Page({ ...@@ -917,105 +930,107 @@ Page({
console.log('播放结束') console.log('播放结束')
}) })
}, },
Countone_Time: function () {
console.log('1') //注释长时间不拍照,换种方式提示
var inter = setInterval(function () { // Countone_Time: function () {
this.setData({ // console.log('1')
smsFlag: true, // var inter = setInterval(function () {
snsMsgWait_one: this.data.snsMsgWait_one - 1 // this.setData({
}); // smsFlag: true,
// console.log('this.data.snsMsgWait_one', this.data.snsMsgWait_one) // snsMsgWait_one: this.data.snsMsgWait_one - 1
if (this.data.snsMsgWait_one == 0) { // });
this.setData({ // // console.log('this.data.snsMsgWait_one', this.data.snsMsgWait_one)
longTimeOnce: true // if (this.data.snsMsgWait_one == 0) {
}) // this.setData({
clearInterval(inter) // longTimeOnce: true
// console.log('this.data.all_state', this.data.all_state) // })
// console.log('this.data.singe_state', this.data.singe_state) // clearInterval(inter)
// console.log('longTimeOnce',this.data.longTimeOnce) // // console.log('this.data.all_state', this.data.all_state)
if (this.data.singe_state === true && this.data.all_state === false && this.data.longTimeOnce === true) { // // console.log('this.data.singe_state', this.data.singe_state)
console.log('倒计时0拍照one') // // console.log('longTimeOnce',this.data.longTimeOnce)
setTimeout(() => { // if (this.data.singe_state === true && this.data.all_state === false && this.data.longTimeOnce === true) {
this.takePhoto2(); // console.log('倒计时0拍照one')
this.setData({ // setTimeout(() => {
all_state: true // this.takePhoto2();
}) // this.setData({
// console.log('all_state', this.data.all_state) // all_state: true
}, 350); // })
} // // console.log('all_state', this.data.all_state)
} // }, 350);
}.bind(this), 1200); // }
}, // }
Counttwo_Time: function () { // }.bind(this), 1200);
console.log('2') // },
var inter = setInterval(function () { // Counttwo_Time: function () {
this.setData({ // console.log('2')
smsFlag: true, // var inter = setInterval(function () {
snsMsgWait_twotime: this.data.snsMsgWait_twotime - 1 // this.setData({
}); // smsFlag: true,
// console.log('this.data.snsMsgWait_twotime', this.data.snsMsgWait_twotime) // snsMsgWait_twotime: this.data.snsMsgWait_twotime - 1
if (this.data.snsMsgWait_twotime == 0) { // });
clearInterval(inter) // // console.log('this.data.snsMsgWait_twotime', this.data.snsMsgWait_twotime)
// console.log('this.data.all_state', this.data.all_state) // if (this.data.snsMsgWait_twotime == 0) {
// console.log('this.data.singe_state', this.data.singe_state) // clearInterval(inter)
this.setData({ // // console.log('this.data.all_state', this.data.all_state)
longTimeTwo: true // // console.log('this.data.singe_state', this.data.singe_state)
}) // this.setData({
// console.log('this.data.singe_state',this.data.singe_state) // longTimeTwo: true
// console.log('this.data.all_state',this.data.all_state) // })
// console.log('this.data.longtimeTwo',this.data.longTimeTwo) // // console.log('this.data.singe_state',this.data.singe_state)
if (this.data.singe_state == true && this.data.all_state == false && this.data.longTimeTwo === true) { // // console.log('this.data.all_state',this.data.all_state)
console.log('倒计时0拍照two') // // console.log('this.data.longtimeTwo',this.data.longTimeTwo)
setTimeout(() => { // if (this.data.singe_state == true && this.data.all_state == false && this.data.longTimeTwo === true) {
// console.log('this.data.take_state', this.data.take_state) // console.log('倒计时0拍照two')
if (this.data.take_state == true) { // setTimeout(() => {
// console.log('不进行拍照') // // console.log('this.data.take_state', this.data.take_state)
} else { // if (this.data.take_state == true) {
this.takePhoto2(); // // console.log('不进行拍照')
this.setData({ // } else {
all_state: true // this.takePhoto2();
}) // this.setData({
} // all_state: true
// console.log('倒计时0拍照twoall_state', this.data.all_state) // })
}, 350); // }
} // // console.log('倒计时0拍照twoall_state', this.data.all_state)
} // }, 350);
}.bind(this), 1200); // }
}, // }
Countthree_Time: function () { // }.bind(this), 1200);
console.log('3') // },
var inter = setInterval(function () { // Countthree_Time: function () {
this.setData({ // console.log('3')
smsFlag: true, // var inter = setInterval(function () {
snsMsgWait_three: this.data.snsMsgWait_three - 1 // this.setData({
}); // smsFlag: true,
// console.log('this.data.snsMsgWait_three', this.data.snsMsgWait_three) // snsMsgWait_three: this.data.snsMsgWait_three - 1
if (this.data.snsMsgWait_three == 0) { // });
clearInterval(inter) // // console.log('this.data.snsMsgWait_three', this.data.snsMsgWait_three)
this.setData({ // if (this.data.snsMsgWait_three == 0) {
longTimeThree: true // clearInterval(inter)
}) // this.setData({
// console.log('this.data.singe_state',this.data.singe_state) // longTimeThree: true
// console.log('this.data.all_state',this.data.all_state) // })
// console.log('this.data.longtimeThree',this.data.longTimeThree) // // console.log('this.data.singe_state',this.data.singe_state)
if (this.data.singe_state == true && this.data.all_state == false && this.data.longTimeThree === true) { // // console.log('this.data.all_state',this.data.all_state)
console.log('倒计时0拍照three') // // console.log('this.data.longtimeThree',this.data.longTimeThree)
setTimeout(() => { // if (this.data.singe_state == true && this.data.all_state == false && this.data.longTimeThree === true) {
// console.log('this.data.take_state', this.data.take_state) // console.log('倒计时0拍照three')
if (this.data.take_state == true) { // setTimeout(() => {
console.log('不进行拍照') // // console.log('this.data.take_state', this.data.take_state)
} else { // if (this.data.take_state == true) {
this.takePhoto2(); // console.log('不进行拍照')
this.setData({ // } else {
all_state: true // this.takePhoto2();
}) // this.setData({
} // all_state: true
// console.log('all_state', this.data.all_state) // })
}, 350); // }
} // // console.log('all_state', this.data.all_state)
} // }, 350);
}.bind(this), 1200); // }
}, // }
// }.bind(this), 1200);
// },
handleOpenVideo() { handleOpenVideo() {
wx.navigateTo({ wx.navigateTo({
url: '/pages/video/video', url: '/pages/video/video',
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
</camera> </camera>
<view class="content"> <view class="content">
<text style='font-size:34rpx'>请将识别框对准结构三维码</text> <text style='font-size:34rpx'>请将识别框对准结构三维码</text>
<image src="/assets/imgs/拍照框.png" mode="widthFix" style="margin:100rpx 0; width: 50%;"/> <image src="/assets/imgs/拍照框.png" mode="widthFix" style="margin:75rpx 0; width: 35%;"/>
<view class="progress-box"> <view class="progress-box">
<text >请保持结构三维码在识别框内等待进度条完成</text> <text >请保持结构三维码在识别框内等待进度条完成</text>
<progress percent="{{progressNumber}}" active stroke-width="10" show-info color="#0270FF" border-radius='100' active-mode='forwards' style="margin-top: 20rpx;"/> <progress percent="{{progressNumber}}" active stroke-width="10" show-info color="#0270FF" border-radius='100' active-mode='forwards' style="margin-top: 20rpx;"/>
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
<view class="btns"> <view class="btns">
<image bindtap="takePhoto" src="https://ai.tj5.cc:35437/static/fenggu/comerz.png" mode="widthFix" style="width: 50%;" /> <image bindtap="takePhoto" src="https://ai.tj5.cc:35437/static/fenggu/comerz.png" mode="widthFix" style="width: 50%;" />
<view class="btn video-btn" bind:tap="handleOpenVideo">查看视频教程</view> <view class="btn video-btn" bind:tap="handleOpenVideo">查看视频教程</view>
<navigator class="btn video-btn" open-type="exit" target="miniProgram">点击按钮返回主页</navigator>
</view> </view>
<!-- 底部文字 --> <!-- 底部文字 -->
......
...@@ -8,21 +8,25 @@ Page({ ...@@ -8,21 +8,25 @@ Page({
aiState: 0, //展示成功或失败页面, aiState: 0, //展示成功或失败页面,
time1: '', //本次认证时间 time1: '', //本次认证时间
time2: '', //认证耗时 time2: '', //认证耗时
bg_color:'' bg_color:'',
Labeldiff:0 //展示码不同页面
}, },
onLoad(options) { onLoad(options) {
const { const {
aiState, aiState,
time1, time1,
time2 time2,
Labeldiff
} = options } = options
console.log(options,time1); // console.log(options,time1);
console.log('options.Labeldiff',options.Labeldiff)
this.setData({ this.setData({
aiState: aiState || 0, aiState: aiState || 0,
time1: time1 || '', time1: time1 || '',
time2: time2 && (new Date().getTime() - time2) / 1000 || '', time2: time2 && (new Date().getTime() - time2) / 1000 || '',
bg_color: getApp().page_bg bg_color: getApp().page_bg,
Labeldiff:Labeldiff || 0
}) })
}, },
// 返回首页 // 返回首页
......
...@@ -15,6 +15,19 @@ ...@@ -15,6 +15,19 @@
</view> </view>
<image src="/assets/imgs/验证成功底部.png" mode="widthFix" style="width: 100%;" /> <image src="/assets/imgs/验证成功底部.png" mode="widthFix" style="width: 100%;" />
</view> </view>
<!-- 码不同页面 -->
<view wx:if="{{Labeldiff == 1 }}" class="error-content full">
<view class="content-text">
<image src="/assets/imgs/未通过.png" mode="widthFix" style="width: 30%;" />
<text style="margin: 40rpx 0;font-size: 34rpx;font-weight: 700;">码不同,不是同一枚标签!</text>
<view style="padding:0 60rpx; text-align: center;font-size: 30rpx;line-height: 48rpx;">请使用同一枚标签进行认证,请保证相机稳定,检查标签码是否有破损,并前往光照适宜的环境进行验证</view>
<view class="btns" >
<view class="btn" bind:tap="handleGoTakePhoto">重新验证</view>
<view class="btn" bind:tap="handleOpenVideo">继续查看视频教程</view>
</view>
</view>
<image src="/assets/imgs/验证成功底部.png" mode="widthFix" style="width: 100%;" />
</view>
<!-- 验证失败页面 --> <!-- 验证失败页面 -->
<view wx:else class="error-content full"> <view wx:else class="error-content full">
<view class="content-text"> <view class="content-text">
......
...@@ -25,6 +25,7 @@ Page({ ...@@ -25,6 +25,7 @@ Page({
openid: '', openid: '',
aiState: 0, aiState: 0,
sameCodeState: 0, sameCodeState: 0,
Labeldiff:0,
filePath: '', filePath: '',
datajson: '', datajson: '',
labelCodejson: '', labelCodejson: '',
...@@ -321,32 +322,33 @@ Page({ ...@@ -321,32 +322,33 @@ Page({
const base = wx.getFileSystemManager().readFileSync(this.data.filePath, 'base64') const base = wx.getFileSystemManager().readFileSync(this.data.filePath, 'base64')
//增加不需要进行码判断 //增加不需要进行码判断
this.checkAiResult(base); // this.checkAiResult(base);
// console.log('base', base) // console.log('base', base)
// if (this.data.labelCode) { //判断标签序号
// // console.log('开始检查标签相似') if (this.data.labelCode) {
// this.checkIsSameCode(base, (state) => { // console.log('开始检查标签相似')
// this.setData({ this.checkIsSameCode(base, (state) => {
// sameCodeState: state this.setData({
// }) sameCodeState: state
// if (state === 1) { })
// this.checkAiResult(base); if (state === 1) {
// } else { this.checkAiResult(base);
// this.setData({ } else {
// isLoading: false, this.setData({
// }) isLoading: false,
// } })
// }) }
// console.log("sameCodeState", this.data.sameCodeState) })
// } else { console.log("sameCodeState", this.data.sameCodeState)
// console.log('进入不需要检查标签相似') } else {
// this.setData({ console.log('进入不需要检查标签相似')
// sameCodeState: 1, this.setData({
// userimage: false, sameCodeState: 1,
// userinfo_name: false userimage: false,
// }) userinfo_name: false
// this.checkAiResult(base); })
// } this.checkAiResult(base);
}
}, },
//检查标签是否相同 //检查标签是否相同
checkIsSameCode(base, cb) { checkIsSameCode(base, cb) {
...@@ -464,6 +466,7 @@ Page({ ...@@ -464,6 +466,7 @@ Page({
}); });
} else { } else {
console.log('码不同') console.log('码不同')
const Labeldiff = 1
cb(0); cb(0);
// console.log('码不同', this.data.sameCodeState) // console.log('码不同', this.data.sameCodeState)
const dtime2 = util.formatTime(new Date()); const dtime2 = util.formatTime(new Date());
...@@ -506,6 +509,10 @@ Page({ ...@@ -506,6 +509,10 @@ Page({
}, },
success: (res) => { success: (res) => {
console.log('all入库成功', res); console.log('all入库成功', res);
wx.reLaunch({
url: `/pages/result/result?Labeldiff=${Labeldiff}`
})
return
}, },
fail: (error) => { fail: (error) => {
console.log('入库失败', error); console.log('入库失败', error);
...@@ -739,17 +746,18 @@ Page({ ...@@ -739,17 +746,18 @@ Page({
// url:'https://www.7856.work:4433/api/classify16/', // url:'https://www.7856.work:4433/api/classify16/',
method: 'POST', method: 'POST',
data: { data: {
'image_type': 20, 'image_type': 50,
'base': base, 'base': base,
}, },
success: (res) => { success: (res) => {
console.log('base',base)
console.log('打印分类接口返回数据res.data', res.data) console.log('打印分类接口返回数据res.data', res.data)
let imagefile = res.data.image_path let imagefile = res.data.image_path
const classScore = res.data.result const classScore = res.data.result
const max_score = Math.max.apply(null, res.data.confidence) const max_score = Math.max.apply(null, res.data.confidence)
const max_score_value = max_score.toFixed(3) const max_score_value = max_score.toFixed(3)
const Score_list = res.data.confidence const Score_list = res.data.confidence
// console.log('Score_list', Score_list) console.log('Score_list', Score_list)
for (var i = 0; i < Score_list.length; i++) { for (var i = 0; i < Score_list.length; i++) {
Score_list[i] = Score_list[i].toFixed(3); Score_list[i] = Score_list[i].toFixed(3);
} }
...@@ -931,7 +939,7 @@ Page({ ...@@ -931,7 +939,7 @@ Page({
key: 'notice', key: 'notice',
data: notice data: notice
}) })
console.log('notice调用人工服务',notice) console.log('notice结果展示',notice)
if (notice != '手机边框') { if (notice != '手机边框') {
if (aiState !== 1) { if (aiState !== 1) {
Count++; Count++;
...@@ -1223,7 +1231,7 @@ Page({ ...@@ -1223,7 +1231,7 @@ Page({
// 跳转到结果页面 // 跳转到结果页面
wx.reLaunch({ wx.reLaunch({
url: `/pages/result/result?time1=${util.formatTime(new Date()) || this.data.people_time}&time2=${new Date().getTime()}&aiState=${aiState}` url: `/pages/result/result?time1=${util.formatTime(new Date()) || this.data.people_time}&time2=${new Date().getTime()}&aiState=${aiState}&Labeldiff=${this.dataLabeldiff}`
}) })
return return
}, },
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"setting": { "setting": {
"compileHotReLoad": true, "compileHotReLoad": true,
"urlCheck": false, "urlCheck": false,
"bigPackageSizeSupport": false "bigPackageSizeSupport": true
}, },
"condition": { "condition": {
"miniprogram": { "miniprogram": {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论