提交 8eba9724 authored 作者: 羊富学's avatar 羊富学

贝因美拍照框和请求500跳转到失败页

上级 65328492
// pages/beiyinmei/beiyinmei.js
import qrcode, { height } from '../../utils/llqrcodefrankyin.js'
import qrcode, {
height
} from '../../utils/llqrcodefrankyin.js'
// const base64js = require('base64-arraybuffer');
......@@ -134,8 +136,7 @@ Page({
console.log('5555')
const photo2 = await that.handleTakePoto(
wx.createCameraContext(),
4,
{
4, {
flash: 'on'
}
)
......@@ -157,18 +158,28 @@ Page({
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'
try {
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
})
} catch (error) {
that.setData({
showPage: 'error'
})
}
}).catch(() => {
that.setData({
showPage: pageType
showPage: 'error'
})
})
}
......@@ -295,6 +306,10 @@ Page({
that.setData({
showPage: pageType
})
}).catch(() => {
that.setData({
showPage: 'error'
})
})
} else {
setTimeout(() => {
......@@ -404,4 +419,4 @@ Page({
* 用户点击右上角分享
*/
onShareAppMessage() {}
})
})
\ No newline at end of file
<!--pages/beiyinmei/beiyinmei.wxml-->
<view wx:if="{{!showPage}}" style="height: 100vh;width: 100vw;position: relative;z-index: 99;">
<view wx:if="{{howPage !== 'success' && showPage !== 'error'}}" style="height: 100vh;width: 100vw;position: relative;z-index: 99;">
<!-- <image src="{{src}}" mode="widthFix" style="position: absolute;top: 0px;left: 0px;z-index: 9999;"/> -->
<camera style="height: 100%;width: 100%;" flash="on" devic-position="back" frame-size="large" resolution="high">
</camera>
<view class="prompt" style="position: absolute;top: 50%;left: 50%;transform: translate(-50%,-50%);z-index: 999999;">
<image src="/assets/imgs/拍照框.png" style="position: relative;z-index: 99999999;" style="width: 25%;" mode="widthFix" />
<!-- <image src="/assets/imgs/拍照框.png" style="position: relative;z-index: 99999999;" style="width: 25%;" mode="widthFix" /> -->
<view class="takephoto-focus">
<view class="top"></view>
<view class="top2"></view>
</view>
<text>请把二维码放置拍照框内</text>
</view>
</view>
......
......@@ -15,6 +15,56 @@
color: #fff;
}
.prompt .takephoto-focus {
position:relative;
height: 200rpx;
width: 200rpx;
/* border: 2px solid #fff; */
}
.prompt .takephoto-focus .top,.top2 {
position: absolute;
top: -2px;
left: -2px;
width: 20rpx;
height: 20rpx;
border: 2px solid #fff;
border-bottom: transparent;
border-right: transparent;
}
.prompt .takephoto-focus .top2 {
left: auto;
right: -2px;
border-left: 0;
border-right: 2px solid #fff;
}
.prompt .takephoto-focus::before {
position: absolute;
bottom: -2px;
left: -2px;
content: '';
width: 20rpx;
height: 20rpx;
border: 2px solid #fff;
border-top: transparent;
border-right: transparent;
}
.prompt .takephoto-focus::after {
position: absolute;
bottom: -2px;
right: -2px;
content: '';
width: 20rpx;
height: 20rpx;
border: 2px solid #fff;
border-top: transparent;
border-left: transparent;
}
.prompt text {
margin-top: 50px;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论