|
|
@@ -0,0 +1,311 @@
|
|
|
+<template>
|
|
|
+ <ion-page>
|
|
|
+ <ion-content :fullscreen="true" class="home">
|
|
|
+ <!-- 轮播图模块 -->
|
|
|
+ <div class="swiper-content">
|
|
|
+ <swiper
|
|
|
+ :modules="[Controller]"
|
|
|
+ @swiper="setSecondSwiper"
|
|
|
+ :controller="{ control: firstSwiper }"
|
|
|
+ class="mySwiper"
|
|
|
+ :autoplay="{ delay: 3500, disableOnInteraction: false }"
|
|
|
+ >
|
|
|
+ <swiper-slide v-for="(item, index) in topBanners" :key="index">
|
|
|
+ <van-image :src="item.pic" fit="cover" height="58.7vw" width="100vw" />
|
|
|
+ </swiper-slide>
|
|
|
+ </swiper>
|
|
|
+
|
|
|
+ <swiper
|
|
|
+ class="swiper-box"
|
|
|
+ :modules="[Controller]"
|
|
|
+ @swiper="setFirstSwiper"
|
|
|
+ :controller="{ control: secondSwiper }"
|
|
|
+ parallax
|
|
|
+ pagination
|
|
|
+ >
|
|
|
+ <swiper-slide v-for="(item, index) in topBanners" :key="index">
|
|
|
+ <div
|
|
|
+ class="text1"
|
|
|
+ data-swiper-parallay="-300"
|
|
|
+ data-swiper-parallax-scale="0.15"
|
|
|
+ data-swiper-parallax-duration="600"
|
|
|
+ >
|
|
|
+ {{ item.remark }}
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ class="text2"
|
|
|
+ data-swiper-parallax="-300"
|
|
|
+ data-swiper-parallax-scale="0.15"
|
|
|
+ data-swiper-parallax-duration="600"
|
|
|
+ >
|
|
|
+ 限量发售
|
|
|
+ </div>
|
|
|
+ </swiper-slide>
|
|
|
+ </swiper>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 通知 -->
|
|
|
+ <van-notice-bar
|
|
|
+ left-icon="volume-o"
|
|
|
+ background="#fff"
|
|
|
+ color="#000"
|
|
|
+ text="
|
|
|
+ 无论我们能活多久,我们能够享受的只有无法分割的此刻,此外别无其他。
|
|
|
+ "
|
|
|
+ >
|
|
|
+ <template #left-icon>
|
|
|
+ <img class="bar-icon" src="../assets/home_icon_redian.png" alt="" />
|
|
|
+ <div class="driver"></div>
|
|
|
+ </template>
|
|
|
+ </van-notice-bar>
|
|
|
+
|
|
|
+ <!-- 初级场 -->
|
|
|
+
|
|
|
+ <template v-for="(item, index) in categories" :key="index">
|
|
|
+ <div class="level">
|
|
|
+ <van-cell :title="item.name" value="全部" :border="false" is-link />
|
|
|
+ <div class="first" v-if="index === 0">
|
|
|
+ <van-image
|
|
|
+ :src="item.icon || firstImg"
|
|
|
+ width="calc(100vw - 40px)"
|
|
|
+ height="calc(100vw - 40px)"
|
|
|
+ fit="cover"
|
|
|
+ radius="4"
|
|
|
+ />
|
|
|
+ <div class="first-content">
|
|
|
+ <product-info></product-info>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="status hot">
|
|
|
+ <img src="../assets/info_icon_qianggouzhong.png" alt="" />
|
|
|
+ <span>火爆抢购中…</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="second" v-else>
|
|
|
+ <van-image :src="item.icon || secondImg" fit="cover" />
|
|
|
+
|
|
|
+ <div class="status">
|
|
|
+ <img src="../assets/info_icon_shijian.png" alt="" />
|
|
|
+ <span>15:00 开启</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <div class="tools">
|
|
|
+ <div class="tool">
|
|
|
+ <img src="../assets/home_icon_pingtaixieyi.png" alt="" />
|
|
|
+ <span>平台协议</span>
|
|
|
+ </div>
|
|
|
+ <div class="tool">
|
|
|
+ <img src="../assets/home_icon_liucheng.png" alt="" />
|
|
|
+ <span>使用教程</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </ion-content>
|
|
|
+ </ion-page>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup>
|
|
|
+import { Swiper, SwiperSlide } from 'swiper/vue'
|
|
|
+import 'swiper/swiper.min.css'
|
|
|
+import 'swiper/swiper-bundle.min.css'
|
|
|
+import SwiperCore, { Pagination, Autoplay, Parallax, Controller } from 'swiper'
|
|
|
+
|
|
|
+import { IonPage, IonHeader, IonToolbar, IonTitle, IonContent, IonButton } from '@ionic/vue'
|
|
|
+import { useRouter } from 'vue-router'
|
|
|
+import { ref, getCurrentInstance, onMounted } from 'vue'
|
|
|
+
|
|
|
+import swiperImg from '../assets/bg.png'
|
|
|
+import firstImg from '../assets/p1.png'
|
|
|
+import secondImg from '../assets/bg2.png'
|
|
|
+
|
|
|
+import productInfo from '../components/ProductInfo.vue'
|
|
|
+
|
|
|
+const router = useRouter()
|
|
|
+function navigate() {
|
|
|
+ router.push({ name: 'login' })
|
|
|
+}
|
|
|
+
|
|
|
+const {
|
|
|
+ appContext: {
|
|
|
+ config: { globalProperties: global }
|
|
|
+ }
|
|
|
+} = getCurrentInstance()
|
|
|
+
|
|
|
+SwiperCore.use([Pagination, Autoplay, Parallax, Controller])
|
|
|
+const firstSwiper = ref(null)
|
|
|
+const secondSwiper = ref(null)
|
|
|
+const setFirstSwiper = swiper => {
|
|
|
+ firstSwiper.value = swiper
|
|
|
+}
|
|
|
+const setSecondSwiper = swiper => {
|
|
|
+ secondSwiper.value = swiper
|
|
|
+}
|
|
|
+
|
|
|
+const topBanners = ref([])
|
|
|
+function getBanner() {
|
|
|
+ global.$http.post('/banner/all', {}, { body: 'json' }).then(res => {
|
|
|
+ topBanners.value = res.content.filter(item => {
|
|
|
+ return item.type === 'TOP'
|
|
|
+ })
|
|
|
+ })
|
|
|
+}
|
|
|
+const categories = ref([])
|
|
|
+function getCategory() {
|
|
|
+ global.$http.post('saleBatch/all', {}, { body: 'json' }).then(res => {
|
|
|
+ categories.value = res.content
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+onMounted(() => {
|
|
|
+ getBanner()
|
|
|
+ getCategory()
|
|
|
+})
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less" scoped>
|
|
|
+.home {
|
|
|
+ --ion-background-color: var(--bg2);
|
|
|
+}
|
|
|
+
|
|
|
+.swiper-content {
|
|
|
+ padding-bottom: 6.4vw;
|
|
|
+}
|
|
|
+.swiper-box {
|
|
|
+ margin: 0 auto;
|
|
|
+ height: 25vw;
|
|
|
+ width: 89vw;
|
|
|
+ background: #112982 linear-gradient(135deg, #d700ff 0%, #3e22ff 100%);
|
|
|
+ box-shadow: 0px 0px 6px 0px #4a65ff;
|
|
|
+ border-radius: 2px;
|
|
|
+ --swiper-theme-color: #fff;
|
|
|
+ --swiper-pagination-color: #fff;
|
|
|
+ position: absolute;
|
|
|
+ top: 40vw;
|
|
|
+ left: 5.5vw;
|
|
|
+ .swiper-slide {
|
|
|
+ .f-col();
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ .text1 {
|
|
|
+ font-size: 20px;
|
|
|
+ font-weight: bold;
|
|
|
+ color: #ffffff;
|
|
|
+ line-height: 28px;
|
|
|
+ text-shadow: 0px 0px 4px rgba(0, 0, 0, 0.5);
|
|
|
+ }
|
|
|
+ .text2 {
|
|
|
+ font-size: 12px;
|
|
|
+ color: #ffffff;
|
|
|
+ line-height: 17px;
|
|
|
+ text-shadow: 0px 0px 4px rgba(0, 0, 0, 0.5);
|
|
|
+ margin-top: 2px;
|
|
|
+ margin-bottom: 15px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /deep/.swiper-pagination-bullet {
|
|
|
+ background-color: #fff;
|
|
|
+ width: 18px;
|
|
|
+ height: 2px;
|
|
|
+ border-radius: 2px;
|
|
|
+ }
|
|
|
+ /deep/.swiper-pagination {
|
|
|
+ bottom: calc(2.7vw + 6px);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.van-notice-bar {
|
|
|
+ margin: 16px 20px 14px;
|
|
|
+ --van-notice-bar-font-size: 13px;
|
|
|
+ border-radius: 4px;
|
|
|
+ .bar-icon {
|
|
|
+ width: 43px;
|
|
|
+ height: 16px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .driver {
|
|
|
+ width: 1px;
|
|
|
+ height: 10px;
|
|
|
+ background: rgba(0, 0, 0, 0.2);
|
|
|
+ margin: 0 8px 0 9px;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+/deep/.van-cell {
|
|
|
+ --van-cell-background-color: var(--bg2);
|
|
|
+ --van-cell-horizontal-padding: 20px;
|
|
|
+ background: var(--bg2);
|
|
|
+ .van-cell__title {
|
|
|
+ font-size: 16px;
|
|
|
+ font-weight: bold;
|
|
|
+ }
|
|
|
+}
|
|
|
+.first {
|
|
|
+ margin: 4px 20px 14px;
|
|
|
+ position: relative;
|
|
|
+ .first-content {
|
|
|
+ position: absolute;
|
|
|
+ bottom: 12px;
|
|
|
+ left: 12px;
|
|
|
+ right: 12px;
|
|
|
+ background: var(--yellow);
|
|
|
+ border-radius: 4px;
|
|
|
+ overflow: hidden;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.status {
|
|
|
+ .f();
|
|
|
+ padding: 2px 6px;
|
|
|
+ background: var(--green);
|
|
|
+ box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.3);
|
|
|
+ border-radius: 4px;
|
|
|
+ position: absolute;
|
|
|
+ top: 18px;
|
|
|
+ left: 18px;
|
|
|
+ img {
|
|
|
+ width: 18px;
|
|
|
+ height: 18px;
|
|
|
+ }
|
|
|
+ span {
|
|
|
+ font-size: 12px;
|
|
|
+ color: #ffffff;
|
|
|
+ line-height: 22px;
|
|
|
+ margin-left: 6px;
|
|
|
+ }
|
|
|
+
|
|
|
+ &.hot {
|
|
|
+ background: var(--red);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.second {
|
|
|
+ margin: 4px 20px 14px;
|
|
|
+ border-radius: 4px;
|
|
|
+ overflow: hidden;
|
|
|
+ position: relative;
|
|
|
+}
|
|
|
+
|
|
|
+.tools {
|
|
|
+ .f();
|
|
|
+ padding: 14px 20px 30px;
|
|
|
+ .tool {
|
|
|
+ width: 50%;
|
|
|
+ .f();
|
|
|
+ justify-content: center;
|
|
|
+ height: 58px;
|
|
|
+ background: #efefef;
|
|
|
+ border-radius: 4px;
|
|
|
+ img {
|
|
|
+ width: 22px;
|
|
|
+ height: 22px;
|
|
|
+ margin-right: 6px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .tool + .tool {
|
|
|
+ margin-left: 15px;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|