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

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

上级 65328492
// pages/beiyinmei/beiyinmei.js // pages/beiyinmei/beiyinmei.js
import qrcode, { height } from '../../utils/llqrcodefrankyin.js' import qrcode, {
height
} from '../../utils/llqrcodefrankyin.js'
// const base64js = require('base64-arraybuffer'); // const base64js = require('base64-arraybuffer');
...@@ -134,8 +136,7 @@ Page({ ...@@ -134,8 +136,7 @@ Page({
console.log('5555') console.log('5555')
const photo2 = await that.handleTakePoto( const photo2 = await that.handleTakePoto(
wx.createCameraContext(), wx.createCameraContext(),
4, 4, {
{
flash: 'on' flash: 'on'
} }
) )
...@@ -157,18 +158,28 @@ Page({ ...@@ -157,18 +158,28 @@ Page({
that.handleApiCheck(base64_1, 'small'), that.handleApiCheck(base64_1, 'small'),
that.handleApiCheck(base64_2, 'big') that.handleApiCheck(base64_2, 'big')
]).then((value) => { ]).then((value) => {
let pageType = 'error' try {
const result1 = value[0], let pageType = 'error'
result2 = value[1] const result1 = value[0],
// data.result == 2 为真 result2 = value[1]
if ( // data.result == 2 为真
result1.data.result == 2 && if (
result2.data.result == 2 result1.data.result == 2 &&
) { result2.data.result == 2
pageType = 'success' ) {
pageType = 'success'
}
that.setData({
showPage: pageType
})
} catch (error) {
that.setData({
showPage: 'error'
})
} }
}).catch(() => {
that.setData({ that.setData({
showPage: pageType showPage: 'error'
}) })
}) })
} }
...@@ -295,6 +306,10 @@ Page({ ...@@ -295,6 +306,10 @@ Page({
that.setData({ that.setData({
showPage: pageType showPage: pageType
}) })
}).catch(() => {
that.setData({
showPage: 'error'
})
}) })
} else { } else {
setTimeout(() => { setTimeout(() => {
...@@ -404,4 +419,4 @@ Page({ ...@@ -404,4 +419,4 @@ Page({
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
onShareAppMessage() {} onShareAppMessage() {}
}) })
\ No newline at end of file
<!--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="{{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;"/> --> <!-- <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 style="height: 100%;width: 100%;" flash="on" devic-position="back" frame-size="large" resolution="high">
</camera> </camera>
<view class="prompt" style="position: absolute;top: 50%;left: 50%;transform: translate(-50%,-50%);z-index: 999999;"> <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> <text>请把二维码放置拍照框内</text>
</view> </view>
</view> </view>
......
...@@ -15,6 +15,56 @@ ...@@ -15,6 +15,56 @@
color: #fff; 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 { .prompt text {
margin-top: 50px; margin-top: 50px;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论