123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- <!-- @format -->
- <script lang="ts" setup>
- import { Swiper, SwiperSlide } from 'swiper/vue'
- import { Autoplay, Navigation, Pagination } from 'swiper/modules'
- import { useUserStore } from '@/stores/modules/user'
- import 'swiper/css'
- import 'swiper/css/navigation'
- import 'swiper/css/autoplay'
- import { getHomeBrandListApi } from '~/api/model/brand'
- const userStore = useUserStore()
- const { isLogin } = storeToRefs(userStore)
- const modules = [Navigation, Pagination, Autoplay]
- const categoryList = ref<any>([])
- const swiperVertical = ref<any>(null)
- getHomeBrandList()
- async function getHomeBrandList() {
- try {
- const params = {
- pageNo: 1,
- pageSize: 8,
- }
- const data: any = await getHomeBrandListApi(params)
- categoryList.value = data.records
- }
- catch (error) {
- console.log('error', error)
- }
- }
- function onVerticalSwiper(swiper: any) {
- swiperVertical.value = swiper
- }
- function onClickLeft() {
- // swiperVertical.value.slideTo()
- swiperVertical.value.slidePrev()
- }
- function onClickRight() {
- // swiperVertical.value.slideTo(4)
- swiperVertical.value.slideNext()
- }
- function scrollToCatalogs() {
- const catalogs = document.getElementById('catalogs')
- if (catalogs)
- catalogs.scrollIntoView({ behavior: 'smooth', block: 'start' })
- }
- </script>
- <template>
- <div class="bg-#0F0820">
- <div class="w-1200-auto pos-relative h-800px">
- <div class="text-center pos-absolute top-200px left-50% translate-x--50%">
- <div class="pos-relative">
- <h1 class="text-58px text-#fff fw-800 ls-2">
- Spark The Trend
- </h1>
- <h1 class="text-58px text-#fff fw-800 ls-2">
- Ignite Sales
- </h1>
- <div
- class="pos-absolute top--26px right--60px w-150px py-8px bg-#FFFF66 b-rd-20px transform-rotate-16deg"
- >
- #Trendy Product
- </div>
- <div
- class="pos-absolute bottom-24px left--46px py-8px w-120px text-#fff bg-#1AC18E b-rd-20px transform-rotate--12deg"
- >
- #Wholesale
- </div>
- </div>
- <el-button class="my-80px !b-#fff !text-#fff !bg-#878490" round @click="scrollToCatalogs">
- View Catalogs
- </el-button>
- </div>
- <div
- class="pos-absolute bottom--100px left-50% translate-x--50% w-1100px mx-auto"
- >
- <div
- class="pos-absolute cursor-pointer left--46px top-200px w-28px h-28px transform-translate-y--50% cursor-not-allowed !cursor-pointer flex justify-center items-center"
- @click="onClickLeft()"
- >
- <img
- src="~/assets/images/swiper_icon_l.png"
- alt=""
- class="!w-24px !h-24px"
- srcset=""
- >
- </div>
- <div
- class="pos-absolute cursor-pointer right--46px top-200px w-28px h-28px transform-translate-y--50% cursor-not-allowed !cursor-pointer flex justify-center items-center"
- @click="onClickRight()"
- >
- <img
- src="~/assets/images/swiper_icon_r.png"
- alt=""
- class="!w-24px !h-24px"
- srcset=""
- >
- </div>
- <Swiper
- v-if="categoryList.length"
- :slides-per-view="3"
- :space-between="30"
- :modules="modules"
- :centered-slides="true"
- :loop="true"
- :autoplay="{
- delay: 3000,
- disableOnInteraction: false,
- pauseOnMouseEnter: true,
- }"
- :navigation="false"
- :pagination="true"
- class="pos-relative"
- @swiper="onVerticalSwiper"
- >
- <SwiperSlide v-for="(item, index) in categoryList" :key="index">
- <common-category-item :item="item" />
- </SwiperSlide>
- </Swiper>
- </div>
- </div>
- </div>
- </template>
- <style lang="less" scoped>
- .swiper-slide {
- text-align: center;
- font-size: 18px;
- /* Center slide text vertically */
- display: -webkit-box;
- display: -ms-flexbox;
- display: -webkit-flex;
- display: flex;
- -webkit-box-pack: center;
- -ms-flex-pack: center;
- -webkit-justify-content: center;
- justify-content: center;
- -webkit-box-align: center;
- -ms-flex-align: center;
- -webkit-align-items: center;
- align-items: center;
- transition: 300ms;
- transform: scale(0.835);
- }
- .swiper-slide-active,
- .swiper-slide-duplicate-active {
- transform: scale(1);
- }
- </style>
|