Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello_uni-id-pages
提交
94af3af7
H
hello_uni-id-pages
项目概览
DCloud
/
hello_uni-id-pages
通知
1054
Star
31
Fork
43
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
4
列表
看板
标记
里程碑
合并请求
2
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello_uni-id-pages
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
4
Issue
4
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
94af3af7
编写于
2月 10, 2023
作者:
C
chenruilong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(uni-id-co): 实人认证检测身份证号逻辑
上级
e8658d6f
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
168 addition
and
144 deletion
+168
-144
pages.json
pages.json
+152
-128
uni_modules/uni-id-pages/common/check-id-card.js
uni_modules/uni-id-pages/common/check-id-card.js
+2
-2
uni_modules/uni-id-pages/pages/userinfo/realname-verify/realname-verify.vue
...-pages/pages/userinfo/realname-verify/realname-verify.vue
+5
-1
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/common/utils.js
...d-pages/uniCloud/cloudfunctions/uni-id-co/common/utils.js
+6
-9
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/facial-recognition-verify/get-certify-id.js
...-id-co/module/facial-recognition-verify/get-certify-id.js
+3
-4
未找到文件。
pages.json
浏览文件 @
94af3af7
{
"pages"
:
[
//pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{
"path"
:
"pages/index/index"
,
"style"
:
{
"navigationBarTitleText"
:
"uni-app"
}
},
{
"path"
:
"uni_modules/uni-id-pages/pages/userinfo/deactivate/deactivate"
,
"style"
:
{
"navigationBarTitleText"
:
"注销账号"
}
},
{
"path"
:
"uni_modules/uni-id-pages/pages/userinfo/userinfo"
,
"style"
:
{
"navigationBarTitleText"
:
"个人资料"
}
},
{
"path"
:
"uni_modules/uni-id-pages/pages/userinfo/bind-mobile/bind-mobile"
,
"style"
:
{
"navigationBarTitleText"
:
"绑定手机号码"
}
},
//
#ifndef
MP-WEIXIN
{
"path"
:
"uni_modules/uni-id-pages/pages/userinfo/cropImage/cropImage"
,
"style"
:
{
"navigationBarTitleText"
:
""
}
},
//
#endif
{
"path"
:
"uni_modules/uni-id-pages/pages/login/login-withoutpwd"
,
"style"
:
{
"navigationBarTitleText"
:
""
}
},
{
"path"
:
"uni_modules/uni-id-pages/pages/login/login-withpwd"
,
"style"
:
{
"navigationBarTitleText"
:
""
}
},
{
"path"
:
"uni_modules/uni-id-pages/pages/login/login-smscode"
,
"style"
:
{
"navigationBarTitleText"
:
"手机验证码登录"
}
},
{
"path"
:
"uni_modules/uni-id-pages/pages/register/register"
,
"style"
:
{
"navigationBarTitleText"
:
"注册"
}
},
//
#ifndef
MP-WEIXIN
{
"path"
:
"uni_modules/uni-id-pages/pages/register/register-admin"
,
"style"
:
{
"navigationBarTitleText"
:
"注册管理员账号"
,
"enablePullDownRefresh"
:
false
}
},
//
#endif
{
"path"
:
"uni_modules/uni-id-pages/pages/register/register-by-email"
,
"style"
:
{
"navigationBarTitleText"
:
"邮箱验证码注册"
}
},
{
"path"
:
"uni_modules/uni-id-pages/pages/retrieve/retrieve"
,
"style"
:
{
"navigationBarTitleText"
:
"重置密码"
}
},
{
"path"
:
"uni_modules/uni-id-pages/pages/retrieve/retrieve-by-email"
,
"style"
:
{
"navigationBarTitleText"
:
"通过邮箱重置密码"
}
},
{
"path"
:
"uni_modules/uni-id-pages/pages/common/webview/webview"
,
"style"
:
{
"navigationBarTitleText"
:
""
,
"enablePullDownRefresh"
:
false
}
},
{
"path"
:
"uni_modules/uni-id-pages/pages/userinfo/change_pwd/change_pwd"
,
"style"
:
{
"navigationBarTitleText"
:
"修改密码"
,
"enablePullDownRefresh"
:
false
}
},{
"path"
:
"uni_modules/uni-id-pages/pages/userinfo/set-pwd/set-pwd"
,
"style"
:
{
"navigationBarTitleText"
:
"设置密码"
,
"enablePullDownRefresh"
:
false
}
}
],
"globalStyle"
:
{
"navigationBarTextStyle"
:
"black"
,
"navigationBarTitleText"
:
"uni-app"
,
"navigationBarBackgroundColor"
:
"#FFF"
,
"backgroundColor"
:
"#F8F8F8"
/*
#ifdef
H
5
*/
,
"navigationStyle"
:
"custom"
/*
#endif
*/
},
"condition"
:
{
//模式配置,仅开发期间生效
"current"
:
0
,
//当前激活的模式(list
的索引项)
"list"
:
[{
"name"
:
""
,
//模式名称
"path"
:
""
,
//启动页面,必选
"query"
:
""
//启动参数,在页面的onLoad函数里面得到
}]
},
"uniIdRouter"
:
{
"loginPage"
:
"uni_modules/uni-id-pages/pages/login/login-withoutpwd"
,
"needLogin"
:
[
"uni_modules/uni-id-pages/pages/userinfo/userinfo"
],
"resToLogin"
:
true
}
"pages"
:
[
//pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{
"path"
:
"pages/index/index"
,
"style"
:
{
"navigationBarTitleText"
:
"uni-app"
}
},
{
"path"
:
"uni_modules/uni-id-pages/pages/userinfo/deactivate/deactivate"
,
"style"
:
{
"navigationBarTitleText"
:
"注销账号"
}
},
{
"path"
:
"uni_modules/uni-id-pages/pages/userinfo/userinfo"
,
"style"
:
{
"navigationBarTitleText"
:
"个人资料"
}
},
{
"path"
:
"uni_modules/uni-id-pages/pages/userinfo/bind-mobile/bind-mobile"
,
"style"
:
{
"navigationBarTitleText"
:
"绑定手机号码"
}
},
//
#ifndef
MP-WEIXIN
{
"path"
:
"uni_modules/uni-id-pages/pages/userinfo/cropImage/cropImage"
,
"style"
:
{
"navigationBarTitleText"
:
""
}
},
//
#endif
{
"path"
:
"uni_modules/uni-id-pages/pages/login/login-withoutpwd"
,
"style"
:
{
"navigationBarTitleText"
:
""
}
},
{
"path"
:
"uni_modules/uni-id-pages/pages/login/login-withpwd"
,
"style"
:
{
"navigationBarTitleText"
:
""
}
},
{
"path"
:
"uni_modules/uni-id-pages/pages/login/login-smscode"
,
"style"
:
{
"navigationBarTitleText"
:
"手机验证码登录"
}
},
{
"path"
:
"uni_modules/uni-id-pages/pages/register/register"
,
"style"
:
{
"navigationBarTitleText"
:
"注册"
}
},
//
#ifndef
MP-WEIXIN
{
"path"
:
"uni_modules/uni-id-pages/pages/register/register-admin"
,
"style"
:
{
"navigationBarTitleText"
:
"注册管理员账号"
,
"enablePullDownRefresh"
:
false
}
},
//
#endif
{
"path"
:
"uni_modules/uni-id-pages/pages/register/register-by-email"
,
"style"
:
{
"navigationBarTitleText"
:
"邮箱验证码注册"
}
},
{
"path"
:
"uni_modules/uni-id-pages/pages/retrieve/retrieve"
,
"style"
:
{
"navigationBarTitleText"
:
"重置密码"
}
},
{
"path"
:
"uni_modules/uni-id-pages/pages/retrieve/retrieve-by-email"
,
"style"
:
{
"navigationBarTitleText"
:
"通过邮箱重置密码"
}
},
{
"path"
:
"uni_modules/uni-id-pages/pages/common/webview/webview"
,
"style"
:
{
"navigationBarTitleText"
:
""
,
"enablePullDownRefresh"
:
false
}
},
{
"path"
:
"uni_modules/uni-id-pages/pages/userinfo/change_pwd/change_pwd"
,
"style"
:
{
"navigationBarTitleText"
:
"修改密码"
,
"enablePullDownRefresh"
:
false
}
},
{
"path"
:
"uni_modules/uni-id-pages/pages/userinfo/set-pwd/set-pwd"
,
"style"
:
{
"navigationBarTitleText"
:
"设置密码"
,
"enablePullDownRefresh"
:
false
}
},
{
"path"
:
"uni_modules/uni-id-pages/pages/userinfo/realname-verify/realname-verify"
,
"style"
:
{
"navigationBarTitleText"
:
"实名认证"
,
"enablePullDownRefresh"
:
false
}
},
{
"path"
:
"uni_modules/uni-id-pages/pages/userinfo/face-verify/face-verify"
,
"style"
:
{
"navigationBarTitleText"
:
"人脸识别验证"
,
"enablePullDownRefresh"
:
false
}
}
],
"globalStyle"
:
{
"navigationBarTextStyle"
:
"black"
,
"navigationBarTitleText"
:
"uni-app"
,
"navigationBarBackgroundColor"
:
"#FFF"
,
"backgroundColor"
:
"#F8F8F8"
/*
#ifdef
H
5
*/
,
"navigationStyle"
:
"custom"
/*
#endif
*/
},
"condition"
:
{
//模式配置,仅开发期间生效
"current"
:
0
,
//当前激活的模式(list
的索引项)
"list"
:
[
{
"name"
:
""
,
//模式名称
"path"
:
""
,
//启动页面,必选
"query"
:
""
//启动参数,在页面的onLoad函数里面得到
}
]
},
"uniIdRouter"
:
{
"loginPage"
:
"uni_modules/uni-id-pages/pages/login/login-withoutpwd"
,
"needLogin"
:
[
"uni_modules/uni-id-pages/pages/userinfo/userinfo"
],
"resToLogin"
:
true
}
}
uni_modules/uni-id-pages/common/check-id-card.js
浏览文件 @
94af3af7
export
default
function
checkIdCard
(
idCardNumber
)
{
if
(
!
idCardNumber
)
return
false
if
(
!
idCardNumber
||
typeof
idCardNumber
!==
'
string
'
||
idCardNumber
.
length
!==
18
)
return
false
const
coefficient
=
[
7
,
9
,
10
,
5
,
8
,
4
,
2
,
1
,
6
,
3
,
7
,
9
,
10
,
5
,
8
,
4
,
2
]
const
checkCode
=
[
1
,
0
,
'
x
'
,
9
,
8
,
7
,
6
,
5
,
4
,
3
,
2
]
...
...
@@ -11,4 +11,4 @@ export default function checkIdCard (idCardNumber) {
}
return
checkCode
[
sum
%
11
].
toString
()
===
code
.
toLowerCase
()
}
\ No newline at end of file
}
uni_modules/uni-id-pages/pages/userinfo/realname-verify/realname-verify.vue
浏览文件 @
94af3af7
...
...
@@ -79,7 +79,11 @@ export default {
return
}
if
(
!
/^
[\u
4e00-
\u
9fa5
]
+$/
.
test
(
this
.
realName
))
{
if
(
typeof
this
.
realName
!==
'
string
'
||
this
.
realName
.
length
<
2
||
!
/^
[\u
4e00-
\u
9fa5
]{1,10}(
·
?[\u
4e00-
\u
9fa5
]{1,10}){0,5}
$/
.
test
(
this
.
realName
)
)
{
uni
.
showToast
({
title
:
"
姓名只能是汉字
"
,
icon
:
"
none
"
...
...
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/common/utils.js
浏览文件 @
94af3af7
...
...
@@ -195,7 +195,7 @@ function isMatchUserApp (userAppList, matchAppList) {
}
function
checkIdCard
(
idCardNumber
)
{
if
(
!
idCardNumber
||
typeof
idCardNumber
!==
'
string
'
)
return
false
if
(
!
idCardNumber
||
typeof
idCardNumber
!==
'
string
'
||
idCardNumber
.
length
!==
18
)
return
false
const
coefficient
=
[
7
,
9
,
10
,
5
,
8
,
4
,
2
,
1
,
6
,
3
,
7
,
9
,
10
,
5
,
8
,
4
,
2
]
const
checkCode
=
[
1
,
0
,
'
x
'
,
9
,
8
,
7
,
6
,
5
,
4
,
3
,
2
]
...
...
@@ -231,14 +231,11 @@ function dataDesensitization (value = '', options = {}) {
return
first
+
star
+
last
}
function
getCurrentDate
()
{
const
date
=
new
Date
()
const
year
=
date
.
getFullYear
()
const
month
=
date
.
getMonth
()
+
1
const
day
=
date
.
getDate
()
return
new
Date
(
`
${
year
}
/
${
month
}
/
${
day
}
`
)
function
getCurrentDateTimestamp
(
date
=
Date
.
now
(),
targetTimezone
=
8
)
{
const
oneHour
=
60
*
60
*
1000
return
parseInt
((
date
+
targetTimezone
*
oneHour
)
/
(
24
*
oneHour
))
*
(
24
*
oneHour
)
-
targetTimezone
*
oneHour
}
module
.
exports
=
{
getType
,
isValidString
,
...
...
@@ -259,5 +256,5 @@ module.exports = {
checkIdCard
,
catchAwait
,
dataDesensitization
,
getCurrentDate
getCurrentDate
Timestamp
}
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/facial-recognition-verify/get-certify-id.js
浏览文件 @
94af3af7
const
{
userCollection
,
REAL_NAME_STATUS
,
frvLogsCollection
,
dbCmd
}
=
require
(
'
../../common/constants
'
)
const
{
ERROR
}
=
require
(
'
../../common/error
'
)
const
{
encryptData
}
=
require
(
'
../../common/sensitive-aes-cipher
'
)
const
{
getCurrentDate
}
=
require
(
'
../../common/utils
'
)
const
{
getCurrentDateTimestamp
}
=
require
(
'
../../common/utils
'
)
/**
* 获取认证ID
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#get-frv-certify-id
...
...
@@ -63,7 +62,7 @@ module.exports = async function (params) {
// 用户发起了人脸识别但未刷脸并且 certifyId 还在有效期内就还可以用上次的 certifyId
if
(
frvLogs
.
data
.
length
)
{
const
record
=
frvLogs
.
data
[
0
]
if
(
re
alName
===
record
.
real_name
&&
idCard
===
record
.
identity
)
{
if
(
re
cord
.
certify_id
)
{
return
{
certifyId
:
record
.
certify_id
}
...
...
@@ -72,7 +71,7 @@ module.exports = async function (params) {
const
userFrvLogs
=
await
frvLogsCollection
.
where
({
user_id
:
uid
,
created_date
:
dbCmd
.
gt
(
getCurrentDate
().
getTime
())
created_date
:
dbCmd
.
gt
(
getCurrentDate
Timestamp
())
}).
get
()
// 限制用户每日认证次数
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录