2025-12-12 10:20:08 +08:00
|
|
|
@echo off
|
2025-12-17 10:46:35 +08:00
|
|
|
chcp 65001 >nul
|
|
|
|
|
title 构建和打包工具
|
2025-12-12 10:20:08 +08:00
|
|
|
|
2025-12-17 11:07:52 +08:00
|
|
|
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] 开始构建项目...
|
2025-12-12 10:20:08 +08:00
|
|
|
call npm run build
|
2025-12-17 11:07:52 +08:00
|
|
|
|
|
|
|
|
if %ERRORLEVEL% NEQ 0 (
|
|
|
|
|
echo.
|
|
|
|
|
echo ❌ 构建失败!请检查错误信息。
|
|
|
|
|
pause
|
|
|
|
|
exit /b 1
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
echo.
|
|
|
|
|
echo [3/3] 压缩构建文件...
|
|
|
|
|
if not exist gsxt (
|
|
|
|
|
echo ❌ 找不到构建输出文件夹 gsxt
|
|
|
|
|
pause
|
|
|
|
|
exit /b 1
|
|
|
|
|
)
|
2025-12-12 10:20:08 +08:00
|
|
|
powershell Compress-Archive -Path gsxt -DestinationPath gsxt.zip
|
2025-12-17 11:07:52 +08:00
|
|
|
|
|
|
|
|
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
|