<template>
	<view class="container article-list clearfix">
		<view class="section" v-for="(item,index) in productList" :key="index" @click="navigaitionTo(item)">
			<image :src="item.appletsImage" mode="aspectFit" class="cover"></image>
			<view class="article-text">
				<view class="title">{{item.name}}</view>
				<view class="content" v-text="item.content"></view>
			</view>
		</view>
	</view>
</template>

<script>
import caimeiApi from '@/common/config/caimeiApi.js'
export default {
	data(){
		return{
			productList:[]
		}
	},
	props:{
		pageData: {
			type: Object
		},
		userIdentity: {
			type: Number
		},
		flag:{
			type:Boolean,
			default:false
		}
	},
	created() {
		this.initData(this.pageData);
	},
	methods:{
		initData(data){
			if(this.flag){
				this.productList = data.floorImageList
			}else{
				this.productList = data.floorImageList.slice(0,4);
			}
		},
		navigaitionTo(item){
			if (item.adsImage === '' && item.linkType === -1) {
				return
			}else if(item.linkType === -1){
				uni.navigateTo({
					url:`/pages/h5/activity/activity-detail?adsImage=${item.adsImage}&title=${item.name}`
				})
			}else{
				caimeiApi.FlooryNavigateTo(item)
			}
		}
	}
}
</script>

<style lang="scss">
.article-list {
	width: 100%;
	height: auto;
	box-sizing: border-box;
	.section {
		width: 339rpx;
		height: 412rpx;
		background: #ffffff;
		box-sizing: border-box;
		border-radius: 16rpx;
		float: left;
		margin-right: 24rpx;
		margin-top: 24rpx;
		&:nth-child(2n){
			margin-right: 0;
		}
		&:nth-child(1),&:nth-child(2){
			margin-top: 0;
		}
		.cover {
			width: 339rpx;
			height: 240rpx;
			border-radius: 16rpx 16rpx 0 0;
			overflow: hidden;
			.cover-gg{
				width: 339rpx;
				height: 240rpx;
			}
		}
		.article-text {
			width: 339rpx;
			box-sizing: border-box;
			padding: 24rpx;
			.title {
				font-size: 26rpx;
				height: 37rpx;
				color: #3a3a3a;
				margin-bottom: 16rpx;
				word-break: break-all;
				overflow: hidden;
				text-overflow: ellipsis;
				display: -webkit-box;
				-webkit-line-clamp: 1;
				-webkit-box-orient: vertical;
			}
			.content {
				font-size: 24rpx;
				line-height: 40rpx;
				color: #8a8a8a;
				word-break: break-all;
				overflow: hidden;
				text-overflow: ellipsis;
				display: -webkit-box;
				-webkit-line-clamp: 2;
				-webkit-box-orient: vertical;
			}
		}
	}
}
</style>
