<!-- 添加工作经历 -->
<template>
	<view class="experience">
		<!-- 导航栏 -->
		<u-navbar class="experience-bar" back-text="" back-icon-color="#fff" title="添加工作经历" title-color="#fff" :background="background">
			<view class="experience-bar-right" slot="right">保存</view>
		</u-navbar>
		
		<!-- 表单 -->
		<view class="experience-form">
			<u-form :model="form" label-position="top">
				<u-form-item label="公司名称">
					<u-input v-model="form.company" placeholder="请输入公司名称"/>
				</u-form-item>
				<u-form-item label="在职时间">
					<u-input v-model="form.startDate" placeholder="入职时间" disabled @click="startDateShow = true" inputAlign="center"/>
					<u-picker mode="time" v-model="startDateShow" :params="{ year: true,
	month: true}" :end-year="endYear" @confirm="startDateConfirm"/>
					<view class="divider"></view>
					<u-input v-model="form.endDate" placeholder="离职时间" @click="endDateShow = true" inputAlign="center"/>
					<u-picker mode="time" v-model="endDateShow" :params="{ year: true,
					month: true}" :end-year="endYear" @confirm="endDateConfirm"/>
				</u-form-item>
				<u-form-item label="职位名称">
					<u-input v-model="form.position" placeholder="请输入职位名称"/>
				</u-form-item>
				<u-form-item label="企业评价">
					<u-input v-model="form.evaluation" placeholder="请输入企业评价"/>
				</u-form-item>
			</u-form>
		</view>
	</view>
</template>

<script>
	export default {
		name: 'AddExperience',
		data() {
			return {
				background: {
					backgroundColor: '#3D5D4C'
				},
				form: {
					company: '',
					startDate: '',
					endDate: '',
					position: '',
					evaluation: ''
				},
				startDateShow: false,
				endDateShow: false,
				endYear: (new Date()).getFullYear()
			}
		},
		methods: {
			/**
			 * 入职时间弹框确认
			 * @param { Object } e 
			 */
			startDateConfirm(e) {
				this.form.startDate = e.year + '-' + e.month
			},
			/**
			 * 离职时间弹框确认
			 * @param { Object } e 
			 */
			endDateConfirm(e) {
				this.form.endDate = e.year + '-' + e.month
			}
		}
	}
</script>

<style lang="scss" scoped>
@import './myResume.scss';
</style>
