init
This commit is contained in:
9
frontend/src/pages/DashboardPage.tsx
Normal file
9
frontend/src/pages/DashboardPage.tsx
Normal file
@@ -0,0 +1,9 @@
|
||||
import { AppCard } from "../components/AppCard";
|
||||
|
||||
export function DashboardPage() {
|
||||
return (
|
||||
<AppCard title="项目骨架已就绪">
|
||||
<p>当前页面用于承接首版后台管理端骨架,后续可继续补充机构端、教师端等业务模块。</p>
|
||||
</AppCard>
|
||||
);
|
||||
}
|
||||
42
frontend/src/pages/LoginPage.tsx
Normal file
42
frontend/src/pages/LoginPage.tsx
Normal file
@@ -0,0 +1,42 @@
|
||||
import { type FormEvent, useState } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { login } from "../api/auth";
|
||||
import { setAccessToken } from "../utils/storage";
|
||||
|
||||
export function LoginPage() {
|
||||
const navigate = useNavigate();
|
||||
const [form, setForm] = useState({
|
||||
username: "admin",
|
||||
password: "admin123",
|
||||
provinceCode: "330000",
|
||||
areaCode: "330100",
|
||||
tenantId: "SCH-HQ"
|
||||
});
|
||||
|
||||
async function handleSubmit(event: FormEvent) {
|
||||
event.preventDefault();
|
||||
const response = await login(form);
|
||||
setAccessToken(response.data.accessToken);
|
||||
navigate("/");
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="login-page">
|
||||
<form className="login-form" onSubmit={handleSubmit}>
|
||||
<h1>K12Study Admin</h1>
|
||||
<input
|
||||
value={form.username}
|
||||
onChange={(event) => setForm({ ...form, username: event.target.value })}
|
||||
placeholder="用户名"
|
||||
/>
|
||||
<input
|
||||
type="password"
|
||||
value={form.password}
|
||||
onChange={(event) => setForm({ ...form, password: event.target.value })}
|
||||
placeholder="密码"
|
||||
/>
|
||||
<button type="submit">登录</button>
|
||||
</form>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
10
frontend/src/pages/NotFoundPage.tsx
Normal file
10
frontend/src/pages/NotFoundPage.tsx
Normal file
@@ -0,0 +1,10 @@
|
||||
import { Link } from "react-router-dom";
|
||||
|
||||
export function NotFoundPage() {
|
||||
return (
|
||||
<div className="not-found">
|
||||
<h1>404</h1>
|
||||
<Link to="/">返回首页</Link>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
13
frontend/src/pages/RoutePlaceholderPage.tsx
Normal file
13
frontend/src/pages/RoutePlaceholderPage.tsx
Normal file
@@ -0,0 +1,13 @@
|
||||
import { useLocation } from "react-router-dom";
|
||||
import { AppCard } from "../components/AppCard";
|
||||
|
||||
export function RoutePlaceholderPage() {
|
||||
const location = useLocation();
|
||||
|
||||
return (
|
||||
<AppCard title="动态路由占位页">
|
||||
<p>当前路由:{location.pathname}</p>
|
||||
<p>这里先用于承接动态菜单和页面挂载,后续再补真实业务实现。</p>
|
||||
</AppCard>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user