<template>
	<view class="content">
		<view class="list-item hflex acenter" v-for="(item,index) in list" :key="index">
			<image :src="item.image" mode="aspectFill"></image>
			<view class="img-right">
				<view class="hflex acenter jbetween right-top">
					<text>{{item.title}}</text>
					<text>{{item.created_at}}</text>
				</view>
				<view class="text">{{item.content}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	import $api from '@/static/js/api.js'
	export default {
		data() {
			return {
				list: [],
				page: 1,
				last_page: 1,
			}
		},
		onLoad() {
			this.getlist()
		},
		onShow() {

		},
		onPullDownRefresh() {

		},
		onReachBottom() {
			if (this.last_page == this.page) {
				uni.$u.toast('已经到底了')
				return
			} else {
				this.page++
				this.getlist()
			}
		},
		methods: {
			getlist() {
				var that = this
				$api.req({
					url: 'notification',
					data: {
						is_page: 1,
						page: that.page,
						limit: 10,
						type: 'like'
					}
				}, function(res) {
					that.list = that.list.concat(res.data.list)
					that.last_page = res.data.last_page
				})
			},
		}
	}
</script>

<style lang="scss">
	.content {
		background-color: #FFFFFF;
		padding: 0 28rpx;

		.list-item {
			padding: 28rpx 0 32rpx;
			border-bottom: 1px solid #F5F5F5;

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

			.img-right {
				width: calc(100% - 92rpx);
				padding: 0 0 0 20rpx;

				.right-top {
					width: 100%;

					text:first-child {
						font-size: 32rpx;
						font-family: PingFangSC, PingFang SC;
						font-weight: 600;
						color: #333333;
					}

					text:last-child {
						font-size: 22rpx;
						font-family: PingFangSC, PingFang SC;
						font-weight: 400;
						color: #999999;
					}
				}

				.text {
					font-size: 24rpx;
					font-family: PingFangSC, PingFang SC;
					font-weight: 400;
					color: #666666;
					padding: 14rpx 0 0;
				}
			}
		}
	}
</style>