杂务:整理文档并收口 YumiNail 修复
This commit is contained in:
@@ -28,12 +28,33 @@
|
||||
|
||||
<div v-if="announcements.length" class="announcement-bar">
|
||||
<div class="announcement-track">
|
||||
<span v-for="item in announcementLoop" :key="`${item.id}-${item.loopKey}`">
|
||||
<button
|
||||
v-for="item in announcementLoop"
|
||||
:key="`${item.id}-${item.loopKey}`"
|
||||
class="announcement-item"
|
||||
type="button"
|
||||
@click="openAnnouncementDetail(item)"
|
||||
>
|
||||
<b>{{ item.publisherName || '平台' }}</b>:{{ item.content }}
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a-modal
|
||||
v-model:open="announcementDetailOpen"
|
||||
title="公告详情"
|
||||
:footer="null"
|
||||
centered
|
||||
>
|
||||
<div v-if="selectedAnnouncement" class="announcement-detail">
|
||||
<div class="announcement-detail__meta">
|
||||
<span>{{ selectedAnnouncement.publisherName || '平台' }}</span>
|
||||
<span>{{ formatAnnouncementTime(selectedAnnouncement.publishTime) }}</span>
|
||||
</div>
|
||||
<p>{{ selectedAnnouncement.content }}</p>
|
||||
</div>
|
||||
</a-modal>
|
||||
|
||||
<a-alert
|
||||
v-if="!isLoggedIn"
|
||||
class="guest-alert"
|
||||
@@ -43,7 +64,7 @@
|
||||
description="先逛作品和门店,收藏、加购、下单时再登录即可。"
|
||||
/>
|
||||
|
||||
<section class="section">
|
||||
<section v-if="!isLoggedIn" class="section">
|
||||
<div class="banner-container">
|
||||
<div class="banner-carousel">
|
||||
<a-carousel v-if="bannerImages.length" autoplay :autoplay-speed="3200" effect="fade">
|
||||
@@ -181,6 +202,8 @@ const featuredItems = ref<ProductCardItem[]>([])
|
||||
const popularSource = ref<ProductCardItem[]>([])
|
||||
const popularItems = ref<ProductCardItem[]>([])
|
||||
const announcements = ref<AnnouncementVO[]>([])
|
||||
const selectedAnnouncement = ref<AnnouncementVO | null>(null)
|
||||
const announcementDetailOpen = ref(false)
|
||||
const productImageCache = ref<Record<string, string>>({})
|
||||
/** searchQuery is a reactive state variable used by the template and event handlers. */
|
||||
const searchQuery = ref('')
|
||||
@@ -201,10 +224,20 @@ const displayName = computed(() => userInfo.value?.nickname || (isLoggedIn.value
|
||||
/** announcementLoop is a reactive state variable used by the template and event handlers. */
|
||||
const announcementLoop = computed(() => [...announcements.value, ...announcements.value].map((item, index) => ({ ...item, loopKey: index })))
|
||||
|
||||
const openAnnouncementDetail = (item: AnnouncementVO) => {
|
||||
selectedAnnouncement.value = item
|
||||
announcementDetailOpen.value = true
|
||||
}
|
||||
|
||||
const formatAnnouncementTime = (value?: string) => {
|
||||
if (!value) return ''
|
||||
return value.replace('T', ' ').slice(0, 16)
|
||||
}
|
||||
|
||||
/** getRandomColor is a local helper used by this page script. */
|
||||
const getRandomColor = (): string => {
|
||||
const colors = ['#ffe4d6', '#d6eaff', '#e2ffd6', '#fff2d6', '#d6ffe4', '#e4d6ff']
|
||||
return colors[Math.floor(Math.random() * colors.length)] ?? '#ffe4d6'
|
||||
const colors = ['var(--theme-primary-soft)', 'var(--secondary-bg-color)', 'var(--theme-page-bg)']
|
||||
return colors[Math.floor(Math.random() * colors.length)] ?? 'var(--theme-primary-soft)'
|
||||
}
|
||||
|
||||
/** getProductCoverUrl is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
|
||||
@@ -400,13 +433,18 @@ const openShopById = (shopId: IdType) => {
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await Promise.all([
|
||||
const homeTasks = [
|
||||
loadUserInfo(),
|
||||
loadAnnouncements(),
|
||||
loadPublicShops(),
|
||||
loadFeaturedProducts(),
|
||||
loadPopularProducts()
|
||||
])
|
||||
]
|
||||
|
||||
if (!isLoggedIn.value) {
|
||||
homeTasks.push(loadPublicShops())
|
||||
}
|
||||
|
||||
await Promise.all(homeTasks)
|
||||
window.addEventListener('scroll', handleScroll)
|
||||
})
|
||||
|
||||
@@ -416,6 +454,15 @@ onUnmounted(() => {
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.mobile-container {
|
||||
background:
|
||||
linear-gradient(rgba(255, 255, 255, 0.68), rgba(255, 255, 255, 0.92)),
|
||||
var(--theme-background-image),
|
||||
var(--theme-page-bg);
|
||||
background-size: cover, cover, auto;
|
||||
background-position: center top;
|
||||
}
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
@@ -455,8 +502,8 @@ onUnmounted(() => {
|
||||
margin: 12px 20px 0;
|
||||
overflow: hidden;
|
||||
border-radius: 8px;
|
||||
background: #fff7ed;
|
||||
border: 1px solid #fed7aa;
|
||||
background: var(--theme-primary-soft);
|
||||
border: 1px solid var(--theme-border);
|
||||
}
|
||||
|
||||
.announcement-track {
|
||||
@@ -464,14 +511,43 @@ onUnmounted(() => {
|
||||
width: max-content;
|
||||
gap: 32px;
|
||||
padding: 9px 14px;
|
||||
color: #7c2d12;
|
||||
color: var(--theme-primary);
|
||||
animation: announcement-scroll 22s linear infinite;
|
||||
}
|
||||
|
||||
.announcement-track span {
|
||||
.announcement-item {
|
||||
border: 0;
|
||||
padding: 0;
|
||||
background: transparent;
|
||||
color: inherit;
|
||||
cursor: pointer;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.announcement-item:hover {
|
||||
color: var(--theme-accent);
|
||||
}
|
||||
|
||||
.announcement-detail {
|
||||
display: grid;
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.announcement-detail__meta {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
color: #8b8b9a;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.announcement-detail p {
|
||||
margin: 0;
|
||||
color: #1f1f1f;
|
||||
line-height: 1.8;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
@keyframes announcement-scroll {
|
||||
from { transform: translateX(0); }
|
||||
to { transform: translateX(-50%); }
|
||||
@@ -492,7 +568,7 @@ onUnmounted(() => {
|
||||
overflow: hidden;
|
||||
min-height: 220px;
|
||||
box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
|
||||
background: linear-gradient(135deg, #f4f7ff 0%, #eef4ff 100%);
|
||||
background: var(--theme-gradient-soft);
|
||||
}
|
||||
|
||||
.banner-slide {
|
||||
@@ -571,7 +647,7 @@ onUnmounted(() => {
|
||||
}
|
||||
|
||||
.see-all {
|
||||
color: #1677ff;
|
||||
color: var(--theme-primary);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user