提交 d2458369 编写于 作者: yi.li's avatar yi.li

登录成功后增加协议校验功能

上级 b493ea94
......@@ -74,4 +74,15 @@ export const handleResetPWD = data => {
})
}
// 判断是否同意协议
export const handleAgreement = data => {
return fetch({
headers,
url: getBaseUrl(`api-ws/agreements/consent`),
method: 'get',
params: data,
description: '检查用户同意的协议',
})
}
......@@ -98,9 +98,10 @@
<script>
let vm = null
import { ssoLogin2, getDeviceInfo } from '@/utils/utils';
import { getSaasDomain } from '@/utils/index';
import { mapActions } from 'vuex';
import md5 from 'js-md5';
import { handleLogin, handleGetCaptcha, handleGetAuthCode, handleResetPWD } from '@/utils/account/accountApi';
import { handleLogin, handleGetCaptcha, handleGetAuthCode, handleResetPWD, handleAgreement, handleLogout } from '@/utils/account/accountApi';
export default {
......@@ -233,7 +234,7 @@
this.resetMobileErr = false;
this.resetMobileErrText = '';
}
if( !this.resetPassword.captchaAnswer ){
this.resetCaptchaErr = true;
this.resetCaptchaErrText = '请输入图形验证码';
......@@ -312,7 +313,7 @@
}, 1000)
}
}
}).catch(err => {
this.$message({
message: '系统错误!',
......@@ -324,7 +325,7 @@
// ------------------------ New End-------------------------------
},
login() {
if(!this.loginData.mobile) {
this.loginMobileErr = true;
......@@ -421,8 +422,11 @@
localStorage.setItem('doctorId',res.data.userId);
localStorage.setItem("mobilePhone", paramsObj.mobile);
sessionStorage.setItem("mobile",paramsObj.mobile);
this.$router.push('/');
// this.$router.push('/');
alert('登录成功')
//新增协议校验
this.checkAgreement();
}).catch(err => {
this.$message({
message: '系统错误!',
......@@ -484,7 +488,7 @@
}
// ------------------------ Old Start-------------------------------
// let para = {
// mobile: this.resetPassword.mobile,
// authCode: this.resetPassword.authCode
......@@ -543,7 +547,7 @@
type: 'error'
});
}
}).catch(err => {
this.$message({
message: '系统错误!',
......@@ -554,7 +558,38 @@
this.sendEncryptRequest( paramsObj, resetPWDCB)
// ------------------------ New End-------------------------------
}
},
//新增协议校验
checkAgreement() {
let mobilePhone = localStorage.getItem("mobilePhone");
if (mobilePhone) {
let para = {
mobilePhone:mobilePhone,
agreementType:1
};
handleAgreement(para).then(res => {
if (res.code == '000000') {
const arr = res.data;
if (arr.length && arr.length == 1) {
window.location.href = getSaasDomain(`pica-base/pica_do_agree.html?agreementType=${arr[0]}`);
} else if (arr.length && arr.length == 2) {
window.location.href = getSaasDomain(`pica-base/pica_do_agree.html?agreementType=${arr[0]}&agreementType2=${arr[1]}`);
} else {
this.$router.push('/');
}
} else {
// 新增 调用后端退出登录接口
handleLogout();
localStorage.removeItem('storageToken')
}
}).catch(err => {
this.$message({
message: '系统错误!',
type: 'error'
});
})
}
},
}
}
</script>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册