提交 9d4e3792 authored 作者: 羊富学's avatar 羊富学

贝因美

上级 7959679d
...@@ -26,18 +26,23 @@ Page({ ...@@ -26,18 +26,23 @@ Page({
flag = false flag = false
const data = new Uint8ClampedArray(frame.data); const data = new Uint8ClampedArray(frame.data);
const d = qrcode.decodefrank(frame.width, frame.height, data) const d = qrcode.decodefrank(frame.width, frame.height, data)
console.log(d);
if (d) { if (d) {
wx.showToast({ wx.showToast({
title:'通过' title:'通过'
}) })
const base64 = wx.arrayBufferToBase64(frame.data) this.cameraContext.takePhoto({
quality:'high',
success(res){
console.log(res,'ss');
const base = wx.getFileSystemManager().readFileSync(res.tempImagePath, 'base64')
console.log(base);
wx.request({ wx.request({
url:'https://www.7856.work:4433/api/Bym_classfily_post/', url:'https://www.7856.work:4433/api/Bym_classfily_post/',
method:'POST', method:'POST',
data:{ data:{
device_id:'50', device_id:'50',
base:base64 base:base
}, },
success(res){ success(res){
console.log(res); console.log(res);
...@@ -46,6 +51,8 @@ Page({ ...@@ -46,6 +51,8 @@ Page({
console.log(e); console.log(e);
} }
}) })
}
})
} else { } else {
flag = true flag = true
} }
......
<!--pages/beiyinmei/beiyinmei.wxml--> <!--pages/beiyinmei/beiyinmei.wxml-->
<view style="height: 100vh;width: 100vw;position: relative;z-index: 99;"> <view style="height: 100vh;width: 100vw;position: relative;z-index: 99;">
<camera device-position="back" frame-size="small" flash="off" binderror="error" style="width: 100%; height: 100%;" mode="normal"> <camera device-position="back" frame-size="large" flash="off" binderror="error" style="width: 100%; height: 100%;" mode="normal">
<view class="prompt"> <view class="prompt">
<image src="/assets/imgs/拍照框.png" style="width: 60%;" mode="widthFix" /> <image src="/assets/imgs/拍照框.png" style="width: 40%;" mode="widthFix" />
<text>请把二维码放置拍照框内</text> <text>请把二维码放置拍照框内</text>
</view> </view>
</camera> </camera>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论