<template>
	<!-- 教研室详情 -->
	<view class="activityDetail">
		<statusBar :item="navbar"></statusBar>

		<!-- 顶部 -->
		<view class="backPic" v-for="(item,index) in actItemList" :key="index + 'a' ">
			<image src="http://43.139.158.220:5007/img/static/yym/Rectangle 40.png" mode="aspectFill"></image>
			<view style="padding: 0 30rpx;margin-bottom: 20px;">
				<view class="card">
					<view class="cardTop three-font">
						{{ item.acName }}
					</view>
					<view class="col fz-font">
						活动日期：<text>{{ item.begin_at }}~{{ item.endTime }}</text>
					</view>
					<view class="col fz-font">
						招募人数：<text>0/{{ item.pers }}</text>
					</view>
					<view class="col fz-font">
						活动地址：<text>{{ item.address }}</text>
						<uni-icons type="location" color="#0056a8"
							style="position: absolute;right: 10px;top: 0;width: 32rpx;height: 45rpx;"></uni-icons>
					</view>
				</view>
			</view>
		</view>

		<!-- 创建者用户名 -->
		<view style="padding: 0 30rpx;">
			<view class="creator" v-for="(item,index) in actItemList" :key="index + 'b' ">
				<image
					:src="item.avatar == null ? 'http://43.139.158.220:5007/img/static/mine/Avatar_default.png' : item.avatar"
					mode="aspectFill"></image>
				<view class="creName btn-font">
					{{ item.username }}
				</view>
			</view>
		</view>

		<!-- 活动详情 -->
		<view class="" style="padding: 0 30rpx;">
			<detailBlock :actItemList='actItemList' :item='judge'></detailBlock>
		</view>



		<!-- 当前成员 -->
		<view style="padding: 0 30rpx;">
			<view class="member">
				<view class="memberTop">
					<view class="btn-font">报名情况(已报名0人)</view>
					<view class="fz-font" style="color: rgba(0, 0, 0, 0.4);display: flex;align-items: center;"
						@click="perList">
						<text>查看更多</text>
						<image src="http://43.139.158.220:5007/img/static/mine/arrow-right.png"
							style="width: 32rpx;height: 32rpx;" mode="aspectFill"></image>
						<!-- <uni-icons type="right"></uni-icons> -->
					</view>
				</view>

				<view class="pers">
					<!-- <view class="per" v-if="perNum == []" v-for="(item,index) in perNum">
						<image :src="item.img"></image>
						<view class="perName fz-font">
							{{item.Name}}
						</view>
					</view> -->
					<view class="per">
						<!-- <image :src="item.img"></image> -->
						<view class="perName fz-font">
							暂无人员
						</view>
					</view>
				</view>
			</view>
		</view>

		<!-- 申请加入 -->
		<view class="btnBlock">
			<button class="btn" @click="gotoAdd">立即报名</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				navbar: {
					title: '活动详情',
					btn: 1
				},
				judge: {
					isShow: 1,
					info: ''
				},
				actItemList: [],
				perNum: []
				// perNum: [{
				// 		Name: '陈芬',
				// 		img: 'http://43.139.158.220:5007/img/static/yym/Ellipse 4 (3).png'
				// 	},
				// 	{
				// 		Name: '贺豪杰',
				// 		img: 'http://43.139.158.220:5007/img/static/yym/Ellipse 4 (4).png'
				// 	},
				// 	{
				// 		Name: '张孝迪',
				// 		img: 'http://43.139.158.220:5007/img/static/yym/Ellipse 4.png'
				// 	},
				// 	{
				// 		Name: '马冬梅',
				// 		img: 'http://43.139.158.220:5007/img/static/yym/Ellipse 4 (2).png'
				// 	},
				// 	{
				// 		Name: '康雯妍',
				// 		img: 'http://43.139.158.220:5007/img/static/yym/Ellipse 4 (1).png'
				// 	},
				// 	{
				// 		Name: '张燕琴',
				// 		img: 'http://43.139.158.220:5007/img/static/mine/Avatar.png'
				// 	}
				// ]

			};
		},
		methods: {
			perList() {
				uni.navigateTo({
					url: '/pages/dy/dy'
				})
			},
			gotoAdd() {
				// console.log(e.currentTarget.dataset['index'], 123);
				// let edata = e.currentTarget.dataset['index'];
				const clickedAcId = this.actItemList[0].acId;
				console.log(clickedAcId);
				uni.navigateTo({
					url: '/pages/hd/hd?acId=' + clickedAcId
				})
			},
			getActivity() {
				// 获取当前页面的URL
				const routes = getCurrentPages();
				console.log(routes[1].options.acId);
				const acId = routes[1].options.acId
				let data = {
					acId: acId,
					ty: 1
				}
				this.$request('/selectActivityID', "POST", data).then(res => {
					console.log(res[0]);
					// this.activeList=[...this.activeList,...res[0]]
					this.actItemList = res[0]
				})
			},
		},
		onShow() {
			this.getActivity()
		}
	}
