11111
This commit is contained in:
@@ -194,13 +194,27 @@ const resendSms = async () => {
|
||||
uni.showLoading({ title: '发送中...' });
|
||||
try {
|
||||
// 调用重新发送验证码接口
|
||||
await $api.createRequest('/app/sendSmsAgain', { phone: phone.value }, 'post');
|
||||
uni.hideLoading();
|
||||
uni.showToast({ title: '验证码已发送', icon: 'success' });
|
||||
startCountdown();
|
||||
const requestParams = { phone: phone.value };
|
||||
// 只有单位用户才传递机构类型
|
||||
if (userType.value === '0') {
|
||||
requestParams.orgType = orgType.value;
|
||||
requestParams.userType = userType.value;
|
||||
}
|
||||
const res = await $api.createRequest('/app/sendSmsAgain', requestParams, 'post');
|
||||
|
||||
// 检查状态码
|
||||
if (res.code === 200 ) {
|
||||
uni.hideLoading();
|
||||
|
||||
uni.showToast({ title: '验证码已发送', icon: 'success' });
|
||||
startCountdown();
|
||||
} else {
|
||||
uni.hideLoading();
|
||||
uni.showToast({ title: res.msg || '发送失败', icon: 'none' });
|
||||
}
|
||||
} catch (error) {
|
||||
uni.hideLoading();
|
||||
uni.showToast({ title: error.msg || '发送失败', icon: 'none' });
|
||||
uni.showToast({ title: error.msg || '发送失败,请重试', icon: 'none' });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -305,16 +319,29 @@ const submitVerification = async () => {
|
||||
|
||||
try {
|
||||
// 调用接口 /app/appLoginPhone
|
||||
const res = await $api.createRequest('/app/appLoginPhone', {
|
||||
const requestParams = {
|
||||
smsCode: code,
|
||||
phone: phone.value,
|
||||
openid: openid.value,
|
||||
unionid: unionid.value,
|
||||
userType: userType.value,
|
||||
orgType: orgType.value
|
||||
}, 'post');
|
||||
userType: userType.value
|
||||
};
|
||||
// 只有单位用户才传递机构类型
|
||||
if (userType.value === '0') {
|
||||
requestParams.orgType = orgType.value;
|
||||
}
|
||||
const res = await $api.createRequest('/app/appLoginPhone', requestParams, 'post');
|
||||
|
||||
if (res.token) {
|
||||
if (res.token && res.code === 200) {
|
||||
// 检查idCard是否为null,如果是则跳转到个人信息不全页面
|
||||
if (res.idCard) {
|
||||
uni.showToast({ title: '个人信息不全,请完善信息', icon: 'none' });
|
||||
setTimeout(() => {
|
||||
uni.navigateTo({ url: '/pages/personal-info/incomplete' });
|
||||
}, 1500);
|
||||
return;
|
||||
}
|
||||
|
||||
// 登录成功,存储token
|
||||
const userStore = useUserStore();
|
||||
await userStore.loginSetToken(res.token);
|
||||
@@ -336,7 +363,7 @@ const submitVerification = async () => {
|
||||
uni.showToast({ title: res.msg || '验证失败', icon: 'none' });
|
||||
}
|
||||
} catch (error) {
|
||||
uni.showToast({ title: error.msg || '验证失败,请重试', icon: 'none' });
|
||||
uni.showToast({ title: error || '验证失败,请重试', icon: 'none' });
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user