fix:完善门店和总部管理端

This commit is contained in:
ljy
2026-07-06 20:58:38 +08:00
parent 67b5a580c5
commit fcf1d45522
25 changed files with 1273 additions and 118 deletions
+8 -2
View File
@@ -5,6 +5,12 @@ import type { WechatLoginResult } from '@dukang/shared-types';
import { request, saveSession, type UserProfile } from '../lib/api';
import { normalizePhoneInput, validateMobilePhone } from '../lib/phone';
import { isWechatEnv, weixinSdk } from '../lib/weixin';
import { touchPromoIfNeeded } from '../lib/promo';
async function finishLogin(navigate: (path: string) => void, returnTo: string) {
await touchPromoIfNeeded();
navigate(returnTo.startsWith('/') ? returnTo : '/');
}
export default function LoginPage() {
const navigate = useNavigate();
@@ -45,7 +51,7 @@ export default function LoginPage() {
phoneVerified: !!result.phoneVerified,
user: result.user as never,
});
navigate(returnTo.startsWith('/') ? returnTo : '/');
void finishLogin(navigate, returnTo);
}
}
@@ -113,7 +119,7 @@ export default function LoginPage() {
body: JSON.stringify({ phone, code }),
});
saveSession(data);
navigate(returnTo.startsWith('/') ? returnTo : '/');
await finishLogin(navigate, returnTo);
} catch (e) {
setMsg(e instanceof Error ? e.message : '登录失败');
} finally {