<template>
	<view>
		<!-- 头部 -->
		<view class="bg-white  header flex row-center">
			<block v-if="cate_id">
				<u-icon name="file-text-fill" color="#DD4250" size="32"></u-icon>
				<view class="cate-title m-l-10">{{ cate.title }}</view>
			</block>
			<block v-else-if="keyword">
				<u-icon name="search" color="#DD4250" size="32"></u-icon>
				<view class="cate-title m-l-10">搜索关键字：{{ keyword }}</view>
			</block>
			<block v-else>
				<u-icon name="file-text-fill" color="#DD4250" size="32"></u-icon>
				<view class="cate-title m-l-10">人才列表</view>
			</block>
		</view>
		<view>
			<!-- 列表 -->
			<talents-list :cid="cate_id" :keyword="keyword"></talents-list>
		</view>

	</view>
</template>

<script>
	import {
		mapActions,
		mapGetters
	} from 'vuex'
	import {
		getCategoryDetail
	} from '@/api/app';
	export default {
		data() {
			return {
				statusBarHeight: 0,
				cate_id: null, //分类id
				keyword: '',
				cate: {
					title: ''
				}
			};
		},
		created() {
			uni.getSystemInfo({
				success: (res) => {
					this.statusBarHeight = res.statusBarHeight;
				}
			});
		},
		onLoad() {
			this.cate_id = this.$Route.query.cate_id;
			this.keyword = this.$Route.query.keyword;
			if (this.cate_id) {
				this.getCategoryFun()
			}
		},
		onShow() {
			this.getUser();
		},
		methods: {
			...mapActions(['getUser']),
			async getCategoryFun() {
				const {
					status,
					data
				} = await getCategoryDetail({
					id: this.cate_id
				});
				if (status == 1) {
					this.cate = data
				}
			},
		},
		computed: {
			...mapGetters(['appConfig']),
		}
	};
</script>
<style lang="scss">
	.header {
		padding: 30rpx;

		.cate-title {
			font-size: 32rpx;
			font-weight: 400;
		}
	}
</style>