<template>
	<view class="page">
		<navbar leftClick @leftClick="$utils.navigateBack" />

		<view class="head">
			<view class="headImage">
				<image :src="hanHaiMember.headImage" mode=""></image>
				<view class="">
					{{ authenticationPerson.name }}
				</view>
			</view>
			<view class="info">
				<view class="name">
					{{ detail.title }}
				</view>
				<view class="tips">
					性别：{{ detail.sex }}
				</view>
				<view class="tips">
					年龄：{{ detail.age }}岁
				</view>
				<view class="tips">
					学历：{{ detail.qualification }}
				</view>
			</view>
			<view class="right">
				<view class="phone">
					<image src="/static/image/home/phone.png" mode=""></image>
					联系他
				</view>
			</view>












		</view>

		<view style="background-color: #f3f3f3;height: 30rpx;"></view>
		
		<view class="box">

			<view class="userinfo">

				<view class="line">
					<view v-if="collectionFlag == false" @click="addResumeCollection">
						<uv-icon size="30rpx" color="666" name="star"></uv-icon>
						收藏
					</view>
					
					
					
					<view v-else @click="addResumeCollection" style="color: red;">
						<uv-icon size="30rpx" color="666" name="star"></uv-icon>
						已收藏
					</view>
				</view>

				<view class="line">
					<view class="left">
						联系电话
					</view>
					<view class="right">
						{{ authenticationPerson.phone }}
					</view>
				</view>

				<view class="line">
					<view class="left">
						期望工作地
					</view>
					<view class="right">
						{{ detail.ipAddress }}
					</view>
				</view>

				<view class="line">
					<view class="left">
						民族
					</view>
					<view class="right">
						{{ detail.nation }}
					</view>
				</view>

				<view class="line">
					<view class="left">
						工龄
					</view>
					<view class="right">
						{{ detail.workTime ? `${detail.workTime}年` : '应届生' }}
					</view>
				</view>

				<view class="line">
					<view class="left">
						IP归属地
					</view>
					<view class="right">
						{{ detail.ipAddress }}
					</view>
				</view>

			</view>

			<view class="info">
				<view class="title2">
					<text>个人介绍</text>

				</view>

				<!-- <view 
				class="text" 
				v-html="text">
				</view> -->
				<view class="text">
					<uv-parse :content="detail.brief"></uv-parse>
				</view>
				<view class="tag-list">
					<view :key="i" v-for="(t, i) in detail.tag && detail.tag.split('、')">
						{{ t }}
					</view>
				</view>
			</view>

		</view>
	</view>
</template>

<script>
	let text = `岗位要求
	1、全日制大专以上学历，艺术设计类相关专业;
	2、两年以上平面、品牌、视觉设计等相关工作经验，能独立完成项目的设计工作，有 3C数码/个护健 康 类产品服务经验优先，有乙方工作经验佳;
	3、具备一定的设计提案能力，能完整的呈现设计思路与创意，能清晰的表达设计逻辑与思考;
	4、热爱设计，平面基本功扎实，拥有优良的审美与创意想法，对版式、色彩把控能力强;对工作富有责任心，具备团队沟通与协作能力;
	5、精通 PS、AI、CDR 等平面设计软件，能独立完成日常平面设计工作内容，熟练使用 PPT/Keynote，能完成提案内容的材料美化工作。
	`
	import userHead from '../components/user/userHead.vue'
	export default {
		components: {
			userHead,
		},
		data() {
			return {
				text: '',
				id: 0,
				detail: {},
				hanHaiMember: {},
				authenticationPerson: {},
				collectionFlag: false,
			}
		},
		onLoad({
			id
		}) {
			this.id = id
		},
		onShow() {
			this.text = this.$utils.stringFormatHtml(text)
			this.getData()
		},
		methods: {
			getData() {
				let data = {
					jobId: this.id
				}
				if (uni.getStorageSync('token')) {
					data.token = uni.getStorageSync('token')
				}
				this.$api('bossQueryResumeById', data, res => {
					if (res.code == 200) {
						this.detail = res.result.resume
						this.collectionFlag = res.result.collectionFlag
						this.hanHaiMember = res.result.hanHaiMember
						this.authenticationPerson = res.result.authenticationPerson
					}
				})
			},
			addResumeCollection(){
				let data = {
					resumeId : this.id
				}
				if(uni.getStorageSync('token')){
					data.token = uni.getStorageSync('token')
				}
				this.$api('addResumeCollection', data, res => {
					if(res.code == 200){
						uni.showToast({
							title: res.message,
							icon: 'none'
						})
					}
				})
				this.getData();
			}
		}
	}
</script>

<style scoped lang="scss">
	.page {
		background-color: #fff;
		min-height: 100vh;

		.head {
			display: flex;
			align-items: center;
			position: relative;
			padding: 20rpx;

			image {
				width: 140rpx;
				height: 140rpx;
				border-radius: 50%;
			}

			.headImage {
				width: 160rpx;
				margin-right: 40rpx;
				display: flex;
				flex-direction: column;
				align-items: center;
				justify-content: center;

				view {
					display: flex;
					font-size: 24rpx;
					align-items: center;
					margin-left: 20rpx;
					background: rgba($uni-color, 0.2);
					color: $uni-color;
					padding: 10rpx;
					border-radius: 10rpx;
					margin-top: 10rpx;
				}
			}

			.info {
				font-size: 28rpx;

				.name {
					font-size: 32rpx;
					display: flex;
					padding-bottom: 10rpx;

					view {
						display: flex;
						font-size: 20rpx;
						align-items: center;
						padding-left: 20rpx;
					}
				}

				.tips {
					font-size: 26rpx;
				}
			}

			.right {
				margin-left: auto;

				.phone {
					background-color: rgba($uni-color, 0.2);
					color: $uni-color;
					padding: 8rpx 16rpx;
					border-radius: 10rpx;

					image {
						width: 24rpx;
						height: 24rpx;
					}
				}
			}
		}

		.box {
			padding: 30rpx;

			.userinfo {
				font-size: 28rpx;
				color: #666666;
				line-height: 44rpx;
				margin-bottom: 40rpx;

				.line {
					margin-bottom: 20rpx;
					display: flex;

					.left {
						width: 220rpx;
						flex-shrink: 0;
					}
				}
			}

			.info {
				.text {
					font-size: 24rpx;
					color: #666666;
					line-height: 44rpx;
				}
			}
		}
	}
</style>