优化商品管理筛选功能

This commit is contained in:
yml2213
2026-07-09 23:55:19 +08:00
parent 0a5448b3f5
commit ef67375132
9 changed files with 252 additions and 56 deletions
@@ -171,6 +171,10 @@ export interface AdminListingQuery {
load?: string
skin_group?: string
skin_name?: string
min_coin?: number
max_coin?: number
min_deposit?: number
max_deposit?: number
limit?: number
page?: number
page_size?: number
@@ -185,7 +189,9 @@ export interface AdminListingPage {
export async function fetchAdminListings(query: AdminListingQuery = {}) {
const params = Object.fromEntries(
Object.entries(query).filter(([, value]) => value !== '' && value !== undefined)
Object.entries(query).filter(
([, value]) => value !== '' && value !== undefined && value !== null
)
)
const { data } = await apiClient.get<ApiResponse<AdminListingPage>>('/admin/listings', { params })
return normalizeAdminListingPage(data.data, query)
@@ -131,6 +131,7 @@ const detailScreenshots = computed(() => {
url,
}))
})
const detailScreenshotUrls = computed(() => detailScreenshots.value.map(shot => shot.url))
function readGroupedScreenshots(item: Listing) {
const groups = item.asset_summary?.screenshot_groups
@@ -462,8 +463,20 @@ function handleToggleFavorite() {
<span>{{ detailScreenshots.length }} </span>
</div>
<div class="detail-screenshot-grid">
<figure v-for="shot in detailScreenshots" :key="shot.url" class="detail-screenshot">
<AuthImage :source="shot.url" :alt="shot.label" />
<figure
v-for="(shot, index) in detailScreenshots"
:key="shot.url"
class="detail-screenshot"
>
<AuthImage
:source="shot.url"
:alt="shot.label"
image-class="detail-screenshot-image"
fallback-class="detail-screenshot-image"
fit="cover"
:preview-src-list="detailScreenshotUrls"
:preview-initial-index="index"
/>
<figcaption>{{ shot.label }}</figcaption>
</figure>
</div>
@@ -908,12 +921,20 @@ function handleToggleFavorite() {
margin: 0;
}
.detail-screenshot img {
.detail-screenshot-image {
width: 100%;
aspect-ratio: 16 / 10;
object-fit: cover;
overflow: hidden;
border-radius: 12px;
border: 1px solid #edf0f4;
background: #f8fafc;
cursor: zoom-in;
}
.detail-screenshot-image :deep(.el-image__inner) {
width: 100%;
height: 100%;
object-fit: cover;
}
.detail-screenshot figcaption {
@@ -996,8 +1017,7 @@ function handleToggleFavorite() {
margin-bottom: 0;
border: 1px solid rgba(245, 158, 11, 0.2);
background:
linear-gradient(135deg, rgba(255, 251, 235, 0.96), rgba(255, 247, 237, 0.92)),
#fffbeb;
linear-gradient(135deg, rgba(255, 251, 235, 0.96), rgba(255, 247, 237, 0.92)), #fffbeb;
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86);
}
@@ -133,6 +133,7 @@ const detailScreenshots = computed(() => {
url,
}))
})
const detailScreenshotUrls = computed(() => detailScreenshots.value.map(shot => shot.url))
function readGroupedScreenshots(item: Listing) {
const groups = item.asset_summary?.screenshot_groups
@@ -328,7 +329,9 @@ function handleToggleFavorite() {
:source="detailScreenshots[0].url"
:alt="getListingTitle(listing)"
image-class="cover-img"
fit="cover"
loading="eager"
:preview-src-list="detailScreenshotUrls"
/>
<div v-else class="cover-placeholder">
<van-icon name="photo-o" :size="40" color="#ccc" />
@@ -449,8 +452,20 @@ function handleToggleFavorite() {
<div v-if="detailScreenshots.length" class="info-card">
<h3 class="card-subtitle">账号截图</h3>
<div class="screenshot-grid">
<figure v-for="shot in detailScreenshots" :key="shot.url" class="screenshot-item">
<AuthImage :source="shot.url" :alt="shot.label" image-class="screenshot-thumb" />
<figure
v-for="(shot, index) in detailScreenshots"
:key="shot.url"
class="screenshot-item"
>
<AuthImage
:source="shot.url"
:alt="shot.label"
image-class="screenshot-thumb"
fallback-class="screenshot-thumb"
fit="cover"
:preview-src-list="detailScreenshotUrls"
:preview-initial-index="index"
/>
<figcaption>{{ shot.label }}</figcaption>
</figure>
</div>
@@ -630,6 +645,12 @@ function handleToggleFavorite() {
}
.cover-img {
width: 100%;
height: 100%;
cursor: zoom-in;
}
.cover-img :deep(.el-image__inner) {
width: 100%;
height: 100%;
object-fit: cover;
@@ -876,11 +897,18 @@ function handleToggleFavorite() {
.screenshot-thumb {
width: 100%;
aspect-ratio: 4 / 3;
object-fit: cover;
overflow: hidden;
border-radius: 8px;
background: #f8fafc;
cursor: pointer;
}
.screenshot-thumb :deep(.el-image__inner) {
width: 100%;
height: 100%;
object-fit: cover;
}
.screenshot-item figcaption {
margin-top: 4px;
color: #6b7280;