<template>
	<view @click="toDetail" class="user-item" :class="{'item-select' : isSelect}">
		<view class="top-info">
			<!-- 头像 -->
			<image class="poster" :src="memberInfo.avatar" mode=""></image>
			<view class="istop" v-if="memberInfo.is_top == 2">
				<view class="iconfont icon-favor_fill_light"></view>
				<view class="text">置顶</view>
			</view>
			<block v-if="isShowPlay">
				<image class="play-btn" :src="imgfixUrls + 'dating/bd_play_video.png'" mode=""></image>
			</block>
			<!-- 浏览量 -->
			<block v-if="isShowViews">
				<view class="look-box">
					<view class="iconfont icon-attention"></view>
					<view class="num">{{memberInfo.pv}}</view>
				</view>
			</block>
			<!-- 操作 -->
			<block v-else>
				<image class="operation" :src="imgfixUrls + 'dating/bd_message2.png'" mode="" @click.stop="extension"></image>
			</block>
			<!-- 位置 -->
			<view class="location">
				<view class="iconfont icon-locationfill"></view>
				<view>{{memberInfo.area}}<span v-if="memberInfo.distances_text">{{memberInfo.distances_text}}</span></view>
			</view>
		</view>
		<view class="user-info">
			<view class="info">
				<view class="name">{{memberInfo.nickname}}</view>
				<view class="sex woman" :class="{'man': memberInfo.gneder == 1}">
					<view v-if="memberInfo.gneder == 2" class="iconfont icon-female"></view>
					<view v-else class="iconfont icon-male"></view>
					<view class="age">{{memberInfo.age}}</view>
				</view>
			</view>
			<view class="property" v-if="propertyInfo.is_show_property">
				<view v-if="propertyInfo.is_have_house" class="property-item" style="margin-left: 30rpx;">
					<view class="iconfont icon-home"></view>
					<view>有房</view>
				</view>
				<view v-if="propertyInfo.is_have_car" class="property-item">
					<view class="iconfont icon-qiche"></view>
					<view>有车</view>
				</view>
				<view v-if="propertyInfo.is_have_house" class="property-item" style="margin-left: 30rpx;">
					<view class="iconfont icon-wode"></view>
					<view>{{memberInfo.work}}</view>
				</view>
			</view>
			<view v-if="isShowSelect" @click.stop="select">
				<view v-if="!isSelect" class="iconfont icon-round select"></view>
				<view v-else class="iconfont icon-chenggong select"></view>
			</view>
		</view>
	</view>
</template>

<script>
	import App from '@/common/js/app.js';
	export default {
		data() {
			return {
				isSelect: false,
			}
		},
		computed: {
			propertyInfo() {
				return {
					is_have_car: this.memberInfo.travel == 2,
					is_have_house: (this.memberInfo.live == 1 || this.memberInfo.live == 2),
					is_show_property: this.memberInfo.travel == 2 || (this.memberInfo.live == 1 || this.memberInfo.live == 2)
				}
			}
		},
		mounted() {
			console.log(this.isShowPlay,'6666666666666')
		},
		props: {
			// 是否显示浏览量
			isShowViews: {
				type: Boolean,
				default: true
			},
			// 是否可以选择
			isShowSelect: {
				type: Boolean,
				default: false
			},
			// 播放按钮
			isShowPlay: {
				type: Boolean,
				default: false,
			},
			// 会员信息
			memberInfo: {
				type: Object,
				default() {
					return {}
				}
			}
		},
		methods: {
			// 推荐点击
			extension() {
				this.$emit('extension',this.memberInfo.id)
			},
			
			// 选择
			select() {
				this.isSelect = !this.isSelect
				this.$emit('select',this.isSelect,this.memberInfo.id)
			},
			
			toDetail() {
				App.navigationTo({
					url: `pages/subPages2/blindDate/member/detail?id=${this.memberInfo.id}`
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.user-item {
		width: 335rpx;
		height: auto;
		border-radius: 20rpx;
		background-color: #F8F8F8;
		overflow: hidden;
		padding-bottom: 20rpx;
		.top-info {
			width: 100%;
			height: 445rpx;
			position: relative;
			.poster {
				width: 100%;
				height: 100%;
			}
			.istop {
				width: auto;
				height: 30rpx;
				padding: 0 10rpx;
				border-radius: 15rpx;
				background: linear-gradient(90deg, #FB5A8C 0%, #F65D10 100%);
				display: flex;
				position: absolute;
				left: 20rpx;
				top: 20rpx;
				color: #fff;
				font-size: 20rpx;
				align-items: center;
				justify-content: center;
				.iconfont {
					font-size: 20rpx;
				}
			}
			.play-btn {
				width: 80rpx;
				height: 80rpx;
				position: absolute;
				top: 184rpx;
				left: 128rpx;
			}
			.look-box {
				width: 60rpx;
				height: 68rpx;
				position: absolute;
				top: 20rpx;
				right: 16rpx;
				display: flex;
				flex-direction: column;
				align-items: center;
				.iconfont {
					font-size: 34rpx;
					color: #fff;
				}
				.num {
					font-size: 20rpx;
					color: #fff;
					margin-top: 6rpx;
				}
			}
			.operation {
				width: 50rpx;
				height: 50rpx;
				position: absolute;
				top: 20rpx;
				right: 20rpx;
			}
			.location {
				width: auto;
				height: 30rpx;
				padding: 0 10rpx;
				background-color: #fff;
				opacity: 0.8;
				border-radius: 10rpx;
				display: flex;
				color: #333;
				font-size: 20rpx;
				align-items: center;
				justify-content: center;
				position: absolute;
				bottom: 20rpx;
				right: 20rpx;
				.iconfont {
					font-size: 20rpx;
				}
			}
		}
		
		.user-info {
			width: 100%;
			height: auto;
			overflow: hidden;
			position: relative;
			.info {
				width: 100%;
				height: 45rpx;
				margin-top: 20rpx;
				display: flex;
				align-items: center;
				.name {
					height: 45rpx;
					font-size: 32rpx;
					color: #333;
					font-weight: bold;
					margin-left: 30rpx;
				}
				.sex {
					width: 70rpx;
					height: 30rpx;
					border-radius: 15rpx;
					display: flex;
					align-items: center;
					justify-content: center;
					color: #fff;
					margin-left: 20rpx;
					.iconfont {
						font-size: 22rpx;
					}
					.icon-female {
						transform: rotate(45deg);
					}
					.age {
						font-size: 20rpx;
					}
				}
				.woman {
					background-color: #FE83AF;
				}
				.man {
					background-color: #0084FF;
				}
			}
			.property {
				width: 100%;
				height: 40rpx;
				margin-top: 20rpx;
				display: flex;
				.property-item {
					width: 90rpx;
					height: 40rpx;
					border-radius: 20rpx;
					background-color: #fff;
					color: #333;
					display: flex;
					align-items: center;
					justify-content: center;
					font-size: 20rpx;
					margin-right: 13rpx;
					.iconfont {
						font-size: 24rpx;
					}
				}
			}
			.select {
				font-size: 40rpx;
				position: absolute;
				right: 20rpx;
				bottom: 0;
			}
			.icon-round {
				color: #ccc;
			}
			.icon-chenggong {
				color: #FDAD28;
			}
		}
	}
	
	.item-select {
		box-sizing: border-box;
		border: 1rpx solid #FDAD28;
	}
</style>
