<template>
	<view class="invitation-list bx">
		<navbar :leftClick="leftClick" :title="$t('page.invitationList.title')"></navbar>

		<!-- 粉丝列表 -->
		<u-list v-if="fanList.length > 0" @scrolltolower="scrolltolower" height="calc(100vh - 90rpx)">
			<view class="fan-list">
				<view v-for="item in fanList" class="fan-item">
					<view class="fan-item-left">
						<image src="@/static/center/5.png" mode="aspectFit"></image>
						<view class="username">{{ item.account}}</view>
					</view>
					<view class="fan-item-right">{{ item.createTime }}</view>
				</view>
			</view>
		</u-list>
		
		<!-- 无粉丝 -->
		<view v-else class="noFans">{{ $t('page.invitationList.noFans') }}</view>
	</view>
</template>

<script>
	import navbar from '@/components/base/m-navbar.vue'

	export default {
		components: {
			navbar
		},
		data() {
			return {
				queryparams : {
					pageNo : 1,
					pageSize : 10
				},
				fanList : []
			}
		},
		onShow() {
			this.getFanList()
		},
		methods: {
			leftClick() {
				uni.navigateTo({
					url: '/pages/home/home'
				})
			},
			
			//获取粉丝列表
			getFanList(){
				this.request('fansPage', {}, this.queryparams).then(res => {
					if (res.code == 200) {
						this.fanList = res.result.records
					}
				})
			},
			
			//滑动到页面底部
			scrolltolower(){
				this.queryparams.pageSize += 10
				this.getFanList()
			}
			
		}
	}
</script>

<style lang="scss" scoped>
	.invitation-list {
		width: 750rpx;
		min-height: 100vh;
		background-color: black;
		margin: 0 auto;
		background-size: 100%;
		background-repeat: no-repeat;
		color: white;
		
		.noFans{
			height: 100vh;
			display: flex;
			align-items: center;
			justify-content: center;
			color: #ffffff80;
		}
		
		.fan-list{
			width: 96%;
			margin: 0rpx auto;
			padding-top: 20rpx;
			border: 1px solid #ffffff80;
			margin-top: 20rpx;
			
			.fan-item{
				display: flex;
				justify-content: space-between;
				align-items: center;
				border-bottom: 1px solid #ffffff80;
				padding: 20rpx;
				box-sizing: border-box;
				
				&:last-child{
					border: none;
				}
				
				.fan-item-left{
					width: 200rpx;
					display: flex;
					align-items: center;
					overflow: hidden;
					
					image{
						width: 100rpx;
						height: 100rpx;
						border-radius: 50%;
					}
					
					.username{
						width: calc(100% - 120rpx);
						margin-left: 20rpx;
						white-space: normal;
						text-overflow: ellipsis;
						overflow: hidden;
					}
				}
				
				.fan-item-right{
					width: calc(100% - 200rpx);
					text-align: right;
					font-size: 20rpx;
					color: #ccc;
				}
			}
		}
	}
</style>