提交 e9fd3da3 编写于 作者: tao.wu's avatar tao.wu

点击【添加居民】,增加用户是否进行过身份认证的校验,并且新增了跳转到saas的入口中的一个参数,用以默认展示身份认证页面的逻辑

上级 65346331
......@@ -52,7 +52,18 @@ router.beforeEach((to, from, next) => {
if(to.meta.checkAuth){
utils.checkAuthFunc().then(res=>{
if(res==3){
next()
if(to.meta.doctorAuth){
utils.getDoctorAuth(router).then(resAuth=>{
if(resAuth==4){
next()
}else{
next(false)
return
}
})
return
}
next();
}else{
next(false)
return
......
......@@ -76,7 +76,8 @@ const patientsRouters = {
meta: {
title: '新增居民',
keepAlive: false,
checkAuth: true
checkAuth: true,
doctorAuth: true
},
},
],
......
......@@ -31,16 +31,19 @@ function getWsHost(){
return host
}
const alertMessage = (msg, confirmButtonText, cancelButtonText, callback) => {
const alertMessage = (msg, confirmButtonText, cancelButtonText, callback, closeCallback) => {
Vue.prototype.$confirm(msg, '提醒', {
confirmButtonText: confirmButtonText,
cancelButtonText: cancelButtonText,
customClass: 'check-auth',
showClose: false,
}).then(() => {
}).then((action) => {
callback();
}).catch(() => {
// 关闭弹窗
if(closeCallback){
closeCallback();
}
});
}
......@@ -107,6 +110,53 @@ export default {
}
}))
})
},
getDoctorAuth: (router)=>{
return new Promise((resolve, reject) => {
resolve(fetch({
headers: {
token: localStorage.getItem('storageToken')
},
url: getBaseUrl(`healths/doctor/doctorAuth`),
method: 'get',
description: '检查用户的认证权限',
}).then(res => {
// 1:未认证 2、认证中 3、认证失败 4、认证成功
// res.data=3; // 该行注释用以本地测试用! 该行注释用以本地测试用! 该行注释用以本地测试用!
if (res.code == '000000') {
if(res.data===1){
alertMessage('您还未进行身份认证,认证成功后即可使用该功能。','去认证','取消', ()=>{
location.href = getSaasHost() + '/saas/pica_personal_edit.html?ZmxhZz0x&showAuthCerty=true'
},()=>{
router.push({
path: '/patients-manage/mypatients-manage/patients-list'
})
})
}else if(res.data===2){
alertMessage('您还未进行身份认证,认证成功后即可使用该功能。','去认证','取消', ()=>{
location.href = getSaasHost() + '/saas/pica_personal_edit.html?ZmxhZz0x&showAuthCerty=true'
},()=>{
router.push({
path: '/patients-manage/mypatients-manage/patients-list'
})
})
}else if(res.data===3){
alertMessage('您的身份认证审核失败,请重新认证通过后即可使用该功能。','重新认证','取消', ()=>{
location.href = getSaasHost() + '/saas/pica_personal_edit.html?ZmxhZz0x&showAuthCerty=true'
},()=>{
router.push({
path: '/patients-manage/mypatients-manage/patients-list'
})
})
}
}
return new Promise((resolve, reject) => {
resolve(res.data)
})
}))
})
}
};
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册