|
|
|
<!--
|
|
|
|
* @Author: ch
|
|
|
|
* @Date: 2019-08-22 19:41:20
|
|
|
|
* @LastEditors: ch
|
|
|
|
* @LastEditTime: 2022-03-29 14:01:10
|
|
|
|
* @Description: file content
|
|
|
|
-->
|
|
|
|
<template>
|
|
|
|
<view>
|
|
|
|
<view class="header">
|
|
|
|
<view class="logo" :class="{'logo__min' : scrollTop > 35 }"></view>
|
|
|
|
<view class="search search__min" v-if="scrollTop > 35" @click="$Router.push('/search')">
|
|
|
|
<text class="search--input">请输入您想搜索的商品名称</text>
|
|
|
|
</view>
|
|
|
|
<view class="msg">
|
|
|
|
<image class="msg--icon" src="@/static/index/msg.png"></image>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="search" @click="$Router.push('/search')">
|
|
|
|
<text class="search--input">请输入您想搜索的商品名称</text>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<Banner :bannerList="bannerList"></Banner>
|
|
|
|
|
|
|
|
<view class="category">
|
|
|
|
<view class="category--item" v-for="item in categoryList" :key="item.url">
|
|
|
|
<view class="category--image-box">
|
|
|
|
<image class="category--image" src="@/static/tabbar/home-active.png"></image>
|
|
|
|
</view>
|
|
|
|
<text class="category--title">{{item.title}}</text>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<Sekill></Sekill>
|
|
|
|
|
|
|
|
<view class="title">甄选推荐</view>
|
|
|
|
<Pick></Pick>
|
|
|
|
|
|
|
|
<view class="title">为您推荐</view>
|
|
|
|
<BsGoodsGroup></BsGoodsGroup>
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
<script>
|
|
|
|
import BsGoodsGroup from '@/components/BsGoodsGroup';
|
|
|
|
import Sekill from './components/Sekill';
|
|
|
|
import Pick from './components/Pick';
|
|
|
|
import Banner from './components/Banner';
|
|
|
|
import {ApiGetBannerData} from '@/common/api/index.js';
|
|
|
|
export default {
|
|
|
|
components : {BsGoodsGroup, Pick, Banner, Sekill},
|
|
|
|
data(){
|
|
|
|
return {
|
|
|
|
scrollTop : 0,
|
|
|
|
bannerList: [],
|
|
|
|
categoryList : [
|
|
|
|
{ url : 'bz2.png', title : '数码周边'},
|
|
|
|
{ url : 'bz1.png', title : '数码周边'},
|
|
|
|
{ url : 'bz3.png', title : '数码周边'},
|
|
|
|
{ url : 'bz4.png', title : '数码周边'},
|
|
|
|
{ url : 'bz5.png', title : '数码周边'},
|
|
|
|
{ url : 'bz6.png', title : '数码周边'},
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
onLoad(){
|
|
|
|
this.getBannerList();
|
|
|
|
},
|
|
|
|
onShow(){
|
|
|
|
uni.pageScrollTo({
|
|
|
|
scrollTop: 0,
|
|
|
|
duration : 0
|
|
|
|
});
|
|
|
|
this.scrollTop = 0;
|
|
|
|
|
|
|
|
console.log(this.$store.state);
|
|
|
|
},
|
|
|
|
onPageScroll({scrollTop}){
|
|
|
|
if(this.scrollTop > 36 && scrollTop > 36){
|
|
|
|
return
|
|
|
|
}
|
|
|
|
this.scrollTop = scrollTop;
|
|
|
|
|
|
|
|
},
|
|
|
|
methods : {
|
|
|
|
async getBannerList(){
|
|
|
|
const {error, result} = await ApiGetBannerData({pageIndex:1, length:999});
|
|
|
|
console.log(result)
|
|
|
|
this.bannerList = result.concat(result).map(i => i.imgUrl);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
page{
|
|
|
|
background: #f8f8f8;
|
|
|
|
padding-bottom: 120rpx;
|
|
|
|
}
|
|
|
|
.header{
|
|
|
|
position: sticky;
|
|
|
|
top: var(--window-top);
|
|
|
|
z-index:999;
|
|
|
|
height: 88rpx;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: space-between;
|
|
|
|
background: #69ADE5;
|
|
|
|
padding: 0 30rpx;
|
|
|
|
}
|
|
|
|
.logo{
|
|
|
|
width: 265rpx;
|
|
|
|
height: 50rpx;
|
|
|
|
background: url("@/static/index/logo.png");
|
|
|
|
background-size: 265rpx;
|
|
|
|
&__min{
|
|
|
|
width: 50rpx;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.msg{
|
|
|
|
&--icon{
|
|
|
|
width: 32rpx;
|
|
|
|
height: 38rpx;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.search{
|
|
|
|
padding: 0 30rpx;
|
|
|
|
background: #69ADE5;
|
|
|
|
&__min{
|
|
|
|
width: 548rpx;
|
|
|
|
}
|
|
|
|
&--input{
|
|
|
|
display: flex;
|
|
|
|
height: 70rpx;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: space-between;
|
|
|
|
background: rgba(255, 255, 255, .3);
|
|
|
|
color: #fff;
|
|
|
|
border-radius: 8rpx;
|
|
|
|
padding: 0 30rpx;
|
|
|
|
font-size: 24rpx;
|
|
|
|
&::after{
|
|
|
|
display: block;
|
|
|
|
content: "";
|
|
|
|
width: 34rpx;
|
|
|
|
height: 36rpx;
|
|
|
|
background: url("@/static/index/search.png");
|
|
|
|
background-size: 100%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
&--icon{
|
|
|
|
width: 34rpx;
|
|
|
|
height: 36rpx;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.category{
|
|
|
|
display: flex;
|
|
|
|
padding: 0 20rpx;
|
|
|
|
flex-wrap: wrap;
|
|
|
|
&--item{
|
|
|
|
padding: 0 10rpx;
|
|
|
|
margin-bottom: 40rpx;
|
|
|
|
}
|
|
|
|
&--image-box{
|
|
|
|
width: 120rpx;
|
|
|
|
height: 120rpx;
|
|
|
|
}
|
|
|
|
&--image{
|
|
|
|
width: 120rpx;
|
|
|
|
height: 120rpx;
|
|
|
|
}
|
|
|
|
&--title{
|
|
|
|
font-size: 24rpx;
|
|
|
|
color: #666;
|
|
|
|
text-align: center;
|
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.title{
|
|
|
|
font-size: 36rpx;
|
|
|
|
margin: 60rpx 30rpx 30rpx;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</style>
|