<template>
	<view class="jp-work-item" @click="ckBtn">
		<view class="jp-work-name">
			<h3>{{item.positionCategoryName}}</h3>
			<span>{{item.dreamMoney}}</span>
		</view>
		<view class="jp-work-tag" >
			<u-tag   :text="item.jobStatus" mode="dark"
				bg-color="#f1f1f7" color="#999" size="mini" />

		</view>
		<view class="jp-work-info">
			<view class="u-flex">

				<p>{{item.sex}}|{{item.age}}岁|{{item.workExp}}|{{item.education}}</p>
			</view>

		</view>
		<view class="jp-work-info">
			<view class="u-flex">
				<u-avatar :src="item.headImage?item.headImage:item.headImageUrl" size="40"></u-avatar>
				<p>{{item.realName}}</p>
				<p v-if="mode==2" >{{item.address}}</p>
			</view>
			<p v-if="mode!=2" >{{item.address}}</p>
			<u-button size="mini" style="margin:0;" v-if="mode==2" @click="$emit('mode2',item.resumeId)">删除</u-button>
		</view>
	</view>
</template>

<script>
	export default {
		name: "Common",
		props: {
			item: {
				require: true,
				default: {},
			},
			ck: {
				require: false,
				default: true
			},
			obj: {
				require: false,
				default: null
			},
			mode:{
				require: false,
				default: 1
			},
		},
		data() {
			return {

			};

		},
		watch:{
			item(newVal,oldVal){
				this.setItem()
			}
		},
		methods: {
			setItem(){
				if (this.obj) {
					
					var sz = this.obj.split(",");
					for (var i in sz) {
						var string1 = sz[i].split("=")[0];
						var string2 = sz[i].split("=")[1];
						this.item[string2] = this.item[string1];
					}
					this.$forceUpdate()
				}
			},
			ckBtn() {
				if (this.ck) {
					this.gotoUrl('pages/hr/index/resumeInfo/resumeInfo?id=' + this.item.resumeId)
				} else {
					this.$emit("ckItem", this.item.resumeId)
				}
			},
			spiltItem(text) {
				if (text) {
					return text.split(",")

				} else {
					return []
				}
			},

		},
		mounted() {
			this.setItem()

		},
		
		destroyed() {

		}

	}
</script>

<style scoped lang="scss">
	.jp-work-item {
		padding: 30rpx;
		background-color: #fff;
		border-bottom: 1px solid #f7f7f7;

		&:last-child {
			border-bottom: none;
		}

		.jp-work-name {
			display: flex;
			justify-content: space-between;
			align-items: center;

			h3 {
				font-size: 36rpx;
			}

			span {
				font-size: 32rpx;
				color: #FF1700
			}
		}

		.jp-work-tag {
			display: flex;
			align-items: center;
			margin-top: 10rpx;

			* {
				margin-right: 10rpx;
			}
		}

		.jp-work-info {
			display: flex;
			justify-content: space-between;
			align-items: center;
			margin-top: 10rpx;

			p {
				color: #999;
				font-size: 24rpx;
				margin-left: 10rpx;
			}
		}
	}
</style>
