feat: 展示蝦皮主图和店铺 (#142)

This commit is contained in:
chengma
2026-08-11 11:18:51 +08:00
parent a441dfef87
commit 38d6a0a04b
22 changed files with 555 additions and 101 deletions
+3
View File
@@ -249,6 +249,9 @@ tr.empty small { color: #aaa; }
.col-title {
max-width: 18%;
}
.col-shop { max-width: 150px; }
.thumb-placeholder, .thumb-fallback { color: #6b7280; font-size: 12px; white-space: nowrap; }
.detail-product-image { width: 120px; max-height: 120px; object-fit: contain; border: 1px solid #ccd1d6; border-radius: 4px; }
/* ── 弹窗 ─────────────────────────────── */
/* 用 hidden 属性控制显示隐藏,JS 只改这一个属性,不拼样式 */
+14
View File
@@ -342,6 +342,7 @@
title.textContent = productTitle + " · 原图";
link.href = url;
image.alt = productTitle + " 原图";
image.referrerPolicy = "no-referrer";
image.hidden = true;
status.hidden = false;
status.classList.remove("missing");
@@ -363,6 +364,18 @@
});
}
function setupImageThumbnails() {
document.querySelectorAll("[data-image-thumb]").forEach(function (image) {
function showFallback() {
image.hidden = true;
var fallback = image.parentElement && image.parentElement.querySelector("[data-image-thumb-fallback]");
if (fallback) fallback.hidden = false;
}
image.addEventListener("error", showFallback);
if (image.complete && image.naturalWidth === 0) showFallback();
});
}
/* ── 顺运宝登录弹窗:验证码"换一张" ─────────────
图片本身、以及旁边的"换一张"按钮,点了都重新请求验证码接口。
`[必须]` 每次请求带一个新的时间戳查询参数,绕开浏览器缓存——
@@ -474,6 +487,7 @@
setupModals();
setupRowDetail();
setupImagePreview();
setupImageThumbnails();
setupCaptchaRefresh();
setupSybSyncFeedback();
setupSybHistoryRefresh();