|
|
|
@ -1,23 +1,25 @@
|
|
|
|
|
<template>
|
|
|
|
|
|
|
|
|
|
<u-swiper name='images' border-radius='1' :duration='duration' :interval='interval' :height="height"
|
|
|
|
|
:list="swiperList">
|
|
|
|
|
</u-swiper>
|
|
|
|
|
<!-- <u-swiper name='images' border-radius='1' :duration='duration' :interval='interval' :height="height" :list="swiperList">
|
|
|
|
|
</u-swiper> -->
|
|
|
|
|
<swiper class="swipper-container" circular :indicator-dots="indicatorDots" :autoplay="autoplay" :interval="interval"
|
|
|
|
|
:duration="duration">
|
|
|
|
|
<swiper-item @click="toDetails(item.sysGoods)" v-for="(item,index) in swiperList" :key='index'>
|
|
|
|
|
<image class="imgs" :src='item.images'></image>
|
|
|
|
|
</swiper-item>
|
|
|
|
|
</swiper>
|
|
|
|
|
<u-divider margin-top='20' margin-bottom='20' color="#F3AF28">店长推荐</u-divider>
|
|
|
|
|
<view class="wrap">
|
|
|
|
|
<u-waterfall v-model="flowList" ref="uWaterfall">
|
|
|
|
|
<template v-slot:left="{leftList}">
|
|
|
|
|
<view @click="toDetails(item)" class="demo-warter" v-for="(item, index) in leftList" :key="index">
|
|
|
|
|
<view class="demo-warter" v-for="(item, index) in leftList" :key="index">
|
|
|
|
|
<!-- 警告:微信小程序中需要hx2.8.11版本才支持在template中结合其他组件,比如下方的lazy-load组件 -->
|
|
|
|
|
|
|
|
|
|
<u-lazy-load threshold="-450" border-radius="10" :image="item.goodsImage.split(',')[0]" :index="index"></u-lazy-load>
|
|
|
|
|
<u-lazy-load @click="toDetails(item)" threshold="-450" border-radius="10"
|
|
|
|
|
:image="item.goodsImage.split(',')[0]" :index="index"></u-lazy-load>
|
|
|
|
|
<view class="demo-title">
|
|
|
|
|
|
|
|
|
|
{{item.goodsName}}
|
|
|
|
|
</view>
|
|
|
|
|
<view class="price-item">
|
|
|
|
|
<view class="demo-price">
|
|
|
|
|
|
|
|
|
|
{{item.specs[0].goodsPrice}}元
|
|
|
|
|
</view>
|
|
|
|
|
<view class="demo-title">
|
|
|
|
@ -28,16 +30,14 @@
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
<template v-slot:right="{rightList}">
|
|
|
|
|
<view @click="toDetails(item)" class="demo-warter" v-for="(item, index) in rightList" :key="index">
|
|
|
|
|
|
|
|
|
|
<u-lazy-load threshold="-450" border-radius="10" :image="item.goodsImage.split(',')[0]" :index="index"></u-lazy-load>
|
|
|
|
|
<view class="demo-warter" v-for="(item, index) in rightList" :key="index">
|
|
|
|
|
<u-lazy-load @click="toDetails(item)" threshold="-450" border-radius="10"
|
|
|
|
|
:image="item.goodsImage.split(',')[0]" :index="index"></u-lazy-load>
|
|
|
|
|
<view class="demo-title">
|
|
|
|
|
|
|
|
|
|
{{item.goodsName}}
|
|
|
|
|
</view>
|
|
|
|
|
<view class="price-item">
|
|
|
|
|
<view class="demo-price">
|
|
|
|
|
|
|
|
|
|
{{item.specs[0].goodsPrice}}元
|
|
|
|
|
</view>
|
|
|
|
|
<view class="demo-title">
|
|
|
|
@ -52,16 +52,16 @@
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
|
import {
|
|
|
|
|
getSwipperListApi,
|
|
|
|
|
getHotListApi
|
|
|
|
|
} from '../../api/home.js'
|
|
|
|
|
import {
|
|
|
|
|
ref
|
|
|
|
|
} from 'vue';
|
|
|
|
|
import {
|
|
|
|
|
onLoad
|
|
|
|
|
} from '@dcloudio/uni-app';
|
|
|
|
|
import {
|
|
|
|
|
getSwipperListApi,
|
|
|
|
|
getHotListApi
|
|
|
|
|
} from '../../api/home.js'
|
|
|
|
|
const carimg = ref('/static/goodscar.png')
|
|
|
|
|
//轮播图高度
|
|
|
|
|
const height = ref('400')
|
|
|
|
@ -73,26 +73,14 @@
|
|
|
|
|
const interval = ref(2000)
|
|
|
|
|
//滑动动画时长
|
|
|
|
|
const duration = ref(500)
|
|
|
|
|
|
|
|
|
|
//定义轮播图的数据,创建一个空数组
|
|
|
|
|
//定义轮播图的数据
|
|
|
|
|
const swiperList = ref([])
|
|
|
|
|
//列表数据,默认空数组
|
|
|
|
|
const flowList = ref([]) //跳转详情
|
|
|
|
|
const toDetails = (item) => {
|
|
|
|
|
//在起始页面跳转到details.vue页面并传递参数
|
|
|
|
|
// uni.navigateTo({
|
|
|
|
|
// url: '../detail/detail?goods=' + JSON.stringify(item)
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: '../detail/detail?goods=' + encodeURIComponent(JSON.stringify(item))
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
//列表数据
|
|
|
|
|
const flowList = ref([])
|
|
|
|
|
//获取轮播图数据
|
|
|
|
|
const getSwipperList = async () => {
|
|
|
|
|
let res = await getSwipperListApi()
|
|
|
|
|
if (res && res.code == 200) {
|
|
|
|
|
console.log(res.data)
|
|
|
|
|
swiperList.value = res.data;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -103,6 +91,14 @@
|
|
|
|
|
flowList.value = res.data;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//跳转详情
|
|
|
|
|
const toDetails = (item) => {
|
|
|
|
|
console.log(item)
|
|
|
|
|
//在起始页面跳转到details.vue页面并传递参数
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: '../detail/detail?goods=' + JSON.stringify(item)
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
onLoad(() => {
|
|
|
|
|
getSwipperList()
|
|
|
|
|
getHotList()
|
|
|
|
@ -117,6 +113,23 @@
|
|
|
|
|
justify-content: center;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 设置轮播图容器高度 */
|
|
|
|
|
.swipper-container {
|
|
|
|
|
height: 150px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 设置swipper-container元素下面的item样式 */
|
|
|
|
|
.swipper-container .item {
|
|
|
|
|
height: 100%;
|
|
|
|
|
text-align: center;
|
|
|
|
|
line-height: 150px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.imgs {
|
|
|
|
|
height: 400rpx;
|
|
|
|
|
width: 100%;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.logo {
|
|
|
|
|
height: 200rpx;
|
|
|
|
|
width: 200rpx;
|
|
|
|
|