<template>
	<view>
		<view class="resumepage">
			<view class="u-flex u-row-between">
				<view class="">
					<view class="u-flex">
						<text style="margin-right: 20rpx;">{{from.name}}</text>
						<!-- <u-icon @click="onchange" name="edit-pen-fill" color="#777" size="22"></u-icon> -->
					</view>
					<view class="" style="margin-top: 20rpx;">
						<text style="margin-right: 12rpx;">{{from.experience}}年工作经验</text>|
						<text style="margin-left: 12rpx;margin-right: 12rpx;">{{from.birthday_text}}岁</text>|
						<text style="margin-left: 12rpx;">{{}}</text>
					</view>
				</view>
				<image style="width: 136rpx;height: 136rpx;border-radius:50%;" :src="from.avatar" mode=""></image>
			</view>
			<view class="" style="margin-top: 30rpx;">
				<view class="u-flex u-row-between">
					<text class="title">个人优势</text>
					<!-- <u-icon name="edit-pen-fill" color="#777" size="22" @click="toadvantage"></u-icon> -->
				</view>
				<view class="mar">
					<input type="text" placeholder="编辑优势亮点，展示我的独特态度" v-model="from.personal_advantage">
				</view>
			</view>
<!-- 			<view class="" style="border-top:2rpx solid #F0F0F0;margin-top: 32rpx;">
				<view class="u-flex ">
					<text class="title">求职状态</text>
				</view>
				<view class="u-flex u-row-between" style="margin-top: 20rpx;">
					<input type="text" placeholder="请选择你的求职状态" v-model="from.job_status_name">
				</view>
			</view> -->
			<view class="" style="border-top:2rpx solid #F0F0F0;margin-top: 32rpx;">
				<view class="u-flex u-row-between">
					<text class="title">求职意向</text>
					<!-- <u-icon @click="toapply(1)" name="plus-circle" size="20"></u-icon> -->
				</view>
				<view class="" style="margin-top: 40rpx;margin-bottom: 20rpx;" v-for="(item,index) in job_intention1"
					:key="item.id" >
					<view class="u-flex u-row-between">
						<view class="">
							<text>{{item.category_job_name}}</text>
							<text style="margin-left: 28rpx;">{{item.salary}}k</text>
						</view>
						<!-- <u-icon name="arrow-right" size="12"></u-icon> -->
					</view>
					<text
						style="margin-top: 20rpx;font-size: 28rpx;font-family: PingFangSC-Regular, PingFang SC;font-weight: 400;color: #777777;">{{item.city}}·{{item.category_industry_name}}</text>
				</view>
			</view>
			<view class="" style="border-top:2rpx solid #F0F0F0;margin-top: 32rpx;">
				<view class="u-flex u-row-between">
					<text class="title">工作经历</text>
					<!-- <u-icon name="plus-circle" size="20" @click="towork(1)"></u-icon> -->
				</view>
				<view class="" v-for="(item,index) in job_experience1" :key="item.id" >
					<view class="u-flex u-row-between" style="margin-top:40rpx ;">
						<text>{{item.company_name}}</text>
						<view class="u-flex">
							<text>{{item.start_time}}-{{item.end_time}}</text>
							<!-- <u-icon name="arrow-right" size="12"></u-icon> -->
						</view>
					</view>
					<view class="" style="margin-top: 20rpx;font-size: 28rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #333333;">
						<text>{{item.job_name}}｜</text>
						<text>{{item.department}}</text>
					</view>
					<view class="concent">
						{{item.work_content}}
					</view>
				</view>
			</view>
			<view class="" style="margin-top: 40rpx;border-top: 2rpx solid #F0F0F0;">
				<view class="u-flex u-row-between">
					<text class="title">项目经历</text>
					<!-- <u-icon name="plus-circle" size="20" @click="toproject(1)"></u-icon> -->
				</view>
				<view class="" style="margin-top: 40rpx;" v-for="(item,index) in project_experience1" >
					<view class="u-flex u-row-between">
						<text>{{item.company_name}}</text>
						<view class="u-flex">
							<text>{{item.start_time}}-{{item.end_time}}</text>
							<!-- <u-icon name="arrow-right" size="12"></u-icon> -->
						</view>
					</view>
					<view class="mar">
						<text>{{item.role}}</text>
					</view>
					<view class="concent">
						{{item.description}}
					</view>
				</view>
				<view class=""></view>
			</view>
			<view class="" style="margin-top: 40rpx;border-top: 2rpx solid #F0F0F0;">
				<view class="u-flex u-row-between">
					<text class="title">教育经历</text>
					<!-- <u-icon name="plus-circle" size="20" @click="toteach(1)"></u-icon> -->
				</view>
				<view class="" style="margin-top: 40rpx;" v-for="(item,index) in education_experience1" :key="item.id" >
					<view class="u-flex u-row-between">
						<text>{{item.name}}</text>
						<view class="u-flex">
							<text>{{item.start_time}}-{{item.end_time}}</text>
							<!-- <u-icon name="arrow-right" size="12"></u-icon> -->
						</view>
					</view>
					<view class="">
						<text>{{item.major}}</text>
					</view>
				</view>
			</view>
			<view class="" style="margin-top: 40rpx;border-top: 2rpx solid #F0F0F0;" >
				<view class="u-flex u-row-between">
					<text class="title">语言能力</text>
					<!-- <u-icon name="plus-circle" size="20" @click="tolanguage(1)"></u-icon> -->
				</view>
				<view class="mar" v-for="(item,index) in language1">
					<view class="u-flex u-row-between">
						<text>{{item.language_name}}</text>
						<view class="u-flex">
							<text>{{item.level_name}}</text>
							<u-icon name="arrow-right" size="12"></u-icon>
						</view>
					</view>
				</view>
			</view>
			<view class="" style="margin-top: 40rpx;border-top: 2rpx solid #F0F0F0;">
				<view class="u-flex u-row-between">
					<text class="title">专业技能与证书</text>
					<!-- <u-icon name="plus-circle" size="20" @click="tocertificate()"></u-icon> -->
				</view>
				<view class="mar">
					<!-- <view style="flex: 1;" class="item">{{certificate.professional_skill}}</view> -->
					<text class="texta item" v-for="(item,index) in certificate1" :key="index" >{{item.professional_skill}}</text>
				</view>
				<view style="margin-top: 32rpx;" class="u-flex u-row-between" v-for="(item,index) in certificate1" :key="index">
					<text>{{item.certificate}}</text>
					<text>{{item.certificate_date}}</text>
				</view>
			</view>
	<!-- 		<view class="" style="margin-top: 40rpx;border-top: 2rpx solid #F0F0F0;margin-bottom:118rpx ;">
				<view class="u-flex u-row-between">
					<text class="title">附加信息</text>
					<!-- <u-icon name="plus-circle" size="20"></u-icon> -->
		<!-- 		</view>
				<view class="mar">
					<input type="text" placeholder="请输入附加消息">
				</view>
			</view> --> 
			<view class="" style="height: 60rpx;"></view>

		</view>
	<!-- 	<view class="back u-flex" style="margin-top: 118rpx;">
			<view class="left">
				简历导入
			</view>
			<view class="right" @click="preview">
				<text style="opacity: 1;color: #0C66C2;">预览</text>  
			</view>
		</view> -->
		<!-- <u-picker :show="jobshow" :columns="joblist"></u-picker> -->
		<u-picker @cancel="show = false" :show="show" :columns="columns" keyName="name"  @confirm="enter"></u-picker>

	</view>
