<template>
	<!-- 遗产概况 -->
	<view class="situation">
		<navbar title="遗产概况" leftClick @leftClick="$utils.navigateBack" />
		<view class="situation-imgs">
			<view class="situation-imgs-one" 
			v-if="list[0].id"
			@click="toUrl(list[0].id)">
				<image :src="list[0].areaImage" mode="aspectFill"/>
				<view class="text">
					<view class="title text-ellipsis">
						{{ list[0].areaName }}
					</view>
					<view class="tip text-ellipsis">
						{{ list[0].areaBrief }}
					</view>
				</view>
			</view>
			<view class="situation-imgs-two"
			v-if="list[1].id"
			@click="toUrl(list[1].id)">
				<image :src="list[1].areaImage" mode="aspectFill"/>
				<view class="text">
					<view class="title text-ellipsis">
						{{ list[1].areaName }}
					</view>
					<view class="tip text-ellipsis">
						{{ list[1].areaBrief }}
					</view>
				</view>
			</view>
			<view class="situation-imgs-four">
				<view
				v-for="(item,index) in list"
				v-if="index > 1"
				@click="toUrl(item.id)"
				:key="index">
					<image :src="item.areaImage" mode="aspectFill"/>
					<view class="text">
						<view class="title text-ellipsis">
							{{ item.areaName }}
						</view>
						<view class="tip text-ellipsis">
							{{ item.areaBrief }}
						</view>
					</view>
				</view>
			</view>
		</view>
		<tabber />
	</view>
</template>

<script>
	export default {
		data() {
			return {
				queryParams: {
					pageNo: 1,
					pageSize: 10,
				},
				total : 0,
				list : [],
			}
		},
		onShow() {
			this.queryAreaList()
		},
		onReachBottom() {
			this.loadMoreData()
		},
		methods: {
			queryAreaList(){
				this.$api('queryAreaList', res => {
					if(res.code == 200){
						this.list = res.result.records
						this.total = res.result.total
					}
				})
			},
			loadMoreData(){
				if(this.queryParams.pageSize < this.total){
					this.queryParams.pageSize += 10
					this.queryAreaList()
				}
			},
			toUrl(id){
				uni.navigateTo({
					url: '/pages/index/tourGuide?areaId=' + id
				})
			},
		}
	}
</script>

<style scoped lang="scss">
	.situation {
		image{
			width: 100%;
			height: 100%;
		}
		.situation-imgs {
			width: 92%;
			margin-top: 20rpx;
			margin-left: 4%;

			.situation-imgs-one {
				height: 360rpx;
				position: relative;
				border-radius: 30rpx;
				overflow: hidden;
				.text{
					.title{
						font-size: 80rpx;
					}
					.tip{
						font-size: 45rpx;
					}
				}
			}

			.situation-imgs-two {
				margin-top: 20rpx;
				height: 300rpx;
				position: relative;
				border-radius: 30rpx;
				overflow: hidden;
				.text{
					.title{
						font-size: 60rpx;
					}
					.tip{
						font-size: 35rpx;
					}
				}
			}

			.situation-imgs-four {
				display: flex;
				flex-wrap: wrap;
				justify-content: space-between;
				>view {
					margin-top: 20rpx;
					width: 48%;
					height: 260rpx;
					position: relative;
					border-radius: 20rpx;
					overflow: hidden;
					.text{
						.title{
							font-size: 34rpx;
							margin-top: 40rpx;
						}
					}
				}
			}
		}
		.text{
			font-family: 楷体;
			// font-family: Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;
			position: absolute;
			bottom: 0;
			left: 0;
			width: 100%;
			height: 100%;
			background-color: #00000036;
			color: #fff;
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: center;
			font-weight: 900;
			.title{
				font-size: 34rpx;
			}
			.tip{
				font-size: 22rpx;
				margin-top: 10%;
			}
		}
	}
</style>