<template>
	<view>
		<view class="list" v-for="(item,index) in activityget_list" :key="item.id">
			<view class="u-flex">
				<image style="width: 92rpx;height: 92rpx;" :src="item.school.logo" mode=""></image>
				<view class="" style="margin-left: 20rpx;">
					<text class="fontsty">{{item.school.name}}{{item.title}}</text>
					<view class="font">
						<text>活动时间：</text>
						<text>{{item.start_time.replaceAll('-','.')}}-{{item.end_time.replaceAll('-','.').slice(-5)}}</text>
					</view>
				</view>
			</view>
			<view class="border u-row-between">
				<view class=""></view>
				<view v-if="item.status==2" class="btn" @click="togeneral(item.id)">查看活动</view>
				<view v-if="item.status==3" @click="tishi(1)" style="background: #d3d3d3;" class="btn">查看活动</view>
				<view v-if="item.status==1" @click="tishi(2)" style="background: #d3d3d3;" class="btn">查看活动</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		activityget_list
	} from "@/units/inquire.js"
	export default {
		onReachBottom() {
			if (this.activityget_list.length != this.total) {
				this.page++
				this.activitygetlist()
			}
		},
		data() {
			return {
				page: 1,
				activityget_list: [],
			}
		},
		mounted() {
			console.log(111);
			this.activitygetlist()
		},
		props: {
			search: ""
		},
		methods: {
			tishi(a) {
				if (a == 1) {
					this.$u.toast("活动已过期")
				} else {
					this.$u.toast("活动未开始")
				}

			},
			togeneral(id) {
				uni.navigateTo({
					url: "/pagesB/general?id=" + id
				})
			},
			activitygetlist() {
				console.log(111);
				activityget_list({
					page: this.page,
					search: this.search
				}).then(res => {
					console.log(res);
					if (this.page == 1) {
						this.activityget_list = res.data.data
					} else {
						this.activityget_list = this.activityget_list.concat(res.data.data)
					}
				})
			}

		}
	}
</script>


<style lang="scss" scoped>
	.list {
		padding: 32rpx 20rpx 24rpx 28rpx;
		background: #fff;
		border-radius: 16rpx;
		margin-top: 20rpx;
		box-sizing: border-box;

		.fontsty {
			font-size: 32rpx;
			font-family: SFPro-Medium, SFPro;
			font-weight: 500;
			color: #222222;
		}

		.font {
			font-size: 24rpx;
			font-family: SFPro-Regular, SFPro;
			font-weight: 400;
			color: #555555;
			margin-top: 14rpx;
		}


		.border {
			margin-top: 28rpx;
			border-top: 2rpx solid #F3F3F3;
			display: flex;

		}



		.btn {
			width: 164rpx;
			height: 68rpx;
			line-height: 68rpx;
			margin-top: 22rpx;
			background: #0C66C2;
			border-radius: 10rpx;
			font-size: 28rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			color: #FFFFFF;
			margin-right: 0 !important;
			text-align: center;
		}
	}
</style>