<template>
	<view class="special-content clearfix">
		<view class="swiper-goods-box">
			<view class="goods-box-item" v-for="(item,index) in productList" :key="index" @click="NavToDetailPage(item)">
				<image :src="item.image" mode="" class="box-item-image"></image>
				<view class="box-item-mask">{{ item.title }}</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default{
		name:"specialContent",
		props:{
			list:{
				type:Array
			}
		},
		data() {
			return{
				current:0,
				productList:[]
			}
		},
		created(){
			this.initData(this.list)
		},
		computed: {
	
		},
		methods:{
			initData(list){
				this.productList = list
			},
			swiperChange(e) {//轮播图切换
				const index = e.detail.current;
				this.current = index;
			},
			NavToDetailPage(floor) {//跳转
				console.log(floor)
				/**
				 * 页面跳转类型
				 * 1、二级页面,2、搜索项目仪器,3、直播页面,4、自由页面,5、商品详情,6、仪器项目详情,7、供应商主页
				 * 8、专题活动页,9、二手市场介绍,10、二手商品列表,11、二手商品发布,12、商品搜索,13、信息详情
				 * 14、品牌招商介绍页,15、维修保养介绍页,16、首页,17、注册页,18、信息中心,19、供应商列表
				 **/
				 if(floor.linkType){
					 const typeMap = {
					 	1:`/pages/goods/goods-instrument?linkId=${floor.linkParam.id}&title=${floor.title}`,
					 	2:`/pages/goods/instrument-details?id=${floor.linkParam.id}`,
					 	5:`/pages/goods/product?id=${floor.linkParam.id}`,
					 	7:`/supplier/pages/user/my-shop?shopId=${floor.linkParam.id}`,
					 	8:`/h5/pages/activity/activity-list`,
					 	9:`/second/pages/form/introduce`,
					 	10:`/second/pages/product/product-list`,
					 	11:`/second/pages/form/form`,
					 	12:`/pages/search/search?keyWord=${floor.title}`,
					 	13:`/h5/pages/article/page?link=${floor.link}`,
					 	14:`/h5/pages/article/page?link=${floor.link}`,
					 	15:`/h5/pages/article/page?link=${floor.link}`,
					 	17:`/pages/login/register-select`,
					 	18:`/h5/pages/article/page?link=${floor.link}`,
					 	19:`/pages/search/search-supplier?keyWord=${floor.title}`
					 }
					 const url = typeMap[floor.linkType];
					 this.$api.navigateTo(url)
				 }
			}
		}
	}
</script>

<style lang="scss">
	.special-content{
		background-color: #F7F7F7;
		width: 100%;
		height: auto;
		box-sizing: border-box;
		padding: 0 24rpx;
	}
	.swiper-goods-box{
		width: 100%;
		height: auto;
		float: left;
		.goods-box-item{
			width: 340rpx;
			height: 340rpx;
			float: left;
			margin-right: 20rpx;
			margin-bottom: 20rpx;
			&:nth-child(2n){
				margin-right: 0;
			}
			position: relative;
			.box-item-image{
				width: 340rpx;
				height: 340rpx;
				display: block;
			}
			.box-item-mask{
				width: 100%;
				height: 64rpx;
				background: rgba(0,0,0,.36);
				line-height: 64rpx;
				font-size: $font-size-26;
				text-align: center;
				color: #FFFFFF;
				position: absolute;
				bottom: 0;
				left: 0;
				box-sizing: border-box;
				padding:0 20rpx;
				white-space: normal;
				word-break: break-all;
				overflow: hidden;
				text-overflow: ellipsis;
				display: -webkit-box;
				-webkit-box-orient: vertical;
				-webkit-line-clamp: 1;
			}
		}
	}
</style>
