<template>
	<view class="g-components-panel-record">
		<view class="ui-list ui-list-text g_mb_10 bgf" style="border-top: 0" v-if="!isResume">
			<block v-for="(group, key) in item" :key="key" class="item-box">
				<view v-if="group" class="item-group" style="padding-top: 0; padding-bottom: 0; padding-right: 32rpx; position: relative; margin-left: 20px">
					<view class="titleMain">
						<view v-if="spliceStr(key) == '1'" class="des" style="position: relative"> <i class="iconfont icon-shenhezhong"></i>报名审核中 </view>
						<view v-if="spliceStr(key) == '2'" class="des" style="position: relative"> <i class="iconfont icon-baomingchenggong"></i>报名成功 </view>
						<view v-if="spliceStr(key) == '3'" class="des" style="position: relative"> <i class="iconfont icon-dairuzhi"></i>待入职 </view>
						<view v-if="spliceStr(key) == '4'" class="des" style="position: relative"> <i class="iconfont icon-ruzhichenggong"></i>在职中 </view>
						<view v-if="spliceStr(key) == '5'" class="des" style="position: relative"> <i class="iconfont icon-yilizhi"></i>已离职 </view>
						<view v-if="spliceStr(key) == '6'" class="des" style="position: relative"> <i class="iconfont icon-baomingchenggong"></i>已完成 </view>
						<view v-if="spliceStr(key) == '9'" class="des" style="position: relative"> <i class="iconfont icon-yuyuelizhi"></i>约离职 </view>
						<view v-if="spliceStr(key) == '11'" class="des" style="position: relative"> <i class="iconfont icon-wei"></i>报名失败 </view>
						<view v-if="spliceStr(key) == '12'" class="des" style="position: relative"> <i class="iconfont icon-yijiedao"></i>已接到 </view>
						<view v-if="spliceStr(key) == '13'" class="des" style="position: relative"> <i class="iconfont icon-wei"></i>未接到 </view>
						<view v-if="spliceStr(key) == '14'" class="des" style="position: relative"> <i class="iconfont icon-wei"></i>面试未通过 </view>
						<view v-if="spliceStr(key) == '15'" class="des" style="position: relative"> <i class="iconfont icon-wei"></i>未入职 </view>
					</view>
					<view style="position: relative" v-for="(itm, inx) in group" class="ui-step-one" :key="inx">
						<view class="cb-cricle"></view>
						<view
							class="ui-list-info"
							:style="{
								'padding-bottom': itm.desp == '' ? '18px' : '24px',
							}"
						>
							<view class="g_fs_12 g_c_3 g_flex_row_start" style="white-space: pre-line">
								<view style="line-height: 20px; color: #666">
									{{ itm.desp }}
								</view>
								<block v-if="itm.policy">
									<text class="g_ml_8 g_flex_column_center" :style="{color: themeColor}" @click="goInfo(itm)">详情</text>
								</block>
							</view>
							<view class="g_fs_12 g_c_9" :class="itm.desp == '' ? '' : 'g_mt_4'">
								<text class>{{ itm.creator }}，{{ itm.create_time }}</text>
							</view>
						</view>
					</view>
				</view>
			</block>
		</view>
		<view class="resumeBox g_pt_12 g_pr_12" v-else>
			<block v-for="(itm, inx) in item" :key="inx">
				<view style="position: relative" class="ui-step-one g_pl_24">
					<view class="cb-cricle g_ml_24"></view>
					<view
						class="ui-list-info"
						:style="{
							'padding-bottom': itm.desp == '' ? '18px' : '24px',
						}"
					>
						<view class="g_fs_12 g_c_3 g_flex_row_start" style="white-space: pre-line">
							<view style="line-height: 20px; color: #666">
								{{ itm.desp }}
							</view>
							<!-- <block v-if="itm.policy">
								<text class="g_ml_8 g_c_main g_flex_column_center" @click="goInfo(itm)">详情</text>
							</block> -->
						</view>
						<view class="g_fs_12 g_c_9" :class="itm.desp == '' ? '' : 'g_mt_4'">
							<text class>{{ itm.creator }}，{{ itm.create_time }}</text>
						</view>
					</view>
				</view>
			</block>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			themeColor: getApp().globalData.themeColor,
			isCreator: false,
		};
	},
	props: {
		item: {
			default() {
				return {};
			},
		},
		isResume: {
			default() {
				return false;
			},
		},
	},
	created() {
		console.log("created", this.item);
		// console.log('uni.getStorageSync("IS_CREATOR")', uni.getStorageSync("IS_CREATOR"));
		this.isCreator = uni.getStorageSync("IS_CREATOR") == 1 ? true : false;
	},
	onShow() {
		this.themeColor = getApp().globalData.themeColor;
	},
	watch: {
		item(val) {
			console.log("watch", this.item);
		},
	},
	methods: {
		spliceStr(str) {
			console.log("strstr", str);
			if (str) {
				return String(str).split("_")[1];
			}
		},
		goInfo(e) {
			console.log("跟进记录组件内点击", e);
			this.$emit("clickInfo", {
				info: e.policy,
				time: e.create_time,
				type: "view",
				title: "查看服务费",
			});
		},
	},
};
</script>

<style lang="scss">
.g-components-panel-record {
	.ui-list-info {
		padding-left: 26rpx;
		border-left: 2px solid #ccc;
		padding-bottom: 15px;
		margin-top: -12px;
	}
	.cb-cricle {
		position: absolute;
		left: -4.5px;
		top: 6px;
		background: #ccc;
		width: 10px;
		height: 10px;
		border-radius: 100%;
	}
	.iconfont {
		position: absolute;
		top: 0px;
		left: -10px;
		display: inline-block;
		width: 20px;
		height: 20px;
		font-size: 14px;
		font-weight: normal;
		text-align: center;
		line-height: 20px;
		border-radius: 50%;
		background: #6a81ff;
		color: #ffffff;
	}
	.des {
		// padding-bottom: 20px;
		padding-left: 26rpx;
		border-left: 2px solid #cccccc;
		left: 0px;
		line-height: 22px;
		height: 50px;
		font-size: 16px;
		font-weight: bold;
		color: #333333;
	}
	.item-group {
		&:last-child {
			.ui-step-one {
				&:last-child {
					.ui-list-info {
						border-left: 2px solid transparent;
					}
				}
			}
		}
	}
	.resumeBox {
		.ui-step-one {
			.ui-list-info {
				transform: translateY(-6px);
				border: none;
				&::before {
					content: "";
					position: absolute;
					left: 0px;
					top: 6px;
					width: 2px;
					height: 95%;
					background: #ccc;
				}
			}
			&:last-child {
				.ui-list-info::before {
					display: none;
				}
			}
		}

		.cb-cricle {
			top: 0px;
		}
	}
}
</style>
