<template><view><view class="uni-list"><view v-show="isFingerPrint" class="uni-list-cell uni-list-cell-pd"><view class="uni-list-cell-db">指纹登录工资条</view><switch :checked="fingerPrintChecked" @change="switchChange($event,1)" /></view><view v-show="isFacial" class="uni-list-cell uni-list-cell-pd"><view class="uni-list-cell-db">面容登录工资条</view><switch :checked="facialChecked" @change="switchChange($event,2)"/></view></view></view>
</template>
<script>export default {data() {return {isFingerPrint:false,isFacial:false,fingerPrintChecked:false,facialChecked:false,wageSafeInfo:[]}},onLoad(){let that = thisthat.getWageSafeInfo()},methods: {switchChange: function (e,type) {let that = thislet value = e.target.valuelet isChangeFingerPrintChecked = type == 1let supportMode = isChangeFingerPrintChecked ? 'fingerPrint' : 'facial'isChangeFingerPrintChecked ? that.fingerPrintChecked = value : that.facialChecked = valueif (!value && !that.fingerPrintChecked && !that.facialChecked) {that.setWageSafe(0)}let checked = isChangeFingerPrintChecked ? that.facialChecked : that.fingerPrintCheckedif (checked && value) {uni.showToast({title: '需取消'+(isChangeFingerPrintChecked ? '面容' : '指纹')+'登录',icon: 'error',duration: 1000,success() {isChangeFingerPrintChecked ? that.fingerPrintChecked = false : that.facialChecked  = false}});} else if(value) {uni.showModal({title: '提示',content: '确定使用'+(isChangeFingerPrintChecked ? '指纹' : '面容')+'登录工资条?',success: function (res) {if (res.confirm) {// 获取设备内是否录入如指纹等生物信息uni.checkIsSoterEnrolledInDevice({checkAuthMode: supportMode,success(res2) {if(res2.isEnrolled){// 开始 SOTER 生物认证uni.startSoterAuthentication({requestAuthModes: [supportMode],challenge: new Date().getTime().toString(),success() {that.setWageSafe(type)},fail() {uni.showToast({title: '设置失败!',icon: 'error',duration: 1000,success() {isChangeFingerPrintChecked ? that.fingerPrintChecked = false : that.facialChecked  = false}});}})} else {uni.showToast({title: '请先录入'+(isChangeFingerPrintChecked ? '指纹' : '面容'),icon: 'error',duration: 1000,success() {isChangeFingerPrintChecked ? that.fingerPrintChecked = false : that.facialChecked  = false}});}},fail() {uni.showToast({title: '设置失败!',icon: 'error',duration: 1000,success() {isChangeFingerPrintChecked ? that.fingerPrintChecked = false : that.facialChecked  = false}});}})} else if (res.cancel) {isChangeFingerPrintChecked ? that.fingerPrintChecked = false : that.facialChecked  = false}}})}},setWageSafe(unlockMode){let that = thislet postJson = {functionCode:'gztOne',unlockMode: unlockMode}that.$http.put('/functionSafe/changeUnlockMode', {}, {params: postJson,}).then(res => {uni.hideLoading()if (res.code === that.$globalConfig.successCode) {//接口返回值// "code": 0,// "message": "设置成功!",// "data": nullif (unlockMode != 0) {// 修改成功uni.showToast({title: '设置成功!',icon: 'success',duration: 1000})}} else {unlockMode == 1 ? that.fingerPrintChecked = false : that.facialChecked = false}}).catch(err=>{unlockMode == 1 ? that.fingerPrintChecked = false : that.facialChecked = false})},checkIsSupportSoterAuthentication(unlockMode){let that = this// 检查设备支持的生物识别类型uni.checkIsSupportSoterAuthentication({success(res) {let supportMode = res.supportModeif (supportMode.length == 0) {uni.showModal({title: '提示',content: '设备不支持!',showCancel:false,success: function (res) {if (res.confirm) {uni.navigateBack({})}}})} else {for (let item of supportMode) {if (item == 'fingerPrint') {that.isFingerPrint = trueif (unlockMode == 1) {that.fingerPrintChecked = true}} else if(item == 'facial') {that.isFacial = trueif(unlockMode == 2) {that.facialChecked = true}}}}}})},getWageSafeInfo(){let that = this;that.$http.get('/functionSafe/getOneByFunctionCode', {params: {functionCode:'gztOne'},header: {launchUrl: '/' +  [...getCurrentPages()].reverse()[0].route}}).then(res=>{uni.hideLoading()if(res.code == that.$globalConfig.successCode){//接口返回值// "id": "2c9180847a7a865c017a84f967d90010",//     "userId": "2c9180847337e654017369d77c8e055c",//     "functionCode": "gztOne",//     "password": "9834cb3f3d889d6c",//     "unlockMode": 0if (res.data !== null) {that.wageSafeInfo = res.datalet unlockMode = that.wageSafeInfo.unlockModethat.checkIsSupportSoterAuthentication(unlockMode)} else {// uni.showModal({//     title: '提示',//     content: '请先设置文字密码!',//    showCancel: false,//     success: function (res) {//         if (res.confirm) {//             uni.redirectTo({//                url: '/pages/work/wage/wage-login'//             })//         }//     }// });}}}).catch(err=>{uni.hideLoading()})}}}
</script><style>page {height: 100%;background-color: #F1F5F8;}
</style>

uni-生物识别模块代码(指纹,面容)相关推荐

  1. 【HaaS Python硬件积木】AS608指纹识别模块 打造指纹门禁 开门有手就行

    一.产品简介 ATK-AS608指纹识别模块是ALIENTEK推出的一款高性能的光学指纹识别模块.它采用的是指纹识别芯片公司杭州晟元芯片技术有限公司生产的AS608指纹识别芯片.该芯片内置DSP运算单 ...

  2. vnr光学识别怎么打开_干货|指纹锁的指纹识别模块的前世今生,智能锁的指纹识别到底有多智能?...

    智能锁现在也有很多叫法:指纹锁.电子锁.可见指纹识别是智能锁的核心功能了,那我们今天来聊聊智能锁的指纹识别模块. 指纹识别的历史 指纹识别认证的流程 指纹识别技术的种类 指纹识别的历史 早在2000多 ...

  3. 人脸识别与膜虹识别_指纹,人脸,虹膜三种生物识别优缺点比较

    就生物识别本身来说,也可以分为指纹识别.人脸识别.虹膜识别.掌/指纹静脉识别等.各种识别方式因各自特性适用于不同的领域.下面将其中应用最广泛的三种识别进行比较介绍. 指纹识别:便捷易操作,但存在被复制 ...

  4. 目前全球生物识别市场规模迅速扩张,虹膜识别技术也发展迅猛

    生物识别技术 生物识别技术,就是利里人体生物特征进行身份认证的一种技术,通过计算机与光学,声学,生物传感器和生物统计学原理等高科技手段的密切结合,将人体固有的生理特征(虹膜.人脸.指纹等)或行为特征( ...

  5. 多模态生物识别有什么优势

    什么是多模态生物识别呢?多模态生物识别就是多种生物识别技术相互融合,满足不同场景和安全级别需要.如:指纹识别最稳定,但是对于一些从事体力劳动的人手比较脏不好识别;人脸识别最友好,但是识别效率低;虹膜识 ...

  6. 一文分析多模态生物识别的优势,快码起来吧!

    在当今信息化时代,如何准确鉴定一个人的身份.保护信息安全,已成为引起社会各界人士普遍关注的热点话题.传统的身份认证由于容易伪造和丢失,越来越难以满足实际需求,目前较为便捷与安全的解决方案无疑就是生物识 ...

  7. 一文了解生物识别技术

    生物识别技术,是通过各类生物传感器和采集技术,获取人体生物特征,再结合深度学习等人工智能技术进行计算和建立模型,进行个人身份鉴定的技术. 其中生物特征分为两类:生理特征和行为特征.生理特征包括指纹,人 ...

  8. 生物识别:怎样才能把想象力转化成商机

    新模式.新市场.新技术尚待时间检验 生物识别,一种既熟悉又神秘的高科技.人们常常在电影中看到关于生物识别一系列眼花缭乱的应用:例如用虹膜识别进入金库.用指纹识别进入实验室,或是用语音识别向家中的机器人 ...

  9. NEC为印度Aadhaar项目提供的生物识别系统注册人数突破10亿

    由NEC提供生物识别系统.印度国民ID管理局(简称UIDAI)主导进行并可为每位国民签发独有身份ID的Aadhaar项目,截至2016年4月其注册人数已经突破10亿.NEC通过提供集指纹 面部 虹膜等 ...

最新文章

  1. Logstash(二)input、codec插件详解
  2. 一周内咸鱼疯转 2.4W 次,最终被所有大厂封杀!
  3. 《C++ primer》--第1,2章小结
  4. Arduino(新手之路2)
  5. 为取消大小周而欢呼?字节员工可不那么想...
  6. 深度学习(十三)caffe之训练数据格式
  7. Android PC投屏简单尝试—最终章1
  8. wxWidgets:wxIdleEvent类用法
  9. Tiff – 值得你体验一下的可视化的字体对比工具
  10. 转:Deep learning系列(十五)有监督和无监督训练
  11. 分布式一致性算法-paxos详解与分析
  12. linux机顶盒 安卓机顶盒 优劣势分析,网络机顶盒怎么样 网络机顶盒优缺点介绍【详解】...
  13. C++中this与*this的区别
  14. 【git学习】解决git提交代码时报错: Unable to create ‘XXX/.git/index.lock‘: File exists.
  15. FineReport学习-练习05-超级链接
  16. 机器学习中的数学——距离定义(二十四):F-散度(F-Divergence)
  17. 使用wxpy实现在微信定时发送文件和消息
  18. 基于白鲸优化算法的函数寻优算法
  19. ktt算法 约化_矩阵特征与特征向量的计算
  20. 智慧医疗是什么?智慧医院包括哪些方面?

热门文章

  1. geoserver图层展示
  2. 【表严肃】一个比较不错的前端教程合集网站
  3. vue把字符串分割成等长的若干字符串,根据特定字符分割字符串
  4. linux shell ifeq,Makefile 中 ifeq ifneq 等用法
  5. 翻拍老照片的实用方法
  6. mysql驱动源码解析_mysql驱动源码分析
  7. Android Studio 2022.1.1 版本安装遇到问题记录
  8. Vue.js绑定class属性
  9. 华能笔试题计算机考试大纲,华能某电厂值长面试题来了,能通过笔试的来测评一下!...
  10. redis的缓存穿透如何解决!