<!--
 * @Author: ch
 * @Date: 2019-08-22 19:41:20
 * @LastEditors: ch
 * @LastEditTime: 2022-03-23 20:11:26
 * @Description: file content
-->
<script>
import {ApiGetBannerData} from '@/common/api/index.js';
export default {
	data() {
		return {
			bannerList: [],
			categoryList : [
				{ url : 'bz.png', title : '数码周边'},
				{ url : 'bz.png', title : '数码周边'},
				{ url : 'bz.png', title : '数码周边'},
				{ url : 'bz.png', title : '数码周边'},
				{ url : 'bz.png', title : '数码周边'},
				{ url : 'bz.png', title : '数码周边'},
			]
		}
	},
	async onLoad() {
		const {error, result} = await ApiGetBannerData({pageIndex:1, length:999});
		this.bannerList = result.concat(result).map(i => i.imgUrl);
	},
	methods: {
		
	},
	
	}
</script>
<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('/pages/goods/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('/pages/goods/search')">
			<text class="search--input">请输入您想搜索的商品名称</text>
		</view>

		<Banner></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 './Sekill';
import Pick from './Pick';
import Banner from './Banner';
export default {
	components : {BsGoodsGroup, Pick, Banner},
	data(){
		return {
			scrollTop : 0
		}
	},
	onLoad(){},
	onPageScroll({scrollTop}){
		this.scrollTop = scrollTop;
	}
}
</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>
