赞
踩
先看效果图
mpvue小程序与数据宝对接实现人脸识别/视频录制/身份验证/CryptoJS 加密 等功能关键代码 index.vue
<template> <div class="page-body"> <!-- 人脸识别引导提示内容 图一 --> <cover-view v-if="showFaceTip" class="showFaceClass"> <cover-image :src="imgUrl.faceTip" style="width:100%;height:1100rpx;" /> <button class="startButton" @click="runRecord" style="width:500rpx;">开始录制</button> </cover-view> <!-- 录制视频代码 图二 --> <div v-else class="showCameraBox"> <cover-view class="longTip" v-show="longTip">'长按'底部按钮录制一段3~5S视频</cover-view> <div class="cameraBox"> <camera @error="error" v-show="!imgsrc" device-position="front" flash="on" style="width: 100%;height:100%;" ></camera> <img v-show="imgsrc" mode="widthFix" :src="imgsrc" style="width:100%;height:100%;" /> </div> <div class="btnRecord"> <canvas canvas-id="firstCanvas" class="canvas"></canvas> <button v-if="cameraBtn" style="cursor:pointer;" class="wrap" id="wrap" :style="style" @touchstart="takePhoto" @touchend="handleTouchEnd" @longpress="handleLongPress" > <div class="inner" :style="style2"></div> </button> <button v-else style="cursor:pointer;" class="wrap" id="wrap" @tap="takePhoto"> <div class="inner" :style="style2"></div> </button> </div> </div> <!-- 弹框提示 --> <mp-loading :showLoading="isShowLoading" loadingText="加载中..." :mask="isShowMask"></mp-loading> </div> </template> <style scoped> .longTip { position: fixed; z-index: 99999999; top: 60rpx; color: rgba(212, 141, 52, 1); } .showFaceClass { position: fixed; top: 0; bottom: 0; right: 0; left: 0; background: #000000; display: flex; align-items: center; flex-direction: column; z-index: 99999999; } .showCameraBox { position: absolute; top: 0; bottom: 0; right: 0; left: 0; background: #000000; z-index: -1; display: flex; align-it
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。