Files
DPM/docs/win-deploy.md
T
Pine d70d9d5fbd feat: add SFX volume control and improve audio feedback
- Implemented separate sound effects volume control in settings.
- Updated backend to handle new `sfx_volume` parameter.
- Enhanced UI to include sound effects volume slider in admin panel.
- Integrated sound effects for various user interactions (clicks, navigation, alerts).
- Added a new global sound engine to manage audio synthesis without external files.
- Updated documentation for Docker deployment and Windows packaging.
- Refactored audio context management to ensure sound effects are available post user interaction.
2026-08-18 07:14:13 +08:00

77 lines
2.7 KiB
Markdown
Raw 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.
# Windows 打包部署指南(免重打包改地址)
## 一、打包后在 exe 同目录放置 config.json(推荐)
打包安装后,在 exe 所在目录(如 `C:\Program Files\云超服昆创园OPC运营中心\`)新建 **`config.json`**
改地址**不需要重新打包**,重启应用即生效:
```json
{
"api_base": "http://192.168.1.9:10085",
"mqtt_url": "ws://192.168.1.3:8083/mqtt",
"mqtt_username": "dpm",
"mqtt_password": "123456"
}
```
- `api_base`FastAPI 后端地址(API / 管理后台 / 媒体)
- `mqtt_url`EMQX Broker 的 **WebSocket** 地址(端口 8083
- `mqtt_username/password`Broker 鉴权账号(默认 dpm / 123456,与后端 .env 一致)
地址解析优先级:**config.json > 后端 /api/config > 构建默认(127.0.0.1**。
## 二、后端 /api/config 方式(同机部署自动生效)
后端 `.env`backend/.env)配置 Broker 后,展播端启动时自动从
`GET /api/config` 获取 MQTT 地址,**无需 config.json**
```
DPM_MQTT_HOST=192.168.1.3
DPM_MQTT_PORT=1883
DPM_MQTT_WS=ws://192.168.1.3:8083/mqtt # 展播端可访问的 WebSocket 地址
MQTT_USERNAME=dpmserver
MQTT_PASSWORD=你的密码
```
> 若后端与 Broker 同机:后端默认 `MQTT_WS_URL=ws://localhost:8083/mqtt` 即可,
> 展播端连 `127.0.0.1` 也通;跨机必须显式配置上面的 IP。
## 三、构建期固定地址(不推荐,需重新打包)
在项目根目录(**构建机器上**)配置 `.env.local`(已被 gitignore):
```
VITE_API_BASE=http://192.168.1.9:10085
VITE_MQTT_URL=ws://192.168.1.3:8083/mqtt
VITE_MQTT_USERNAME=dpm
VITE_MQTT_PASSWORD=123456
```
然后 `yarn build:win`(脚本自动清理旧 exe 进程再打包)。
## 四、打包前必须确认
| 检查项 | 说明 |
|---|---|
| exe 未被运行 | `taskkill /f /im "昆明大学生创业园展播系统.exe"`,或直接用 `yarn build:win` |
| 后端已启动 | 浏览器打开 `http://<后端IP>:10085/api/health` 应返回 `{"ok":true,...}` |
| Broker WebSocket 已开 | EMQX 需开启 8083 端口 WS 监听,且账号密码与 config.json 一致 |
| Windows 防火墙 | 首次运行允许,或放行出站 10085/8083(管理端上传用 10085 |
## 五、常见排查
```
# 测试后端连通(展播机 PowerShell
Invoke-WebRequest http://192.168.1.9:10085/api/health
# 测试 Broker WS 端口
Test-NetConnection 192.168.1.3 -Port 8083
# 看前端启动日志(bootstrap 会打印 MQTT 地址来源)
打开应用后按 F12(WebView2 开发者工具)→ Console
```
- 应用日志打印 `[bootstrap] config.json MQTT -> ...` = config.json 生效
- 打印 `[bootstrap] /api/config MQTT -> ...` = 后端下发
- 两者都没有 = 两个来源都不可达,请检查 IP/防火墙