gameSeriveUniapp/启动项目.bat
2026-01-12 16:48:28 +08:00

118 lines
2.1 KiB
Batchfile
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@echo off
chcp 65001 >nul
echo ========================================
echo 游戏服务交易平台 V2 - 启动脚本
echo ========================================
echo.
:menu
echo 请选择运行方式:
echo.
echo [1] 运行到微信小程序(推荐)
echo [2] 运行到 H5浏览器
echo [3] 编译到微信小程序(生产)
echo [4] 编译到 H5生产
echo [5] 安装依赖
echo [6] 清除缓存并重新安装
echo [0] 退出
echo.
set /p choice=请输入选项 (0-6):
if "%choice%"=="1" goto dev_weixin
if "%choice%"=="2" goto dev_h5
if "%choice%"=="3" goto build_weixin
if "%choice%"=="4" goto build_h5
if "%choice%"=="5" goto install
if "%choice%"=="6" goto clean
if "%choice%"=="0" goto end
echo 无效的选项,请重新选择!
echo.
goto menu
:dev_weixin
echo.
echo 正在启动微信小程序开发模式...
echo.
echo 提示:
echo 1. 确保已安装微信开发者工具
echo 2. 在微信开发者工具中开启"服务端口"
echo 3. 编译完成后会自动打开微信开发者工具
echo.
call npm run dev:mp-weixin
goto end
:dev_h5
echo.
echo 正在启动 H5 开发模式...
echo.
echo 提示:
echo 浏览器会自动打开 http://localhost:5173
echo 可以使用浏览器开发者工具进行调试
echo.
call npm run dev:h5
goto end
:build_weixin
echo.
echo 正在编译微信小程序(生产环境)...
echo.
call npm run build:mp-weixin
echo.
echo 编译完成!
echo 输出目录unpackage/dist/build/mp-weixin
echo.
pause
goto menu
:build_h5
echo.
echo 正在编译 H5生产环境...
echo.
call npm run build:h5
echo.
echo 编译完成!
echo 输出目录unpackage/dist/build/h5
echo.
pause
goto menu
:install
echo.
echo 正在安装依赖...
echo.
call npm install
echo.
echo 依赖安装完成!
echo.
pause
goto menu
:clean
echo.
echo 正在清除缓存...
echo.
if exist node_modules (
echo 删除 node_modules...
rmdir /s /q node_modules
)
if exist unpackage (
echo 删除 unpackage...
rmdir /s /q unpackage
)
echo.
echo 正在重新安装依赖...
call npm install
echo.
echo 清除并重装完成!
echo.
pause
goto menu
:end
echo.
echo 感谢使用!
echo.
pause