<template>
	<view>
		<view class="bg-img" style="background-image: url('https://upload-file-data.obs.cn-south-1.myhuaweicloud.com/97d63ec49f544a33a6a8cc3c0b64b17a-songRankBgImg.png');height: 200upx;"></view>
		<block v-for="(item, index) in boostList" :key="index">
			<view class="flex align-center justify-between boder">
				<view class="flex align-center">
					<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;" v-if="item.typeSub==1">打榜</view>
				<view class="text-sm" style="color: #757575;" v-if="item.typeSub==2">打赏</view>
				<view class="name padding-right flex justify-end" style="width: 200upx;">{{item.totalHotValue}}热力值</view>
			</view>
		</block>
		<view style="height: 80rpx;" v-if="status">
			<u-divider bgColor="#f1f1f1;" height="80">到底了</u-divider>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				boostList: [],
				userId: '',
				current: 1,
				size: 30,
				status: false,
			}
		},
		onLoad() {
			this.userId = uni.getStorageSync("userId")
			if (!this.userId) {
				this.$u.toast('用户未登录')
				return
			}
			this.getMyBoostList()
		},
		onReachBottom() {
			if (this.boostList.length < this.current * this.size) {
				this.status = true;
			} else {
				this.current += 1;
				this.getMyBoostList();
			}
		},
		methods: {
			getMyBoostList() {
				this.$u.api.boost.myBoost({senderId: this.userId, current: this.current, size: this.size}).then(res => {
					this.boostList = [...this.boostList,...res.records];
				})
			}
		}
	}
</script>

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