前端小版本自动更新

This commit is contained in:
2026-04-27 13:37:51 +08:00
parent 8ca34cabd1
commit c93cabe0eb
4 changed files with 46 additions and 3 deletions
+15
View File
@@ -38,3 +38,18 @@
- form 增加 `quantity: 1`(默认值 1
- 模板增加 +/ 步进器 UI
- 提交数据中加入 `quantity: form.value.quantity > 0 ? form.value.quantity : 1`
## 后端 - 根路由增加版本字段
- `routers/api.go`
- 添加包级变量 `GitVersion``GitCommit``BuildTime`
- `GET /api/` 响应新增 `version``gitCommit``buildTime` 三个字段
- `main.go``main()` 启动时将变量赋值给 `routers`
- `install.sh` 修复:`BUILD_TIME` 格式改 `YYYYMMDD_HHMMSS`(去空格,避免 ldflags 解析报错)
## Web 前端 - 版本定义 + Footer 显示
- `vite.config.js`:读取 `package.json``version`,通过 `define: { __APP_VERSION__ }` 注入全局常量
- `components/AppFooter.vue`
- script 中 `const version = __APP_VERSION__`
- 模板中版权行末尾显示 `v{{ version }}`(如 `v0.1.0`