<template>
	<view>
		<block v-if="$u.test.isEmpty(boostList)">
			<u-empty margin-top="300" text="暂无数据" mode="list"></u-empty>
		</block>
		<block v-else>
			<block v-for="(item, index) in boostList" :key="index">
				<view class="flex align-center justify-between boder">
					<view class="flex align-center" style="width: 55%;">
						<view class="padding-sm">
							<u-avatar :src="item.avatar" size="82"></u-avatar>
						</view>
						<view>
							<view class="name">{{item.nickName}}</view>
							<view class="time padding-top-xs">{{item.createTime}}</view>
						</view>
					</view>
					<view class="text-sm" style="color: #757575;">{{item.typeSub == 1 ? '打榜' : '打赏'}}</view>
					<view class="name padding-right flex justify-end" style="width: 180upx;">{{+item.totalHotValue}}热力值</view>
				</view>
			</block>
			<view style="height: 80rpx;" v-if="status">
				<u-divider bgColor="#f1f1f1;"  height="80">到底了</u-divider>
			</view>
		</block>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				current: 1,
				size: 30,
				status: false,
				boostList: [],
			}
		},
		onLoad() {
			this.userId = uni.getStorageSync("userId");
			this.getBoostDetail();
		},
		onReachBottom() {
			if (this.boostList.length < this.current * this.size) {
				this.status = true;
			} else {
				this.current += 1;
				this.getBoostDetail();
			}
		},
		methods: {
			getBoostDetail() {
				this.$u.api.boost.list({receiverId: this.userId, current: this.current, size: this.size}).then(res => {
					this.boostList = [...this.boostList,...res.records];
				})
			}
		}
	}
</script>

<style>
	.name {
		font-size: 26upx;
		font-family: PingFang SC;
		font-weight: bold;
		color: #111111;
	}
	.time {
		font-size: 22upx;
		font-family: PingFang SC;
		color: #9E9E9E;
	}
	.boder {
		margin: 20upx;
		box-shadow: -1upx -1upx 60upx #d0d0d0;
		border-radius: 30upx;
	}
</style>
