<template>
	<view>
		<view class="list" v-if="pageList.length>0">
			<view class="li ddflex" v-for="(item,index) in pageList" :key="index" @click="jumpUrl(opt.isBusiness ? '/product/home/home?userId='+item.uid : '/topics/home/home?userId='+item.uid)">
				<image :src="item.avatar" mode="aspectFill" class="userimg"></image>
				<view class="name fflex">{{item.userName}}</view>
				<view class="time">{{item.followDate}}</view>
				<image src="../../static/pages/images/more.png" class="rico"></image>
			</view>
		</view>
		<view class="nodata" v-else>
			<image :src="picUrlss+'empty_jl.png'"></image>
			<text>暂无记录</text>
		</view>
	</view>
</template>

<script>
const app = getApp();
const req = require("../../utils/request.js");
const api = require("../../utils/api.js");

export default {
	data() {
		return {
			picUrlss: req.public.picUrls,
			opt: {},
			form: {
				page: 1,
				limit: 10
			},
			isLoad: true,
			pageList: [],
		};
	},
	props: {},
	onLoad: async function(options) {
		this.opt = options;
		this.getPageList();
	},
	onReachBottom() {
		this.form.page++
		this.getPageList();
	},
	methods: {
		getPageList(){
			if (!this.isLoad) return false;
			this.isLoad = false;
			let form = this.form;
			form.behavior = 1;
			form.type = 11;
			if(this.opt.userId) form.uid = this.opt.userId;
			req.getRequest(api.follow_user_list,form,data=>{
				if ( data && data.length >= 10) this.isLoad = true;
				if (this.form.page > 1) data = this.pageList.concat(data);
				this.pageList = data;
			})
		},
		jumpUrl(url){
			uni.navigateTo({
				url: url
			})
		}
	}
};
</script>
<style>
	@import "./index.css";
</style>