</template>

<script setup>
	import {
		resumeDetail,
		get_job_status,
		update,
	} from "@/units/inquire.js"
	export default {
		data() {
			return {
				jlid: '',
				show:false,
				columns:[[]],
				certificate1:[],
				from: {
					avatar:"",
					name: "",
					birthday_text: "",
					personal_advantage: "", //个人优势
					additional_info: "", //附加信息
					experience: "",
					job_status_id:"",	//string	求职状态ID
					job_status_name:""	//求职状态名称
				},
				//求职意向
				job_intention: {
					job_date: "", //date	求职时间(求职意向
					province_id: "", //string	期望省份ID(求职意向
					city_id: "", //string	期望城市ID(求职意向
					province: "", //string	期望省份名称(求职意向
					city: "", //string	期望城市名称(求职意向
					salary_type: "", //string	薪资类型: year=年薪;month=月薪(求职意向
					salary: "", //string	薪水(求职意向
					salary_month: "", //string	一年多少薪(求职意向
					category_field_id: "", //string	领域ID(求职意向
					category_field_name: "", //string	领域名称(求职意向
					category_industry_first: "", //string	行业一级ID(求职意向
					category_industry_id: "", //string	行业ID(求职意向
					category_industry_first_name: "", //string	行业一级名称(求职意向
					category_industry_name: "", //string	行业名称(求职意向
					category_job_first: "", //string	职业分类一级ID(求职意向
					category_job_second: "", //string	职业分类二级ID(求职意向
					category_job_id: "", //string	职位分类ID(求职意向
					category_job_first_name: "", //string	职业分类一级名称(求职意向
					category_job_second_name: "", //string	职业分类二级名称(求职意向
					category_job_name: "", //string	职位分类名称(求职意向)
					is_pay: "",
				},
				//工作经历
				job_experience: {
					company_name: "", //	string	公司名称(工作经历
					industry_id: "", //string	公司行业ID(工作经历
					department: "", //tring	所属部门(工作经历
					job_name: "", //ing	职位名称(工作经历
					underling_count: "", //unt	string	下属数量(工作经历
					report_to: "", //ring	汇报对象(工作经历
					start_time: "", //ate	在职开始时间: 如 2019-01-01(工作经历
					end_time: "", //e	在职结束时间: 如 2019-01-01(工作经历
					level_reason: "", //	string	离职原因(工作经历
					work_content: "", //	string	工作内容(工作经历
				},
				//项目经历
				project_experience: {
					name: "", //string	项目名称(项目经历
					company_name: "", //string	公司名称(项目经历
					role: "", // string	项目角色(项目经历
					start_time: "", //tring	开始时间(项目经历
					end_time: "", //string	结束时间(项目经历
					description: "", // string	项目描述(项目经
				},
				//教育经历
				education_experience: {
					name: "", //string	学校名称(教育经历
					is_recruit: "", //string	是否统招: 1.是, 0.不是(教育经历
					education_id: "", //string	学历ID(教育经历
					education_name: "", //string	学历名称(教育经历
					major: "", //string	专业(教育经历
					start_time: "", //string	开始时间 如 2019-01-01(教育经历
					end_time: "", //string	结束时间 如 2019-01-01(教育经历
				},
				//语言能力
				language: {
					language_id: "", //      tring	语言ID(语言能力
					level_id: "", //      ng	水平ID(语言能力
					language_name: "", //      	string	语言名称(语言能力
					level_name: "", //      ring	水平名称(语言能力
				},
				certificate:{
					certificate:"",
					certificate_date:""
				},
				//附件简历
				file: {
					file: "", //string	附件(附件简历
					title: "", //string	附件名称(附件简历
				},
				education_experience1: [], //教育经历
				job_experience1: [], //工作经历
				job_intention1: [], //教育经历
				project_experience1: [], //项目经历
				language1: [], //语言能力
				joblist: [],
			}
		},
		onLoad() {
			this.get_job_status()
			// this.resumeDetail()
		},
		onShow(){
			this.resumeDetail()
		},
		methods: {
			preview(){
				uni.navigateTo({
					url:"/pagesD/preview"
				})
			},
			tocertificate(){
				uni.navigateTo({
					url:"/pagesD/certificate"
				})
			},
			tolanguage(type,id){
				uni.navigateTo({
					url:"/pagesD/language?type="+type+"&id="+id
				})
			},
			toteach(type,id){
				uni.navigateTo({
					url:"/pagesD/teach?type="+type+"&id="+id
				})
			},
			toproject(type,id){
				uni.navigateTo({
					url:"/pagesD/project?type="+type+"&id="+id
				})
			},
			enter(e){
				this.from.job_status_name = e.value[0].name
				this.from.job_status_id =  e.value[0].id
				this.show = false
			},
			get_job_status(){
				get_job_status().then(res=>{
					this.columns[0] =  res.data
				})
			},
			toadvantage() {
				uni.navigateTo({
					url: "/pagesD/advantage",
					events: {
						todcp:(res) => {
							this.from.personal_advantage = res
							update({
								personal_advantage:this.from.personal_advantage,
								source_type:"resume",
								source_id:this.jlid
							}).then(res=>{
								this.resumeDetail()
							})
						}
					}
				})
			},
			// get_job_status() {
			// 	get_job_status().then(res => {
			// 		this.joblist = res.data
			// 	})
			// },
			toapply(type,id) {
				uni.navigateTo({
					url: "/pagesD/apply?type=" + type+"&id="+id,
					events: {
						apply: (res) => {
							console.log(res);
						}
					}
				})
			},
			towork(type,id) {
				uni.navigateTo({
					url: "/pagesD/work?key=" + type+"&id="+id,
					events: {
						work: (res) => {
							console.log(res);
						}
					}
				})
			},
			resumeDetail() {
				resumeDetail().then(res => {
					this.from.avatar = res.data.avatar
					this.from.personal_advantage = res.data.personal_advantage
					this.jlid = res.data.id
					this.from.name = res.data.name,
					this.from.birthday_text = res.data.birthday_text,
					// this.job_intention.province = res.data.job_intention[0].province,
					this.from.experience = res.data.experience
					this.education_experience1 = res.data.education_experience
					this.job_experience1 = res.data.job_experience
					this.job_intention1 = res.data.job_intention
					this.language1 = res.data.language
					this.project_experience1 = res.data.project_experience
					this.from.job_status_name = res.data.job_status_name
					this.from.job_status_id = res.data.job_status_id
					this.certificate.certificate = res.data.certificate.certificate
					this.certificate.certificate_date = res.data.certificate.certificate_date
					this.certificate1 = res.data.certificate
				})
			},
			onchange() {
				uni.navigateTo({
					url: "/pagesD/personal-infor?id=" + this.jlid
				})
			}
		}
	}
