<template>
	<view class="search-list">
		<view class="search-top">
			<swiper class="swiper" circular :indicator-dots="true">
				<swiper-item>
					<view class="project-item">
						<view class="title">
							<view class="name">
								维绿大厦
							</view>
							<view class="to">
								进入项目
							</view>
						</view>
						<image class="image"
							src="https://assets.api.uizard.io/api/cdn/stream/0ba939e8-082b-42f9-a314-be3e195b3b25.png"
							mode="aspectFill">
						</image>
					</view>
				</swiper-item>
				<swiper-item>
					<view class="project-item">
						<view class="title">
							<view class="name">
								维绿大厦
							</view>
							<view class="to">
								进入项目
							</view>
						</view>
						<image class="image"
							src="https://assets.api.uizard.io/api/cdn/stream/0ba939e8-082b-42f9-a314-be3e195b3b25.png"
							mode="aspectFill">
						</image>
					</view>
				</swiper-item>
				<swiper-item>
					<view class="project-item">
						<view class="title">
							<view class="name">
								维绿大厦
							</view>
							<view class="to">
								进入项目
							</view>
						</view>
						<image class="image"
							src="https://assets.api.uizard.io/api/cdn/stream/0ba939e8-082b-42f9-a314-be3e195b3b25.png"
							mode="aspectFill">
						</image>
					</view>
				</swiper-item>
			</swiper>
		</view>
		<view class="house-list">
			<house-item v-for="(item,index) in list" :house="item" :key="item.id"></house-item>
		</view>
	</view>
</template>

<script>
	import houseItem from "@/components/house/houseItem.vue";
	import {
		getOpenHouseListByPage
	} from '@/request/api/house.js'
	export default {
		data() {
			return {
				list: []
			}
		},
		onLoad(body) {
			console.log(body);
			this.init();
		},
		methods: {
			init() {
				getOpenHouseListByPage({
					currPage: 1,
					pageSize: 10
				}).then(res => {
					if (res.code === 200) {
						this.list = this.list.concat(res.data.dataList); //追加新数据
					}
				})
			}
		},
		components: {
			houseItem
		}
	}
</script>

<style lang="scss">
	.search-list {
		.search-top {
			padding: 30rpx;

			.swiper {
				border-radius: 16rpx;
				overflow: hidden;
				height: 400rpx;
			}

			.project-item {
				height: 100%;
				background: #fff;
				box-shadow: 0px 1px 12px rgba(3, 3, 3, 0.08);

				.title {
					display: flex;
					padding: 20rpx 30rpx;
					align-items: center;
				}

				.name {
					font-weight: bold;
					font-size: 32rpx;
					flex: 1;
					width: 0;
					overflow: hidden;
				}

				.to {
					border: 1px solid $uni-primary;
					width: 160rpx;
					height: 60rpx;
					text-align: center;
					line-height: 60rpx;
					font-size: 24rpx;
					border-radius: 60rpx;
					color: $uni-primary;
				}

				.image {
					height: 300rpx;
				}
			}
		}

		.house-list {
			padding: 30rpx;
			padding-top: 0;
		}
	}
</style>