<template>
	<view class="resume">
		<view class="module">
			<view class="f_b">
				<view class="name">{{ userInfo.name || '' }}</view>
				<u-icon name="edit-pen" size="22" color="#3686DC" @click="toPersonal"/>
			</view>
			<view class="f_s">
				{{ userInfo.age || 0 }}岁
				<view style="margin: 0 20rpx;">|</view>
				{{ userInfo.sex ? '男' : '' }}
				{{ userInfo.sex === false ? '女' : '' }}
			</view>
			<view class="f_s">
				<u-icon name="phone-fill" size="20"/>
				<view style="margin-left: 16rpx;">
					{{ userInfo.phoneNumber }}
				</view>
			</view>
		</view>
		<view class="module">
			<view class="f_b">
				<view class="name">求职意向</view>
				<view class="f_s" @click="toIntention">
					<u-icon
						name="setting"
						size="22"
						color="#3686DC"
					/>
					<view style="margin-left: 16rpx;color: #3686DC;">管理</view>
				</view>
			</view>
			<view class="f_s" v-for="item in intentionList">
				<u-icon name="file-text-fill" size="20"/>
				<view style="margin-left: 16rpx;">
					{{item.industryName}}
				</view>
			</view>
		</view>
		<view class="module">
			<view class="f_b">
				<view class="name">工作/实习经历</view>
				<view class="f_s" @click="toWork('')">
					<u-icon
						name="plus"
						size="22"
						color="#3686DC"
					/>
					<view style="margin-left: 16rpx;color: #3686DC;">添加</view>
				</view>
			</view>
		</view>
		<view class="module" v-for="item in workExperienceList">
			<view class="f_b">
				<view class="f_s">
					<u-icon name="bookmark-fill" size="24"/>
					<view class="name" style="margin-left: 16rpx;">
						{{item.orgName}}
					</view>
				</view>
				<u-icon name="edit-pen" size="22" color="#3686DC" @click="toWork(item.id)"/>
			</view>
			<view class="time">{{item.startTime}} - {{item.endTime}}</view>
			<view style="color: #666;">{{item.job}}</view>
			<view class="desc">{{item.descr}}</view>
		</view>
		<view class="module">
			<view class="f_b">
				<view class="name">教育经历</view>
				<view class="f_s" @click="toEducation('')">
					<u-icon
						name="plus"
						size="22"
						color="#3686DC"
					/>
					<view style="margin-left: 16rpx;color: #3686DC;">添加</view>
				</view>
			</view>
		</view>
		<view class="module" v-for="item in personEducationalList">
			<view class="f_b">
				<view class="f_s">
					<u-icon name="bookmark-fill" size="24"/>
					<view class="name" style="margin-left: 16rpx;">
						{{item.school}}
					</view>
				</view>
				<u-icon name="edit-pen" size="22" color="#3686DC" @click="toEducation(item.id)"/>
			</view>
			<view class="time">{{item.startTime}} - {{item.endTime}}</view>
			<view style="color: #666;">{{item.qualification}} | {{item.major}}</view>
		</view>
		<view class="module">
			<view class="f_b">
				<view class="f_s">
					<u-icon name="bookmark-fill" size="24"/>
					<view class="name" style="margin-left: 16rpx;">
						自我评价
					</view>
				</view>
				<u-icon name="edit-pen" size="22" color="#3686DC" @click="toSelf"/>
			</view>
			<view class="desc">{{userInfo.selfEvaluation || ''}}</view>
		</view>
		<view style="height: 200px;"></view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userInfo: {},
				intentionList: [], // 意向职位
				workExperienceList: [], // 工作经历
				personEducationalList: [], // 教育经历
			}
		},
		onShow() {
			this.$http.get('/person/person/details', {}).then(res => {
				this.userInfo = res.data
				this.$http.get('/objective/l', {personId: res.data.id}).then(res => {
					this.intentionList = res.data.list
				})
				this.$http.get('/workExperience/l', {personId: res.data.id}).then(res => {
					this.workExperienceList = res.data.list
				})
				this.$http.get('/personEducational/l', {personId: res.data.id}).then(res => {
					this.personEducationalList = res.data.list
				})
			})
		},
		methods: {
			// 基本信息
			toPersonal(){
				uni.navigateTo({
					url: `/pages/user/resume/personalInfo`
				})
			},
			// 求职意向
			toIntention() {
				uni.navigateTo({
					url: `/pages/user/resume/intention?id=${this.userInfo.id}`
				})
			},
			toWork(id) {
				uni.navigateTo({
					url: `/pages/user/resume/work?id=${id}`
				})
			},
			toEducation(id) {
				uni.navigateTo({
					url: `/pages/user/resume/education?id=${id}`
				})
			},
			toSelf() {
				uni.navigateTo({
					url: `/pages/user/resume/selfEvaluation`
				})
			}
		},
	}
</script>

<style lang="scss">
.resume{
	padding: 30rpx;
	background: #fff;
	box-sizing: border-box;
	overflow: auto;
	.module{
		margin-bottom: 70rpx;
		font-size: 28rpx;
		>view{
			margin-bottom: 20rpx;
		}
		.name{
			font-size: 38rpx;
		}
		.time{
			margin: 20rpx 0;
			font-size: 24rpx;
			color: #777;
		}
		.minTitle{
			font-size: 36rpx;
			line-height: 1;
		}
		.tag{
			margin: 16rpx 16rpx 0 0;
		}
		.desc{
			color: #666;
			line-height: 1.7;
			white-space: pre-line;
			font-weight: 300;
		}
	}
}
</style>
