feat: integrate pixel teacher presence and resilient classroom preview

This commit is contained in:
鲨鱼辣椒 committed 2026-09-23 18:23:53 +08:00
1 parent 12d800ec51
commit 7951cca700
60 files changed
+3313 -180

No files matched your search

+7 -3
View File
@@ -9,6 +9,7 @@ import { hostApiFetch } from '@/lib/host-api';
import { useAuthStore } from '@/stores/auth';
import { useProviderStore } from '@/stores/providers';
import logoSvg from '@/assets/logo.svg';
import { codingRecoveryAccount, readCodingLoginRecovery } from '@/lib/coding-login-recovery';
const LOGIN_SERVICE_ERROR_MESSAGE = '登录服务暂时不可用,请稍后重试。';
const LOGIN_ERROR_MESSAGE = '登录失败,请稍后重试。';
@@ -117,6 +118,7 @@ export function Login() {
const navigate = useNavigate();
const location = useLocation();
const returnPath = getSafeLoginReturnPath(location.state);
const reauthenticate = location.state?.reauthenticate === true;
const loginWithPassword = useAuthStore((state) => state.loginWithPassword);
const loginWithMobile = useAuthStore((state) => state.loginWithMobile);
const loading = useAuthStore((state) => state.loading);
@@ -253,10 +255,10 @@ export function Login() {
}, []);
useEffect(() => {
if (isAuthenticated() && !submitting) {
if (isAuthenticated() && !submitting && !reauthenticate) {
navigate(returnPath, { replace: true });
}
}, [isAuthenticated, navigate, returnPath, submitting]);
}, [isAuthenticated, navigate, returnPath, submitting, reauthenticate]);
const finishLogin = async (login: () => Promise<void>) => {
setSubmitError(null);
@@ -271,7 +273,9 @@ export function Login() {
await logout();
throw syncError;
}
navigate(returnPath, { replace: true });
const recovery = readCodingLoginRecovery(location.state?.codingRecovery);
const sameAccount = recovery?.account === codingRecoveryAccount(useAuthStore.getState().user);
navigate(returnPath, { replace: true, state: sameAccount ? { codingRecovery: recovery } : undefined });
} catch (loginError) {
setSubmitError(loginError instanceof Error ? loginError.message : String(loginError));
} finally {