<template>
	<view class="accounmt">
		<view class="beizhu">
			友情提示：完善简历有助于您在竞标时提高竞争力哦
		</view>
		<view style="display: flex;justify-content: space-between;">
			<view>
				<view style="display: flex;align-items: center;">
					<p style="font-weight: bold;font-size: 36rpx;">
						{{resumedata.name}}
					</p>
					<p>{{resumedata.sex}}</p>
				</view>
			</view>
		</view>

		<!-- 个人优势 -->
		<view class="linx"></view>
		<view style="display: flex;justify-content: space-between;">
			<p style="font-weight: bold;font-size: 36rpx;">基本信息</p>
			<img @click="nextpro('advantage')" style="width: 14px;height: 14px;margin:6px 5px 0 5px"
				src="http://image.keyitest.cn/static/resume/edit.png" alt="" />
		</view>
		<p v-if='resumedata.city' @click="nextpro('advantage')"
			style="color: #333333;margin-top:13px;line-height: 40rpx;">{{resumedata.city}}</p>
		<p v-if='resumedata.testSkills' @click="nextpro('advantage')"
			style="color: #333333;margin-top:13px;line-height: 40rpx;">{{resumedata.testSkills}}</p>
		<p v-if='resumedata.personalAdvantage' @click="nextpro('advantage')"
			style="color: #333333;margin-top:13px;line-height: 40rpx;">{{resumedata.personalAdvantage}}</p>
		<p v-else style="color: #333333;margin-top:13px;">无</p>
		<!-- 工作经历 -->
		<view class="linx"></view>
		<view style="display: flex;justify-content: space-between;">
			<p style="font-weight: bold;font-size: 36rpx;">工作经历</p>
			<img @click="nextpro('work')" style="width: 14px;height: 14px;margin:6px 5px 0 5px"
				src="http://image.keyitest.cn/static/resume/add.png" alt="" />
		</view>
		<view v-if="worklist.length>0">
			<view v-for="(item,key) of worklist" @click="workdetaols(item)">
				<view style="display: flex;justify-content: space-between;margin: 45rpx 0 25rpx 0;">
					<p style="font-weight: bold;font-size:14px;">{{item.name}}</p>
					<view style="display: flex;">
						<p style="margin-right:6px;color: #4D4D4D;">{{item.startTime}}-{{item.endTime}}
						</p>
						<u-icon name="arrow-right" color="#808080" size="26"></u-icon>
					</view>
				</view>
				<p style="color:#000000">{{item.title}}</p>
				<p style="color: #595959;margin-top:25rpx;line-height: 20px;">
					{{item.intro}}
				</p>
			</view>
		</view>
		<p v-else style="color: #333333;margin-top:13px;">无</p>
		<!-- 项目经历 -->
		<view class="linx"></view>
		<view style="display: flex;justify-content: space-between;">
			<p style="font-weight: bold;font-size: 36rpx;">项目经历</p>
			<img @click="nextpro('pro')" style="width: 14px;height: 14px;margin:6px 5px 0 5px"
				src="http://image.keyitest.cn/static/resume/add.png" alt="" />
		</view>
		<view v-if="projectlist.length>0">
			<view v-for="(item,key) of projectlist" @click="prodetaols(item)">
				<view style="display: flex;justify-content: space-between;margin: 45rpx 0 25rpx 0;">
					<p style="font-weight: bold;font-size:14px;">{{item.name}}</p>
					<view style="display: flex;">
						<p style="margin-right:6px;color: #4D4D4D;">{{item.startTime}}-{{item.endTime}}
						</p>
						<u-icon name="arrow-right" color="#808080" size="26"></u-icon>
					</view>
				</view>
				<p style="color:#000000">{{item.title}}</p>
				<p style="color: #595959;margin-top:25rpx;line-height: 20px;">
					{{item.intro}}
				</p>
			</view>
		</view>
		<p v-else style="color: #333333;margin-top:13px;">无</p>

		<!-- 教育经历 -->
		<view class="linx"></view>
		<view style="display: flex;justify-content: space-between;">
			<p style="font-weight: bold;font-size: 36rpx;">教育经历</p>
			<img @click="nextpro('edu')" style="width: 14px;height: 14px;margin:6px 5px 0 5px"
				src="http://image.keyitest.cn/static/resume/add.png" alt="" />
		</view>
		<view v-if="educationlist.length>0">
			<view v-for="(item,key) of educationlist" @click="edudetaols(item)">
				<view style="display: flex;justify-content: space-between;margin: 45rpx 0 25rpx 0;">
					<p style="font-weight: bold;font-size:14px;">{{item.name}}</p>
					<view style="display: flex;">
						<p style="margin-right:6px;color: #4D4D4D;">{{item.startTime}}-{{item.endTime}}
						</p>
						<u-icon name="arrow-right" color="#808080" size="26"></u-icon>
					</view>
				</view>
				<p style="color:#000000">{{item.education}}</p>
				<p style="color: #595959;margin-top:25rpx;line-height: 20px;">
					{{item.major}}
				</p>
			</view>
		</view>
		<p v-else style="color: #333333;margin-top:13px;">无</p>
		<!-- 资格证书 -->
		<view class="linx"></view>
		<view style="display: flex;justify-content: space-between;">
			<p style="font-weight: bold;font-size: 36rpx;">资格证书</p>
			<img @click="nextpro('basic')" style="width: 14px;height: 14px;margin:6px 5px 0 5px"
				src="http://image.keyitest.cn/static/resume/add.png" alt="" />
		</view>
		<view style="text-align:center;margin: 15px 0;" v-for="it in credentialsList" @click="bookdetaols(it)">
			<view style="display: flex;justify-content: space-between;margin: 45rpx 0 25rpx 0;">
				<view>
					<p style="text-align: left;">{{it.fileName}}</p>
					<img @click="priveimg(it.fileUrl)" style="width: 196rpx;height: 139rpx;" :src="it.fileUrl" alt="">
				</view>
				<view style="display: flex;">
					<u-icon name="arrow-right" color="#808080" size="26"></u-icon>
				</view>
			</view>
			<!-- <p  style="text-align: left;">{{it.fileName}}</p>
			<img @click="priveimg(it.fileUrl)"
				style="width: 196rpx;height: 139rpx;" :src="it.fileUrl" alt=""> -->
		</view>
		<view class="linx"></view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userinfo: {},
				projectlist: [], //项目集合
				worklist: [], //工作经历
				educationlist: [], //教育
				resumedata: {},
				credentialsList: [], //证书
			}
		},
		onShow() {

			this.http.quickGet(`/personal/resume`, true).then(res => {
				// 经历
				this.projectlist = res.data.experience.filter(it => it.type == 0)
				this.worklist = res.data.experience.filter(it => it.type == 1)
				this.educationlist = res.data.experience.filter(it => it.type == 2)
				// 个人简介
				this.resumedata = res.data.personalInfo
				// 证书
				this.credentialsList = res.data.credentials
			})
		},
		onLoad() {

		},
		methods: {
			//添加项目
			nextpro(type) {
				if (type == 'basic') {
					uni.navigateTo({
						url: '/pages/personal/personalresume/basicinform'
					})
				} else if (type == 'advantage') {
					uni.navigateTo({
						url: '/pages/personal/personalresume/advantage'
					})
				} else if (type == 'work') {
					uni.navigateTo({
						url: '/pages/personal/personalresume/workexperience'
					})
				} else if (type == 'pro') {
					uni.navigateTo({
						url: '/pages/personal/personalresume/projectexperience?type=1'
					})
				} else if (type == 'edu') {
					uni.navigateTo({
						url: '/pages/personal/personalresume/education?type=1'
					})
				}
			},
			//修改项目详情
			prodetaols(item) {
				uni.navigateTo({
					url: `/pages/personal/personalresume/projectexperience?type=2&caseId=${item.caseId}`
				})
			},
			workdetaols(item) {
				uni.navigateTo({
					url: `/pages/personal/personalresume/workexperience?type=2&caseId=${item.caseId}`
				})
			},
			edudetaols(item) {
				uni.navigateTo({
					url: `/pages/personal/personalresume/education?type=2&caseId=${item.caseId}`
				})
			},
			bookdetaols(item) {
				uni.navigateTo({
					url: `/pages/personal/personalresume/basicinform?fileItem=${JSON.stringify(item)}&fileList=${JSON.stringify(this.credentialsList.filter(it => it.fileId != item.fileId))}`
				})
			},
			//预览图片
			priveimg(logourl) {
				// console.log('预览图片')
				let imgsArray = [];
				imgsArray[0] = logourl
				uni.previewImage({
					current: 0,
					urls: imgsArray
				});
			},
		}
	}
</script>

<style>
	.accounmt {
		background-color: #ffffff;
		/* height: 96vh; */
		width: 96vw;
		margin: 2vh auto;
		padding: 10px 15px 30px 15px;
		border-radius: 5px;
		font-size: 13px;
	}

	.linx {
		width: 100%;
		height: 1rpx;
		opacity: 0.15;
		background: #999999;
		margin: 15px 0;
	}

	.beizhu {
		font-size: 25rpx;
		color: #808080;
		margin-bottom: 20rpx;
		font-weight: 500;
	}
</style>