You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
149 lines
4.0 KiB
149 lines
4.0 KiB
<template>
|
|
<view class="content">
|
|
<u-modal v-model="show" :show-title="false" :show-confirm-button="false" :show-cancel-button="true"
|
|
:content-style="{ 'justify-content': 'center','align-items': 'center',height:'300rpx',display:'flex'}"
|
|
@cancel="printCancel">
|
|
<u-icon name="fingerprint" color="red" size="150rpx"></u-icon>
|
|
</u-modal>
|
|
<image class="logo" src="/static/logo.png"></image>
|
|
<view style="color:red;">{{ result }}</view>
|
|
<button @tap="fingerprint()">开启指纹验证</button>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data() {
|
|
return {
|
|
result: '',
|
|
disabled:true,
|
|
show:false,
|
|
}
|
|
},
|
|
onLoad() {
|
|
|
|
},
|
|
methods: {
|
|
printCancel:function(){
|
|
plus.fingerprint.cancel();
|
|
this.result="停止指纹识别"
|
|
},
|
|
fingerprint: function() {
|
|
// // #ifdef APP-PLUS
|
|
// if (!plus.fingerprint.isSupport()) {
|
|
// uni.showToast({
|
|
// title: 'This device does not support fingerprint identification',
|
|
// icon: 'none',
|
|
// duration: 1500
|
|
// })
|
|
// // this.disabled = true;
|
|
// } else if (!plus.fingerprint.isKeyguardSecure()) {
|
|
// uni.showToast({
|
|
// title: 'This device does not support fingerprint identification',
|
|
// icon: 'none',
|
|
// duration: 1500
|
|
// })
|
|
|
|
// } else if (!plus.fingerprint.isEnrolledFingerprints()) {
|
|
// uni.showToast({
|
|
// title: 'There is no fingerprint entered in this device. Please turn it on in the setting',
|
|
// icon: 'none',
|
|
// duration: 1500
|
|
// })
|
|
// // this.disabled = true;
|
|
// } else {
|
|
// // this.result = '此设备支持指纹识别';
|
|
// // // this.disabled = false;
|
|
// // #ifdef MP-WEIXIN
|
|
// this.disabled = false;
|
|
// this.result = '请在微信真机中使用,模拟器不支持';
|
|
// // #endif
|
|
// // #ifndef APP-PLUS || MP-WEIXIN
|
|
// this.result = '此平台不支持指纹识别';
|
|
// // #endif
|
|
|
|
|
|
// let that=this;
|
|
// // #ifdef APP-PLUS
|
|
// plus.fingerprint.authenticate(function() {
|
|
// plus.nativeUI.closeWaiting(); //兼容Android平台关闭等待框
|
|
// that.show=false;
|
|
// that.result='指纹识别成功'
|
|
// //plus.nativeUI.alert('指纹识别成功');
|
|
// }, function(e) {
|
|
// switch (e.code) {
|
|
// case e.AUTHENTICATE_MISMATCH:
|
|
// plus.nativeUI.toast('指纹匹配失败,请重新输入');
|
|
// break;
|
|
// case e.AUTHENTICATE_OVERLIMIT:
|
|
// plus.nativeUI.closeWaiting(); //兼容Android平台关闭等待框
|
|
// plus.nativeUI.alert('指纹识别失败次数超出限制,请使用其它方式进行认证');
|
|
// break;
|
|
// case e.CANCEL:
|
|
// plus.nativeUI.toast('已取消识别');
|
|
// break;
|
|
// default:
|
|
// plus.nativeUI.closeWaiting(); //兼容Android平台关闭等待框
|
|
// plus.nativeUI.alert('指纹识别失败,请重试');
|
|
// break;
|
|
// }
|
|
// });
|
|
// // Android平台手动弹出等待提示框
|
|
// if ('Android' == plus.os.name) {
|
|
// this.show=true;
|
|
// /* plus.nativeUI.showWaiting('指纹识别中...').onclose = function() {
|
|
// plus.fingerprint.cancel();
|
|
// } */
|
|
// }
|
|
// // #endif
|
|
|
|
// // #ifdef MP-WEIXIN
|
|
// wx.startSoterAuthentication({
|
|
// requestAuthModes: ['fingerPrint'],
|
|
// challenge: '123456',
|
|
// authContent: '请用指纹解锁',
|
|
// success(res) {
|
|
// uni.showToast({
|
|
// title: '识别成功',
|
|
// mask: false,
|
|
// duration: 1500
|
|
// });
|
|
// }
|
|
// })
|
|
// // #endif
|
|
// }
|
|
// // #endif
|
|
|
|
this.$walletUtil.fingerprint()
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
.content {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
|
|
.logo {
|
|
height: 200rpx;
|
|
width: 200rpx;
|
|
margin-top: 200rpx;
|
|
margin-left: auto;
|
|
margin-right: auto;
|
|
margin-bottom: 50rpx;
|
|
}
|
|
|
|
.text-area {
|
|
display: flex;
|
|
justify-content: center;
|
|
}
|
|
|
|
.title {
|
|
font-size: 36rpx;
|
|
color: #8f8f94;
|
|
}
|
|
</style>
|
|
|