<template>
	<view class="active">
		<view class="list" v-if="list.length>0">
			<view class="list-item" @click="detail(item.id)" v-for="(item,index) in list" :key="index">
				<view class="tips" v-if="item.type!=null">
					{{item.type}}
				</view>
				<image :src="item.cover!='path' ? item.cover: '../../static/images/active.png'" mode="">
				</image>
				<view class="right">
					<view class="title">
						{{item.title == null?'--':item.title}}
					</view>
					<view class="text">
						<text>主持人：{{item.compere == null?'--': item.compere}}</text>
						<!-- <text>参与者：{{item.participant}}</text> -->
					</view>
<!-- 					<view class="address">
						活动地址：{{item.address}}
					</view> -->	
					<view class="time">
						活动日期：{{item.day == null?'--': item.day}}
					</view>
				</view>
				<view class="files" @click.stop="tofile(item.id)">
					附件
				</view>
			</view>

		</view>
		<view class="empty" v-else>
			<image src="../../static/images/pass.png" mode="widthFix"></image>
			<view class="empty-text">
				暂无活动
			</view>
		</view>
	</view>
</template>

<script>
	var app = getApp()
	export default {
		data() {
			return {
				current_tab: 0,
				list: [],
				page: 1,
				last: false
			}
		},
		async onLoad() {
			// if (this.is_weixin()) {
			// 	this.navTitle()
			// }
			this.page = 1
			this.list = []
			this.last = false
			this.getList()
		},
		onReachBottom() {
			if (!this.last) {
				this.page++
			}
			console.log(this.page)
			this.getList()
		},
		methods: {
			getList() {
				let params = {
					category_id: this.current_tab ,
					page: this.page
				}
				app.request('/organization-activity', params, 'get').then(res => {
					console.log(res, 'ppp')
					let data = res.data.data.data
					console.log(res, 'course1')
					if (this.page > 1 && data.length == 0) {
						uni.showToast({
							title: '暂无更多',
							icon: 'none'
						})
						this.last = true
					} else {
						this.list = this.list.concat(data)
					}
				})
				
			},
			detail(id) {
				console.log('详情')
				uni.navigateTo({
					url: './details?id=' + id
				})
			},
			tofile(id){
				uni.navigateTo({
					url: './files?id=' + id
				})
			}

		}
	}
</script>

<style lang="scss" scoped>
	page {
		position: relative;
		background-color: rgba(238, 238, 238, 1);


	}

	.add {
		position: fixed;
		bottom: 75px;
		right: 15px;
		text-align: center;
		z-index: 6;

		.add-buttom {
			width: 36px;
			height: 36px;
			background: #6A6A6A;
			display: inline-block;
			text-align: center;
			line-height: 36px;
			opacity: 1;
			border-radius: 50%;
		}

		.add-tips {
			font-size: 10px;
			font-family: PingFang SC;
			font-weight: bold;
			line-height: 14px;
			color: #292929;
			opacity: 1;
			margin-top: 3px;

		}
	}

	.active {
		position: relative;
		overflow: hidden;
		height: 100%;

		.tab {
			display: flex;
			align-items: center;
			width: 80%;
			margin: 0 auto;

			.item,
			.active-item {
				margin-top: 17px;

				view {
					display: block;
				}

				font-size: 18px;
				font-family: PingFang SC;
				font-weight: bold;
				line-height: 20px;
				color: rgba(113, 113, 113, .43);
				opacity: 0.43;
				opacity: 1;
				flex: 1;
				text-align: center;

				.week {
					padding-bottom: 12px;
				}

				.line {
					width: 48px;
					height: 4px;
					background: #3B7653;
					opacity: 1;
					border-radius: 1px;
					display: block;
					margin: 0 auto;

				}
			}

			.active-item {
				font-size: 18px;
				font-family: PingFang SC;
				font-weight: bold;
				line-height: 20px;
				color: #3B7653;

				.week {
					padding-bottom: 8px;
				}

			}
		}

		.list {
			padding: 15px;
			
			.list-item {
				background: #fff;
				opacity: 1;
				border-radius: 12px;
				padding: 15px 15px;
				position: relative;
				display: flex;
				align-items: center;
				margin-bottom: 10px;
				overflow: hidden;
				.tips {
					position: absolute;
					width: 62px;
					height: 21px;
					text-align: center;
					line-height: 21px;
					background: rgba($color: red, $alpha: 0.6);
					top: 0;
					right: 0;
					opacity: 1;
					border-radius: 0px 12px 0px 12px;
					font-size: 12px;
					font-family: PingFang SC;
					color: #fff;
				}

				image {
					flex: 0 0 65px;
					width: 65px;
					height: 60px;
					margin-right: 6px;
				}

				.right {
					flex: 1;
					padding-left: 5px;
					width: calc(100% - 150px);

					.title {
						font-size: 16px;
						font-family: PingFang SC;
						font-weight: bold;
						line-height: 20px;
						color: #282828;
						opacity: 1;
						white-space: nowrap;
						/*设置不换行*/
						overflow: hidden;
						/*设置隐藏*/
						text-overflow: ellipsis;
						/*设置隐藏部分为省略号*/
					}

					.text {
						font-size: 13px;
						font-family: PingFang SC;
						font-weight: 400;
						line-height: 20px;
						color: rgba(40, 40, 40, .47);
						margin-top: 3px;
						width: 230px;
						display: flex;
						text{
							display: block;
							width: 115px;
							white-space: nowrap;
							/*设置不换行*/
							overflow: hidden;
							/*设置隐藏*/
							text-overflow: ellipsis;
							/*设置隐藏部分为省略号*/
						}
					}
					.address{
						font-size: 13px;
						font-family: PingFang SC;
						font-weight: 400;
						line-height: 20px;
						color: rgba(40, 40, 40, .47);
						margin-top: 3px;
						width: 230px;
					}

					.time {
						font-size: 10px;
						font-family: PingFang SC;
						font-weight: 400;
						line-height: 20px;
						color: rgba(40, 40, 40, .47);
						width: 230px;
						white-space: nowrap;
						/*设置不换行*/
						overflow: hidden;
						/*设置隐藏*/
						text-overflow: ellipsis;
						/*设置隐藏部分为省略号*/
					}
				}
				.files{
					color: #E65538;
				}
			}
		}
		.empty{
			width: 100%;
			height: 100vh;
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: center;
			image{
				width: 150px;
			}
		}
	}
</style>
