|
|
@ -67,24 +67,46 @@
|
|
|
|
<el-button
|
|
|
|
<el-button
|
|
|
|
:loading="loading"
|
|
|
|
:loading="loading"
|
|
|
|
type="primary"
|
|
|
|
type="primary"
|
|
|
|
style="width:100%;margin-bottom:30px;"
|
|
|
|
style="width:100%;margin-bottom:20px;padding: 1rem"
|
|
|
|
@click.native.prevent="handleLogin"
|
|
|
|
@click.native.prevent="handleLogin"
|
|
|
|
>登录
|
|
|
|
>登录
|
|
|
|
</el-button>
|
|
|
|
</el-button>
|
|
|
|
|
|
|
|
|
|
|
|
</el-form>
|
|
|
|
</el-form>
|
|
|
|
|
|
|
|
<el-button style="width:100%;margin-bottom:20px;" @click="handleOpen">
|
|
|
|
|
|
|
|
<svg-icon class="svg-icon-data" icon-class="face" />
|
|
|
|
|
|
|
|
人脸识别登录
|
|
|
|
|
|
|
|
</el-button>
|
|
|
|
<div class="forget-pwd"><a>忘记密码?</a></div>
|
|
|
|
<div class="forget-pwd"><a>忘记密码?</a></div>
|
|
|
|
</el-card>
|
|
|
|
</el-card>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="statement">COPYRIGHT © 2022 杭州研一智控科技有限公司 版权所有</div>
|
|
|
|
<div class="statement">COPYRIGHT © 2022 杭州研一智控科技有限公司 版权所有</div>
|
|
|
|
|
|
|
|
<!-- 人脸识别 -->
|
|
|
|
|
|
|
|
<el-dialog
|
|
|
|
|
|
|
|
title="提示"
|
|
|
|
|
|
|
|
:visible.sync="dialogVisible"
|
|
|
|
|
|
|
|
width="30%"
|
|
|
|
|
|
|
|
:show-close="false"
|
|
|
|
|
|
|
|
:close-on-click-modal="false"
|
|
|
|
|
|
|
|
@close="handleClose"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<div class="dia-title">人脸识别登录</div>
|
|
|
|
|
|
|
|
<div class="dia-img"><img :src="play" alt=""></div>
|
|
|
|
|
|
|
|
<div class="dia-desc">人脸识别登录</div>
|
|
|
|
|
|
|
|
<div class="dia-act">正在识别</div>
|
|
|
|
|
|
|
|
<div class="dia-info">请保持您的正脸在取景框内...</div>
|
|
|
|
|
|
|
|
<div class="dia-back">
|
|
|
|
|
|
|
|
<el-button @click="handleBack">返回</el-button>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</el-dialog>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
<script>
|
|
|
|
// import { validUsername } from '@/utils/validate'
|
|
|
|
// import { validUsername } from '@/utils/validate'
|
|
|
|
import stringify from '@/utils/stringify'
|
|
|
|
import stringify from '@/utils/stringify'
|
|
|
|
import { login } from '@/api/user/user'
|
|
|
|
import { faceRecognition, faceStart, faceStop, login } from '@/api/user/user'
|
|
|
|
import { client_list } from '@/api/common'
|
|
|
|
import { client_list } from '@/api/common'
|
|
|
|
|
|
|
|
import { throttle, web_stream as webStream } from '@/utils'
|
|
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
export default {
|
|
|
|
name: 'Login',
|
|
|
|
name: 'Login',
|
|
|
@ -104,6 +126,7 @@ export default {
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
|
|
|
|
dialogVisible: false,
|
|
|
|
backgrounddiv: {
|
|
|
|
backgrounddiv: {
|
|
|
|
'background-image': 'url(' + require('@/assets/login/login.png') + ')'
|
|
|
|
'background-image': 'url(' + require('@/assets/login/login.png') + ')'
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -117,7 +140,11 @@ export default {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
loading: false,
|
|
|
|
loading: false,
|
|
|
|
passwordType: 'password',
|
|
|
|
passwordType: 'password',
|
|
|
|
redirect: undefined
|
|
|
|
redirect: undefined,
|
|
|
|
|
|
|
|
web_stream: null,
|
|
|
|
|
|
|
|
img_list: [],
|
|
|
|
|
|
|
|
play: null,
|
|
|
|
|
|
|
|
rflag: false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
watch: {
|
|
|
@ -129,6 +156,50 @@ export default {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
methods: {
|
|
|
|
|
|
|
|
handleClose: throttle(function() {
|
|
|
|
|
|
|
|
faceStop().then(
|
|
|
|
|
|
|
|
res => {
|
|
|
|
|
|
|
|
console.log(res)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
this.web_stream.destroy()
|
|
|
|
|
|
|
|
this.play = null
|
|
|
|
|
|
|
|
this.rflag = false
|
|
|
|
|
|
|
|
}, 1000),
|
|
|
|
|
|
|
|
handleOpen() {
|
|
|
|
|
|
|
|
this.$forceUpdate()
|
|
|
|
|
|
|
|
faceStart().then(res => {
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
|
|
this.play = process.env.VUE_APP_FACE_API + '/face/play/'
|
|
|
|
|
|
|
|
this.web_stream = webStream.get(process.env.VUE_APP_FACE_API + '/face/play/', (data) => {
|
|
|
|
|
|
|
|
if (data.length > 41) {
|
|
|
|
|
|
|
|
const buffer = Buffer.allocUnsafe(data.byteLength - 41)
|
|
|
|
|
|
|
|
data.copy(buffer, 0, 37)
|
|
|
|
|
|
|
|
this.img_src = buffer.toString('base64')
|
|
|
|
|
|
|
|
const count = Math.floor(Math.random() * 10 + 1)
|
|
|
|
|
|
|
|
// 随机抽样
|
|
|
|
|
|
|
|
if (count < 2) {
|
|
|
|
|
|
|
|
this.img_list.push('data:image/png;base64,' + this.img_src)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.img_list.length > 10 && this.rflag) {
|
|
|
|
|
|
|
|
const data = {
|
|
|
|
|
|
|
|
'images': this.img_list
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
faceRecognition(data).then((res) => {
|
|
|
|
|
|
|
|
this.rflag = false
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
this.img_list = []
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
this.rflag = true
|
|
|
|
|
|
|
|
this.dialogVisible = true
|
|
|
|
|
|
|
|
}, 200)
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
handleBack() {
|
|
|
|
|
|
|
|
this.dialogVisible = false
|
|
|
|
|
|
|
|
},
|
|
|
|
showPwd() {
|
|
|
|
showPwd() {
|
|
|
|
if (this.passwordType === 'password') {
|
|
|
|
if (this.passwordType === 'password') {
|
|
|
|
this.passwordType = ''
|
|
|
|
this.passwordType = ''
|
|
|
@ -193,7 +264,7 @@ export default {
|
|
|
|
.login-form-container {
|
|
|
|
.login-form-container {
|
|
|
|
color: #C0C4CC;
|
|
|
|
color: #C0C4CC;
|
|
|
|
width: 27.5rem;
|
|
|
|
width: 27.5rem;
|
|
|
|
height: 33.75rem;
|
|
|
|
/*height: 36rem;*/
|
|
|
|
position: absolute;
|
|
|
|
position: absolute;
|
|
|
|
right: 8.0625rem;
|
|
|
|
right: 8.0625rem;
|
|
|
|
top: 50%;
|
|
|
|
top: 50%;
|
|
|
@ -314,8 +385,8 @@ $light_gray: #eee;
|
|
|
|
position: relative;
|
|
|
|
position: relative;
|
|
|
|
width: 27.5rem;
|
|
|
|
width: 27.5rem;
|
|
|
|
max-width: 100%;
|
|
|
|
max-width: 100%;
|
|
|
|
padding-top: 4rem;
|
|
|
|
padding-top: 2rem;
|
|
|
|
padding-left: 1rem;
|
|
|
|
//padding-left: 1rem;
|
|
|
|
overflow: hidden;
|
|
|
|
overflow: hidden;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -361,5 +432,59 @@ $light_gray: #eee;
|
|
|
|
cursor: pointer;
|
|
|
|
cursor: pointer;
|
|
|
|
user-select: none;
|
|
|
|
user-select: none;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.svg-icon-data {
|
|
|
|
|
|
|
|
width: 1.5rem;
|
|
|
|
|
|
|
|
height: 1.5rem;
|
|
|
|
|
|
|
|
vertical-align: -0.3rem;
|
|
|
|
|
|
|
|
fill: currentColor;
|
|
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.dia-title {
|
|
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
|
|
font-size: 2.3125rem;
|
|
|
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
|
|
|
color: #303133;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.dia-img {
|
|
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
|
|
margin-top: 2rem;
|
|
|
|
|
|
|
|
margin-bottom: 2rem;
|
|
|
|
|
|
|
|
img {
|
|
|
|
|
|
|
|
height: 23.4375rem;
|
|
|
|
|
|
|
|
width: 23.4375rem;
|
|
|
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
|
|
|
border: 2px solid #707070;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.dia-desc {
|
|
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
|
|
font-size: 2.3125rem;
|
|
|
|
|
|
|
|
font-weight: 400;
|
|
|
|
|
|
|
|
color: #000000;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.dia-act {
|
|
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
|
|
font-size: 1.625rem;
|
|
|
|
|
|
|
|
font-weight: 400;
|
|
|
|
|
|
|
|
color: #409EFF;
|
|
|
|
|
|
|
|
margin-top: 0.5rem;
|
|
|
|
|
|
|
|
margin-bottom: 1rem;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.dia-info {
|
|
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
|
|
font-size: 1.5rem;
|
|
|
|
|
|
|
|
font-weight: 400;
|
|
|
|
|
|
|
|
color: #C0C4CC;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
.dia-back{
|
|
|
|
|
|
|
|
margin-top: 0.5rem;
|
|
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
</style>
|
|
|
|