<template>
	<view class="content">
		<view class="list-item" v-for="(item,index) in list" :key="index" @click="toinfo(item)" v-if="list.length > 0">
			<view class="top hflex acenter jbetween">
				<text class="text_hide">{{item.title}}</text>
				<text>{{item.salary_min}}-{{item.salary_max}}K·{{item.salary_month}}薪</text>
			</view>

			<view class="hflex acetner">
				<view class="text-box" v-if="item.education">{{item.education}}</view>
				<view class="text-box" v-if="item.experience_min">{{item.experience_min}}-{{item.experience_max}}年
				</view>
			</view>
			<view class="bottom hflex acenter jbetween">
				<text>{{item.name}} {{item.mobile}}</text>
				<text>{{item.city}}</text>
			</view>
		</view>
		<view class="hflex acenter jcenter " style="height: 100vh;" v-else>
			<u-empty mode="data"></u-empty>
		</view>
	</view>
</template>

<script>
	import $api from '@/static/js/api.js'
	export default {
		data() {
			return {
				list: [],
				page: 1,
				last_page: 1,
			}
		},
		onLoad() {
			this.getlist()
		},
		onReachBottom() {
			if (this.page < this.last_page) {
				this.page++
				this.getlist()
			} else {
				uni.$u.toast('已经到底了')
				return
			}
		},
		methods: {
			toinfo(item) {
				uni.navigateTo({
					url: '/pageC/zhiwei-detail?id=' + item.id
				})
			},
			getlist() {
				var _this = this
				$api.req({
					url: 'job',
					method: 'GET',
					data: {
						is_page: 1,
						page: _this.page,
						limit: 10,
					}
				}, function(res) {
					if (res.code == 10000) {
						_this.list = _this.list.concat(res.data.list)
						_this.last_page = res.data.last_page
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.content {
		padding: 20rpx 24rpx;
		background: #F4F4F4;

		.list-item {
			background: #FFFFFF;
			border-radius: 16rpx;
			margin: 0 0 20rpx;
			box-sizing: border-box;
			padding: 26rpx 20rpx;

			.top {
				padding-bottom: 20rpx;

				text:first-child {
					font-size: 32rpx;
					font-family: PingFangSC, PingFang SC;
					font-weight: 600;
					color: #222222;
					max-width: 432rpx;
				}

				text:last-child {
					font-size: 28rpx;
					font-family: JDZhengHT, JDZhengHT;
					font-weight: 400;
					color: #00B0B0;
				}
			}

			.company {
				padding: 16rpx 0;

				text {
					font-size: 24rpx;
					font-family: PingFangSC, PingFang SC;
					font-weight: 400;
					color: #666666;
				}
			}

			.text-box {
				background: #F4F4F4;
				border-radius: 4rpx;
				padding: 4rpx 10rpx;
				font-size: 20rpx;
				font-family: PingFangSC, PingFang SC;
				font-weight: 400;
				color: #555555;
				margin: 0 16rpx 0 0;
			}

			.bottom {
				padding: 26rpx 0 0;

				text:first-child {
					font-size: 20rpx;
					font-family: SFPro, SFPro;
					font-weight: 400;
					color: #444444;
				}

				text:last-child {
					font-size: 20rpx;
					font-family: PingFangSC, PingFang SC;
					font-weight: 400;
					color: #999999;
				}
			}
		}
	}
</style>