fix: 更新健康监测模块页面与文档,新增静态服务配置

This commit is contained in:
liuyunqin
2026-07-15 17:34:52 +08:00
parent ff11ee0e1c
commit c7096947e0
18 changed files with 756 additions and 472 deletions
+62
View File
@@ -0,0 +1,62 @@
@echo off
chcp 65001 >nul
title 健康CQ原型 - 本地服务器
cd /d "%~dp0"
echo ============================================
echo 健康CQ升级项目 · 高保真交互原型
echo ============================================
echo.
:: ── 检查端口 8080 是否已被占用 ──
netstat -ano 2>nul | findstr ":8080" | findstr "LISTENING" >nul
if %errorlevel% equ 0 (
echo [跳过] 端口 8080 已被占用,服务器已在运行。
goto open_browser
)
:: ── 优先 npx serve(配置了 serve.json),备选 Python ──
where npx >nul 2>nul
if %errorlevel% equ 0 (
echo [启动] 使用 npx serve 启动服务器...
start "健康CQ原型-服务器" /min cmd /c "npx --yes serve . -p 8080 --no-clipboard"
goto wait_server
)
where python >nul 2>nul
if %errorlevel% equ 0 (
echo [启动] 使用 Python 启动服务器...
start "健康CQ原型-服务器" /min cmd /c "python -m http.server 8080"
goto wait_server
)
echo [错误] 未找到 Node.js (npx) 或 Python
echo 请安装 Node.js: https://nodejs.org/
pause
exit /b 1
:wait_server
echo [等待] 服务器启动中...
set /a COUNT=0
:wait_loop
set /a COUNT+=1
powershell -NoProfile -Command "try {$r=Invoke-WebRequest -Uri 'http://localhost:8080/' -TimeoutSec 2 -UseBasicParsing; exit 0} catch {exit 1}" >nul 2>&1
if %errorlevel% equ 0 (
echo [就绪] 启动成功!(%COUNT%秒)
goto open_browser
)
if %COUNT% geq 30 (
echo [超时] 30秒未就绪,请检查是否被防火墙拦截
pause
exit /b 1
)
timeout /t 1 /nobreak >nul
goto wait_loop
:open_browser
echo [打开] 打开浏览器...
start http://localhost:8080/
echo.
echo ✅ 完成!以后双击本文件即可一键启动。
timeout /t 2 /nobreak >nul
exit