</script>


<style lang="scss">
	.texta{
		margin-right: 20rpx;
	}
	.concent {
		font-size: 28rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		color: #555555;
		margin-top: 20rpx;
	}

	.mar {
		margin-top: 20rpx;
	}

	.title {
		font-size: 32rpx;
		font-family: PingFangSC-Medium, PingFang SC;
		font-weight: 500;
		color: #222222;
		margin-top: 34rpx;
	}

	.item {
		height: 48rpx;
		background: #F4F4F4;
		border-radius: 6rpx;
		padding: 14rpx;
		box-sizing: border-box;
	}

	.resumepage {
		padding: 0 32rpx;
		background-color: #fff;
	}

	.back {
		padding: 16rpx 32rpx;
		background: #FFFFFF;
		height: 118rpx;
		box-sizing: border-box;
		position: fixed;
		bottom: 0;
		left: 0;

		.left {
			width: 356rpx;
			background: #0C66C2;
			border-radius: 12rpx;
			font-size: 32rpx;
			font-family: PingFangSC-Medium, PingFang SC;
			font-weight: 500;
			color: #FFFFFF;
			height: 88rpx;
			line-height: 88rpx;
			margin-right: 24rpx;
			text-align: center;
		}

		.right {
			width: 304rpx;
			// opacity: 0.1;
			// background: #0C66C2;
			border-radius: 12rpx;
			font-size: 32rpx;
			font-family: PingFangSC-Medium, PingFang SC;
			font-weight: 500;
			color: #0C66C2;
			height: 88rpx;
			line-height: 88rpx;
			text-align: center;
			background-color: rgba(12, 102, 194, 0.1);
		}
	}
</style>