</script>

<style lang="scss">
	.activityDetail {
		padding-bottom: 80px;

		.backPic {
			width: 750rpx;
			position: relative;

			image {
				width: 100%;
				display: block;
			}

			.card {
				position: absolute;
				width: 690rpx;
				// height: 150px;
				bottom: -20px;
				left: 50%;
				// padding: 30rpx 16px;
				padding: 30rpx;
				border-radius: 10px;
				background-color: #ffffff;
				transform: translate(-50%, 0);

				.cardTop {
					// display: flex;
					// justify-content: center;
					// padding-bottom: 5px;
					margin-bottom: 5px;
					// font-size: 18px;
					font-weight: bold;
					display: -webkit-box;
					word-break: break-all;
					text-overflow: ellipsis;
					overflow: hidden;
					-webkit-box-orient: vertical;
					-webkit-line-clamp: 2;

					/*设置 需要显示的行数*/
					.title {
						font-weight: bold;
					}
				}

				.col {
					position: relative;
					margin-bottom: 10rpx;
					color: #999999;
					padding-right: 40px;
					// font-size: 14px;
					width: 100%;
					display: -webkit-box;
					word-break: break-all;
					text-overflow: ellipsis;
					overflow: hidden;
					-webkit-box-orient: vertical;
					-webkit-line-clamp: 2;

					/*设置 需要显示的行数*/
					text {
						color: #333333;
					}
				}

				.tag {
					display: flex;
				}
			}

			// background-image: url(http://43.139.158.220:5007/img/static/resource/jqr.png);
		}


		.creator {
			display: flex;
			// padding: 10px 30px;
			padding: 30rpx 20rpx;
			background-color: #ffffff;
			align-items: center;
			margin-top: 30px;
			margin-bottom: 20rpx;
			border-radius: 10px;

			image {
				width: 96rpx;
				height: 96rpx;
				border-radius: 50%;
				margin-right: 20rpx;
			}

			.creName {
				font-weight: bold;
			}
		}

		.member {
			background-color: #ffffff;
			margin-top: 20rpx;
			padding: 30rpx;
			border-radius: 10px;
			margin-bottom: 30rpx;

			.memberTop {
				display: flex;
				justify-content: space-between;
				margin-bottom: 10px;
			}

			.pers {
				display: flex;
				justify-content: space-between;
				align-items: center;

				.per {
					// display: inline-block;
					display: flex;
					flex-direction: column;
					// justify-content: center;
					align-items: center;

					image {
						width: 72rpx;
						height: 72rpx;
						border-radius: 50%;
					}

					.perName {
						// font-size: 14px;
						text-align: center;
					}
				}

			}

		}

		.btnBlock {
			position: fixed;
			bottom: 0;
			width: 750rpx;
			background-color: #ffffff;
			// padding: 20px 0;
			padding: 2vh 0;

			.btn {
				width: 432rpx;
				height: 88rpx;
				font-weight: 500;
				display: flex;
				justify-content: center;
				align-items: center;
				margin: auto;
				background-color: #0056a8;
				color: #ffffff;
			}
		}
	}
</style>