<template>
	<view class="page">
		<view class="pageMain" v-if="list.length > 0 || !loadOver">
			<ty-list-list :status="load_status">
				<view class="padding-top-30 padding-bottom-20 border-bottom-ed" v-for="(item,index) in list"
					:key="index" @click="go('/pages/expert/detail?id=' + item.expert_id)">
					<view class="flex">
						<view class="headerImg margin-right-15">
							<image :src="item.head_img" class="width-100p height-100p block" mode="aspectFill">
							</image>
						</view>
						<view class="flex-one">
							<view class="flex align-center margin-bottom-10">
								<view class="flex-one margin-right-30 text-34 text-33 text-bold line-50">{{item.name}}
								</view>
								<view class="text-32 text-ff85 text-bold text-price">29</view>
							</view>
							<view class="text-26 text-909298 text-cut-one">{{item.brief}}</view>
						</view>
					</view>
					<view class="flex justify-end">
						<view class="text-26 text-ff text-bold text-center line-height-60 radius-10 bg-2f9"
							style="width: 140rpx;" @click.stop="delFollow(item.expert_id)">
							不再关注
						</view>
					</view>
				</view>
			</ty-list-list>
		</view>
		<view class="padding-top-100 flex flex-direction align-center" v-if="list.length == 0 && loadOver">
			<view class="emptyImg">
				<image src="/static/home/empty2.png" class="width-100p height-100p block"></image>
			</view>
			<view class="text-30 text-33 margin-bottom-40">您还没有关注过专家</view>
			<view class="text-26 text-ff text-center line-height-60 radius-30 bg-2f9" style="width: 220rpx;"
				@click="go('/pages/home/index',3)">去首页逛逛</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [],
				load_status: '',
				loadOver: false, //加载完
			}
		},
		onLoad(options) {
			this.type = options.type;
			this.loadList(1)
		},
		onReachBottom() {
			this.loadList(2)
		},
		methods: {
			loadList(first_page) {
				this.rq.getList('fire/api/Fire/getFollowExpertList', {

				}, {
					that: this,
					first_page
				}).then(() => {
					this.loadOver = true;
				})
			},
			delFollow(id) {
				this.rq.getData('fire/api/Fire/submitExpertFollow', {
					expert_id: id
				}).then(res => {
					if (res.code == 0) {
						this.loadOver = false;
						this.loadList(1)
					}
				})
			}
		}
	}
</script>

<style scoped>
	.pageMain {
		width: 100vw;
		min-height: 100vh;
		background: #fff;
		padding: 0 30rpx calc(30rpx + env(safe-area-inset-bottom));
		box-sizing: border-box;
	}

	.headerImg {
		width: 110rpx;
		height: 110rpx;
		border-radius: 10rpx;
		overflow: hidden;
	}

	.emptyImg {
		width: 160rpx;
		height: 160rpx;
		margin-bottom: 60rpx;
	}
</style>
