<template>
	<view class="content">
		<!-- 搜索 -->
		<piker-search @handleSearch="handleSearch" :placeholder='"找领导"' :width="'100'" :isAddress="false" :isPost="true"
			:isWork="false"></piker-search>

		<!--  -->
		<view class="box">
			<view class="list" v-for="(ite,ind) in list" :key="ind" @click="handledetail(ite)" v-if="list.length">
				<view class="left">
					<image :src="ite.avatar" mode="aspectFill"></image>
				</view>
				<view class="right">
					<view>
						<text class="name">{{ite.name}}</text>
						<text class="post">{{ite.posname}}</text>
					</view>
					<view class="c999 place">{{ite.composname}}<text v-if="ite.place" class="ml-5 mr-5">|</text>{{ite.place}}</view>
					<view class="c999">{{ite.mobile}}</view>
					<view class="c999">{{ite.province}}{{ite.city}}{{ite.area}}{{ite.address}}</view>
				</view>
			</view>
			<view class="nolist" v-if="!list.length">
				<image src="../../static/none.png"></image>
				<text>暂无数据</text>
			</view>
		</view>
	</view>
</template>

<script>
	import pikerSearch from "../../components/search.vue"
	export default {
		data() {
			return {
				name: "",
				province: "",
				city: "",
				industryid: "",
				list: [],
				page: 1,
				lastPage: 1,
			}
		},
		components: {
			pikerSearch
		},
		onLoad() {
			this.handleVipList()
		},
		onReachBottom() {
			let that = this
			if (!this.lastPage || this.page >= this.lastPage) {
				uni.showToast({
					title: '没有更多数据！',
					icon: 'none'
				})
				return
			}
			this.page++
			this.handleVipList()
		},
		methods: {
			// 领导风采
			handleVipList() {
				let that = this
				that.$model.getVipList({
					name: that.name,
					pageNo: that.page,
					pageSize: 10,
				}).then(res => {
					if (res.code == 0) {
						this.list = this.list.concat(res.data.rows)
						that.lastPage = res.data.totalpage
					} else {
						that.$tools.msg(res.message);
					}
				})
			},
			handleSearch(name) {
				let that = this
				// if (!uni.getStorageSync('token')) {
				// 	that.$tools.msg("登录后查看更多")
				// 	return
				// }
				this.name = name
				this.list = []
				this.page = 1
				this.handleVipList()
			},
			// 详情
			handledetail(ite) {
				let that = this
				// if (!uni.getStorageSync('token')) {
				// 	that.$tools.msg("登录后查看更多")
				// 	return
				// }
				uni.navigateTo({
					url: "/pages/phoneList/detail?id=" + ite.id
				})
			}

		}
	}
</script>

<style scoped lang="scss">
	.content {
		background-color: #fff;
	}


	.box {
		margin-top: 35px;
		width: 100%;

		.list {
			display: flex;
			justify-content: space-around;
			align-items: center;
			padding: 15px 0;
			border-bottom: 1px solid #dfdfdf;

			.left {
				width: 85px;
				height: 110px;
				border: 1px solid #dfdfdf;

			}

			.right {
				margin-left: 10px;
				width: calc(100% - 100px);
				height: 112px;
				display: flex;
				flex-wrap: wrap;
				justify-content: space-between;

				view {
					width: 100%;
					overflow: hidden;
					text-overflow: ellipsis;
					white-space: nowrap;
				}

				.name {
					color: #000;
					font-size: 16px;
					margin-right: 10px;
					font-weight: bold;
					max-width: 50%;
					overflow: hidden;
					text-overflow: ellipsis;
					white-space: nowrap;
				}

				.post {
					width: auto;
					display: inline-block;
					background-color: #F7B133;
					text-align: center;
					font-size: 12px;
					padding: 2px 10px;
					border-radius: 5px;
					color: #fff;
					margin-left: 15px;
				}

				.place {
					text {
						position: inherit;
						padding-left: 0;
					}
				}
			}

			image {
				width: 100%;
				height: 100%;
			}
		}
	}
</style>