feat(product): 商品图删除接通 + 至少保留一张

- 详情页编辑态的删除叉子原是纯 CSS ::after 装饰、没绑事件,且列表用的是 asset id 而非删除接口要的
  ProductImage id —— 接通:编辑态点图真调删除接口、用 ProductImage id,非编辑态仍点击放大
- 商品至少保留一张图(与「创建必须带图」一致):后端删到最后一张返回 400;前端只剩一张时那张不显示
  叉子 + 提示「商品至少保留一张图;要移除请删除整个商品」;封面无对应 ProductImage(如三视图采用为封面)
  则只展示、不可删
- 加 2 个后端测试(多张可删 200 / 删最后一张 400)

真实接口验:两张删一张 200、再删最后一张 400 并保留一张;后端测试通过,tsc/build 通过。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
seaislee1209
2026-06-23 16:29:05 +08:00
co-authored by Claude Opus 4.8
parent f02c8053a1
commit f9c52a171c
4 changed files with 72 additions and 18 deletions
+5 -2
View File
@@ -336,8 +336,9 @@
.img-upload:hover { border-color: var(--heat); color: var(--heat); }
.img-upload svg { width: 18px; height: 18px; }
.ov-card.editing .img-upload { display: grid; }
.ov-card.editing .ov-images-sub .thumb { cursor: pointer; }
.ov-card.editing .ov-images-sub .thumb::after {
/* 编辑态:可删的图(有 ProductImage 关联)右上角显示删除 X;整块点击即删 */
.ov-card.editing .ov-images-sub .thumb.is-del { cursor: pointer; }
.ov-card.editing .ov-images-sub .thumb.is-del::after {
content: '×';
position: absolute;
top: 4px; right: 4px;
@@ -348,7 +349,9 @@
display: grid; place-items: center;
font-size: 13px;
line-height: 1;
pointer-events: none;
}
.ov-card.editing .ov-images-sub .thumb.is-del:hover::after { background: var(--heat); }
.ov-images-sub .thumb { position: relative; }
.pd-overview .ov-h {
display: flex; align-items: baseline; gap: 8px;