<template>
	<view style="min-height: 100vh;background-color: #f8f8f8;box-sizing: border-box;">
		<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 style="font-size: 14px;line-height: 22px;font-weight: bold;">{{item.title}}</view>
					<!-- <view class="text" v-html="item.describe"></view> -->
					<view class="text">{{item.publish_time}}</view>
				</view>
			</view>
			<view class="" v-if="dataList.length==0">
				<loadmore :isMore="true" v-if="dataList.length=='0'" />
			</view>
		</view>
	</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.dataList=[];
			this.getList();
		},
		methods: {
			getList(){
				let _this = this;
				App._post_form('&p=student&do=campusActivitiesList', 
					{page:_this.page, size: 10, mid: _this.mid}, 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{
		flex: 1;
		overflow: hidden;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
	}
	.text{
		display: -webkit-box;//将盒子转换为弹性盒子
		-webkit-box-orient: vertical;//文本显示方式，默认水平
		-webkit-line-clamp: 2;//设置显示多少行
		overflow: hidden;
		font-size: 13px;
		color: #999;
	}
}
</style>
