<template>
	<view class="main">
		<!-- 推荐达人 -->
		<u-popup :show="drShow" :round="10" mode="center" @close="closeShow" closeable>
			<view class="uni-margin-wrap">
				<swiper class="swiper" circular :indicator-dots="indicatorDots" :autoplay="autoplay"
					:interval="interval" :duration="duration">
					<swiper-item>
						<view class="swiper-item">
							<view class="title-con">{{ '推荐达人' }}</view>
							<view class="screen">
								<view class="screen-view" @click="screenTaps(index, item)"
									v-for="(item, index) in screenList"
									:style="remIndex == item.id ? 'font-weight:bold' : ''">
									{{ item.name }}
								</view>
							</view>
							<view class="tjClass" v-for="(item, index) in tjList">
								<view class="styleColors">NO.0{{ item.rank }}</view>
								<img class="avatar" v-if="item.headPath" :src="item.headPath" />
								<image class="avatar" v-else src="@/static/images/avatar.png" />
								<view class="user-name">{{ item.memberName }}</view>
							</view>
						</view>
					</swiper-item>
					<swiper-item>
						<view class="swiper-item">
							<view class="title-con">{{ '抗衰达人' }}</view>
							<view class="screen">
								<view class="screen-view" @click="screenTaps1(index, item)"
									v-for="(item, index) in screenList1"
									:style="remIndex1 == item.id ? 'font-weight:600' : ''">
									{{ item.name }}
								</view>
							</view>
							<view class="tjClass" v-for="(item, index) in ksList">
								<view class="styleColors">NO.0{{ item.rank }}</view>
								<img class="avatar" v-if="item.headPath" :src="item.headPath" />
								<image class="avatar" v-else src="@/static/images/avatar.png" />
								<view class="user-name">{{ item.memberName }}</view>
							</view>
						</view>
					</swiper-item>
				</swiper>
			</view>
		</u-popup>
	</view>
</template>

<script>
	import * as my from '@/config/mine.js'
	// import Swiper from "swiper";
	export default {
		name: "talentList",
		props: {
			drShow: {
				type: Boolean,
				default: false
			}
		},
		data() {
			return {

				screenList: [{
						name: '年度',
						id: 6
					},
					{
						name: '季度',
						id: 5
					},
					{
						name: '月度',
						id: 4
					},
				],
				screenList1: [{
						name: '年度',
						id: 9
					},
					{
						name: '季度',
						id: 8
					},
					{
						name: '月度',
						id: 7
					},
				],
				remIndex: 6, //推荐达人下标
				remIndex1: 9, //抗衰达人下标
				tjList: [],
				ksList: [],
				indicatorDots: true,
				autoplay: false,
				interval: 2000,
				duration: 500

			};
		},
		mounted() {

			this.getUserTj();
			this.getUserKs()
		},


		methods: {
			closeShow(){
				this.$emit('closeShow')
			},
			screenTaps(index, item) {
				this.remIndex = item.id;
				this.getUserTj();
			},
			screenTaps1(index, item) {
				this.remIndex1 = item.id;
				this.getUserKs();
			},
			getUserTj() {
				my.recommend({
					wallType: this.remIndex
				}).then((res) => {
					this.tjList = res.rows;
				});
			},
			getUserKs() {
				my.repurchase({
					wallType: this.remIndex1
				}).then((res) => {
					this.ksList = res.rows;
				});
			},
		
		}
	}
</script>

<style lang="scss" scoped>
	.uni-margin-wrap {
		width: 690rpx;
		height:800rpx;
	
		.swiper {
				height: 800rpx;
			.swiper-item {
				display: block;
				text-align: center;
				.title-con {
					font-size: 36rpx;
					font-family: Source Han Sans CN;
					font-weight: bold;
					color: #282828;
					margin: 60rpx 0;
				
				}
				
				.screen {
					display: flex;
					align-items: center;
					justify-content: center;
				
					.screen-view {
						margin: 0 50rpx;
						cursor: pointer;
						font-size: 30rpx;
						font-family: Source Han Sans CN;
						color: #282828;
					}
				}
				.tjClass {
					display: flex;
					align-items: center;
					margin-top: 30rpx;
					justify-content: center;
				
					.styleColors {
						font-size: 26rpx;
						font-family: Source Han Sans CN;
						font-weight: bold;
						color: #FB3024;
					}
				
					.avatar {
						width: 124rpx;
						height: 124rpx;
						border-radius: 50%;
						margin-top: 10rpx;
						margin: 0 30rpx;
					}
				
					.user-name {
						font-size: 32rpx;
						font-family: Source Han Sans CN;
						font-weight: 400;
						color: #282828;
						overflow: hidden;
						text-overflow: ellipsis;
						white-space: nowrap;
					}
				}
			}
		}
		
	}

	
	


	.swiper-container {

		.swiper-slide {
			width: 650rpx;
			padding-bottom: 40rpx;
			background: #ffffff;
			text-align: center;

			.title-con {
				font-size: 36rpx;
				font-family: Source Han Sans CN;
				font-weight: bold;
				color: #282828;
				margin: 60rpx 0;

			}

			.screen {
				display: flex;
				align-items: center;
				justify-content: center;

				.screen-view {
					margin: 0 50rpx;
					cursor: pointer;
					font-size: 30rpx;
					font-family: Source Han Sans CN;
					color: #282828;
				}
			}

			.tjClass {
				display: flex;
				align-items: center;
				margin-top: 30rpx;
				justify-content: center;

				.styleColors {
					font-size: 26rpx;
					font-family: Source Han Sans CN;
					font-weight: bold;
					color: #FB3024;
				}

				.avatar {
					width: 124rpx;
					height: 124rpx;
					border-radius: 50%;
					margin-top: 10rpx;
					margin: 0 30rpx;
				}

				.user-name {
					font-size: 32rpx;
					font-family: Source Han Sans CN;
					font-weight: 400;
					color: #282828;
					overflow: hidden;
					text-overflow: ellipsis;
					white-space: nowrap;
				}
			}
		}
	}
</style>