fix(listings): 优化账号详情页 UI 与皮肤展台并修复全局居中样式

This commit is contained in:
yml
2026-11-30 16:34:20 +08:00
parent ad94ab23d0
commit 295c88dd2f
9 changed files with 1334 additions and 1022 deletions
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { readError } from '@/shared/utils/error'
import { ElMessage, ElMessageBox } from 'element-plus'
import { computed, nextTick, onMounted, ref, watch } from 'vue'
import { computed, nextTick, onMounted, ref } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { ShoppingCart, Star, StarFilled, ArrowLeft, DocumentCopy } from '@element-plus/icons-vue'
import { goBackOrHome } from '@/shared/utils/routerBack'
@@ -26,7 +26,9 @@ import {
formatRatio,
getCoinWan,
getDailyLoss,
getDetailSkinGroups,
getFaceOwnerText,
getHighlightSkins,
getListingConsumablePrice,
getListingChips,
getListingDisplayPrice,
@@ -65,6 +67,7 @@ const renterAgreementRef = ref<HTMLElement | null>(null)
const { recordListingView, isFavorite, toggleFavorite } = useListingCollections()
const activeImageIndex = ref(0)
const skinShowcaseRef = ref<HTMLElement | null>(null)
const canCreateOrderAfterAgreement = computed(
() =>
@@ -205,39 +208,25 @@ function readGroupedScreenshots(item: Listing) {
})
}
// 皮肤清单(带高光品级)
// 皮肤清单(带高光品级与 Bento 排版)
const detailSkinGroups = computed(() => {
if (!listing.value) return []
const groups = listing.value.asset_summary?.skin_groups
if (typeof groups !== 'object' || groups === null) return []
const titles: Record<string, { title: string; type: string }> = {
melee: { title: '近战皮肤', type: 'melee' },
operatorRed: { title: '干员红皮', type: 'operatorRed' },
operatorGold: { title: '干员金皮', type: 'operatorGold' },
operator: { title: '干员皮肤', type: 'operator' },
weapon: { title: '武器皮肤', type: 'weapon' },
other: { title: '其他皮肤', type: 'other' },
imported: { title: '其他皮肤', type: 'other' },
}
return Object.entries(groups as Record<string, unknown>)
.map(([key, value]) => {
const meta = titles[key] || { title: key, type: 'other' }
return {
key,
type: meta.type,
title: meta.title,
options: Array.isArray(value)
? value.filter((skin): skin is string => typeof skin === 'string')
: [],
}
})
.filter(group => group.options.length)
return getDetailSkinGroups(listing.value)
})
const highlightSkins = computed(() => {
if (!listing.value) return []
return getHighlightSkins(listing.value, 6)
})
const totalSkinCount = computed(() => {
return detailSkinGroups.value.reduce((acc, g) => acc + g.options.length, 0)
})
function scrollToSkinShowcase() {
skinShowcaseRef.value?.scrollIntoView({ behavior: 'smooth', block: 'start' })
}
// 规格胶囊(过滤已展示的哈夫币、保险、AWM)
const secondaryChips = computed(() => {
if (!listing.value) return []
@@ -381,33 +370,6 @@ function updateAgreementReadState(type: 'virtual' | 'renter') {
}
}
// 锁定/解锁背景滚动
watch(agreementVisible, visible => {
const pcMain = document.querySelector('.pc-main') as HTMLElement
if (!pcMain) return
if (visible) {
const scrollTop = pcMain.scrollTop || 0
pcMain.style.overflow = 'hidden'
pcMain.style.position = 'fixed'
pcMain.style.top = `-${scrollTop}px`
pcMain.style.left = '0'
pcMain.style.right = '0'
pcMain.style.width = '100%'
pcMain.dataset.scrollTop = String(scrollTop)
} else {
const scrollTop = parseInt(pcMain.dataset.scrollTop || '0', 10)
pcMain.style.overflow = ''
pcMain.style.position = ''
pcMain.style.top = ''
pcMain.style.left = ''
pcMain.style.right = ''
pcMain.style.width = ''
pcMain.scrollTop = scrollTop
delete pcMain.dataset.scrollTop
}
})
function handleToggleFavorite() {
if (!listing.value) return
const added = toggleFavorite(listing.value)
@@ -553,6 +515,31 @@ function goBack() {
}}</strong>
</div>
</div>
<!-- 首屏高光皮肤速览条(若有) -->
<div v-if="highlightSkins.length" class="header-skin-strip">
<div class="header-skin-label">
<van-icon name="diamond-o" :size="15" />
<span>精选皮肤</span>
<strong class="header-skin-total">{{ totalSkinCount }}款</strong>
</div>
<div class="header-skin-list">
<span
v-for="(skin, index) in highlightSkins"
:key="`${skin.type}-${skin.name}-${index}`"
class="header-skin-chip"
:class="`skin-type-${skin.type}`"
>
<i class="quality-gem" />
<span class="header-skin-badge">{{ skin.badge }}</span>
<span class="header-skin-name">{{ skin.name }}</span>
</span>
</div>
<button type="button" class="header-skin-jump" @click="scrollToSkinShowcase">
<span>查看展台</span>
<van-icon name="arrow-down" :size="12" />
</button>
</div>
</section>
<!-- 多图互动验号展台 (Gallery Showcase) -->
@@ -641,6 +628,67 @@ function goBack() {
</div>
</section>
<!-- 精选皮肤展台(若有) -->
<section
v-if="detailSkinGroups.length"
id="skin-showcase"
ref="skinShowcaseRef"
class="detail-card skin-card"
>
<div class="section-title-bar skin-showcase-header">
<div class="title-left">
<span class="skin-header-badge" aria-hidden="true">
<van-icon name="diamond-o" :size="18" />
</span>
<div class="skin-title-copy">
<h2>精选皮肤展台</h2>
<span class="title-tip">包含近战、红皮、金皮及武器涂装等核心外观资产</span>
</div>
</div>
<div class="skin-summary-bar">
<span
v-for="group in detailSkinGroups"
:key="group.key"
class="skin-summary-chip"
:class="`skin-type-${group.type}`"
>
<i class="quality-gem" />
<span>{{ group.badge }} {{ group.options.length }}</span>
</span>
<span class="skin-total-badge">共 {{ totalSkinCount }} 款精选</span>
</div>
</div>
<div class="skin-groups-container">
<div
v-for="group in detailSkinGroups"
:key="group.key"
class="skin-group-block"
:class="[`skin-cabinet-${group.type}`, { 'is-wide': group.isWide }]"
>
<div class="skin-group-header">
<div class="skin-group-title-wrap">
<span class="skin-group-accent" />
<span class="skin-group-title">{{ group.title }}</span>
<span class="skin-tier-tag">{{ group.tierLabel }}</span>
</div>
<span class="skin-group-count">{{ group.options.length }} 款</span>
</div>
<div class="skin-pill-wrap">
<span
v-for="opt in group.options"
:key="opt"
class="skin-pill"
:class="`skin-type-${group.type}`"
>
<i class="quality-gem" />
<span class="skin-pill-name">{{ opt }}</span>
</span>
</div>
</div>
</div>
</section>
<!-- 号主说明与交接备注 -->
<section class="detail-card note-card">
<div class="section-title-bar">
@@ -656,37 +704,6 @@ function goBack() {
</div>
</section>
<!-- 精选皮肤展台(若有) -->
<section v-if="detailSkinGroups.length" class="detail-card skin-card">
<div class="section-title-bar">
<div class="title-left">
<h2>精选皮肤展台</h2>
<span class="title-tip">包含近战、金皮、红皮及武器皮肤</span>
</div>
<span class="gallery-count">共 {{ totalSkinCount }} 款精选</span>
</div>
<div class="skin-groups-container">
<div v-for="group in detailSkinGroups" :key="group.key" class="skin-group-block">
<div class="skin-group-header">
<span class="skin-group-title">{{ group.title }}</span>
<span class="skin-group-count">{{ group.options.length }} 款</span>
</div>
<div class="skin-pill-wrap">
<span
v-for="opt in group.options"
:key="opt"
class="skin-pill"
:class="`skin-type-${group.type}`"
>
<i class="quality-dot" />
<span>{{ opt }}</span>
</span>
</div>
</div>
</div>
</section>
<!-- 仓库贵重物资 & 额外消耗品(若有) -->
<section v-if="resourceItems.length" class="detail-card resources-card">
<div class="section-title-bar">
@@ -880,6 +897,7 @@ function goBack() {
v-model="agreementVisible"
title="下单协议确认"
width="860px"
style="max-width: calc(100vw - 32px)"
class="order-agreement-dialog"
:close-on-click-modal="false"
>