<template>
	<app-layout>
		<view class="popcase">
			<view class="item" v-for="(item,index) in exampleList"
				@tap="goPage(`/pages/case/caseDetails?id=${item.id}`)">
				<image :src="item.cover_pic" mode=""></image>
				<view class="main-between bt">
					<view class="main-between-y">
						<view class="title t-omit">{{item.title}}</view>
						<!-- <view class="desc">{{item.exampleStyle.name}}·{{item.exampleHouse.name}}</view> -->
					</view>
					<!-- <view class="price20"><text class="rmb">￥</text>2466.00</view> -->
				</view>
			</view>
			<appNoGoods v-if="exampleList.length===0" :title="'没有任何案例...'"></appNoGoods>
		</view>
	</app-layout>
</template>

<script>
	import appNoGoods from '@/components/page-component/app-no-goods/app-no-goods.vue'
	export default {
		components: {
			appNoGoods
		},
		data() {
			return {
				exampleList: [],
				page: 1,

			};
		},
		watch: {

		},
		computed: {

		},
		methods: {
			getExampleList() {
				this.$request({
					url: this.$api.example.list,
					data: {
						style_id: this.style_id,
						house_id: this.house_id,
						is_chosen: 0,
						page: this.page
					},
					method: 'post'
				}).then(res => {
					if (res.code === 0) {
						this.exampleList = res.data.list
					}
				})
			},
			goPage(url) {
				uni.navigateTo({
					url: url
				})
			},
		},
		onLoad(option) {
			this.style_id = option.style_id ? option.style_id : ''
			this.house_id = option.house_id ? option.house_id : ''
			uni.setNavigationBarTitle({
				title: option.nav_title
			});
			this.getExampleList()
		},
		onReachBottom() {
			this.page++
			this.getExampleList()
		}
	};
</script>

<style lang="scss" scoped>
	@import '../index/index.scss';

	.tabs {
		box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
		background-color: #fff;
		padding: 30rpx 36rpx 20rpx;
		position: relative;
		z-index: 10;

		.item {
			display: inline-block;
			text-align: center;
			font-size: 32rpx;
			font-weight: bold;
			color: #999999;
			margin-right: 36rpx;
		}

		.active {
			color: #222222;
			position: relative;
		}

		.underline {
			position: absolute;
			bottom: 20rpx;
			z-index: 100;
		}
	}

	.popcase {
		padding-top: 40rpx;

		.item {
			width: 678rpx;
			height: auto;
			background: #FFFFFF;
			border-radius: 8rpx;
			margin: 0 auto 30rpx;
			overflow: hidden;

			image {
				width: 100%;
				height: 340rpx;
			}

			.bt {
				padding: 27rpx 24rpx 37rpx 33rpx;
			}

			.title {
				width: 580rpx;
				font-size: 32rpx;
				font-weight: bold;
				color: #222222;
			}

			.desc {
				font-size: 22rpx;
				font-weight: 500;
				color: #A6824F;
			}
		}
	}
</style>
