| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225 |
- <template>
- <section class="mb-product-section">
- <!-- tabs 盖在视频下半部分 -->
- <section class="mb-tabs-wrapper">
- <section class="mb-tabs">
- <div v-for="(tab, index) in productTabs" :key="index" class="tab-item" :class="{ active: activeTab === index }"
- @click="activeTab = index">
- {{ tab.name }}
- </div>
- </section>
- </section>
- <!-- cards 正常向下排列 -->
- <section class="mb-cards" :class="{ 'is-multi': isMultiLayout }">
- <div v-for="(card, index) in displayCards" :key="index" class="mb-card">
- <h3 class="card-title">{{ card.title }}</h3>
- <p class="card-description">{{ card.description }}</p>
- <div v-if="card.features?.length" class="card-features">
- <span v-for="(feature, idx) in card.features" :key="idx" class="feature-tag">{{ feature }}</span>
- </div>
- <div class="card-actions">
- <button class="btn-primary" type="button">更多详情</button>
- <button class="btn-secondary" type="button">0元体验</button>
- </div>
- </div>
- </section>
- </section>
- </template>
- <script setup>
- import { ref, computed } from 'vue'
- import { productTabs } from '~/utils/product'
- const activeTab = ref(0)
- const currentTabData = computed(() => productTabs[activeTab.value])
- const displayCards = computed(() => {
- const cards = currentTabData.value?.cards ?? []
- return cards
- })
- const isMultiLayout = computed(() => currentTabData.value?.layout === 'multi')
- </script>
- <style lang="scss" scoped>
- .mb-product-section {
- width: 100%;
- }
- .mb-tabs-wrapper {
- position: relative;
- width: 100%;
- z-index: 3;
- padding: 0 6px;
- box-sizing: border-box;
- }
- .mb-tabs {
- width: 100%;
- box-sizing: border-box;
- height: 42px;
- margin: 0 auto;
- border-radius: 150px;
- background: linear-gradient(177deg, rgba(165, 101, 255, 0.30) -20.47%, rgba(3, 0, 20, 0.30) 134.25%);
- backdrop-filter: blur(20px);
- display: flex;
- align-items: center;
- padding: 0 12px;
- overflow-x: auto;
- scroll-behavior: smooth;
- -webkit-overflow-scrolling: touch;
- scrollbar-width: none;
- -ms-overflow-style: none;
- &::-webkit-scrollbar {
- display: none;
- }
- .tab-item {
- flex-shrink: 0;
- font-weight: 400;
- color: #ffffff;
- font-size: 12px;
- line-height: 16px;
- cursor: pointer;
- white-space: nowrap;
- transition: color 0.3s ease, background 0.3s ease, transform 0.3s ease;
- display: flex;
- align-items: center;
- justify-content: center;
- min-width: 88px;
- height: 32px;
- padding: 0 16px;
- border-radius: 16px;
- background: transparent;
- &.active {
- background: linear-gradient(62.84deg, rgba(130, 77, 255, 1) 0%, rgba(164, 125, 255, 1) 100%);
- color: #ffffff;
- font-weight: 500;
- }
- &:hover:not(.active) {
- color: #bdbdbd;
- transform: translateY(-1px);
- }
- }
- }
- .mb-cards {
- width: 100%;
- box-sizing: border-box;
- margin-top: 20px;
- padding: 0 10px;
- display: flex;
- flex-direction: column;
- gap: 8px;
- }
- .mb-cards.is-multi {
- flex-direction: row;
- overflow-x: auto;
- scroll-snap-type: x mandatory;
- scroll-padding: 10px;
- scroll-behavior: smooth;
- -webkit-overflow-scrolling: touch;
- scrollbar-width: none;
- -ms-overflow-style: none;
- &::-webkit-scrollbar {
- display: none;
- }
- }
- .mb-card {
- width: 100%;
- border-radius: 20px;
- border: 1px solid rgba(198, 186, 255, 0.30);
- background: linear-gradient(177deg, rgba(165, 101, 255, 0.25) -20.47%, rgba(3, 0, 20, 0.25) 134.25%);
- backdrop-filter: blur(20px);
- padding: 18px 16px 16px;
- box-sizing: border-box;
- min-height: 290px;
- display: flex;
- flex-direction: column;
- }
- .mb-cards.is-multi .mb-card {
- flex: 0 0 96%;
- scroll-snap-align: center;
- }
- .card-title {
- margin: 0;
- text-align: center;
- color: #ffffff;
- font-size: 16px;
- font-weight: 500;
- line-height: 18px;
- }
- .card-description {
- margin: 12px 0 0;
- color: rgba(255, 255, 255, 0.65);
- font-size: 12px;
- font-weight: 400;
- line-height: 18px;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 6;
- overflow: hidden;
- }
- .card-features {
- margin-top: 12px;
- display: flex;
- flex-direction: column;
- gap: 10px;
- }
- .feature-tag {
- font-size: 12px;
- font-weight: 400;
- line-height: 12px;
- color: #9b71ff;
- }
- .card-actions {
- margin-top: auto;
- padding-top: 14px;
- display: flex;
- justify-content: flex-end;
- gap: 12px;
- }
- .btn-primary {
- display: flex;
- width: 72px;
- height: 20px;
- justify-content: center;
- align-items: center;
- flex-shrink: 0;
- border-radius: 4px;
- background: linear-gradient(117deg, #A39DFF -41.28%, #7D46FF 60.31%);
- color: #FFF;
- font-size: 12px;
- font-weight: 400;
- padding: 2px 6px;
- }
- .btn-secondary {
- display: flex;
- width: 72px;
- height: 20px;
- justify-content: center;
- align-items: center;
- flex-shrink: 0;
- border-radius: 4px;
- background: rgba(255, 255, 255, 0.20);
- backdrop-filter: blur(2px);
- color: #FFF;
- font-size: 12px;
- font-weight: 400;
- padding: 2px 6px;
- }
- </style>
|