<template>
	<view>
		<view class="g_border_e_t g_flex_row_between">
			<!-- @click="handleBotom(item)" -->
			<view class="g_flex_row_between flex_center g_flex_1 g_pl_16 g_pt_9 g_pb_9" hover-class="thover" hover-stop-propagation>
				<view class="g_flex_1 g_flex_row_start">
					<view @click="copyWechat(item)">
						<image class="g_w_20 g_h_20 g_mr_4" v-if="item.weChat" src="https://bocai-cms.oss-cn-beijing.aliyuncs.com/web-resource/pugongying/wechat.svg" alt="" />
						<image class="g_w_20 g_h_20 g_mr_4" v-else src="https://bocai-cms.oss-cn-beijing.aliyuncs.com/web-resource/pugongying/wechat_gray.svg" alt="" />
						#{{ item.userId }}
					</view>
					<view @click="takeTel(item.tel)" class="g_ml_24">
						<view class="g_w_20 g_h_20 g_radius_50 g_flex_column_center flex_center g_mr_4" :class="item.tel ? '' : 'g_bg_e'" :style="item.tel ? {'background-color': themeColor} : {}" :src="cdnBaseImg + 'tel.svg'" alt="">
							<view class="icon-a-dianhua1 iconfont g_fs_14 g_c_f"> </view>
						</view>
						打电话
					</view>
				</view>
				<!-- {{from}} -->
				<view v-if="item.status == 1 && from != 'townsman'">
					<view @click="record(item)" class="g_w_56 g_h_24 g_fs_12 g_mr_16 g_text_c g_radius_12" :style="{color: themeColor, borderColor: themeColor, border: '1px solid ' + themeColor}" style="line-height: 22px">报名</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
/* 职位列表 - 信息面板
 * @params item 对象
 * @function handleBotom 点击事件
 */
export default {
	data() {
		return {
			cdnBaseImg: this.G.store().cdnBaseImg,
			themeColor: getApp().globalData.themeColor,
		};
	},
	created() {
		uni.$on('themeChanged', (color) => {
			this.themeColor = color;
		});
	},
	props: {
		item: {
			type: Object,
			dafault: () => {
				return {};
			},
		},
		recordStatus: {
			default: () => {
				return 1;
			},
		},
		classify: {
			type: Number,
			default: () => {
				return 0;
			},
		},
		from: {
			type: String,
			default: () => {
				return "";
			},
		},
	},
	methods: {
		handleBotom($item) {
			this.$emit("clickBottom", $item);
		},
		handleOpenStatus($item) {
			if ((this.recordStatus == 1 || this.recordStatus == 2) && this.from != "record") {
				this.$emit("clickMore", $item);
			}
		},
		copyWechat(e) {
			// console.log(e);
			if (e.userId) {
				this.G.copyText("#" + e.userId);
			}
		},
		takeTel(e) {
			// console.log(e);
			if (e) {
				uni.makePhoneCall({
					phoneNumber: e,
				});
			} else {
				uni.showToast({
					icon: "none",
					title: "请补充老乡电话再重试",
				});
			}
		},
		record($item) {
			// console.log("$item", $item);
			uni.navigateTo({
				url: "/root/home/quickApplication",
				// 小程序页面间通信, 确保页面渲染完再获取简历信息
				events: {
					ceshi: function (data) {
						setTimeout(() => {
							uni.$emit("getTownsman", { info: $item });
						}, 0);
						// console.log(data);
					},
				},
			});
		},
	},
};
</script>

<style></style>
