diff --git a/打包.bat b/打包.bat index 2217214..1bec27a 100644 --- a/打包.bat +++ b/打包.bat @@ -1,14 +1,56 @@ @echo off chcp 65001 >nul title 构建和打包工具 -echo lin___LinZhi哨岗打包 sgxt_pc... +echo ======================================== +echo 林芝哨岗 vue构建和打包工具 +echo ======================================== +echo. + +cd /d "%~dp0" + +echo [1/3] 清理旧的构建文件... +@REM if exist gsxt ( +@REM rmdir /s /q gsxt +@REM ) +if exist gsxt.zip ( + del gsxt.zip +) + +echo. +echo [2/3] 开始构建项目... call npm run build -echo 打包完成,正在压缩... -if exist gsxt.zip del gsxt.zip + +if %ERRORLEVEL% NEQ 0 ( + echo. + echo ❌ 构建失败!请检查错误信息。 + pause + exit /b 1 +) + +echo. +echo [3/3] 压缩构建文件... +if not exist gsxt ( + echo ❌ 找不到构建输出文件夹 gsxt + pause + exit /b 1 +) powershell Compress-Archive -Path gsxt -DestinationPath gsxt.zip -echo 压缩完成! -explorer . -msg * "林芝哨岗pc打包完成!" -start http://localhost:9528?project=sgxt_pc -powershell -Command "Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.MessageBox]::Show('打包和压缩已完成!', '成功', [System.Windows.Forms.MessageBoxButtons]::OK, [System.Windows.Forms.MessageBoxIcon]::Exclamation)" \ No newline at end of file + +if %ERRORLEVEL% EQU 0 ( + echo. + echo ✅ 构建和打包完成! + echo 📦 输出文件: gsxt.zip + echo 📁 文件大小: + dir gsxt.zip | findstr gsxt.zip + start http://localhost:9528?project=sgxt_pc + explorer . + msg * "林芝哨岗打包完成!" + @REM powershell -Command "Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.MessageBox]::Show('打包和压缩已完成!', '成功', [System.Windows.Forms.MessageBoxButtons]::OK, [System.Windows.Forms.MessageBoxIcon]::Exclamation)" +) else ( + echo ❌ 压缩失败! +) + +echo. +echo 按任意键退出... +pause >nul \ No newline at end of file