<template>
	<view class="resume animated fadeInDownBig">
		<view class="message">
			<view class="title">需要完善简历100%才能投递哦</view>
			<view class="progress">
				<u-line-progress :percentage="(((16 - item.emptyCount) / 16) * 100).toFixed(0)" height="25" text="完善"></u-line-progress>
			</view>
		</view>
		<view class="row">
			<!--个人信息-->
			<view class="top" @click="go('/pages/user/resume/base?item=' + JSON.stringify(item))">
				<view class="sm6">
					<view class="name">
						<text>{{ item.name ? item.name : '姓名' }}</text>
						<text class="icon">&#xe6be;</text>
					</view>
					<view class="desc">
						<text class="text" v-if="item.experience">{{ item.experience }}</text>
						<text class="yd"></text>
						<text class="text" v-if="item.age">{{ item.age }}岁</text>
						<text class="yd"></text>
						<text class="text" v-if="item.qualification">{{ item.qualification }}</text>
					</view>
					<view class="desc">
						<view class="inf omit" v-if="item.phone">
							<text class="icon">&#xe622;</text>
							<text>{{ item.phone }}</text>
						</view>
						<view class="inf" v-if="item.email">
							<text class="icon">&#xe908;</text>
							<text>{{ item.email }}</text>
						</view>
					</view>
				</view>
				<image :src="item.avatar ? ip + item.avatar : '../../../static/ls.jpg'" mode="widthFix" class="tx" v-if="item.avatar"></image>
			</view>
		</view>
		<!--个人优势-->
		<view class="row" @click="go('/pages/user/resume/advantage?item=' + item.advantage)">
			<view class="label">
				<text class="title">个人优势</text>
				<text class="icon">&#xe6be;</text>
			</view>
			<view class="ellip">{{ item.advantage }}</view>
		</view>
		<!--求职状态-->
		<view class="row">
			<view class="item">
				<text class="title">求职状态</text>
				<view class="right">
					<picker :range="dict.state" @change="picker($event, 'state')">
						<input placeholder="请选择求职状态" v-model="item.state" :disabled="true" style="text-align: right; padding-right: 20px" placeholder-class="pc" />
						<view class="icon more" style="margin-top: -18px; float: right">&#xe62b;</view>
					</picker>
				</view>
			</view>
		</view>
		<!--求职期望-->
		<view class="row">
			<view class="label" @click="go('/pages/user/resume/desire')">
				<text class="title">求职期望</text>
				<text class="icon">&#xe7c4;</text>
			</view>
			<view class="con" v-for="(item, index) in item.desireList" :key="index" @click="go('/pages/resume/user/desire?item=' + JSON.stringify(item))">
				<view class="tit">
					<view class="left" style="width: 70%">
						<text>{{ item.positionName }}</text>
						<text class="salary">{{ item.salary }}</text>
					</view>
					<view class="right"><text class="icon">&#xe62b;</text></view>
				</view>
				<view class="desc">{{ item.cityName }}</view>
			</view>
		</view>
		<!--工作经历-->
		<view class="row">
			<view class="label" @click="go('/pages/resume/user/work')">
				<text class="title">工作经历</text>
				<text class="icon">&#xe7c4;</text>
			</view>
			<view class="con" v-for="(item, index) in item.workList" :key="index" @click="go('/pages/resume/user/work?item=' + JSON.stringify(item))" style="margin-bottom: 15px">
				<view class="tit">
					<view class="left">{{ item.companyName }}</view>
					<view class="right">
						<text class="date">{{ item.startDate }}-{{ item.endDate }}</text>
						<text class="icon">&#xe62b;</text>
					</view>
				</view>
				<view class="desc">
					<text class="bf">{{ item.positionName }}</text>
				</view>
				<view class="ellip">内容: {{ item.job }}</view>
			</view>
		</view>
		<!--项目经历-->
		<view class="row">
			<view class="label" @click="go('/pages/resume/user/project')">
				<text class="title">项目经历</text>
				<text class="icon">&#xe7c4;</text>
			</view>
			<view class="con" v-for="(item, index) in item.projectList" :key="index" @click="go('/pages/resume/user/project?item=' + JSON.stringify(item))">
				<view class="tit">
					<view class="left">{{ item.projectName }}</view>
					<view class="right">
						<text class="date">{{ item.startDate }}-{{ item.endDate }}</text>
						<text class="icon">&#xe62b;</text>
					</view>
				</view>
				<view class="desc">
					<text class="bf">{{ item.role }}</text>
				</view>
				<view class="ellip">内容: {{ item.projectDescribe }}</view>
			</view>
		</view>
		<!--教育经历-->
		<view class="row">
			<view class="label" @click="go('/pages/resume/user/education')">
				<text class="title">教育经历</text>
				<text class="icon">&#xe7c4;</text>
			</view>
			<view class="con" v-for="(item, index) in item.educationList" :key="index" @click="go('/pages/resume/user/education?item=' + JSON.stringify(item))">
				<view class="tit">
					<view class="left">{{ item.schoolName }}</view>
					<view class="right">
						<text class="date">{{ item.time }}</text>
						<text class="icon">&#xe62b;</text>
					</view>
				</view>
				<view class="desc">
					<text class="bf">{{ item.speciality }}</text>
					<text class="bf">{{ item.education }}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			ip: this.http.ip,
			item: { desireList: [], workList: [], projectList: [], educationList: [] },
			dict: {
				state: this.util.getData('state')
			}
		};
	},
	onLoad() {
		uni.$on('resume', (res) => {
			this.getData();
		});
		this.getData();
	},
	methods: {
		getData() {
			this.http.request({
				url: '/app/resume/index',
				success: (res) => {
					this.item = res.data.data;
					console.log(this.item);
				}
			});
		},
		picker(e, tag) {
			this.http.request({
				url: '/app/resume/state',
				data: { state: this.dict[tag][e.detail.value] },
				method: 'POST',
				success: (res) => {
					uni.showToast({ title: '操作成功' });
					this.item[tag] = this.dict[tag][e.detail.value];
				}
			});
		},
		go(url) {
			uni.navigateTo({ url: url });
		}
	},
	destroyed() {
		uni.$off('resume');
	}
};
</script>

<style lang="scss">
.message {
	.progress {
		margin-top: 7px;
	}
}
</style>
