<template>
	<view style="min-height: 100vh;background-color: #f8f8f8;box-sizing: border-box;padding-bottom: 50px;">
		<view class="content_wrapper">
			<view v-for="(item,index) in dataList" :key="index" class="list-item" @click="toDetail(item.id)">
				<image :src="item.promotional_img" mode="aspectFill"></image>
				<view class="text-box">
					<view class="text1">{{item.title}}</view>
					<view class="text">
						发布人：{{item.nickname}}
						<!-- <image style="width: 60upx;height: 60upx" :src="activitiesInfo.avatar"></image> -->
					</view>
					<view class="text">发布时间：{{item.publish_time}}</view>
				</view>
				<view @click.stop="">
					<navigator :url="'./activitiesExtend?id='+item.id" class="editbtn">编辑</navigator>
				</view>
			</view>
			<view class="" v-if="dataList.length==0">
				<loadmore :isMore="true" v-if="dataList.length=='0'" />
			</view>
		</view>
		<navigator url="./activitiesExtend" class="release-btn">发布校园活动</navigator>
	</view>
</template>

<script>
	import App from '@/common/js/app.js';
	import loadmore from '@/components/template/loadmore.vue'
	export default {
		data() {
			return {
				page: 1,
				dataList: [],
				mid:null
			}
		},
		components: {
			loadmore
		},
		onLoad() {
			this.mid = uni.getStorageSync('userinfo').mid;
		},
		onShow(){
			this.page = 1;
			this.getList();
		},
		methods: {
			getList(){
				let _this = this;
				App._post_form('&p=student&do=campusActivitiesList', 
					{page:_this.page, size: 10, mid: _this.mid, sub: 1}, res => {
					if(_this.page===1){
						if(res.data.data.length>0){
							_this.setData({
								dataList: res.data.data
							})
						}
					}else{
						if(res.data.data.length>0){
							let dataList = _this.dataList.concat(res.data.data);
							_this.setData({
								dataList
							})
						}
					}
				});
			},
			toDetail(id){
				uni.navigateTo({
					url:'/pagesA/campusActivities/campusActivities?id='+id
				})
			}
		},
		onReachBottom(){
			this.page++;
			this.getList();
		}
	}
</script>

<style lang="scss">
.dis-flex{
	display: flex;
	align-items: center;
}
.content_wrapper{
	padding: 10px 15px;
	.list-item{
		display: flex;
		padding: 15px 0px;
		border-bottom: 1px solid #efefef;
	}
	image{
		width: 80px;
		height: 80px;
		border-radius: 6px;
		margin-right: 10px;
	}
	.text-box{
		height: 80px;
		flex: 1;
		overflow: hidden;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
	}
	.text1{
		font-size: 14px;font-weight: bold;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2;
		overflow: hidden;
	}
	.text{
		display: -webkit-box;//将盒子转换为弹性盒子
		-webkit-box-orient: vertical;//文本显示方式，默认水平
		-webkit-line-clamp: 1;//设置显示多少行
		overflow: hidden;
		font-size: 12px;
		color: #999;
	}
	.editbtn{
		background-color: #509DFD;
		color: #fff;font-size: 12px;
		padding: 8upx 20upx;
		border-radius: 10upx;
		margin-left: 10px;
	}
}
.release-btn{
	width: 690upx;
	height: 84upx;
	color: #509DFD;
	border: 1px solid #509DFD;
	background-color: #FFF;
	text-align: center;
	padding: 0;
	position: fixed;
	bottom: 30upx;
	left: 30upx;
	box-sizing: border-box;
	font-size: 35upx;
	text-decoration: none;
	line-height: 80upx;
	border-radius: 50px;
	overflow: hidden;
}
</style>
