<template>
	<view class="page">
		<loadlogo v-if="!loadlogo" />
		<block v-else>
			<view class="record-item" v-for="(item,index) in recordList" :key="index">
				<user :memberInfo="item"></user>
			</view>
			<!-- 返回按钮 -->
			<view class="back-btn" @click="goindex">返回</view>
		</block>
	</view>
</template>

<script>
	import App from '@/common/js/app.js';
	import Loadlogo from '@/components/template/loadlogo.vue';
	import user from '@/components/template/user.vue'
	export default {
		data() {
			return {
				loadlogo: false,
				type: 1,
				lng: '',
				lat: '',
				currentPage: 1,
				totalPage: 1,
				recordList: [],
			}
			
		},
		components: {
			Loadlogo,
			user
		},
		onLoad(e) {
			let _this = this
			_this.type = e.type
			uni.getLocation({
			    type: 'wgs84',
			    success(res) {
					_this.lng = res.longitude
					_this.lat = res.latitude
			    }
			})
			_this.getRecordInfo()
		},
		methods: {
			getRecordInfo() {
				let _this = this
				App._post_form(
					`&p=dating&do=recordList`,
					{
						page: _this.currentPage,
						type: _this.type,
						lng: _this.lng,
						lat: _this.lat
					},
					res => {
						_this.loadlogo = true
						console.log(_this.loadlogo,'111111111111111111')
						_this.recordList = [..._this.recordList,...res.data.list]
						_this.totalPage = res.data.total
						_this.currentPage ++
					},
					false,
					() => {
					}
				);
			},
		
		
			goindex(){
				let pages = getCurrentPages();
				console.log(pages);
				if(pages.length == 1){
					App.navigationTo({
						url: "pages/subPages2/blindDate/personal"
					})
				}else{
					uni.navigateBack({
						delta:1
					})
				}
			},
		},
		onReachBottom() {
			if(this.currentPage <= this.totalPage) {
				this.getRecordInfo()
			}
		}
	}
</script>

<style lang="scss" scoped>
	.page {
		width: 690rpx;
		height: auto;
		margin: auto;
		display: flex;
		flex-wrap: wrap;
		.record-item {
			margin: 0 20rpx 20rpx 0;
			&:nth-child(2n) {
				margin-right: 0;
			}
		}
	}
	
	
	.back-btn {
		width: 100rpx;
		height: 100rpx;
		border-radius: 50rpx;
		text-align: center;
		line-height: 100rpx;
		background: linear-gradient(270deg, #FF8E88 0%, #FDAD28 100%);
		font-size: 28rpx;
		color: #fff;
		position: fixed;
		right: 30rpx;
		bottom: 250rpx;
	}
</style>
