设为首页 加入收藏

TOP

微信小程序 人脸识别登陆模块(三)
2019-08-30 00:37:18 】 浏览:93
Tags:程序 人脸 识别 登陆 模块
38 client_id: '**************************', 39 client_secret: '*******************************'//用自己的 40 }, 41 header: { 42 'Content-Type': 'application/json' // 默认值 43 }, 44 success(res) { 45 that.setData({ 46 token: res.data.access_token//获取到token 47 }) 48 } 49 }) 50 51 //上传人脸进行 比对 52 wx.request({ 53 url: 'https://aip.baidubce.com/rest/2.0/face/v3/search?access_token=' + that.data.token, 54 method: 'POST', 55 data: { 56 image: this.data.base64, 57 image_type: 'BASE64', 58 group_id_list: '********'//自己建的用户组id 59 }, 60 header: { 61 'Content-Type': 'application/json' // 默认值 62 }, 63 success(res) { 64 that.setData({ 65 msg: res.data.result.user_list[0].score 66 }) 67 if(that.data.msg > 80){ 68 wx.showToast({ 69 title: '验证通过', 70 icon: 'success', 71 duration: 1000 72 }) 73 //验证通过,跳转至UI页面 74 wx.switchTab({ 75 url: '../UI/ui', 76 }) 77 } 78 } 79 }); 80 81 wx.showToast({ 82 title: '请重试', 83 icon: 'loading', 84 duration: 500 85 }) 86 }, 87 error(e) { 88 console.log(e.detail) 89 } 90 })

 至此,我们的登陆也搞定了。


注意:上述的 登陆注册 是一个小程序的一个模块。关系如下

所以,需要在index页面中设置按钮,来跳转到注册以及登陆页面,然后注册登陆成功后,再跳转至其他功能页面。

后记

这次小程序实战,对我自己也是一个不小的挑战,对比各个云接口、看接口文档、查资料,耗费了大概十来天。但我相信大有裨益。另外,对我参考的博客和回答的诸位表示感谢。我们一起前进!

参考资料

【1】微信小程序开发文档

【2】百度云接口文档.v3版

首页 上一页 1 2 3 下一页 尾页 3/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇从零学习Fluter(八):Flutter的四.. 下一篇微信小程序推广技巧、营销方案

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目