<template>
	<!-- 遗产概况 -->
	<view class="situation">
		<navbar title="遗产概况" leftClick @leftClick="$utils.navigateBack" />
		
		<view class="top-img">
			<uv-swiper
			:list="banner.yc" 
			indicator
			height="420rpx"
			keyName="imageContent"></uv-swiper>
		</view>
		
		<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 class="qg-top"></view>
				<view class="qg-bottom"></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 class="qg-top"></view>
				<view class="qg-bottom"></view>
			</view> -->
			
			<view class="situation-imgs-four">
				<view
				v-for="(item,index) in list"
				v-if="index > 0"
				@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 class="qg-top"></view>
					<view class="qg-bottom"></view>
				</view>
			</view>
		</view>
		<tabber />
	</view>
</template>

<script>
	import { mapState } from 'vuex'
	export default {
		data() {
			return {
				queryParams: {
					pageNo: 1,
					pageSize: 10,
				},
				total : 0,
				list : [],
			}
		},
		computed : {
			...mapState(['banner']),
		},
		onShow() {
			this.queryAreaList()
		},
		onReachBottom() {
			this.loadMoreData()
		},
		onPullDownRefresh() {
			this.queryAreaList()
		},
		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
				// })
				
				uni.navigateTo({
					url: '/pages_order/service/areaDetail?id=' + id
				})
			},
		}
	}
</script>

<style scoped lang="scss">
	.situation {
		--qg : 60rpx;
		image{
			width: 100%;
			height: 100%;
		}
		
		.qg-top{
			position: absolute;
			top: 0;
			left: 0;
			width: 100%;
			overflow: hidden;
			display: flex;
			justify-content: space-between;
			&::after{
				content: '';
				display: block;
				width: var(--qg);
				height: var(--qg);
				background-color: $uni-bg-color;
				border-radius: 50%;
				transform: translate(50%, -50%);
			}
			&::before{
				content: '';
				display: block;
				width: var(--qg);
				height: var(--qg);
				background-color: $uni-bg-color;
				border-radius: 50%;
				transform: translate(-50%, -50%);
			}
		}
		.qg-bottom{
			position: absolute;
			bottom: 0;
			left: 0;
			width: 100%;
			overflow: hidden;
			display: flex;
			justify-content: space-between;
			&::after{
				content: '';
				display: block;
				width: var(--qg);
				height: var(--qg);
				background-color: $uni-bg-color;
				border-radius: 50%;
				transform: translate(50%, 50%);
			}
			&::before{
				content: '';
				display: block;
				width: var(--qg);
				height: var(--qg);
				background-color: $uni-bg-color;
				border-radius: 50%;
				transform: translate(-50%, 50%);
			}
		}
		
		.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 {
				position: relative;
				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 {
					position: relative;
					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>