一、拍照流程

上个小节,我们把签到页面设计出来了,这节课我们要把拍照按钮功能给实现一下。
image.png
我们设计签到页面的时候,在 <camera> 标签下面放置了 <image> 标签,用户拍完照之后, <camera> 标签隐藏起来,然后 <image> 标签显示拍照的图片,如果用户对照片满意,就可以点 击签到按钮提交照片执行签到。

  1. <template>
  2. <view>
  3. <camera device-position="front" flash="off" class="camera" @error="error" v-if="showCamera"></camera>
  4. <image mode="widthFix" class="image" :src="photoPath" v-if="showImage"></image>
  5. <view class="operate-container">
  6. <button type="primary" class="btn" @tap="clickBtn" :disabled="canCheckin">{{btnText}}</button>
  7. <button type="warn" class="btn" @tap="afresh" :disabled="canCheckin">重拍</button>
  8. </view>
  9. <view class="notice-container">
  10. <text class="notice">注意事项</text>
  11. <text class="desc">拍照签到的时候,必须要拍摄自己的正面照片,侧面照片会导致无法识别。另外,拍照的时候不要戴墨镜或者帽子,避免影响拍照签到的准确度。</text>
  12. </view>
  13. </view>
  14. </template>

二、跳转到签到页面

前端控制。