feat(auth): 微信登录自动分配 patient 角色 + 创建患者档案
Some checks failed
CI / rust-check (push) Has been cancelled
CI / rust-test (push) Has been cancelled
CI / frontend-build (push) Has been cancelled
CI / security-audit (push) Has been cancelled

- 新增迁移 m20260510_000133:为所有租户创建 patient 角色并分配 19 个权限
- wechat_service: bind_phone 自动 assign_patient_role + ensure_patient_record
- find_or_create_user_by_phone 新用户自动获得 patient 角色和患者档案
- 小程序 auth store: bindPhone 抛出异常而非静默返回 false
- 小程序登录页: 捕获绑定错误并显示可操作的对话框
This commit is contained in:
iven
2026-05-10 09:57:45 +08:00
parent 28bcdc4208
commit 11101ac204
5 changed files with 238 additions and 12 deletions

View File

@@ -52,11 +52,24 @@ export default function Login() {
return;
}
const { encryptedData, iv } = e.detail;
const success = await bindPhone(encryptedData, iv);
if (success) {
navigateAfterLogin();
} else {
Taro.showToast({ title: '绑定失败,请重试', icon: 'none' });
try {
const success = await bindPhone(encryptedData, iv);
if (success) {
navigateAfterLogin();
}
} catch (err: any) {
const msg = err?.message || '绑定失败';
Taro.showModal({
title: '绑定手机号失败',
content: msg,
confirmText: '重新登录',
cancelText: '取消',
success: (res) => {
if (res.confirm) {
setNeedBind(false);
}
},
});
}
};