<!-- 查看非商户简历 -->

<template>
	<view v-if="!loading" style="padding-bottom: 100upx;" class="main_width">
		<view class="form_item">
			<view style="margin-left: 3%;">
				<view style="color: #4A4A4A;font-size: 44upx;align-items: center;display: flex;">
					{{sub_data.true_name||'-'}}
					<navigator url="./perInfo">
						<image v-if="allow_edit==1" style="width: 35upx;height: 35upx;margin-left: 10upx;"
							src="../../static/resume_edit.png"></image>
					</navigator>
				</view>
				<view class="check_resume_top">
					<view>{{sub_data.gender||'-'}} · {{sub_data.age||'-'}}岁</view>
					<view>籍贯：{{sub_data.birthaddr||'-'}}</view>
					<view>身高：{{sub_data.body_height||'-'}}cm<text
							style="margin-left: 30upx;">体重：{{sub_data.body_weight||'-'}}kg</text></view>
					<view v-if="sys_role==0">手机号码：{{sub_data.mobile}}</view>
				</view>
			</view>
			<image style="width: 130upx;height: 130upx;margin-right: 3%;border-radius: 50%;"
				:src="sub_data.profile_photo==''?'../../static/user.png': (sub_data.profile_photo.indexOf('http://')==0||sub_data.profile_photo.indexOf('https://')==0)?sub_data.profile_photo:(serverUrl+ sub_data.profile_photo)">
		</view>

		<view style="display: block;" class="form_item" :key="item.key" v-for="(item, index) in resume_info_item_edit">
			<view class="rht">{{item.name}}</view>
			<view style="width: 94%;margin-left: 3%;margin-top: 20upx;">
				{{sub_data[item.key]||''}}
			</view>
		</view>

		<view style="display: block;" class="form_item">
			<view style="padding-bottom: 20upx;" class="rht">相关证书</view>
			<view style="width: 94%;margin-left: 3%;margin-top: 20upx;">
				<image :key="index" @click="check_imgs(index)" v-for="(item,index) in sub_data.certificates" :src="item"
					style="width: 100%;margin-bottom: 20upx;border-radius: 20upx;" mode="widthFix"></image>
			</view>
		</view>
	</view>
	<view class="loading_text" v-else>加载中...</view>
</template>

<script>
	import commonData from '../../commonData.js'
	import commonFun from '../../commonFun.js'

	export default {
		data() {
			return {
				resume_info_item_edit: commonData.resume_info_item_edit, //textarea显示字段
				sub_data: {
					profile_photo: ''
				}, //用户信息
				loading: true,
				id: '', //对方id
				bizCatalog: '', //查看类型：获取某个商家TraderEntity，获取某个会员WorkerEntity
				allow_edit: 0, //是否显示编辑按钮
				sys_role: commonData.sys_role, //角色
			}
		},
		onLoad(e) {
			// 是否为查看其他人
			this.bizCatalog = e.bizCatalog || 'WorkerEntity'
			this.allow_edit = e.allow || 0
			this.id = e.id
			this.get_info()
		},
		onPullDownRefresh() {
			this.get_info()
		},
		methods: {
			check_imgs(current) {
				let certificates = (this.sub_data.certificates)
				uni.previewImage({
					urls: certificates,
					current,
				});
			},
			// 获取信息
			get_info() {
				uni.showLoading({
					title: '加载中...',
					mask: true,
				})
				this.loading = true
				let params = {
					bizCatalog: this.bizCatalog,
					handleMode: 'fetch',
					traderId: this.id,
					workerId: this.id,
				}
				console.log('简历页面请求参数')
				console.log(params)
				commonFun.requestUrl('&WsAjaxBiz=Worker&WsAjaxAction=entityDataHandle', params, res => {
					if (res.status) {
						uni.hideLoading()
						this.sub_data = res.data.Result
						console.log('简历页面获取其他个人信息')
						console.log(this.sub_data)
					}
					this.loading = false
					uni.stopPullDownRefresh()
				}, false)
			},
		}
	}
</script>

<style>
	.check_resume_top {
		line-height: 42upx;
		margin-top: 10upx;
	}

	.check_resume_top view {
		color: #949494;
	}
</style>
