<template>
	<view class="fengxiang">
		<view>
			<view></view>
			<view>我的邀请({{yqnumber}})</view>
			<view></view>
		</view>
		<scroll-view class="scrvie" scroll-y="true" @scrolltoupper='init' @scrolltolower='jiazai'>
			<view class="conetn-box">
				<view v-for="item in yqrs">
					<view>
						<image :src="item.headPhoto"></image>
						<view>{{item.nickname}}</view>
					</view>
					<view>{{item.createdTime}}</view>
				</view>
			</view>
		</scroll-view>
	</view>
	<view @click="goshare" class="yaoqin">
		邀请
	</view>
</template>

<script>
	import {criticisminvite} from '@/api/user.js'
	import {ref} from 'vue'
	export default {
		onUnload() {
			uni.hideLoading()
		},
		setup() {
			let yqrs=ref([])
			// criticisminvite({}).then(res=>{
			// 	console.log(res);
			// 	yqrs.value=res.rows
			// })
			let yqnumber=ref('')
			let page=1
			function init(){
				page=1
				uni.showLoading({
					title:'加载中'
				})
				criticisminvite({pageNum:page,pageSize:20}).then(res=>{
					console.log(res);
					yqrs.value=res.rows
					uni.hideLoading()
					yqnumber.value=res.total
				})
			}
			function jiazai(){
				page++
				uni.showLoading({
					title:'加载中'
				})
				criticisminvite({pageNum:page,pageSize:20}).then(res=>{
					uni.hideLoading()
					if(res.rows.length==0){
						uni.showToast({
							title:'已经到底啦',
							icon:'none',
							duration:2000
						})
						page--
						return
					}
					res.rows.map(item=>{
						yqrs.value.push(item)
					})
				})
			}
			init()
			function goshare(){
				uni.navigateTo({
					url:'../share/share'
				})
			}
			
			return {
				yqnumber,
				goshare,
				yqrs,
				init,
				jiazai
			}
		}
	}
</script>

<style lang="scss">
	page{
		padding-top: 30upx;
	}
.fengxiang{
	display: flex;
	flex-direction: column;
	align-items: center;
	width: 680upx;
	// height: 1276upx;
	padding: 30upx;
	background: #23262F;
	border-radius: 12upx;
	box-sizing: border-box;
	margin: auto;
	>view:nth-of-type(1){
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 28upx;
		font-weight: bold;
		margin-bottom: 40upx;
		color: #FFFFFF;
		>view:nth-of-type(1){
			width: 64upx;
			height: 6upx;
			background: linear-gradient(270deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0) 100%);
			border-radius: 22upx;
			margin-right: 10upx;
		}
		>view:nth-of-type(3){
			width: 64upx;
			height: 6upx;
			background: linear-gradient(270deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.2) 100%);
			border-radius: 22upx;
			margin-left: 10upx;
		}
	}
	>.scrvie{
		max-height: 75vh;
		width: 100%;
		.conetn-box{
			width: 100%;
			display: flex;
			flex-direction: column;
			align-items: center;
			>view{
				width: 100%;
				display: flex;
				align-items: center;
				justify-content: space-between;
				margin-bottom: 40upx;
				&:nth-last-child(1){
					margin-bottom: 0;
				}
				>view{
					font-size: 28upx;
					font-weight: 400;
					color: #8D8C9F;
					display: flex;
					align-items: center;
					>image{
						width: 64upx;
						height: 64upx;
						border-radius: 50%;
						margin-right: 18upx;
					}
					>view{
						font-size: 28upx;
						font-weight: 400;
						color: #FFFFFF;
					}
				}
			}
		}
	}
}
.yaoqin{
	position: fixed;
	left: 50%;
	bottom: 40upx;
	transform: translateX(-50%);
	width: 276upx;
	height: 84upx;
	background: linear-gradient(351deg, #9735DC 0%, #570CDC 100%);
	box-shadow: 0upx 8upx 8upx 2upx rgba(0, 0, 0, 0.25);
	border-radius: 48upx;
	opacity: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 28upx;
	font-weight: 500;
	color: #FFFFFF;
}
</style>
