From f5fa9ace88ab5da5c0a7361676595d47f4b43176 Mon Sep 17 00:00:00 2001 From: freedakgmail Date: Mon, 27 Jul 2026 09:44:21 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=83=A8=E7=BD=B2=E5=89=8D=E7=AB=AF?= =?UTF-8?q?=E5=88=B0dm.all8ai.top=20+=20=E6=80=A7=E8=83=BD=E4=BC=98?= =?UTF-8?q?=E5=8C=96=20+=20=E7=99=BB=E5=BD=95=E9=A1=B5=E5=AF=86=E7=A0=81?= =?UTF-8?q?=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 前端构建部署到152.136.182.184服务器,nginx反向代理 - SSH反向隧道(13333端口)连接服务器到本地后端 - SSL证书自动配置(Let's Encrypt) - API baseURL支持环境变量VITE_API_BASE_URL - 后端端口改为3333,CORS允许所有来源 - 物化6个慢视图(overview/risk/loop_health/benchmark/region/followup) - 登录页保留密码输入框,必须输入密码才能登录 - run.md添加登录账号信息 --- client/.env.production | 2 ++ client/src/lib/api.ts | 2 +- client/src/pages/LoginPage.tsx | 5 +++-- client/src/vite-env.d.ts | 1 + client/vite.config.ts | 2 +- run.md | 11 +++++++++- server/src/index.ts | 4 ++-- server/src/routes/data.ts | 40 ++++++---------------------------- server/src/routes/tasks.ts | 4 ++-- 9 files changed, 29 insertions(+), 42 deletions(-) create mode 100644 client/.env.production create mode 100644 client/src/vite-env.d.ts diff --git a/client/.env.production b/client/.env.production new file mode 100644 index 0000000..02fd38f --- /dev/null +++ b/client/.env.production @@ -0,0 +1,2 @@ +# 构建时设置API地址(内网穿透地址) +# VITE_API_BASE_URL=https://your-ngrok-url/api diff --git a/client/src/lib/api.ts b/client/src/lib/api.ts index d1b486b..5a1fc3e 100644 --- a/client/src/lib/api.ts +++ b/client/src/lib/api.ts @@ -1,7 +1,7 @@ import axios from 'axios' const api = axios.create({ - baseURL: '/api', + baseURL: import.meta.env.VITE_API_BASE_URL || '/api', timeout: 30000, }) diff --git a/client/src/pages/LoginPage.tsx b/client/src/pages/LoginPage.tsx index a3a5140..f18a4f5 100644 --- a/client/src/pages/LoginPage.tsx +++ b/client/src/pages/LoginPage.tsx @@ -9,7 +9,7 @@ interface LoginPageProps { export function LoginPage({ onLogin }: LoginPageProps) { const navigate = useNavigate() const [username, setUsername] = useState('总部管理员') - const [password, setPassword] = useState('123') + const [password, setPassword] = useState('') const [error, setError] = useState('') const handleLogin = async () => { @@ -34,9 +34,11 @@ export function LoginPage({ onLogin }: LoginPageProps) { setUsername(e.target.value)} + onKeyDown={(e) => e.key === 'Enter' && handleLogin()} className="mt-1 w-full rounded-md border px-3 py-2 text-sm" /> + {error &&

{error}

}
- {error &&

{error}

}