Эх сурвалжийг харах

feat: 品类目录册集合UI

chenpeng 4 долоо хоног өмнө
parent
commit
5b8d7306d1

BIN
assets/images/categories_slug_bg.png


+ 3 - 5
assets/style/common.less

@@ -63,13 +63,11 @@
 }
 
 .el-button {
-    background-color: #FAF5F1 !important;
-    border-color: #9B6CFF !important;
-    color: #9B6CFF !important;
+    border-radius: 6px !important;
 
     &:hover {
-        background-color: #9B6CFF !important;
-        border-color: #9B6CFF !important;
+        background-color: #b390fb !important;
+        border-color: #b390fb !important;
         color: #fff !important;
     }
 }

+ 3 - 2
components/AppHeader.vue

@@ -45,8 +45,9 @@ const { navigateBgColor, navigateTextColor } = storeToRefs(commonStore)
 
 <style lang="less" scoped>
 .custom-bg {
-  backdrop-filter: blur(20px);
-  -webkit-backdrop-filter: blur(20px);
+  opacity: 0.9;
+  backdrop-filter: blur(5px);
+  -webkit-backdrop-filter: blur(5px);
   transition: background-color 0.3s ease;
 }
 </style>

+ 33 - 0
components/business/categories/comp/item.vue

@@ -0,0 +1,33 @@
+<script lang='ts' setup>
+defineProps({
+  item: Object as any,
+})
+</script>
+
+<template>
+  <div>
+    <div class="pos-relative b-rd-12px bg-#fff shadow-item overflow-hidden">
+      <img :src="item.img" alt="" srcset="" class="w-100% h-310px  object-cover">
+      <div class="p-30px">
+        <h3
+          class="!mb-10px fw-800 text-24px text-#333 line-clamp-2"
+        >
+          {{ item.title }}
+        </h3>
+        <div class="text-16px text-#999 lh-22px line-clamp-2 mb-20px">
+          {{ item.description }}
+        </div>
+        <el-button class="!bg-#9B6CFF !text-#fff !b-#9B6CFF !h-40px px-24px">
+          Download
+          <svgo-arrow-line-r class="w-16px h-16px ml-10px !text-#fff" />
+        </el-button>
+      </div>
+    </div>
+  </div>
+</template>
+
+<style lang='less' scoped>
+.shadow-item{
+  box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.1);
+}
+</style>

+ 1 - 1
layouts/default.vue

