Files
ops2/.workbuddy/memory/2026-04-27.md
T
2026-04-27 13:04:57 +08:00

41 lines
2.0 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.
# 2026-04-27 工作记录
## 移动端仓库 - 物品列表显示数量
- `pages/warehouse/warehouse.vue`:两处物品卡片(全部 Tab / 仅物品 Tab)均加入 `数量: {{ item.Quantity ?? 1 }}` 显示
## 后端 - 编译时注入 Git 版本信息
- `main.go`:添加 `GitVersion``GitCommit``BuildTime` 三个变量(由 `-ldflags -X` 注入)
- `main.go`:添加 `GET /api/version` 接口(无需认证,返回三个版本字段)
- `install.sh`:编译前读取 `git describe --tags``git rev-parse --short HEAD`、当前时间,组装 `LDFLAGS` 传入 `go build`
- 编译命令示例:`CGO_ENABLED=0 GOOS=linux go build -o OPSYS -ldflags="-s -w -X main.GitVersion=... -X main.GitCommit=... -X main.BuildTime=..." main.go`
## 移动端设置页 - 显示版本号 + 自动递增脚本
- 创建 `frontend/ops2_uniapp/bump-version.js`
- 读取 `manifest.json`(支持去除 JS 注释后再 `JSON.parse`
- `versionCode` +1`versionName` 自动递增 patch 位
- 用法:`node bump-version.js`(打包前手动执行)
- `pages/settings/settings.vue`
- 底部新增"关于"分组,显示版本号
- 真机端:`plus.runtime.version`
- H5 端:`fetch('/manifest.json')` + 去注释 + `JSON.parse`
- 样式补全 `cell-label`
## 移动端仓库 - 物品编辑页补充 quantity 字段
- `pages/warehouse/item-edit.vue`:参考 Web 端 `WarehouseItemEdit.vue`
- form 增加 `quantity: 1`
- 编号和备注之间添加 +/− 步进器 UI
- `fetchDetail` 回填 `quantity: item.Quantity ?? 1`
- 提交数据加入 `quantity: form.value.quantity > 0 ? form.value.quantity : 1`
- 删除调试 log,补步进器样式
## 移动端仓库 - 新增物品页面补充 quantity 字段
- `pages/warehouse/add-item.vue`:参考 Web 端 `WarehouseAddItem.vue`,补充 `quantity` 字段
- form 增加 `quantity: 1`(默认值 1
- 模板增加 +/ 步进器 UI
- 提交数据中加入 `quantity: form.value.quantity > 0 ? form.value.quantity : 1`