<template>
	<view>
		<block v-for="(item,index) in plist" :key="index">
			<view class="cu-card dynamic no-card solid-bottom echo-comjobs-item padding-top-sm padding-lr-sm radius">
				<view class="cu-item shadow padding-top-sm padding-bottom">
					<view class="padding-lr flex justify-between align-center">
						<view class="basis-lg text-bold text-df text-cut">{{item.user.nickname}}</view>
						<view class="basis-sm text-cut text-right text-red text-sm">
							{{item.status_text}}
						</view>
					</view>
					<view class="padding-lr padding-tb-xs text-cut">
						<view v-for="(titem,tindex) in item.user.com_cate" :key="tindex" class="cu-tag light bg-blue lg echo-tags-item">{{titem}}</view>
					</view>
					<view class="padding-lr padding-tb-xs text-cut">
						<view v-for="(eitem,eindex) in item.user.emp_time" :key="eindex" class="cu-tag light bg-red lg echo-tags-item">{{eitem}}</view>
					</view>
					<view class="padding-lr text-cut text-sm flex justify-between align-center">
						<view class="basis-lg text-df text-cut">{{sex[item.user.gender]}}</view>
					</view>
					<view class="padding-lr padding-tb-xs flex justify-end">
						<view class="cu-btn bg-green radius" @tap="showMobile(item.user.mobile)" v-if="item.status == 2">拔打电话</view>
						<view class="cu-btn bg-blue margin-left-sm radius" @tap="goDetail(item.userid)">查看简历</view>
					</view>
				</view>
			</view>
		</block>
		<uni-load-more :status="pstatus"></uni-load-more>
		
	</view>
</template>

<script>
	import slFilter from '@/components/sl-filter/sl-filter.vue';
	import uniLoadMore from "@/components/uni-load-more/uni-load-more.vue";
	var _this;
	export default {
		components: {
			slFilter,
			uniLoadMore
		},
		data() {
			return {
				workerinfo: {},
				
				pstatus: 'more',
				ppage: 1,
				psize: 20,
				plist: [],
				sex: ['未知','男','女'],
			};
		},
		onLoad: function(option){
			_this = this;
			_this.workerinfo = uni.getStorageSync('workerinfo') || false;
			_this.getMore();
		},
		onPullDownRefresh: function() {
			_this.pageRefresh();
		},
		onReachBottom: function() {
			if (_this.pstatus !== 'more') {
				return;
			}
			_this.getMore();
		},
		methods: {
			pageRefresh: function() {
				_this.pstatus = 'more';
				_this.ppage = 1;
				_this.plist = [];
				_this.getMore();
			},
			getMore: function() {
				_this.$req.ajax({
					path: "resume/workerLog",
					data: {
						ppage: _this.ppage,
						psize: _this.psize,
						workerid: _this.workerinfo.id
					}
				}).then((data) => {
					_this.pstatus = data.status;
					_this.plist = _this.plist.concat(data.list);
					_this.ppage += 1;
					uni.stopPullDownRefresh();
				}).catch((err) => {
					uni.showModal({
						title: '信息提示',
						content: err,
						showCancel: false
					});
				});
			},
			goDetail: function(id) {
				uni.navigateTo({
					url: '/pages/resume/detail?id=' + id
				});
			},
			showMobile: function(mobile) {
				uni.makePhoneCall({
					phoneNumber:mobile.toString()
				});
			}
		}
	}
</script>

<style>
</style>