@@ -12,7 +12,7 @@ watch(
   (v) => {
     if (v === '/')
       commonStore.setNavigateBgColor('#0F0820')
-    else commonStore.setNavigateBgColor('#FFFFFF')
+    else commonStore.setNavigateBgColor('#0F0820')
   },
   {
     immediate: true,

+ 52 - 1
pages/categories/[slug].vue

@@ -1,11 +1,62 @@
 <script lang='ts' setup>
+const list = [
+  {
+    id: 1,
+    title: 'Stationary & Office Supplies',
+    description: 'Discover bestsellers and fresh arrivals tailored to your niche.',
+    img: 'https://picsum.photos/560/310',
+  },
+  {
+    id: 2,
+    title: 'Stationary & Office Supplies',
+    description: 'Discover bestsellers and fresh arrivals tailored to your niche.',
+    img: 'https://picsum.photos/560/310',
+  },
+  {
+    id: 3,
+    title: 'Stationary & Office Supplies',
+    description: 'Discover bestsellers and fresh arrivals tailored to your niche.',
+    img: 'https://picsum.photos/560/310',
+  },
+  {
+    id: 4,
+    title: 'Stationary & Office Supplies',
+    description: 'Discover bestsellers and fresh arrivals tailored to your niche.',
+    img: 'https://picsum.photos/560/310',
+  },
+]
 </script>
 
 <template>
   <div>
-    solutions
+    <div class=" bg-#0F0820">
+      <div class="header w-1200-auto text-center flex items-center justify-center h-600px  bg-no-repeat bg-center" style="background-image: url('https://picsum.photos/420/420')">
+        <h1 class="text-58px fw-800 text-#fff ls-2">
+          STATIONARY & OFFICE SUPPLIES
+        </h1>
+      </div>
+    </div>
+    <div class="py-120px w-1200-auto text-center">
+      <h2 class="text-36px fw-800 text-#333 !mb-20px">
+        Our Latest Product <span class="custom-title-bg">Catalogs</span>
+      </h2>
+      <div class="text-#999 text-22px mb-40px">
+        Discover bestsellers and fresh arrivals tailored to your niche.
+      </div>
+      <div class="grid grid-cols-2 gap-64px text-left">
+        <div v-for="item in list" :key="item.id">
+          <business-categories-comp-item :item="item" />
+        </div>
+      </div>
+    </div>
+    <common-block-catalogs />
+    <common-block-blog class="!pb-0"/>
+    <AppFooter />
   </div>
 </template>
 
 <style lang='less' scoped>
+.header{
+  background-position: 50% 75%;
+}
 </style>

+ 12 - 11
pages/categories/index.vue

@@ -3,16 +3,18 @@
 
 <template>
   <div class="bg-#0F0820">
-    <div class="header w-1200-auto text-center pt-224px pb-150px">
-      <h1 class="text-58px fw-800 text-#fff ls-2">
-        Discover, Download,
-      </h1>
-      <h1 class="text-58px fw-800 text-#9B6CFF ls-2 !mt-10px">
-        Delight!
-      </h1>
-      <el-button class="mt-30px !bg-#fff !text-#9B6CFF !b-0px" round>
-        View Catalogs
-      </el-button>
+    <div class="header w-1200-auto flex items-center justify-center text-center h-600px  bg-no-repeat bg-center" style="background-image: url('https://picsum.photos/600/600')">
+      <div>
+        <h1 class="text-58px fw-800 text-#fff ls-2">
+          Discover, Download,
+        </h1>
+        <h1 class="text-58px fw-800 text-#9B6CFF ls-2 !mt-10px">
+          Delight!
+        </h1>
+        <el-button class="mt-30px !bg-#fff !text-#9B6CFF !b-0px" round>
+          View Catalogs
+        </el-button>
+      </div>
     </div>
     <business-categories-list />
     <business-categories-block />
@@ -24,7 +26,6 @@
 
 <style lang='less' scoped>
 .header{
-  background: url('https://picsum.photos/600/600') no-repeat center center;
   background-position-x: right;
 }
 </style>

+ 5 - 4
pages/index.vue

@@ -1,17 +1,17 @@
 <!-- @format -->
 
 <script setup lang="ts">
+import { debounce } from 'lodash-es'
 import { useCommonStore } from '@/stores/modules/common'
 
 const commonStore = useCommonStore()
-
 onMounted(() => {
   const sections = document.querySelectorAll('.data-section')
   const appScroller = document.getElementById('app-scroller')
   if (!appScroller)
     return
-  appScroller.addEventListener('scroll', () => {
-    const scrollPosition = appScroller.scrollTop
+  const handleScroll = debounce(() => {
+    const scrollPosition = appScroller.scrollTop + 72
     sections.forEach((section) => {
       const sectionTop = section.offsetTop
       const sectionHeight = section.offsetHeight
@@ -21,7 +21,8 @@ onMounted(() => {
         commonStore.setNavigateBgColor(newColor)
       }
     })
-  })
+  }, 50)
+  appScroller.addEventListener('scroll', handleScroll)
 })
 </script>
 

+ 0 - 179
pages/test.vue

@@ -1,179 +0,0 @@
-<script setup lang="ts">
-import { onMounted, ref } from 'vue'
-
-const navRef = ref<HTMLElement | null>(null)
-const currentSection = ref('')
-
-function updateNavBackground(section: Element) {
-  const backgroundColor = window.getComputedStyle(section).backgroundColor
-  if (navRef.value)
-    navRef.value.style.backgroundColor = backgroundColor
-}
-
-onMounted(() => {
-  // Intersection Observer for when sections come into view
-  const observer = new IntersectionObserver(
-    (entries) => {
-      console.log('scrollPosition---------1')
-
-      entries.forEach((entry) => {
-        if (entry.isIntersecting) {
-          currentSection.value = entry.target.id
-          updateNavBackground(entry.target)
-        }
-      })
-    },
-    {
-      threshold: 0.5,
-      rootMargin: '-80px 0px 0px 0px', // Adjust based on your nav height
-    },
-  )
-
-  // Observe all sections
-  document.querySelectorAll('.section').forEach((section) => {
-    observer.observe(section)
-  })
-
-  // Scroll event handler for continuous updates
-  // 获取id为app-scroller的元素
-  const appScroller = document.getElementById('app-scroller')
-  appScroller.addEventListener('scroll', () => {
-    console.log('scrollPosition---------2', appScroller?.scrollTop)
-    const sections = document.querySelectorAll('.section')
-    const scrollPosition = window.scrollY + 80 // Add nav height offset
-
-    sections.forEach((section) => {
-      const sectionTop = section.offsetTop
-      const sectionHeight = section.offsetHeight
-
-      if (scrollPosition >= sectionTop && scrollPosition < sectionTop + sectionHeight)
-        updateNavBackground(section)
-    })
-  })
-})
-</script>
-
-<template>
-  <div class="app">
-    <nav ref="navRef" class="navigation">
-      <div class="nav-content">
-        <h1>Logo</h1>
-        <div class="nav-links">
-          <a href="#section1">Section 1</a>
-          <a href="#section2">Section 2</a>
-          <a href="#section3">Section 3</a>
-          <a href="#section4">Section 4</a>
-        </div>
-      </div>
-    </nav>
-
-    <main>
-      <section id="section1" class="section" style="background-color: #f8f9fa;">
-        <h2>Section 1</h2>
-        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
-      </section>
-
-      <section id="section2" class="section" style="background-color: #e9ecef;">
-        <h2>Section 2</h2>
-        <p>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
-      </section>
-
-      <section id="section3" class="section" style="background-color: #dee2e6;">
-        <h2>Section 3</h2>
-        <p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</p>
-      </section>
-
-      <section id="section4" class="section" style="background-color: #ced4da;">
-        <h2>Section 4</h2>
-        <p>Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
-      </section>
-    </main>
-  </div>
-</template>
-
-<style>
-* {
-  margin: 0;
-  padding: 0;
-  box-sizing: border-box;
-}
-
-body {
-  margin: 0;
-  padding: 0;
-  min-height: 100vh;
-}
-
-.app {
-  min-height: 100vh;
-  width: 100%;
-}
-
-.navigation {
-  position: fixed;
-  top: 0;
-  left: 0;
-  right: 0;
-  height: 80px;
-  transition: background-color 0.3s ease;
-  z-index: 1000;
-}
-
-.nav-content {
-  max-width: 1200px;
-  margin: 0 auto;
-  padding: 0 20px;
-  height: 100%;
-  display: flex;
-  align-items: center;
-  justify-content: space-between;
-}
-
-.nav-links {
-  display: flex;
-  gap: 20px;
-}
-
-.nav-links a {
-  color: #333;
-  text-decoration: none;
-  font-weight: 500;
-  transition: color 0.3s ease;
-}
-
-.nav-links a:hover {
-  color: #000;
-}
-
-main {
-  padding-top: 80px;
-  width: 100%;
-}
-
-.section {
-  min-height: 100vh;
-  width: 100%;
-  padding: 40px;
-  display: flex;
-  flex-direction: column;
-  justify-content: center;
-  align-items: center;
-  text-align: center;
-}
-
-h1 {
-  margin: 0;
-  font-size: 24px;
-}
-
-h2 {
-  font-size: 32px;
-  margin-bottom: 20px;
-}
-
-p {
-  max-width: 600px;
-  line-height: 1.6;
-  margin: 0;
-}
-</style>

+ 3 - 5
stores/modules/common.ts

@@ -14,19 +14,17 @@ export const useCommonStore = defineStore(
       if (!color)
         return
       color = color.toUpperCase()
-      console.log('newColor-----color', color)
       if (color === '#0F0820') {
         navigateTextColor.value = '#ffffff'
-        navigateBgColor.value = `${color}`
+        navigateBgColor.value = 'rgba(15,8,32, 0.7)'
       }
       else if (color === '#F3F4FB') {
         navigateTextColor.value = '#0F0820'
-        navigateBgColor.value = `${color}`
+        navigateBgColor.value = 'rgba(243,244,251, 0.7)'
       }
       else if (color === '#FFFFFF') {
-        console.log('newColor-----color---2', color)
         navigateTextColor.value = '#0F0820'
-        navigateBgColor.value = `${color}`
+        navigateBgColor.value = 'rgba(255, 255, 255, 0.7)'
       }
     }