1、在登录界面中新加人脸登录按钮
<el-button type="primary" style="width: 150px" @click="faceLogin" >人脸登录</el-button>
http://localhost:8080/#/faceLogin
faceLogin(){
this.$router.push('/faceLogin');
},
{
path: '/facelogin',
name: 'facelogin',
component: facelogin,
hidden:true
}
效果是
落地页随机拍摄的面部头像
2.按钮跳转到落地页随机拍摄的面部头像界面
<template>
<div class="login-container">
<div class="login-form" v-show="canvasShow">
<p class="titleInfo">请把正脸对准摄像头</p>
<div class="regInfo">
<!-- <div class="tip">没有检测到脸</div> -->
<div class="canvas">
<!--描绘video截图-->
<canvas ref="cav" id="canvas" width="200" height="200"></canvas>
<!--video用于显示媒体设备的视频流,自动播放-->
<video ref="vd" id="video" autoplay playsinline style="width: 200px;height: 200px"></video>
</div>
</div>
<p style="text-align:center;padding:50px 0 0"><el-button id="capture" ref="capture" @click='handleClick'>拍 照</el-button> </p>
<!-- <img :src='imgUrl' width="100" height="100"> -->
</div>
<div v-show="tipShow" class="tipShow">
<el-alert