add 项目运行截图

This commit is contained in:
王鹏
2026-04-10 14:37:23 +08:00
parent a2f5875d1b
commit ef8237d8d1
15 changed files with 2943 additions and 1 deletions

3
bat/close_cmd.bat Normal file
View File

@@ -0,0 +1,3 @@
@echo off
taskkill /f /im cmd.exe /t

8
bat/run_admin.bat Normal file
View File

@@ -0,0 +1,8 @@
@echo off
chcp 65001 >nul
cd /d D:\code\front\manage_code
npm run serve
pause

8
bat/run_front.bat Normal file
View File

@@ -0,0 +1,8 @@
@echo off
chcp 65001 >nul
cd /d D:\code\front\client_code
npm run serve
pause

25
bat/run_install_admin.bat Normal file
View File

@@ -0,0 +1,25 @@
@echo off
:: 设置编码为 UTF-8
chcp 65001 >nul
:: 1. 增加 /d 参数切换盘符,并检查路径是否存在
cd /d D:\code\front\manage_code
if %errorlevel% neq 0 (
echo [错误] 无法找到目录: D:\code\front\manage_code
pause
exit /b
)
echo 当前目录: %cd%
:: 2. 判断 node_modules 是否存在
if not exist "node_modules\" (
echo 未检测到 node_modules 目录,开始安装依赖...
:: 使用 call 确保 npm 执行完后脚本继续运行
call npm install
) else (
echo 检测到 node_modules 目录,跳过依赖安装。
)
echo.
echo 执行完毕!

25
bat/run_install_front.bat Normal file
View File

@@ -0,0 +1,25 @@
@echo off
:: 设置编码为 UTF-8
chcp 65001 >nul
:: 1. 增加 /d 参数切换盘符,并检查路径是否存在
cd /d D:\code\front\client_code
if %errorlevel% neq 0 (
echo [错误] 无法找到目录: D:\code\front\client_code
pause
exit /b
)
echo 当前目录: %cd%
:: 2. 判断 node_modules 是否存在
if not exist "node_modules\" (
echo 未检测到 node_modules 目录,开始安装依赖...
:: 使用 call 确保 npm 执行完后脚本继续运行
call npm install
) else (
echo 检测到 node_modules 目录,跳过依赖安装。
)
echo.
echo 执行完毕!

View File

@@ -0,0 +1,47 @@
@echo off
chcp 65001 >nul
setlocal enabledelayedexpansion
:: 强制切换到脚本所在目录解决管理员模式启动默认在System32的问题
cd /d "%~dp0"
echo 正确盘符: %~d0
echo 正确路径: %cd%
:: 使用/d参数强制切换驱动器+目录
cd /d "D:\code\server" 2>nul
if %errorlevel% neq 0 (
echo [ERROR] Can not enter D:\code\server
echo 请检查:
echo 1. D盘是否存在
echo 2. code目录是否存在
echo 3. 是否有权限访问
exit /b
)
echo 扫描子目录中...
dir /ad /b
set "first_dir="
for /f "delims=" %%d in ('dir /ad /b 2^>nul') do (
set "first_dir=%%d"
goto :dir_found
)
:dir_found
if not defined first_dir (
echo [ERROR] No subdirectory found
exit /b
)
echo 进入子目录: !first_dir!
cd /d "!first_dir!"
echo 当前路径: %cd%
if not exist "target\" (
echo 执行Maven构建...
call mvn clean package
) else (
pause
echo 检测到 target 目录跳过Maven构建。
)

99
bat/run_server.bat Normal file
View File

@@ -0,0 +1,99 @@
@echo off
chcp 65001 >nul
setlocal enabledelayedexpansion
:: 强制切换到脚本所在目录解决管理员模式启动默认在System32的问题
cd /d "%~dp0"
echo 正确盘符: %~d0
echo 正确路径: %cd%
:: 使用/d参数强制切换驱动器+目录
cd /d "D:\code\server" 2>nul
if %errorlevel% neq 0 (
echo [ERROR] Can not enter D:\code\server
echo 请检查:
echo 1. D盘是否存在
echo 2. code目录是否存在
echo 3. 是否有权限访问
exit /b
)
echo 扫描子目录中...
dir /ad /b
set "first_dir="
for /f "delims=" %%d in ('dir /ad /b 2^>nul') do (
set "first_dir=%%d"
goto :dir_found
)
:dir_found
if not defined first_dir (
echo [ERROR] No subdirectory found
exit /b
)
echo 进入子目录: !first_dir!
cd /d "!first_dir!"
echo 当前路径: %cd%
if not exist "target\" (
echo 执行Maven构建...
call mvn clean package
) else (
echo 检测到 target 目录跳过Maven构建。
)
echo 进入target目录...
cd target
echo 目录内容:
dir /b
:: ========== 新增端口检查功能 ==========
echo 正在检查8080端口占用...
set "port_pid="
for /f "tokens=5" %%p in ('netstat -ano -p tcp ^| findstr ":8080" ^| findstr "LISTENING"') do (
set "port_pid=%%p"
echo 检测到端口占用PID: !port_pid!
taskkill /F /PID !port_pid! >nul 2>&1 && (
echo 成功终止进程: !port_pid!
) || (
echo [警告] 无法终止进程: !port_pid!
echo 可能需要管理员权限,请右键用管理员身份运行
)
)
if not defined port_pid (
echo 8080端口未被占用
)
:: ========== 端口检查结束 ==========
set "jar_file="
for /f "delims=" %%j in ('dir /b /a-d *.jar ^| findstr /v "original.jar"') do (
set "jar_file=%%j"
goto :jar_found
)
:jar_found
if not defined jar_file (
echo [ERROR] No valid jar found
echo 建议检查:
echo 1. Maven构建是否成功
echo 2. target目录内容
dir /b *.jar
exit /b
)
echo 启动Jar包: !jar_file!
java -jar "!jar_file!"
if %errorlevel% neq 0 (
echo [ERROR] Java启动失败 (code: %errorlevel%)
echo 可能原因:
echo 1. 缺少依赖
echo 2. 端口占用
echo 3. 配置错误
pause
)

34
bat/run_sql.bat Normal file
View File

@@ -0,0 +1,34 @@
@echo off
chcp 65001 >nul
cd /d D:\code\db
set "MYSQL_PATH=C:\Program Files\MySQL\MySQL Server 8.0\bin\mysql.exe"
for %%F in (*.sql) do (
echo 正在处理文件: %%F
"%MYSQL_PATH%" -u root -p123456 -e "CREATE DATABASE IF NOT EXISTS %%~nF;"
:: 第一次导入尝试
"%MYSQL_PATH%" -u root -p123456 %%~nF < %%F
:: 检查数据库是否存在
"%MYSQL_PATH%" -u root -p123456 -e "USE %%~nF;" 2>nul
if errorlevel 1 (
echo 数据库 %%~nF 第一次导入失败,尝试重新导入...
:: 第二次导入尝试
"%MYSQL_PATH%" -u root -p123456 -e "DROP DATABASE IF EXISTS %%~nF; CREATE DATABASE %%~nF;"
"%MYSQL_PATH%" -u root -p123456 %%~nF < %%F
:: 再次检查
"%MYSQL_PATH%" -u root -p123456 -e "USE %%~nF;" 2>nul
if errorlevel 1 (
echo 错误: 数据库 %%~nF 导入失败!
) else (
echo 数据库 %%~nF 重新导入成功
)
) else (
echo 数据库 %%~nF 导入完成
)
)