uniapp生物识别示例(人脸识别、指纹识别)

news/2024/9/29 13:30:09/

准备工作:

mainfest.json设置勾选:

勾选完成后打 App自定义调试基座测试包

示例代码:

<template><view class="content"><button v-if="supportSoterAuthenticationArray.includes('facial')" @click="SoterAuthenticationFunction('facial')">人脸识别</button><button v-if="supportSoterAuthenticationArray.includes('fingerPrint')" @click="SoterAuthenticationFunction('fingerPrint')">指纹识别</button></view>
</template><script setup>import { onShow } from '@dcloudio/uni-app'import { ref } from 'vue';onShow(()=>{checkIsSupportSoterAuthentication()})const supportSoterAuthenticationArray = ref([])const checkIsSupportSoterAuthentication = () => {uni.checkIsSupportSoterAuthentication({success(res) {supportSoterAuthenticationArray.value = res.supportMode}})}const SoterAuthenticationFunction = (type) => {uni.checkIsSoterEnrolledInDevice({checkAuthMode: type,success(res) {res.isEnrolled && uni.startSoterAuthentication({requestAuthModes: [type],challenge: '123456',authContent: '生物解锁',success(res) {console.log(res,'成功回调','执行相关逻辑');}})}})}
</script><style lang="scss" scoped></style>

效果展示:


http://www.ppmy.cn/news/1531934.html

相关文章

设计模式之享元(Flyweight)模式

前言 面向对象很好地解决了 “抽象” 的问题&#xff0c;但是不可避免的要付出一定的代价。对于通常情况来讲&#xff0c;面向对象的成本大都可以忽略不计。但是某些情况&#xff0c;面向对象所带来的成本必须谨慎处理 具体需要自己根据需求去评估 定义 “对象性能” 模式。运用…

SpringBoot 属性大写无法绑定

一、场景分析 假设有如下一个对象&#xff0c;它的三个属性全部大写。 package com.study.member.entity; import lombok.Data; Data public class Member {private String NAME;private Integer AGE;private String PHONE; } 在使用 SpringMVC 进行接口调用的时候&#xff…

GraphQL规范

GraphQL规范 内置类型内置指令自省 对IDEA插件GraphQL生成的规范的总结。详细规范文档请参阅GraphQL规范 内置类型 ID: 表示唯一标识符&#xff0c;通常用于对象的重取或缓存键。String: 表示文本数据&#xff0c;可读的字符串。Boolean&#xff1a;布尔Float:表示双精度浮点数…

智能BI项目第六期

本期任务 分析系统现在的不足分布式消息队列分布式消息队列 RabbitMQ 入门实战 系统现状不足分析总结 让我们来讨论一下单机系统的问题。 现状&#xff1a;我们的异步处理是通过本地线程池实现的。 但是存在以下问题&#xff1a; 无法集中限制&#xff0c;仅能单机限制&a…

網路本地連接沒有有效的IP配置:原因與解決方法

網路本地連接顯示“沒有有效的IP配置”。這通常意味著你的電腦無法從路由器或其他網路設備獲取有效的IP地址&#xff0c;從而導致無法上網。本文將從原因和解決方法兩個方面&#xff0c;詳細解析這個問題。 一、問題的原因 路由器或數據機問題&#xff1a; 路由器或數據機出…

H5 随机身份证号码、社会统一信用代码、手机号、名字、银行卡号码

平时注册可能会用到这些&#xff0c;原本用自己服务器搭了个&#xff0c;感觉纯前端的还能引入到项目中挺好的&#xff0c;之后再追加一些常用的随机数据&#xff0c;这样写表单应该就会好测试了(●’◡’●)。 在线链接 https://linyisonger.github.io/H5.Examples/?name./07…

【RabbitMQ】RabbitMQ 的概念以及使用RabbitMQ编写生产者消费者代码

目录 1. RabbitMQ 核心概念 1.1生产者和消费者 1.2 Connection和Channel 1.3 Virtual host 1.4 Queue 1.5 Exchange 1.6 RabbitMO工作流程 2. AMQP 3.RabbitMO快速入门 3.1.引入依赖 3.2.编写生产者代码 ​3.3.编写消费者代码 4.源码 1. RabbitMQ 核心概念 在安装…

python的pyinstaller

1、pyinstaller --onefile -w *.py 可以生成可执行文件 -w就是不需要有console窗体出现、 2、 console窗体会出现一些警告。 比如 Warning: QT_DEVICE_PIXEL_RATIO is deprecated. Instead use: QT_AUTO_SCREEN_SCALE_FACTOR to enable platform plugin controlled per-scre…