修改页面,完成单页模式新增首页返回上一页按钮

This commit is contained in:
2026-08-31 14:48:32 +08:00
parent aaed0584b1
commit 15b301b358
363 changed files with 10895 additions and 213 deletions
+17 -4
View File
@@ -91,6 +91,17 @@
return root.GenealogyApi && root.GenealogyApi.defaultClient;
}
async function cacheCurrentUser(api) {
if (!root.PublicNavigation) return;
root.PublicNavigation.clearUser();
try {
root.PublicNavigation.storeUser(await api.currentProfile());
} catch (error) {
// 账户摘要加载失败不应阻断已经成功的登录,个人中心会再次读取并同步资料。
root.PublicNavigation.clearUser();
}
}
function getCaptchaOperation(formType) {
// PC 验证中心按业务动作解析服务端已激活的验证场景。
var config = FORM_CONFIG[formType] || {};
@@ -385,7 +396,8 @@
setFormStatus(form, '正在验证账号…', 'loading');
try {
await api.login(buildLoginBody(values));
root.location.href = await resolvePostLoginUrl(api, 'login');
await cacheCurrentUser(api);
root.NavigationUtil.open(await resolvePostLoginUrl(api, 'login'));
} catch (error) {
setFormStatus(form, error.message || '登录失败', getApiStateType(error));
} finally {
@@ -407,7 +419,8 @@
setFormStatus(form, '正在验证短信验证码…', 'loading');
try {
await api.loginBySms(buildSmsLoginBody(values));
root.location.href = await resolvePostLoginUrl(api, 'sms-login');
await cacheCurrentUser(api);
root.NavigationUtil.open(await resolvePostLoginUrl(api, 'sms-login'));
} catch (error) {
setFormStatus(form, error.message || '短信登录失败', getApiStateType(error));
} finally {
@@ -429,7 +442,7 @@
setFormStatus(form, '正在创建账号…', 'loading');
try {
await api.register(buildRegisterBody(values));
root.location.href = getSuccessUrl('register');
root.NavigationUtil.open(getSuccessUrl('register'));
} catch (error) {
setFormStatus(form, error.message || '注册失败', getApiStateType(error));
} finally {
@@ -490,7 +503,7 @@
try {
await api.resetPassword(buildPasswordResetBody(values));
showMessage('密码已重设,请重新登录');
root.location.href = getSuccessUrl('password-reset');
root.NavigationUtil.open(getSuccessUrl('password-reset'));
} catch (error) {
setFormStatus(form, error.message || '重设密码失败', getApiStateType(error));
} finally {