feat(ui): adopt Tailwind v4 design system and archive change
- Add tailwindcss v4 + @tailwindcss/vite to mall, shop-admin, admin - Add @vmall/shared/theme.css tokens with html[data-accent] presets - Add @vmall/ui kit (VBtn/VBadge/VField/VInput/VCard/VPanel/VTable/VPage, VAccentSwatch, useAccent) as a Nuxt module - Convert all three apps to kit + utilities; delete ui.css/mall.css and every <style scoped>; consoles get accent presets, mall locked to red - Fix VCard boolean prop default (padding) and PDP/store stale useAsyncData keys on param navigation - Archive adopt-tailwind-design-system; new frontend-ui capability spec
This commit is contained in:
+24
-208
@@ -80,222 +80,38 @@ onMounted(() => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="collective-page">
|
||||
<div class="min-h-screen bg-bg pb-14 font-sans text-text">
|
||||
<UiBreadcrumb :items="breadcrumb" />
|
||||
<section class="w1200 marketing-section">
|
||||
<img class="marketing-banner" src="/mock/collective-banner.svg" :alt="t('marketing.collectiveBannerAlt')" />
|
||||
<header class="section-heading">
|
||||
<h1>{{ t("marketing.collectiveTitle") }}</h1>
|
||||
</header>
|
||||
<p v-if="error" class="collective-error" role="alert">{{ error }}</p>
|
||||
<div v-if="loading" class="muted">{{ t("common.loading") }}</div>
|
||||
<div v-else-if="activities.length" class="collective-grid">
|
||||
<article v-for="activity in activities" :key="activity.id" class="collective-card hover-lift">
|
||||
<NuxtLink :to="`/goods/${activity.product_slug}`" class="product-image">
|
||||
<img :src="activity.image || '/mock/product-1.svg'" :alt="pick(activity.product_name, locale)" loading="lazy" />
|
||||
<section class="mx-auto max-w-mall bg-surface px-4">
|
||||
<img class="h-[350px] w-full object-cover" src="/mock/collective-banner.svg" :alt="t('marketing.collectiveBannerAlt')" />
|
||||
<header class="mt-5 border border-border bg-bg px-4 py-3.5"><h1 class="m-0 border-l-[3px] border-primary pl-2.5 text-[17px] font-medium">{{ t("marketing.collectiveTitle") }}</h1></header>
|
||||
<p v-if="error" class="my-4 border border-danger/30 bg-danger/10 px-3.5 py-2.5 text-danger" role="alert">{{ error }}</p>
|
||||
<div v-if="loading" class="py-6 text-muted">{{ t("common.loading") }}</div>
|
||||
<div v-else-if="activities.length" class="grid gap-4 py-5 [grid-template-columns:repeat(auto-fill,minmax(220px,1fr))]">
|
||||
<VCard v-for="activity in activities" :key="activity.id" :padded="false" class="min-w-0 overflow-hidden">
|
||||
<NuxtLink :to="`/goods/${activity.product_slug}`" class="flex h-52 items-center justify-center bg-bg">
|
||||
<img class="h-full w-full object-contain" :src="activity.image || '/mock/product-1.svg'" :alt="pick(activity.product_name, locale)" loading="lazy" />
|
||||
</NuxtLink>
|
||||
<div class="product-body">
|
||||
<NuxtLink :to="`/goods/${activity.product_slug}`" class="product-name">{{ pick(activity.name, locale) }}</NuxtLink>
|
||||
<div class="deal-meta">
|
||||
<span class="deal-price"><PriceText :amount-minor="activity.group_price_minor" :currency="activity.currency" /></span>
|
||||
<span class="group-tag">{{ t("marketing.peopleGroup", { n: activity.required_members }) }}</span>
|
||||
</div>
|
||||
<p class="joined">
|
||||
<s><PriceText :amount-minor="activity.original_price_minor" :currency="activity.original_currency" /></s>
|
||||
</p>
|
||||
|
||||
<div v-if="activity.open_groups.length" class="group-list">
|
||||
<label v-for="group in activity.open_groups" :key="group.id" class="group-option">
|
||||
<input v-model="selectedGroup[activity.id]" type="radio" :name="`group-${activity.id}`" :value="group.id" />
|
||||
<span>{{ t("marketing.paidMembers", { n: group.paid_member_count, total: group.required_members }) }}</span>
|
||||
<span class="group-expiry">{{ group.expires_at.slice(5, 16).replace('T', ' ') }}</span>
|
||||
<div class="p-3.5">
|
||||
<NuxtLink :to="`/goods/${activity.product_slug}`" class="line-clamp-2 font-medium hover:text-primary">{{ pick(activity.name, locale) }}</NuxtLink>
|
||||
<div class="mt-2 flex items-center justify-between gap-2"><span class="text-lg font-semibold text-primary"><PriceText :amount-minor="activity.group_price_minor" :currency="activity.currency" /></span><VBadge tone="red">{{ t("marketing.peopleGroup", { n: activity.required_members }) }}</VBadge></div>
|
||||
<p class="my-2 text-sm text-muted"><s><PriceText :amount-minor="activity.original_price_minor" :currency="activity.original_currency" /></s></p>
|
||||
<div v-if="activity.open_groups.length" class="grid gap-2">
|
||||
<label v-for="group in activity.open_groups" :key="group.id" class="flex cursor-pointer items-center gap-2 rounded-md border border-border p-2 text-xs has-[:checked]:border-primary has-[:checked]:bg-primary-soft">
|
||||
<input v-model="selectedGroup[activity.id]" class="h-4 w-4 accent-primary" type="radio" :name="`group-${activity.id}`" :value="group.id" />
|
||||
<span class="flex-1">{{ t("marketing.paidMembers", { n: group.paid_member_count, total: group.required_members }) }}</span>
|
||||
<span class="text-muted">{{ group.expires_at.slice(5, 16).replace('T', ' ') }}</span>
|
||||
</label>
|
||||
</div>
|
||||
<p v-else class="joined">{{ t("marketing.noOpenGroups") }}</p>
|
||||
|
||||
<div class="group-actions">
|
||||
<button
|
||||
type="button"
|
||||
class="mbtn red"
|
||||
:disabled="workingId === activity.id"
|
||||
@click="start(activity, true)"
|
||||
>
|
||||
{{ t("marketing.openGroup") }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="mbtn"
|
||||
:disabled="workingId === activity.id || !chosenGroup(activity.id)"
|
||||
@click="start(activity, false)"
|
||||
>
|
||||
{{ t("marketing.joinGroup") }}
|
||||
</button>
|
||||
</div>
|
||||
<p v-if="chosenGroup(activity.id)" class="joined">
|
||||
{{ joined(activity, chosenGroup(activity.id)) }}
|
||||
</p>
|
||||
<p v-else class="my-2 text-sm text-muted">{{ t("marketing.noOpenGroups") }}</p>
|
||||
<div class="mt-3 flex gap-2"><VBtn class="flex-1" variant="primary" type="button" :disabled="workingId === activity.id" @click="start(activity, true)">{{ t("marketing.openGroup") }}</VBtn><VBtn class="flex-1" type="button" :disabled="workingId === activity.id || !chosenGroup(activity.id)" @click="start(activity, false)">{{ t("marketing.joinGroup") }}</VBtn></div>
|
||||
<p v-if="chosenGroup(activity.id)" class="mt-2 text-sm text-muted">{{ joined(activity, chosenGroup(activity.id)) }}</p>
|
||||
</div>
|
||||
</article>
|
||||
</VCard>
|
||||
</div>
|
||||
<UiEmptyState v-else :text="t('marketing.noCollectiveProducts')" />
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.collective-page {
|
||||
padding-bottom: 60px;
|
||||
}
|
||||
.marketing-section {
|
||||
background: #fff;
|
||||
}
|
||||
.marketing-banner {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 350px;
|
||||
object-fit: cover;
|
||||
}
|
||||
.section-heading {
|
||||
margin-top: 20px;
|
||||
border: 1px solid var(--mall-line);
|
||||
background: #fafafa;
|
||||
padding: 14px 18px;
|
||||
}
|
||||
.section-heading h1 {
|
||||
margin: 0;
|
||||
border-left: 3px solid var(--mall-red);
|
||||
padding-left: 10px;
|
||||
font-size: 17px;
|
||||
font-weight: 500;
|
||||
}
|
||||
.collective-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(5, minmax(0, 1fr));
|
||||
gap: 15px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
.collective-card {
|
||||
min-width: 0;
|
||||
border: 1px solid var(--mall-line);
|
||||
background: #fff;
|
||||
}
|
||||
.product-image {
|
||||
display: flex;
|
||||
height: 180px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 12px;
|
||||
}
|
||||
.product-image img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: contain;
|
||||
}
|
||||
.product-body {
|
||||
padding: 0 12px 13px;
|
||||
}
|
||||
.product-name {
|
||||
display: block;
|
||||
height: 36px;
|
||||
overflow: hidden;
|
||||
color: var(--mall-ink);
|
||||
font-size: 13px;
|
||||
line-height: 1.4;
|
||||
text-decoration: none;
|
||||
}
|
||||
.product-name:hover {
|
||||
color: var(--mall-red);
|
||||
}
|
||||
.deal-meta {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 5px;
|
||||
margin-top: 11px;
|
||||
}
|
||||
.deal-price {
|
||||
color: var(--mall-red);
|
||||
font-size: 17px;
|
||||
font-weight: 700;
|
||||
}
|
||||
.group-tag {
|
||||
flex: 0 0 auto;
|
||||
border: 1px solid #f2b9bc;
|
||||
background: #fff4f4;
|
||||
padding: 2px 5px;
|
||||
color: var(--mall-red);
|
||||
font-size: 11px;
|
||||
}
|
||||
.joined {
|
||||
margin: 7px 0 10px;
|
||||
color: var(--mall-faint);
|
||||
font-size: 12px;
|
||||
}
|
||||
.deal-link {
|
||||
display: block;
|
||||
border-top: 1px solid var(--mall-line);
|
||||
padding-top: 9px;
|
||||
color: var(--mall-red);
|
||||
font-size: 12px;
|
||||
text-decoration: none;
|
||||
}
|
||||
.deal-link span {
|
||||
float: right;
|
||||
font-size: 16px;
|
||||
line-height: 11px;
|
||||
}
|
||||
@media (max-width: 1240px) {
|
||||
.w1200 {
|
||||
width: calc(100% - 32px);
|
||||
}
|
||||
}
|
||||
@media (max-width: 900px) {
|
||||
.collective-grid {
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
@media (max-width: 600px) {
|
||||
.marketing-banner {
|
||||
height: 220px;
|
||||
}
|
||||
.collective-grid {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
.collective-error {
|
||||
margin: 12px 0 0;
|
||||
padding: 10px 14px;
|
||||
color: #b42318;
|
||||
background: #fff1f0;
|
||||
border: 1px solid #ffd6d2;
|
||||
}
|
||||
.group-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
margin: 8px 0;
|
||||
}
|
||||
.group-option {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
font-size: 12px;
|
||||
color: var(--mall-muted);
|
||||
cursor: pointer;
|
||||
}
|
||||
.group-expiry {
|
||||
margin-left: auto;
|
||||
color: var(--mall-faint);
|
||||
font-size: 11px;
|
||||
}
|
||||
.group-actions {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
.group-actions .mbtn {
|
||||
flex: 1;
|
||||
padding: 5px 8px;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user