<template>
	<view class="p-root-detail-job g_ml_10 g_mr_10 g_mt_10 g_kuaishou">
		 
		<view class="g_bg_f g_radius_8 g_mb_10 g_pl_10 g_pr_10" style="width: calc(100% - 0px); margin: 0 auto; margin-bottom: 10px"
		>
			<view class="g_flex_row_between flex_center g_h_57 g_fs_16 g_border_e_b" v-if="isJm && jobDetail.newXmf">
				<view class="g_flex_row_start" style="flex: none">
					<view class="g_fw_600 g_mr_4 g_flex_column_center">项目方</view>
				</view>
				<view class="g_flex_row_end" style="flex: 1">
					<span class="g_c_6" selectable="false" space="false" decode="false">
						{{ jobDetail.newXmf }}
					</span>
				</view>
			</view>
			<view class="g_flex_row_between flex_center g_fs_16" @click="showFee" >
				<view class="g_flex_row_start" style="flex: none">
					<view class="g_fw_600 g_mr_4 g_h_57 g_flex_column_center">代理佣金</view>
				</view>
				<view class="g_flex_row_end flex_center g_h_57" style="flex: 1">
					<span class>
						<div v-if="!isLogin">登录查看</div>
						<div v-else-if="isfensi == 2">
							{{ jobDetail.serverPrice }}
						</div>
						<div v-else>
							{{ "仅代理可见" }}
						</div>
					</span>
					<view class="iconfont icon-gengduo11 g_fs_14 g_c_6 g_ml_4"></view>
				</view>
			</view>
		</view>

		<view class="g_pt_16 g_pb_16 g_pl_16 g_pr_16 g_radius_8 g_bg_f">
			<view v-if="speed == 0" class="">
				<rh-loading />
			</view>
			<view v-if="speed == 1" class="">
				<view class="m-info g_mb_12">
					<view class="g_flex_1">
						<view class="g_mb_10 g_flex_row_between flex_center">
							<!-- to c 才用 jobDetail.aliasJobName  -->
							<view class="g_flex_1 g_c_3 g_fs_20 g_fw_bold">{{ jobDetail.jobName }}</view>
							<view class="g_fs_14 g_c_9">
								{{ jobDetail.updateTime }}
							</view>
							<!-- <view class="g_flex_none g_flex_column_center">
								<g-panel-server :str="attention ? jobDetail.serverPrice : '关注查看'" verson="new" />
							</view> -->
						</view>

						<template v-if="jobDetail.classify == 1">
							<view class="g_c_9">
								<view class="g_flex_row_between flex_center g_mb_12" v-if="jobDetail.addss">
									<!-- <view class="g_flex_column_center">
										<i class="iconfont icon-dingwei2 g_c_6 g_fs_17 g_lh_1_2"></i>
									</view> -->
									<view class="g_fs_14 g_ml_4 g_lh_1_2 g_flex_column_center">
										{{ (jobDetail.addss ? jobDetail.addss + " | " : "") + jobDetail.genderAge }}
									</view>
								</view>
								<!-- <view class="g_flex_row_start">
									<view class="g_fs_14 g_ml_4 g_lh_1_2 g_flex_column_center">{{ jobDetail.genderAge }} </view>
								</view> -->
							</view>
						</template>
					</view>
				</view>
				<view class="g_flex_row_start" v-if="jobDetail.jobSpecialLabelNames">
					<!-- :style="{ color: labelColor[index % labelColor.length], 'background-color': bgColor[index % bgColor.length] }" -->
					<view v-for="(item, index) in jobDetail.jobSpecialLabelNames" :style="{ color: `${labelColor[index % labelColor.length]}`, 'background-color': `${bgColor[index % bgColor.length]}` }" class="g_mr_8 g_mb_8 g_pl_4 g_pr_4"> {{ item }}</view>
				</view>
				<!-- <view class="g_flex_row_start" v-if="appid == 'wxb0c590fd696b79be' && isUseNewJob">
					<view v-for="(item, index) in jobDetail.jobRequestLabelNames" :style="{ color: `${labelColor[index % labelColor.length]}`, 'background-color': `${bgColor[index % bgColor.length]}` }" class="g_mr_8 g_mb_4 g_pl_4 g_pr_4 g_c_6 g_bg_f_5"> {{ item }}</view>
				</view> -->
				<view class="g_flex_row_between g_mt_8">
					<view class="g_flex_row_start g_flex_1">
						<view class="g_fs_16 g_fw_600 g_c_f40 g_lh_1_2 g_flex_column_center" v-if="jobDetail.priceStr">
							{{ jobDetail.priceStr }}
						</view>
						<view class="g_fs_14 g_c_9" v-if="jobDetail.monthPay && jobDetail.priceStr && jobDetail.priceStr.indexOf('元/月') == -1">
							{{ jobDetail.monthPay ? "丨" + jobDetail.monthPay : "" }}
						</view>
					</view>
					<view class="g_flex_none g_flex_column_center" style="font-size: 14px;color: #999999;">
						招聘人数：{{ jobDetail.headcount || recruitNum }}人
					</view>
				</view>
				<!-- 地址 -->
				<div style="background-color: rgba(2, 122, 255, 0.08);border-radius: 8px;margin: 10px auto;padding: 8px;">
					<view class="m-address " 
								hover-class="thover" 
							  v-if="(jobDetail && jobDetail.store) || (jobDetail.storeLat && jobDetail.storeLng)">
						<div class="store-item g_flex_row_start" v-if="jobDetail && jobDetail.store" style="margin-bottom: 6px;">
							<view class="g_flex_none" style="font-size: 14px;color: #999;">
								工作单位：
							</view>
							<view class="g_flex_1 g_flex_column_center" @click="showCompanyInfo">
								<view class="g_ell_1 g_fw_600" style="font-size: 14px;color: #000;">
									{{ jobDetail.store.aliasName || "-" }}
								</view>
							</view>
						</div>
						<div class="store-item g_flex_row_start" v-if="jobDetail && jobDetail.store" style="margin-bottom: 6px;">
							<view class="g_flex_none" style="font-size: 14px;color: #999;">
								企业简介：
							</view>
							<view class="g_flex_1 g_flex_column_center" @click="showCompanyInfo">
								<view class="g_ell_1" style="font-size: 14px;color: #999;">
									{{ jobDetail.store.storeInfo || "-" }}
								</view>
							</view>
							<view class="g_flex_none g_flex_c" style="width: 24px;" @click="showCompanyInfo">
								<i class="iconfont icon-gengduo11 g_c_9 g_w_14 g_h_14" style="font-size: 16px;color: #999999;"></i>
							</view>
						</div>
						<div class="store-item g_flex_row_start" >
							<view class="g_flex_none" style="font-size: 14px;color: #999;">
								工作地点：
							</view>
							<view class="g_flex_1 g_mr_4 g_flex_column_center" @click="goAddress">
								<view class="g_ell_2" style="font-size: 14px;color: #999;">
									{{ jobDetail.storeAddr || "-" }}
								</view>
							</view>
							<view class="g_flex_none g_flex_c" style="width: 24px;" @click="goAddress">
								<i class="iconfont icon-dizhi1 g_c_9 g_w_14 g_h_14" style="font-size: 18px;color: #999999;"></i>
							</view>
						</div>
					</view>
					<view v-else class="g_border_e_t g_mt_16"></view>
				</div>
				<!-- 轮播banner -->
				<!-- 轮播banner -->
				<view class="m-banner g_pb_16 g_border_f5_b g_mt_12" v-if="swiperArray.length > 0">
					<scroll-view class="banner-scroll" scroll-x="true" show-scrollbar="false" :scroll-with-animation="true">
						<view class="scroll-content">
							<view v-for="(item, index) in swiperArray" :key="index" class="scroll-item" :class="index == 0 ? 'g_ml_0 g_mr_0' : ''" @click="item.type == 'image' ? handleViewBig(item, index) : showVideo(item)">
								<u-image :radius="4" v-if="item.type == 'image'" :showLoading="true" :src="item.image" width="58px" height="58px" style="border-radius: 4px"> </u-image>

								<!-- #ifdef H5 || APP-PLUS -->
								<view class="g_w_58 g_h_58 g_radius_4 videoContainer" v-else>
									<video class="theVideo" :show-fullscreen-btn="true" :show-play-btn="true" :show-center-play-btn="true" :enable-play-gesture="true" :id="item.id" :src="item.image" @fullscreenchange="fullScreen" :muted="muted" :show-mute-btn="isFullscreen" :show-progress="isFullscreen" :show-time="isFullscreen" :controls="isFullscreen" :enable-progress-gesture="isFullscreen" :object-fit="'cover'" style="width: 100%; height: 100%"></video>
								</view>
								<!-- #endif -->
							</view>
						</view>
					</scroll-view>
				</view>
				<!-- 职位描述富文本 -->
				<view class="g_flex_row_center g_border_e_b">
					<u-tabs inactive-color="#000000" bg-color="transparent" :list="tabInfo.list" :current="tabInfo.active" :active-color="globalData.themeColor" bar-width="32" bar-height="6" @change="setType" :gutter="50" font-size="36" duration="0.05" height="76"></u-tabs>
				</view>
				<view class="" v-if="tabInfo.active == 0">
					<view class="g_fs_15">
						<template v-for="(item, index) in templateArr" :key="index">
							<view class="g_flex_row_start flex_center g_fw_600 g_mt_12 g_mb_8 g_fs_18" v-if="item.show">
								<view class="" v-if="item.num == 1">一、</view>
								<view class="" v-if="item.num == 2">二、</view>
								<view class="" v-if="item.num == 3">三、</view>
								<view class="" v-if="item.num == 4">四、</view>
								<view class="" v-if="item.num == 5">五、</view>
								<view class="" v-if="item.num == 6">六、</view>
								<view class="">
									{{ item.type }}
								</view>
							</view>
							<template v-for="(inner, index) in item.children" :key="index">
								<view class="g_flex_row_start g_fs_14" style="line-height: 22px; padding-left: 16px" v-if="inner.show">
									<view class="g_flex_row_start flex_start g_fw_600">
										<view class="g_mr_4" style="font-size: 16px">
											{{ `${inner.num}. ` }}
										</view>
										<view class="g_flex_1" style="font-size: 16px">
											{{ `${inner.key}: ` }}
											<text class="g_fw_400 g_ml_4" selectable="false" space="false" decode="false" style="font-size: 16px">
												{{ inner.value }}
											</text>
										</view>
									</view>
									<!-- @blur="inner.edit = false" -->
								</view>
							</template>
						</template>
					</view>
				</view>

				<view class="g_flex_column_center" v-if="tabInfo.active == 1">
					<view class="g_fs_16">
						<!-- <view class="g_fw_600 g_flex_row_start flex_center g_mb_8 g_mt_16"> <view class="g_mr_12 g_bg_main" style="width: 4px; height: 19px; border-radius: 2px"> </view>职位描述 </view> -->
						<view class="g_c_0 g_pt_12 g_fs_18" style="white-space: pre-line">
							<view @click="setCopy" v-if="jobDetail.jobInfoWithoutReturnFee || jobDetail.jobInfo">
								<span class="desp-copy g_c_main g_border_main">复制</span>
							</view>
							{{ jobDetail.jobInfoWithoutReturnFee || jobDetail.jobInfo || "-" }}
						</view>
					</view>
				</view>
				
				<view class="g_flex_column_center" v-if="tabInfo.active == 2 && jobDetail.newdesc">
					<view class="g_fs_16">
						<view class="g_c_0 g_pt_12 g_fs_18" style="white-space: pre-line">
							<view @click="setCops" v-if="jobDetail.newdesc != '暂无脱敏版通告'">
								<span class="desp-copy g_c_main g_border_main">复制</span>
							</view>
							<div :style="{
										'margin-top':jobDetail.newdesc == '暂无脱敏版通告' ? '0' : '26px'
									 }"
									 :class="jobDetail.newdesc == '暂无脱敏版通告' ? 'g_flex_row_center' : ''"
							>
								{{ jobDetail.newdesc || "-" }}
							</div>
						</view>
					</view>
				</view>
				<!-- 底部固定操作栏 -->

				<g-panel-fixed>
					<slot>
						<view class="g_pl_20 g_pr_20 g_flex_row_center flex_center flex_nw" style="width: calc(100% - 0px)">
							<view class="g_flex_none g_flex_column_center" v-if="from != 'bill'">
								<!-- @click="showShareImg"  -->
								<button class="g_pl_0 g_pr_0 g_bg_f g_mr_16" hover-class="thover" v-if="envVersion != 'trial'" style="line-height: 1" open-type="share">
									<icon class="iconfont icon-zhuanfa1 g_fsi_16" style="color: #787878; line-height: 1; margin-top: -5px; font-size: 19px !important"> </icon>
									<view class="g_fs_12 g_c_6 g_w_28" style="margin-top: 4px">分享</view>
								</button>
							</view>
							<!--  && miniAppInfo.id != loginInfo.agencyId -->
							<!-- <view class="g_flex_none g_flex_column_center" v-if="attention && from != 'bill'">
								<button class="g_pl_0 g_pr_0 g_bg_f g_mr_12 g_w_36" hover-class="thover" style="line-height: 1; border-radius: 0" @click="handleCollection">
									<icon :class="['iconfont g_mr_2', isSc ? 'icon-heart-fill g_c_f0' : 'icon-heart g_c_6']" style="line-height: 1; margin-top: -5px; font-size: 20px !important"> </icon>
									<view class="g_fs_12 g_c_6" style="margin-top: 4px">{{ isSc ? "已收藏" : "收藏" }}</view>
								</button>
							</view> -->
							<view class="g_flex_none g_flex_column_center">
								<button class="g_pl_0 g_pr_0 g_bg_f g_mr_12 g_w_36" hover-class="thover" style="line-height: 1; border-radius: 0" @click="goIm">
									<icon class="iconfont icon-message" style="color: #787878; line-height: 1; margin-top: -5px; font-size: 20px !important"> </icon>
									<view class="g_fs_12 g_c_6" style="margin-top: 4px">客服</view>
								</button>
							</view>
							<view class="g_flex_1 g_flex_column_center" hover-class="none" hover-stop-propagation="false">
								<view class="g_flex_row_end" hover-class="none" hover-stop-propagation="false">
									<view class="g_flex_none g_flex_column_center" style="margin-right: 8px; width: 100px" v-if="attention && from != 'bill' && jobDetail.agencyId != loginInfo.agencyId && false">
										<view v-if="!isLogin" class="g_flex_column_center">
											<rh-quicklogin mobileToLogin="/appLoginByTelAssistant" codeToMobile="/getWechatTel" @exportSetToken="pushSetToken('relationService')">
												<rh-button
													
													:cusStyle="{
														position: 'relative',
														top: '-1px',
														right: '-1px',
													}"
													btnText="联系客服"
													class="g_flex_1 g_fw_600"
													size="small_auto"
												></rh-button>
											</rh-quicklogin>
										</view>
										<view v-else class="g_flex_column_center">
											<rh-button
												
												btnText="联系客服"
												class="g_fw_600 g_mr_12 g_w_100"
												size="small_auto"
												@clickBtn="showService"
												:cusStyle="{
													position: 'relative',
													top: '-1px',
													right: '-1px',
												}"
											>
											</rh-button>
										</view>
									</view>
									<view class="g_flex_1 g_flex_column_center">
										<view v-if="!isLogin" class="">
											<rh-quicklogin mobileToLogin="/appLoginByTelAssistant" codeToMobile="/getWechatTel" @exportSetToken="pushSetToken('record')">
												<rh-button
													
													:cusStyle="{
														position: 'relative',
														top: '-1px',
														right: '-1px',
													}"
													btnText="立即报名"
													class="g_flex_1 g_fw_600"
													size="small_auto"
													type="primary"
												></rh-button>
											</rh-quicklogin>
										</view>
										<view v-else class="">
											<rh-button
												
												:cusStyle="{
													position: 'relative',
													top: '-1px',
													right: '-1px',
												}"
												btnText="立即报名"
												class="g_flex_1 g_fw_600"
												size="small_auto"
												:type="jobDetail.recruitment == 2 || !attention ? 'infro' : 'primary'"
												@clickBtn="handleOpenApplyPopup"
											></rh-button>
										</view>
									</view>
								</view>
							</view>
						</view>
					</slot>
				</g-panel-fixed>
			</view>
		</view>




		<div class="other-dom" style="margin-top: 12px;background-color: #fff;border-radius: 8px;">
			<div class="g_flex_row_start" style="padding: 10px 12px 0;">
				<div style="font-size: 16px;color: #666;" class="g_flex_none">
					信息来源：
				</div>
				<div style="font-size: 16px;color: #333;margin-left: 0px;" class="g_flex_1 g_flex_column_center">
					{{ fullName || "-" }}
				</div>
			</div>
			<div class="g_flex_row_start" style="padding: 2px 12px 10px;">
				<div style="font-size: 16px;color: #666;" class="g_flex_none g_flex_column_center">
					有效期限：
				</div>
				<div style="font-size: 16px;color: #333;margin-left: 0px;" class="g_flex_1 g_flex_column_center">
					{{ validEndTime }}
				</div>
			</div>
		</div>

		<div class="other-dom" style="margin-top: 12px;background-color: #fff;border-radius: 8px;">
			<div class="g_flex_row_start" style="padding: 10px 16px;font-size: 17px;font-weight: bold;border-bottom: 1px solid #eee;">
				业小满安全提示
			</div>
			<div class="" style="padding: 8px 10px 10px;color: rgba(102, 102, 102, 1);font-size: 12px;">
				业小满严禁用人单位和招聘者用户做出任何损害求职者合法权益的违法违规行为，包括但不限于扣押求职者证件、收取求职者财物、向求职者集资、让求职者入股、诱导求职者异地入职、异地参加培训、违法违规使用求职者简历等，您一旦发现此类行为，请 <text style="color: #027aff"  @click="goReport">立即举报</text>
			</div>
		</div>

		



		<view class="g_h_104s"></view>
		<view class="g_pt_10 pop-container" :class="showServicePop ? 'show' : ''" v-if="false">
			<view class="g_p_8 g_bg_f g_border_e">
				<view class="g_flex_row_between">
					<view class="g_flex_row_start flex_center">
						<view>
							<view class="g_bg_main g_c_f g_flex_row_center g_fs_24 flex_center g_w_36 g_h_36 g_mr_4 g_radius_50 icon-kefu iconfont" />
						</view>
						<view>
							<view class="g_fs_14">专属招聘客服</view>
							<view class="g_fs_12 g_c_6">您好！是否需要帮您推荐职位？</view>
						</view>
					</view>
					<view class="g_flex_row_end flex_center">
						<view class="g_w_62 g_mr_6" @click="showServicePop = false">
							<rh-button btnText="稍后再说" height="28" fontSize="12" class=" " size="small_auto" type="infro" @clickBtn="showServicePop = false"></rh-button>
						</view>
						<view class="g_w_62">
							<rh-button btnText="立即咨询" height="28" fontSize="12" class="" size="small_auto" type="primary" @clickBtn="showService"></rh-button>
						</view>
					</view>
				</view>
			</view>
		</view>
		<u-popup v-model="canvasInfo.isShow" border-radius="8" mode="bottom" :closeable="true" :mask-close-able="false">
			<view class="g_pt_24 g_pb_24 g_h_all g_w_all g_flex_row_center">
				<!-- #ifdef MP-WEIXIN -->
				<image :src="canvasInfo.posterImg" class="g_pb_24" style="height: 75vh; width: calc(75vh * 0.52)" :show-menu-by-longpress="true" mode="aspectFit|aspectFill|widthFix" lazy-load="false"></image>

				<!-- #endif -->
				<!-- #ifdef H5 || APP-PLUS -->
				<view class="canvas-card g_position_rela g_flex_row_center" id="canvas-card" style="">
					<view class="m-card g_position_abso g_w_all" style="left: 50%; transform: translateX(-50%)">
						<view class="g_c_f g_fs_12 g_fw_600 g_mt_92 g_text_c"> {{ userInfo.agencyName }} </view>
						<view class="g_bg_f g_mt_48 g_flex_row_center g_p_10" style="width: 90%; height: 118px; border-radius: 4px">
							<view class="g_fs_16 g_fw_600 g_mb_8">
								{{ jobDetail.jobName }}
							</view>
							<view class="g_flex_row_start">
								<image class="g_w_40 g_h_40" :src="jobDetail.logo" mode="aspectFit|aspectFill|widthFix" lazy-load="false" binderror="" bindload=""> </image>
								<view class="g_ml_8">
									<view class="g_c_f40 g_fs_16 g_mb_4">
										<span class="g_fw_600 g_mr_4">
											{{ jobDetail.priceStr }}
										</span>
										<span class="g_fs_14">
											{{ jobDetail.monthPay }}
										</span>
									</view>
									<view class="g_fs_12 g_c_6">
										{{ jobDetail.shortDistrict }}
										<span class="g_fs_12">
											{{ jobDetail.age }}
										</span>
									</view>
								</view>
							</view>
							<view class="g_flex_row_start g_fs_12 g_mt_8">
								<view v-for="(item, index) in jobDetail.jobSpecialLabelNames" v-if="index < 3" style="background-color: #ddd; color: #333" class="g_mr_8 g_p_2 g_radius_4"> {{ item }}</view>
							</view>
						</view>
						<view class="g_mt_48 g_text_c">
							<view class="g_fs_12 g_c_f"> 长按查看职位详情 </view>
							<view class="m-logo g_flex_c">
								<image
									:src="canvasInfo.wxCode"
									class="g_flex_row_center"
									:style="{
										width: 141 + 'px',
										height: 141 + 'px',
										top: '302px',
									}"
								></image>
							</view>
							<view class="g_fs_14 g_c_f"> 好工作 放心干 </view>
						</view>
					</view>
				</view>

				<!-- #endif -->
				<rh-button  btnText="保存到相册" type="primary" @clickBtn="saveToalbum"></rh-button>
			</view>
		</u-popup>
		<u-popup v-model="applyPopup.isShow" mode="center" negative-top="300" :uZindex="1" border-radius="12" :closeable="true" :mask-close-able="true">
			<view class="">
				<!-- <view class="g_text_c g_fs_18 g_fw_600 g_pt_18 g_flex_c" style="position: absolute; top: 0; left: 0; width: 100%">快速报名</view> -->
				<applyPanel :jid="jobDetail.id" :subLoading="btnLoading" @exportForm="submitApply" />
			</view>
		</u-popup>
		<u-popup v-model="serviceShow" mode="center" border-radius="8" :mask-close-able="false" width="600rpx">
			<i class="iconfont icon-guanbi g_c_6" style="position: absolute; right: 12px; top: 12px" @click="hideService"></i>
			<div class="g_pt_32 g_pb_32 g_text_c">
				<p class="g_fs_18 g_mb_24 g_fw_600">加客服微信</p>
				<div class="g_pb_32 g_fs_14 g_c_6" @click.stop="makePhoneCall" :mark:tel="currentStore.tel">联系电话: {{ currentStore.splitPhone }}</div>
				<!-- <image src="https://open.work.weixin.qq.com/wwopen/userQRCode?vcode=vc42c1ec51fd446856" :show-menu-by-longpress="true" style="width: 184px; height: 184px"></image> -->
				<image class="" style="width: 184px; height: 184px" :src="currentStore.wechatQrcode" mode="aspectFit|aspectFill|widthFix" lazy-load="false" binderror="" bindload="" show-menu-by-longpress> </image>
				<p class="g_fs_12 g_mt_12">长按识别二维码</p>
			</div>
		</u-popup>
		<u-popup v-model="showPushJobPop" mode="center" negative-top="300" :uZindex="1" border-radius="12" :closeable="false" :mask-close-able="true">
			<view class="g_p_16" style="width: 80vw">
				<view class="g_fs_18 g_fw_600 g_text_c">客服联系</view>
				<view class="g_text_c g_mt_16">
					<view class="g_fs_15"> 允许客服主动联系，快速推荐合适岗位 </view>
					<view class="g_flex_row_end flex_center g_mt_12">
						<checkbox-group class="dib" name="acheck" @change="switchRadioChange">
							<label>
								<checkbox :checked="pushJobChecked" value="acheck" class="dib biggerSize" color="#3578f6" style="transform: scale(0.7)" />
							</label>
						</checkbox-group>
						<view class="g_fs_14">七天内不再提示</view>
					</view>
					<view class="g_flex_row_end flex_center g_mt_16">
						<view class="g_w_64 g_mr_10" @click="handlePushJob('unallowed')">
							<rh-button btnText="不允许" height="32" fontSize="12" class=" " size="small_auto" type="infro"></rh-button>
						</view>
						<view class="g_w_64">
							<view v-if="!isLogin" class="g_flex_column_center">
								<rh-quicklogin mobileToLogin="/appLoginByTelAssistant" codeToMobile="/getWechatTel" @exportSetToken="pushSetToken('pushJob')">
									<rh-button btnText="允许" height="32" fontSize="12" class="" size="small_auto" type="primary"></rh-button>
								</rh-quicklogin>
							</view>
							<rh-button v-else btnText="允许" height="32" fontSize="12" class="" size="small_auto" type="primary" @clickBtn="handlePushJob('allow')"></rh-button>
						</view>
					</view>
				</view>
			</view>
		</u-popup>

		<canvas type="2d" style="position: absolute; left: -2000px; width: 425px; height: 350px; background: #fff" id="canvasId" ref="canvasId"></canvas>
	
		
	</view>
</template>

<script>
// #ifdef H5 || APP-PLUS
// import html2canvas from "html2canvas";
// #endif
// #ifdef H5
import { saveAs } from "file-saver";
// #endif
import dateTimePicker from "../../utils/dateTimePicker.js";
// import dateUtil from "../../utils/dateUtil.js";
import applyPanel from "../../pages/home/child/applyRecord.vue";
import _G from "./utils/commonSub.js";
export default {
	onReady() {
		this.G.setNavStyle();
	},
	onShareAppMessage() {
		let that = this;
		let path;
		if (this.isMember) {
			path = `/root/detail/job?id=${that.jobDetail.id}&from=home&userId=${that.userInfo.user.id}`;
		} else {
			path = `/root/detail/job?id=${that.jobDetail.id}&from=home`;
		}
		// console.log("path", path);
		return {
			promise: new Promise((resolve, reject) => {
				that.getWXCanvas("", "setShare").then((res) => {
					// console.log("getWXCanvas", res);
					wx.hideLoading();
					resolve({
						title: uni.getStorageSync("apply-token") && uni.getStorageSync("apply-userinfo") ? (uni.getStorageSync("apply-userinfo").user.userName +'帮你挑选了一份靠谱好工作，快来看看是不是适合你~') : '',
						imageUrl: res.tempFilePath,
						path,
					});
				});
			}),
		};
	},
	onShareTimeline() {
		let that = this;
		let path;
		if (this.isMember) {
			path = `id=${that.jobDetail.id}&from=home&userId=${that.userInfo.user.id}`;
		} else {
			path = `id=${that.jobDetail.id}&from=home`;
		}
		let appInfo = uni.getStorageSync("miniApp-info");
		return {
			promise: new Promise((resolve, reject) => {
				that.getWXCanvas("", "setShare").then((res) => {
					// console.log("getWXCanvas", res);
					wx.hideLoading();
					resolve({
						title: uni.getStorageSync("apply-token") && uni.getStorageSync("apply-userinfo") ? (uni.getStorageSync("apply-userinfo").user.userName +'帮你挑选了一份靠谱好工作，快来看看是不是适合你~') : '',
						imageUrl: appInfo.logo,
						query:path,
					});
				});
			}),
		};
	},
	mounted() {
		var obj = dateTimePicker.dateTimePicker(this.startYear, this.endYear, this.currentTime);
		this.currentTime = this.G.formatDateYMD(new Date().toLocaleDateString()) + " 06:00";
		this.dateTimeArray = obj.dateTimeArray;
		this.dateTime = obj.dateTime;
	},
	components: {
		applyPanel,
	},
	data() {
		return {
			fullName:uni.getStorageSync("miniApp-info") && uni.getStorageSync("miniApp-info").agencyName,
			isfensi:uni.getStorageSync("apply-userinfo") && uni.getStorageSync("apply-userinfo").isfensi,
			isAgency:uni.getStorageSync("apply-userinfo") && uni.getStorageSync("apply-userinfo").agencyId,
			isJm:uni.getStorageSync("apply-userinfo") && uni.getStorageSync("apply-userinfo").agencyId && uni.getStorageSync("apply-userinfo").agencyId == '114827',
			pushJobChecked: false, // 是否七天内显示
			showPushJobPop: false,
			showServicePop: false, // 显示客服下拉弹窗
			isFullscreen: false, // 添加全屏状态跟踪
			tabInfo: {
				list: [
					{
						name: "职位详情",
						key: "0",
					},
					{
						name: "通告分享",
						key: "1",
					},
				],
				active: 0,
			},
			goImLoading: false,
			isUseNewJob: getApp().globalData.isUseNewJob,
			appid: getApp().globalData.appId,
			globalData: getApp().globalData,
			isLogin: false,
			envVersion: uni.getStorageSync("ENV_VERSION"), // 小程序环境判断
			isMember: uni.getStorageSync("IS_MINIAPP_MEMBER"), // 登陆者是否当前小程序成员的判断
			hasPermission: uni.getStorageSync("HAS_PERMISSION") == 1 ? true : false, // 登陆者是否有权限查看

			muted: true,
			videoContextTemp: {},
			corpUserFlag: false,
			agreeRadio: ["agree"],
			isPerson: false,
			speed: 1,
			uid: 0, // 职位id
			userId: 0, // 可能存在的推荐人id
			jobDetail: {},
			isCollection: false,
			swiperArray: [],
			applyPopup: {
				isShow: false,
			},
			formInfo: {
				userName: "",
				idCard: "",
				tel: "",
				interTime: "",
			},
			startYear: new Date().getFullYear(),
			endYear: new Date().getFullYear() + 2,
			currentTime: "",
			dateTimeArray: null,
			dateTime: [],
			from: "", // 来源页面
			isSc: false, // 收藏判断
			attention: true, // 分享时隐藏信息
			selfJob: false, // 是否是自己团队职位的判断
			showPrice: true, // 隐藏服务费
			labelColor: ["#c41d7f", "#096dd9", "#531dab", "#d46b08", "#389e0d", "#08979c", "#cf1322"],
			bgColor: ["#fff0f6", "#e6f7ff", "#f9f0ff", "#fff7e6", "#f6ffed", "#e6fffb", "#fff1f0"],
			loginInfo: {},
			cdnBaseImg: this.G.store().cdnBaseImg,
			IS_CREATOR: false,

			applyList: [],
			wxPlat: "",
			canvasInfo: {
				// 分享的图片相关信息
				posterImg: "",
				isShow: false,
				wxCode: "",
			},
			userInfo: uni.getStorageSync("apply-userinfo"), // 登录人的信息
			miniAppInfo: uni.getStorageSync("miniApp-info"), // 小程序的信息
			serviceShow: false, // 客服弹窗
			currentStore: {},
			templateArr: [
				// 职位描述模板
				{
					type: "工作内容",
					show: false,
					childrenType: ["工作内容", "工作方式", "班次工时", "休息", "工衣", "车间", "安检门", "带手机", "流水线"],
					children: [],
				},
				{
					type: "工作要求",
					show: false,
					childrenType: ["性别年龄", "文化学历", "身份证", "资质证件", "纹身烟疤", "案底黑户", "少数民族", "区域要求", "身体状况", "体检要求", "返厂政策"],
					children: [],
				},
				{
					type: "薪资待遇",
					show: false,
					childrenType: ["岗位薪资", "综合月薪", "薪资明细", "发薪日", "银行卡", "预支工资", "岗前培训", "试用期", "员工福利"],
					children: [],
				},
				{
					type: "吃饭住宿",
					show: false,
					childrenType: ["吃饭", "住宿", "保险"],
					children: [],
				},
				{
					type: "押金",
					show: false,
					childrenType: ["餐卡押金", "宿舍押金", "工装押金", "厂牌押金", "工具押金"],
					children: [],
				},
				{
					type: "面试",
					show: false,
					childrenType: ["面试地址", "面试评价", "面试时间", "面试注意事项", "项目驻场"],
					children: [],
				},
			],
			btnLoading: false, // 报名提交按钮的loading
			validEndTime: "", // 有效期限
			recruitNum: 0, // 招聘人数
		};
	},
	onLoad(options) {
		let that = this;
		// 计算有效期限（当前时间+48小时）
		this.calcValidEndTime();
		// console.log("详情", options);
		// console.log("this.G.store().cdnBaseImg", this.G.store().cdnBaseImg);
		if (options.id) {
			this.uid = options.id;
		}
		setTimeout(() => {
			this.showServicePop = true;
		}, 5000);
		if (options.from) {
			this.from = options.from;
		}
		if (options.userId) {
			this.userId = options.userId;
			uni.setStorageSync("AGENCY_USER_ID", options.userId);
		}
		// if (!uni.getStorageSync("apply-token")) {
		// 	// console.log("apply-token");
		// 	uni.navigateTo({
		// 		url: "/root/login/index?type=detail&id=" + options.id,
		// 	});
		// 	return;
		// }
		if (options.storeJobId) {
			// console.log("HHHHHHHHHHHHH");
			this.uid = options.storeJobId;
		} else if (options.scene) {
			// console.log("XXXXXXXXXXXX");
			//扫小程序码携带参数
			var sceneStr = decodeURIComponent(options.scene);
			var sceneJson = this.G.sceneToJson(sceneStr);
			// console.log("sceneJson===", sceneJson);
			this.uid = sceneJson.storeJobId || sceneJson.i.split("_")[1];
			this.userId = sceneJson.i.split("_")[0];
			uni.setStorageSync("AGENCY_USER_ID", this.userId);
		}
		// 获取招聘人数（12小时内不更新，id变化时更新）
		this.getRecruitNum();
		// console.log("=====================", that.api.hasSee);
		this.getDetail().then((res) => {
			console.log("详情页1123", res,'--',that.jobDetail);
			let objMiddle = JSON.parse(res.cozeStructureRes);
			console.log("objMiddle", objMiddle);
			delete objMiddle["佣金"];
			delete objMiddle["佣金详情"];
			delete objMiddle["企业位置"];
			delete objMiddle["职位标签"];
			delete objMiddle["职位标题"];
			delete objMiddle["职位分类"];
			delete objMiddle["项目驻场"];
			let num1 = 1;
			this.templateArr.forEach((item) => {
				let num = 1;
				item.childrenType.forEach((innerItem) => {
					item.children.push({
						key: innerItem,
						value: objMiddle[innerItem],
						num,
						show: objMiddle[innerItem] ? true : false,
						edit: false,
					});
					if (objMiddle[innerItem]) {
						num++;
					}
				});
				item.num = num1;
				if (item.children[item.children.length - 1].num != 1) {
					item.show = true;
					num1++;
				}
			});

			// 脱敏版 职位详情接口返回的cozeStructureRes里新增了一个safeNotice  是脱敏后的原始通告
			// 原始版-lastNotice
			// 标准版-jobInfo是toB标准版  jobInfoWithoutxx是toC标准版
			that.jobDetail.newdesc = res.lastNotice || '暂无原单';  //objMiddle['safeNotice'] || '暂无脱敏版通告';				
		});
		this.loginInfo = uni.getStorageSync("apply-userinfo");
		if (uni.getStorageSync("apply-token")) {
			that.G.Get(that.api.hasSee + "?jobId=" + that.uid, "", (res) => {});
		}
		if (this.miniAppInfo.autoDeliverySecond) {
			// 用户没有同意过，则弹出弹窗
			if (!uni.getStorageSync("userAllowed")) {
				let time = this.miniAppInfo.autoDeliverySecond * 1000; // 获取自动弹出客服弹窗的时间间隔（单位：秒）
				let nowTime = new Date().getTime();
				if ((uni.getStorageSync("pushJob_deadline") && (nowTime - uni.getStorageSync("pushJob_deadline")) / (1000 * 60 * 60 * 24) > 7) || !uni.getStorageSync("pushJob_deadline")) {
					setTimeout(() => {
						this.showPushJobPop = true;
					}, time);
				}
				// 用户同意过,则静默调用接口
			} else if (uni.getStorageSync("userAllowed") && uni.getStorageSync("apply-userinfo")) {
				that.handlePushJob("allow");
			}
		}

		// console.log("this.applyList", this.applyList);
	},
	onShow() {
		let that = this;
		this.isLogin = uni.getStorageSync("apply-userinfo") ? true : false;
		this.IS_CREATOR = uni.getStorageSync("IS_CREATOR") == 1 ? true : false;
		// console.log("this.IS_CREATOR", this.IS_CREATOR);
		this.corpUserFlag = uni.getStorageSync("apply-userinfo").corpUserFlag;


		if(that.isJm){
			that.tabInfo = {
				list: [
					{
						name: "职位详情",
						key: "0",
					},
					{
						name: "通告分享",
						key: "1",
					},
					{
						name: "原单",
						key: "2",
					},
				],
				active: 0,
			};
		}else{
			that.tabInfo = {
				list: [
					{
						name: "职位详情",
						key: "0",
					},
					{
						name: "通告分享",
						key: "1",
					},
				],
				active: 0,
			};
		}


		uni.getSystemInfo({
			success: function (res) {
				// console.log(res);
				that.wxPlat = res.hostName;
			},
		});
	},

	methods: {
		goReport() {
			uni.navigateTo({
				url: "/root/person/feedback",
			});
		},
		// 计算有效期限
		calcValidEndTime() {
			let now = new Date();
			let endTime = new Date(now.getTime() + 48 * 60 * 60 * 1000);
			let year = endTime.getFullYear();
			let month = String(endTime.getMonth() + 1).padStart(2, '0');
			let day = String(endTime.getDate()).padStart(2, '0');
			let hour = String(endTime.getHours()).padStart(2, '0');
			let minute = String(endTime.getMinutes()).padStart(2, '0');
			this.validEndTime = `${year}年${month}月${day}日${hour}:${minute} 前有效`;
		},
		// 获取招聘人数（12小时内不更新，id变化时更新）
		getRecruitNum() {
			let storageKey = 'job_recruit_num_' + this.uid;
			let storedData = uni.getStorageSync(storageKey);
			let now = new Date().getTime();
			
			if (storedData) {
				let data = JSON.parse(storedData);
				// 验证uid是否匹配，且12小时内不更新
				if (data.uid === this.uid && now - data.timestamp < 12 * 60 * 60 * 1000) {
					this.recruitNum = data.num;
					return;
				}
			}
			
			// 生成新的随机数并存储（280-360之间，10的倍数）
			let num = (Math.floor(Math.random() * 9) + 28) * 10;
			this.recruitNum = num;
			uni.setStorageSync(storageKey, JSON.stringify({
				num: num,
				timestamp: now,
				uid: this.uid
			}));
		},
		showFee() {
			let that = this;
			if (uni.getStorageSync("apply-token")) {
				if(that.isfensi != 2){
					uni.showModal({
						title: "",
						content: "仅代理可见",
						confirmText: "知道了",
						showCancel: false,
						success(res) {
							
						},
					});
					return false;
				}
			} else {
				uni.showModal({
					title: "",
					content: "登录后查看",
					confirmColor: getApp().globalData.themeColor,
					confirmText: "去登录",
					cancelText: "知道了",
					success(res) {
						if (res.confirm) {
							wx.navigateTo({
								url: "/root/person/loginIndex",
							});
						}
					},
				});
				return false;
			}


		
			let content, title;
			title = that.jobDetail.serverPrice;
			content = that.jobDetail.returnFeeDesp;
			uni.showModal({
				title,
				content,
				contentColor: "#ccc",
				confirmColor: getApp().globalData.themeColor,
				confirmText: "确定",
				showCancel: false,
				success(res) {},
			});
		},
		showCompanyInfo() {
			let that = this;
			let title = that.jobDetail.store.aliasName || "-";
			let content = that.jobDetail.store.storeInfo || "-";
			uni.showModal({
				title,
				content,
				contentColor: "#666",
				confirmColor: getApp().globalData.themeColor,
				confirmText: "我知道了",
				showCancel: false,
				success(res) {},
			});
		},
		getCode(callback = () => {}) {
			uni.login({
				success(wxRes) {
					callback(wxRes.code);
				},
				fail(res) {
					// console.log(res);
				},
			});
		},
		goAddress() {
			let that = this;
			// // console.log(e.currentTarget.dataset.address);
			var address = this.jobDetail;
			// console.log(address);
			wx.openLocation({
				latitude: Number(address.storeLat),
				longitude: Number(address.storeLng),
				name: address.storeName,
				address: address.storeAddr,
				scale: 15,
				success(res) {
					// console.log(res);
				},
				fail(res) {
					// console.log(res);
				},
			});
		},
		makePhone(tel) {
			uni.makePhoneCall({
				phoneNumber: tel, //仅为示例
			});
		},
		radioGroupChange(e) {
			// console.log(e);
		},
		goPage($path) {
			uni.navigateTo({
				url: $path,
			});
		},
		// toKnowInfo(id) {
		// 	let that = this;
		// 	// console.log(id);
		// 	that.G.Get(that.api.bind_enterpriseDetail + "/" + id, "", (res) => {
		// 		if (that.loginInfo.agencyId == that.jobDetail.agencyId || res.recordStatus == 1 || res.recordStatus == 2) {
		// 			that.attention = true;
		// 		} else {
		// 			that.G.handleConfirm(
		// 				"你还不是他的粉丝，无法查看职位",
		// 				(res) => {
		// 					let params = {
		// 						id: that.jobDetail.agencyId,
		// 						isShowMore: false,
		// 						jobDetailShow: false,
		// 					};
		// 					uni.navigateTo({
		// 						url: "/root/detail/user?" + that.G.objToStr(params),
		// 					});
		// 				},
		// 				(res) => {},
		// 				"关注发单号",
		// 				true,
		// 				"去关注"
		// 			);
		// 		}
		// 		that.speed = 1;
		// 	});
		// },
		handleCollection() {
			let that = this;

			if (this.isLogin) {
				that.G.Get(that.api.yi_job_collect + "/" + that.uid, {}, (res) => {
					that.isSc = !that.isSc;
					uni.showToast({
						title: that.isSc ? "收藏成功" : "取消收藏",
						icon: "success",
					});
				});
			} else {
				uni.showModal({
					title: "登录提示",
					content: "收藏功能需要登录才能使用,是否登录",
					success(res) {
						if (res.confirm) {
							uni.navigateTo({
								url: "/root/login/index?path=detail",
							});
						} else {
						}
					},
				});
			}
		},
		showService() {
			let that = this;
			if (!that.isLogin) {
				uni.showToast({
					title: "请先登录",
					icon: "none",
				});
				return;
			}
			if (that.goImLoading) {
				return false;
			}

			that.goImLoading = true;
			that.F.wyyxGet(that.api.job_get_cus + "?jobId=" + that.jobDetail.id, {}, (cusData) => {
				that.F.wyyxPost(
					that.api.wyyx_create,
					{
						// senderUserId: uni.getStorageSync("apply-uid"),
						// receiverUserId: cusData,
						senderAccid: uni.getStorageSync("im-accid"),
						receiverAccid: cusData.accid,
					},
					(res) => {
						uni.$UIKitStore.uiStore.selectConversation(res.conversationId);
						let list = ["addss", "genderRestrict", "genderAge"];
						let newList = [];
						list.forEach((item) => {
							if (that.jobDetail[item]) {
								newList.push(that.jobDetail[item]);
							}
						});
						that.jobDetail.info = newList.join("丨");
						that.F.wyyxPost(
							that.api.wyyx_sendCard,
							{
								conversationType: 1,
								// senderUserId: uni.getStorageSync("apply-uid"), // 发送者id 即当前登录用户id
								// receiverUserId: cusData, // 接收方用户id
								senderAccid: uni.getStorageSync("im-accid"),
								receiverAccid: cusData,
								type: 100000,
								jobDetail: {
									title: that.jobDetail.jobName || "",
									info: that.jobDetail.info,
									label: that.jobDetail.jobRequestLabelNames.length > 0 ? that.jobDetail.jobRequestLabelNames : [],
									salaryClassifyValue: that.jobDetail.priceStr || "",
									serviceFee: that.showPrice ? that.jobDetail.serverPrice : "",
									monthPay: that.jobDetail.monthPay || "",
									jobId: that.uid || "",
								},
							},
							() => {
								// uni.navigateTo({
								// 	url: "/root/NEUIKit/pages/Chat/index",
								// });
								that.goImLoading = false;
							},
							() => {},
						);
					},
					() => {},
				);
			});
		},
		// showService() {
		// 	if (this.appid == "wxb0c590fd696b79be") {
		// 		this.getKefu();
		// 	} else {
		// 		this.getKefu();
		// 	}
		// 	// this.serviceShow = true;
		// },
		hideService() {
			this.serviceShow = false;
		},

		getDetail() {
			let that = this;
			that.speed = 0;
			return new Promise((resolve) => {
				that.G.Get(that.api.job_personDetail + "/" + that.uid, "", (res) => {
					that.isSc = res.record.collected == 1 ? true : false;
					console.log("职位详情：", res);
					res = {
						...res,
						...res.record,
					};
					if (!res.hasOwnProperty("storeJobDetail")) {
						res.storeJobDetail = {};
					}

					res.addss = that.G.setJobInfoPositionv3(res.storeAddr);
					// console.log("职位详情1------：", res);
					that.isPerson = res.agencyId == uni.getStorageSync("apply-agencyId") ? true : false;
					// res.serverPrice = that.G.setReturnFee(res.returnFee, res.returnFeeType);
					res.agencyServerPrice = that.G.setReturnFee(res.agencyReturnFee, res.agencyReturnFeeType);
					res.serverPrice = that.G.setReturnFee(res.returnFee, res.returnFeeType);

					let setData = that.G.disposeJobListData(res);
					// console.log("setData.district", setData.district);
					res.addressStr = setData.district.slice(0, -1);
					res.sexStr = setData.genderAge;

					// res.ageStr = setData.age;
					// res.priceStr = that.G.getSalaryClassifyValue(res.salaryClassify, res.salaryClassifyValue);
					res.priceStr = res.salaryClassify != 7 ? that.G.getSalaryClassifyValue(res.salaryClassify, res.salaryClassifyValue) : that.G.getSalaryClassifyValue(res.salaryClassify, res.minMonthlyPay, res.maxMonthlyPay);

					res.monthPay = res.minMonthlyPay / 100 + "-" + res.maxMonthlyPay / 100;
					res.updateTime = that.G.setDeadLine(res.updateTime, "jiaofu");
					// console.log("res.images", res.images);
					that.swiperArray =
						res.images.length == 0
							? []
							: res.images.map((item, index) => {
									return {
										id: index + 1,
										image: item.url,
										type: item.url.indexOf(".mp4") > -1 ? "video" : "image",
									};
								});
					if (res.logo) {
						that.swiperArray.unshift({
							id: 0,
							image: res.logo,
							type: "image",
						});
					}
					that.jobDetail = res;
					that.selfJob = that.jobDetail.agencyId == that.loginInfo.agencyId;
					if (that.jobDetail.jobInfo.indexOf("————————" > -1)) {
						that.jobDetail.jobInfo = that.jobDetail.jobInfo.replace(/\*\*\*\*\*/g, "").split("————————")[0];
					} else {
						that.jobDetail.jobInfo = that.jobDetail.jobInfo.replace(/\*\*\*\*\*/g, "");
					}
					// that.jobDetail.jobRequestLabelNamesList = that.jobDetail.jobRequestLabelNames.split(",");
					// that.jobDetail.jobSpecialLabelNamesList = that.jobDetail.jobSpecialLabelNames.split(",");
					var str = that.jobDetail.supplier;
					var reg = /1[3456789]\d{9}/g;
					var phone = str && str.contactsTel ? str.contactsTel.match(reg) : null;
					if (phone != null) {
						that.jobDetail["phone"] = phone.toString();
					}
					// // console.log(phone.length);

					// that.jobDetail.jobName = '三顿饭卡加斯冯老师独立开发技术的返利看打两发慷慨激昂收代理费'
					that.jobDetail.logo = that.jobDetail.logo.indexOf("http:") > -1 ? that.jobDetail.logo.replace("http:", "https:") : that.jobDetail.logo;
					that.jobDetail.newXmf = uni.getStorageSync('apply-agencyId') == uni.getStorageSync('pgy-agency-id') ?
																 (res.agencyId == uni.getStorageSync('apply-agencyId') ? (res.upFullName || res.upAgencyName || res.upProviderName) : res.agencyName) : 
																	'';
																	
							
					
					
					setTimeout(() => {
						that.speed = 1;
					}, 100);
					resolve(that.jobDetail);
				});
			});
		},
		getImgCode() {
			var that = this;
			return new Promise((resolve) => {
				that.G.Get(that.api.get_singlejob_QRcode + "/" + that.uid, "", (res) => {
					// console.log("res", res);
					that.canvasInfo.wxCode = res.qrcode;
					resolve();
				});
			});
		},
		// 微信端绘制
		getWXCanvas(sharelImg, type) {
			const that = this;
			// type: 值为setShare是通过官方分享接口分享出去的封面, 为setJob是通过分享按钮生成分享的海报
			return new Promise((resolve) => {
				var mycenter = 0; //文字左右居中显示
				var myheight = 0; //文字高度
				const query = uni.createSelectorQuery().in(this);
				query
					.select("#canvasId")
					.fields({
						node: true,
						size: true,
					})
					.exec((res) => {
						// console.log("uni 获取节点信息：", res);
						// // console.log("sharelImg", sharelImg);
						const canvas = res[0].node;
						const ctx = canvas.getContext("2d");
						if (type == "setShare") {
							that.setShareCover(ctx, canvas, mycenter).then((canvas) => {
								// console.log("output canvas", canvas);
								uni.canvasToTempFilePath({
									canvas: canvas,
									success(res) {
										// console.log("res222", res);
										resolve(res);
									},
									fail(res) {
										uni.hideLoading();
										uni.showToast({
											title: res.errMsg,
											icon: "error",
										});
									},
								});
							});
						} else if (type == "setJob") {
							new Promise(function (resolve) {
								// 绘制背景图片
								uni.getImageInfo({
									src: sharelImg, // 网络图片
									success(res) {
										// console.log("res111", res);
										canvas.width = res.width;
										canvas.height = res.height;
										mycenter = canvas.width / 2;
										myheight = canvas.height;
										const img = canvas.createImage();
										img.src = res.path;
										// console.log("img111", img);
										img.onload = (info) => {
											ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
											// console.log("info111", info);
											resolve(true);
										};
									},
									fail(err) {},
								});
							}).then(() => {
								// console.log("inthen");
								//使用：
								that
									.setShareJobImg(ctx, canvas, mycenter)
									.then(function (canvas1) {
										// console.log("canvas1", canvas1);
										uni.canvasToTempFilePath({
											canvas: canvas1,
											success(res) {
												// console.log("res222", res);
												resolve(res);
											},
											fail(res) {
												uni.hideLoading();
												uni.showToast({
													title: res.errMsg,
													icon: "error",
												});
											},
										});
									})
									.catch((err) => {
										// console.log(err);
										uni.hideLoading();
										uni.showToast({
											title: "生成失败,请重试",
										});
									});
							});
						}
					});
			});
		},
		/**
		 * 生成分享小程序的封面
		 */
		setShareCover(ctx, canvas, mycenter) {
			let that = this;
			canvas.width = 750;
			canvas.height = 600;
			mycenter = canvas.width / 2;
			let labelLeft = 0;
			let baseLeft, logoSize, titleFontSize, mainFontSize, line1, line2, line3, line4, line5, line6, line7, line8;
			baseLeft = 24; // 左侧基准线
			logoSize = 132; // logo尺寸
			mainFontSize = 36; // 内容字体大小
			titleFontSize = 60; // 标题字体大小
			let ytit = 56;
			let stit = 56;
			let btit = 50;
			let dis = 44,
				labelHeight = 44;
			let offsetY = 50; // 整体向下偏移10像素
			line1 = 0; // 第一行距顶部距离
			line2 = 90 - dis + offsetY;
			line3 = 200 - dis + offsetY;
			line4 = 280 - dis + offsetY;
			line5 = 350 - dis - labelHeight + offsetY;
			line6 = 380 - dis - labelHeight - 10 + offsetY;
			line7 = 460 - dis - labelHeight + offsetY;

			// 绘制基础白色背景
			// console.log("that.jobDetail", that.jobDetail);
			_G.roundRect1(ctx, 0, 0, 750, 600, 0, "#fff");
			return new Promise(function (imgres) {
				_G.fillTextLineBreak(ctx, that.jobDetail.jobName.length > 11 ? that.jobDetail.jobName.slice(0, 11) + "..." : that.jobDetail.jobName, baseLeft, line2, 800, 20, "#000", titleFontSize, "500", "left"); // 岗位标题
				// _G.fillTextLineBreak(ctx, that.jobDetail.jobName, baseLeft, line2, 800, 20, "#000", titleFontSize, "500", "left"); // 岗位标题
				// console.log("isLogin", that.isLogin);
				// console.log("innerLogin", that.isLogin);
				_G.fillTextLineBreak(ctx, that.jobDetail.monthPay, 750 - ctx.measureText(that.jobDetail.monthPay).width, line3, 400, 20, "#ff4400", ytit, "400"); // 月工资
				_G.fillTextLineBreak(ctx, that.jobDetail.salaryClassify == 7 ? "月薪" : that.jobDetail.priceStr, baseLeft + 10, line3, 400, 40, "#ff4400", stit + 6, "600", "left"); // 时薪
				if (that.jobDetail.jobRequestLabelNames.length > 0) {
					that.jobDetail.jobRequestLabelNames
						.filter((itema, indexa) => {
							return indexa < 3;
						})
						.forEach((item1, index) => {
							if (index <= 3) {
								_G.fillTextLineBreak(ctx, item1, baseLeft + labelLeft + 12, line4 + 4, 400, 40, "#666", mainFontSize); // 标签字符
								_G.roundRect1(ctx, baseLeft + labelLeft, line4 - 38, ctx.measureText(item1).width + 24, 56, 8, "#00000012");
								labelLeft += ctx.measureText(item1).width + 32;
								if (index == 3) {
									labelLeft = 0;
								}
							}
							// else if (index > 3 && index <= 6) {
							// 	_G.roundRect1(ctx, baseLeft + labelLeft, line5 - 38, ctx.measureText(item1).width + 24, 56, 8, "#00000012");
							// 	_G.fillTextLineBreak(ctx, item1, baseLeft + labelLeft + 12, line5 + 4, 400, 40, "#666", mainFontSize); // 标签字符
							// 	labelLeft += ctx.measureText(item1).width + 32;
							// }
						});
				}
				// 临时注释
				// else if (that.jobDetail.jobSpecialLabelNames.length > 0) {
				// 	that.jobDetail.jobSpecialLabelNames.forEach((item1, index) => {
				// 		if (index <= 3) {
				// 			_G.fillTextLineBreak(ctx, item1, baseLeft + labelLeft + 12, line4 + 4, 400, 40, "#666", mainFontSize); // 标签字符
				// 			_G.roundRect1(ctx, baseLeft + labelLeft, line4 - 38, ctx.measureText(item1).width + 24, 56, 8, "#00000012");
				// 			labelLeft += ctx.measureText(item1).width + 32;
				// 			if (index == 3) {
				// 				labelLeft = 0;
				// 			}
				// 		} else if (index > 3 && index <= 6) {
				// 			_G.roundRect1(ctx, baseLeft + labelLeft, line5 - 38, ctx.measureText(item1).width + 24, 56, 8, "#00000012");
				// 			_G.fillTextLineBreak(ctx, item1, baseLeft + labelLeft + 12, line5 + 4, 400, 40, "#666", mainFontSize); // 标签字符
				// 			labelLeft += ctx.measureText(item1).width + 32;
				// 		}
				// 	});
				// }

				// 根据标签数量调整宣传标语位置
				// _G.roundRect1(ctx, mycenter - 712 / 2, line6 + (that.jobDetail.jobSpecialLabelNames.length > 3 ? 0 : -70), 712, 60, 4, "#fff6e8"); // 宣传标语背景
				_G.roundRect1(ctx, mycenter - 712 / 2, line6, 712, 60, 4, "#fff6e8"); // 宣传标语背景

				// 绘制立即咨询
				// 根据标签数量调整立即咨询背景位置
				// _G.roundRect1(ctx, mycenter - 712 / 2, line7 + (that.jobDetail.jobSpecialLabelNames.length > 3 ? 0 : -70), 712, 100, 4, "#3b80fa"); // 立即咨询背景
				_G.roundRect1(ctx, mycenter - 712 / 2, line7, 712, 100, 4, getApp().globalData.themeColor); // 立即咨询背景
				// 根据标签数量调整立即咨询位置
				// _G.fillTextLineBreak(ctx, "立即咨询", mycenter - 24 - ctx.measureText("立即咨询").width / 2, line7 + (that.jobDetail.jobSpecialLabelNames.length > 3 ? 70 : 0), 300, 120, "#fff", titleFontSize, "500"); // 立即咨询
				ctx.textBaseline = "middle";
				ctx.textAlign = "center";
				ctx.font = "500 " + btit + "px Arial";
				ctx.fillStyle = "#fff";
				ctx.fillText("立即查看", mycenter, line7 + 50);
				ctx.textBaseline = "alphabetic";
				ctx.textAlign = "left";
				// 绘制职位logo
				// console.log("that.jobDetail.logo", that.jobDetail.logo);
				// uni.downloadFile({
				// 	url: that.jobDetail.logo,
				// 	success(res) {
				// 		// console.log("draw", res);
				// 		const img = canvas.createImage();
				// 		img.src = res.tempFilePath;
				// 		img.onload = () => {
				// 			_G.roundRect(ctx, img, baseLeft, line2, logoSize, logoSize, 8);

				// 		};
				// 	},
				// 	fail(err) {
				// 		// console.log("logodownloadFile err", err);
				// 	},
				// });
				uni.downloadFile({
					url: "https://bocai-cms.oss-cn-beijing.aliyuncs.com/web-resource/pugongying/goxj2-qpwbo.png",
					success(res) {
						// console.log("duihao", res);
						const img1 = canvas.createImage();
						img1.src = res.tempFilePath;
						// console.log("img info img", img1);
						img1.onload = (info) => {
							// console.log("img info", info);
							let safeMarkPosition = 44;
							// 宣传标语
							["安全保障", "工资保障", "补贴保障"].forEach((item1, index) => {
								// 根据标签数量调整安全标识位置
								// _G.fillTextLineBreak(ctx, item1, baseLeft + safeMarkPosition, line6 + (that.jobDetail.jobSpecialLabelNames.length > 3 ? 0 : -70) + 40, 100, 32, "#fca025");
								// _G.roundRect(ctx, img, baseLeft + safeMarkPosition - 36, line6 + (that.jobDetail.jobSpecialLabelNames.length > 3 ? 0 : -70) + 12, 32, 32, 12);
								_G.fillTextLineBreak(ctx, item1, baseLeft + safeMarkPosition, line6 + 40, 100, 32, "#fca025");
								_G.roundRect(ctx, img1, baseLeft + safeMarkPosition - 36, line6 + 12, 32, 32, 12);
								safeMarkPosition += 130 + ctx.measureText(item1).width;
							});
							setTimeout(() => {
								// console.log("success draw");
								imgres(canvas);
							}, 200);
						};
					},
					fail(err) {
						// console.log("downloadFile err", err);
					},
				});
			}).catch((err) => {
				// console.log("all err", err);
			});
		},
		// 生成分享的海报
		setShareJobImg(ctx, canvas, mycenter, funObj) {
			let that = this;
			let labelLeft = 0;
			// ctx.arcTo()
			let baseTop, logoLeft, logoSize, titleSize, ageTop, salaryClassifyValueLeft, salaryClassifyValueTop, monthlyPaySize, position, markTop, roundRectHeight, fubiaotiTop, bottomSloganTop, QRSize;
			logoLeft = 56 * 2;
			let baseMiddle = 248 * 2;
			let offsetY = 10; // 整体向下偏移10像素
			// if (that.data.checkedList.length == 1) {
			baseTop = 2 * 370 + offsetY;
			logoSize = 2 * 96;
			QRSize = 2 * 260;
			titleSize = 2 * 30;
			roundRectHeight = 2 * 260;
			ageTop = 2 * 110;
			salaryClassifyValueLeft = 2 * 56;
			salaryClassifyValueTop = 2 * 54;
			monthlyPaySize = 2 * 24;
			markTop = 2 * 145;
			fubiaotiTop = 2 * 155;
			bottomSloganTop = 2 * 355;
			// console.log("that.canvasInfo.wxCode", that.canvasInfo.wxCode);
			return new Promise((imgres) => {
				_G.roundRect1(ctx, 24 * 2, baseTop - 100, 1104, roundRectHeight, 32, "#fff");
				// console.log(that.jobDetail);
				// // console.log(that.jobDetail.store);
				// // console.log(app.globalData.ip + that.currCode);
				that.jobDetail.jobRequestLabelNames.forEach((item1, index) => {
					// // console.log(item1);
					// // console.log(ctx.measureText(item1).width);
					if (index <= 2) {
						_G.fillTextLineBreak(ctx, item1, 60 * 2 + labelLeft, baseTop + markTop + 30 * 2, 400 * 2, 20, "#333", monthlyPaySize); // 标签字符
						_G.roundRect1(ctx, 52 * 2 + labelLeft, baseTop + markTop, ctx.measureText(item1).width + 16 * 2, 40 * 2, 32 * 2, "#00000012");
						labelLeft += ctx.measureText(item1).width + 32 * 2;
					}
				});
				_G.fillTextLineBreak(ctx, that.jobDetail.jobName.length > 11 ? that.jobDetail.jobName.slice(0, 11) + "..." : that.jobDetail.jobName, logoLeft, baseTop, 1000, 20, "#000", titleSize, "600", "left"); // 岗位标题
				// _G.fillTextLineBreak(ctx, that.jobDetail.jobName, logoLeft, baseTop, 500 * 2, 20, "#333", titleSize, "600", "left"); // 岗位标题
				_G.fillTextLineBreak(ctx, that.jobDetail.priceStr, salaryClassifyValueLeft, baseTop + salaryClassifyValueTop, 400 * 2, 20, "#ff4400", titleSize, "600"); // 时薪

				_G.fillTextLineBreak(ctx, that.jobDetail.monthPay, salaryClassifyValueLeft + ctx.measureText(that.jobDetail.priceStr + " ").width, baseTop + salaryClassifyValueTop, 400 * 2, 20, "#ff4400", monthlyPaySize, "400"); // 月工资

				_G.fillTextLineBreak(ctx, that.jobDetail.shortDistrict, salaryClassifyValueLeft, baseTop + ageTop, 300 * 2, 20, "#333", monthlyPaySize); // 省市年龄

				_G.fillTextLineBreak(ctx, that.jobDetail.age, salaryClassifyValueLeft + ctx.measureText(that.jobDetail.shortDistrict).width, baseTop + ageTop, 300 * 2, 20, "#333", monthlyPaySize); // 省市年龄
				//  - ctx.measureText(that.userInfo.agencyName).width / 2
				_G.fillTextLineBreak(ctx, that.miniAppInfo.fullName || that.miniAppInfo.agencyName, mycenter - ctx.measureText(that.miniAppInfo.fullName || that.miniAppInfo.agencyName).width / 2, baseTop - fubiaotiTop, 400 * 2, 20, "#fff", monthlyPaySize, "600"); // 代理名称
				// - ctx.measureText("长按查看职位详情").width / 4
				// _G.fillTextLineBreak(ctx, "长按查看职位详情", mycenter - ctx.measureText("长按查看职位详情").width / 2, baseTop + bottomSloganTop - 30, 300 * 2, 20, "#fff", monthlyPaySize); // 底部slogan
				// - ctx.measureText("好工作  放心干").width / 3.2
				_G.fillTextLineBreak(ctx, "长按查看职位详情", mycenter - ctx.measureText("长按查看职位详情").width / 2, baseTop + bottomSloganTop + 730, 500 * 2, 20, "#fff", monthlyPaySize); // 底部slogan
				// console.log("that.canvasInfo.wxCode", that.canvasInfo.wxCode);
				uni.getImageInfo({
					src: "https://daotian.matripe.com.cn" + that.canvasInfo.wxCode,
					success(res) {
						// console.log("res333", res);
						const img = canvas.createImage();
						img.src = res.path;
						img.onload = () => {
							// console.log("ctx", ctx);
							// console.log("canvas", canvas);
							_G.roundRect1(ctx, mycenter - 580 / 2, baseTop + 740, 580, 580, 0, "#fff");
							_G.roundRect(ctx, img, mycenter - res.width / 2 - 40, baseTop + 770, QRSize, QRSize, 0);
							// if (index == that.data.checkedList.length - 1) {
							setTimeout(() => {
								imgres(canvas);
							}, 200);
							// }
							// // console.log("that.jobDetail.logo", that.jobDetail.logo);
							// uni.getImageInfo({
							// 	src: that.jobDetail.logo,
							// 	success(res) {
							// 		// console.log("res444", res);
							// 		const img = canvas.createImage();
							// 		img.src = res.path;
							// 		img.onload = () => {
							// 			imgres(canvas);
							// 		};
							// 	},
							// 	fail(err) {},
							// });
							// uni.downloadFile({
							// 	url: that.jobDetail.logo || "https://matripe.oss-cn-beijing.aliyuncs.com/default.png", //网络图片,如果不行请换一个
							// 	success(res) {
							// 		// console.log(res);
							// 		const img = canvas.createImage();
							// 		img.src = res.tempFilePath;
							// 		img.onload = () => {
							// 			_G.roundRect(ctx, img, logoLeft, baseTop + 40, logoSize, logoSize, 8);
							// 			setTimeout(() => {
							// 				imgres(canvas);
							// 			}, 200);
							// 		};
							// 	},
							// 	fail(err) {
							// 		// console.log(err);
							// 	},
							// });
						};
					},
					fail(err) {
						// console.log(err);
					},
				});
			});
		},
		handleViewBig($item, $index) {
			let that = this;
			// 只筛选出类型为'image'的项目用于预览
			const imageUrls = that.swiperArray.filter((item) => item.type === "image").map((item) => item.image);

			// 计算当前图片在过滤后数组中的索引
			let imageIndex = 0;
			for (let i = 0; i < that.swiperArray.length; i++) {
				if (that.swiperArray[i].type === "image") {
					if (that.swiperArray[i] === $item) {
						break;
					}
					imageIndex++;
				}
			}

			uni.previewImage({
				urls: imageUrls,
				current: imageIndex,
			});
		},
		showShareImg() {
			let that = this;

			if (this.isLogin) {
				if (that.canvasInfo.posterImg) {
					that.canvasInfo.isShow = true;
					return;
				}
				uni.showLoading({
					title: "生成中",
				});
				this.getImgCode().then((res) => {
					that
						.getWXCanvas("https://bocai-cms.oss-cn-beijing.aliyuncs.com/web-resource/2023-09-01/7ca85384-9f22-474d-893f-092b61de684d_share.png", "setJob")
						.then((canvasRes) => {
							// console.log("canvasRes", canvasRes);
							that.canvasInfo.posterImg = canvasRes.tempFilePath;
							that.canvasInfo.isShow = true;
						})
						.finally(() => {
							uni.hideLoading();
						});
				});
			} else {
				uni.showModal({
					title: "登录提示",
					content: "分享功能需要登录才能使用,是否登录",
					success(res) {
						if (res.confirm) {
							uni.navigateTo({
								url: "/root/login/index?path=detail",
							});
						} else {
						}
					},
				});
			}
		},
		saveToalbum() {
			let that = this;
			// console.log(that.canvasInfo.posterImg);
			uni.saveImageToPhotosAlbum({
				filePath: that.canvasInfo.posterImg,
				success(res) {
					// console.log(res);
					if (res.errMsg == "saveImageToPhotosAlbum:ok") {
						uni.showToast({
							title: "图片已保存",
							icon: "none",
							duration: 1500,
						});
					}
				},
				fail(res) {
					// console.log(res);
					uni.showToast({
						title: "图片保存失败",
						icon: "none",
						duration: 1500,
					});
				},
			});
		},

		handleOpenApplyPopup() {
			let that = this;
			if (!that.isLogin) {
				uni.showModal({
					title: "登录提示",
					content: "报名功能需要登录才能使用,是否登录",
					success(res) {
						if (res.confirm) {
							uni.navigateTo({
								url: "/root/login/index?path=detail",
							});
						} else {
						}
					},
				});
				return;
			}

			if (!this.attention) {
				return false;
			}
			that.getCode((res) => {
				uni.setStorageSync("apply-code", res);
				// console.log("是否执行");
			});
			// that.applyPopup.isShow = true;
			uni.navigateTo({
				url: "/root/home/quickApplication?jobId=" + this.jobDetail.id + "&jobName=" + this.jobDetail.jobName + "&title=报名&type=" + that.jobDetail.jobType + "&tid=" + that.jobDetail.record.templateId,
			});
			if (this.jobDetail.recruitment == 1) {
				this.formInfo = {
					userName: "",
					idCard: "",
					tel: "",
					interTime: "",
				};
				// this.applyPopup = {
				// 	isShow: true,
				// };
			} else {
				uni.showToast({
					title: "停招职位不能报名",
					icon: "none",
				});
			}
		},
		handleToggleCollection() {
			this.isCollection = !this.isCollection;
			if (this.isCollection) {
				uni.showToast({
					icon: "success",
					title: "收藏成功",
				});
			}
		},

		changeDateTime(e) {
			// console.log(e);
			var dateTimeArray = this.dateTimeArray,
				dateTime = e.detail.value;
			this.currentTime = dateTimeArray[0][dateTime[0]].replace("年", "") + "-" + dateTimeArray[1][dateTime[1]].replace("月", "") + "-" + dateTimeArray[2][dateTime[2]].replace("日", "") + " " + dateTimeArray[3][dateTime[3]];
		},

		changeDateTimeColumn(e) {
			// console.log(e);
			var arr = this.dateTime;
			var dateArr = this.dateTimeArray;
			arr[e.detail.column] = e.detail.value;
			dateArr[2] = dateTimePicker.getMonthDay(dateArr[0][arr[0]], dateArr[1][arr[1]]);
			for (let index = 0; index < dateArr[2].length; index++) {
				dateArr[2][index] = dateArr[2][index] + "日";
			}
			// .replace("年",'').replace("月",'').replace("日",'')
			dateTimeArray = dateArr;
			dateTime = arr;
		},

		// 复制通告
		setCopy(e) {
			var that = this;
			let text = that.jobDetail.jobInfoWithoutReturnFee || that.jobDetail.jobInfo;
			uni.setClipboardData({
				data: text,
				success(res) {
					uni.getClipboardData({
						success(res) {
							// console.log(res.data); // data
							uni.showToast({
								title: "复制成功",
								icon: "success",
							});
						},
					});
				},
			});
		},
		setCops(e){
			var that = this;
			let text = that.jobDetail.newdesc;
			uni.setClipboardData({
				data: text,
				success(res) {
					uni.getClipboardData({
						success(res) {
							uni.showToast({
								title: "复制成功",
								icon: "success",
							});
						},
					});
				},
			});
		},
		handleSubmit() {
			let that = this;
			// console.log("that.formInfo", that.formInfo);
			that.formInfo.jobId = that.uid;
			that.formInfo.interviewTimeStr = that.currentTime;
			// console.log("that.formInfo1", that.formInfo, that.agreeRadio);
			if (that.formInfo.userName == "") {
				uni.showToast({
					icon: "none",
					title: "请输入您的真实姓名，只包含中文或英文字符",
				});
				return false;
			}
			if (that.formInfo.idCard == "") {
				uni.showToast({
					icon: "none",
					title: "请输入18位有效身份证号码",
				});
				return false;
			}
			if (!that.G.setReg(that.formInfo.idCard, "idcard")) {
				uni.showToast({
					icon: "none",
					title: "请输入正确的身份证号",
				});
				return false;
			}
			if (that.formInfo.tel == "") {
				uni.showToast({
					icon: "none",
					title: "请输入联系电话",
				});
				return false;
			}
			if (!that.G.setReg(that.formInfo.tel, "tel")) {
				uni.showToast({
					icon: "none",
					title: "请输入正确的联系电话",
				});
				return false;
			}
			if (!that.agreeRadio.length) {
				uni.showToast({
					icon: "none",
					title: "请阅读协议",
				});
				return false;
			}
			that.G.Post(that.api.job_recordJob, that.formInfo, (res) => {
				// console.log(res);
				uni.showToast({
					icon: "success",
					title: "报名成功",
				});
				that.applyPopup.isShow = false;
			});
		},
		/**
		 * 新的报名方法
		 */
		submitApply(e, callBack) {
			let that = this;
			that.btnLoading = true;
			let params = {
				userName: e.name,
				tel: e.tel,
				jobId: that.jobDetail.id,
			};
			// console.log('uni.getStorageSync("AGENCY_ID")', uni.getStorageSync("AGENCY_ID"));
			// console.log('uni.getStorageSync("userinfo")', uni.getStorageSync("apply-userinfo"));
			// return
			if (uni.getStorageSync("AGENCY_ID") == uni.getStorageSync("apply-userinfo").user.agencyId) {
				params.agencyUserId = uni.getStorageSync("apply-userinfo").user.id;
				params.followUserId = uni.getStorageSync("apply-userinfo").user.id;
			}
			if (uni.getStorageSync("AGENCY_USER_ID")) {
				params.agencyUserId = uni.getStorageSync("AGENCY_USER_ID");
				params.followUserId = uni.getStorageSync("AGENCY_USER_ID");
			}
			that.G.Post(
				that.api.yi_job_recordJob,
				params,
				(res) => {
					that.applyPopup.isShow = false;
					// uni.showTabBar();
					uni.showToast({
						title: "报名成功",
						icon: "success",
					});
					that.btnLoading = false;
					// uni.navigateTo({
					// 	url: "/root/other/result",
					// 	success: function (res) {
					// 		callBack(true);
					// 	},
					// });
				},
				() => {
					that.btnLoading = false;
				},
			);
		},
		goEditJob() {
			let that = this;
			uni.navigateTo({
				url: "/root/home/jobForm?id=" + that.uid,
			});
		},
		getIDCardInfo() {
			let that = this;

			that.G.uploadImg((res) => {
				// console.log("身份证信息：", res);
				this.formInfo.userName = res.info.name;
				this.formInfo.idCard = res.info.num;
				this.formInfo.nation = res.info.nationality;
				this.formInfo.age = res.info.age;
				this.formInfo.address = res.info.address;
				this.formInfo.idCardImageUrl = res.image;
				this.formInfo.sex = res.info.sex == "男" ? 1 : 2;
			}, "idcard");
		},
		// 显示视频
		showVideo(e) {
			var that = this;
			// console.log("showVideo e", e);
			// console.log("showVideo that.swiperArray", that.swiperArray);
			this.videoContext = uni.createVideoContext(`${e.id}`, this);
			that.videoContextTemp = that.videoContext;
			this.videoContext.requestFullScreen({
				direction: "landscape", // 横屏全屏
			});
			this.videoContext.hideStatusBar();
			this.videoContext.play();
		},
		takeTel($item) {
			// console.log($item);
			// if ($item) {
			uni.makePhoneCall({
				phoneNumber: $item.customServiceUser.tel,
			});
			// }
		},
		kefu(e) {
			var that = this;

			let url = this.jobDetail.storeJobDetail.customServiceUrl;
			// // console.log('/pages/detail/index?storeJobId' + this.data.searchForm.storeJobId);
			if (url != "") {
				uni.openCustomerServiceChat({
					// extInfo: { url: 'https://work.weixin.qq.com/kfid/kfc84d8465f4c633511' },
					extInfo: {
						url: "https://work.weixin.qq.com/kfid/kfc8e1e424ef907601f",
					},
					showMessageCard: true,
					sendMessagePath: `/root/detail/job.html?id=${that.uid}&classify=${that.jobDetail.classify}`,
					// sendMessageImg:'../../assets/images/jbn.png',
					corpId: "ww225068732d3e7462",
					success(res) {
						// console.log("res", res);
					},
					fail(err) {
						// console.log("err", err);
					},
				});
			} else {
				uni.showToast({
					title: "该岗位暂无客服",
					icon: "none",
					duration: 2000,
				});
			}
		},
		fullScreen(e) {
			// console.log(e);
			this.muted = true;
			this.isFullscreen = e.detail.fullScreen; // 更新全屏状态

			if (!e.detail.fullScreen) {
				this.videoContext.stop();
			}
		},
		shareVideo(e) {
			var that = this;
			// console.log(e);
			uni.showLoading({
				title: "下载中...",
				mask: true,
			});
			if (this.wxPlat == "wxwork") {
				uni.downloadFile({
					url: e.image, // 下载url
					success: (downloadRes) => {
						uni.saveVideoToPhotosAlbum({
							filePath: downloadRes.tempFilePath,
							success: () => {
								// console.log("视频已保存到相册");
							},
							fail: () => {
								console.error("保存视频到相册失败");
							},
						});
						uni.hideLoading();
					},
					fail: () => {
						uni.hideLoading();
						console.error("下载文件失败");
					},
				});
			} else {
				uni.downloadFile({
					url: e.image, // 下载url
					success(res) {
						// 下载完成后转发
						uni.hideLoading();
						uni.showLoading({
							title: "分享中...",
							mask: true,
						});
						uni.shareVideoMessage({
							videoPath: res.tempFilePath,
							success() {
								uni.hideLoading();
								// console.log("=================-----=========");
								// console.log(that.videoContextTemp);
								that.videoContextTemp.exitFullScreen();
								// uni.setNavigationBarTitle({
								//   title: '当前页面'
								// })
							},
							fail: (res) => {
								// console.log(res);
								// console.log("失败原因1111");
								uni.hideLoading();
								uni.showToast({
									title: "分享失败",
								});
							},
						});
					},
					fail: (res) => {
						// console.log("失败原因" + res);
						uni.hideLoading();
						uni.showToast({
							title: "下载失败",
						});
					},
				});
			}
		},
		/**
		 * 拨打电话
		 */
		makePhoneCall(e) {
			var that = this;
			if (!e.mark.tel) {
				uni.showToast({
					title: "暂无联系方式",
					icon: "none",
				});
				return;
			}
			uni.makePhoneCall({
				phoneNumber: e.mark.tel,
			});
		},
		getKefu() {
			let that = this;
			that.currentStore = uni.getStorageSync("CUSTOMSERVICE_INFO");
			that.currentStore.splitPhone = this.G.splitPhone(that.currentStore.tel);
			that.serviceShow = true;
		},
		pushSetToken(_type) {
			let that = this;
			that.G.checkToken().then(() => {
				that.getDetail().then(()=>{
					that.isLogin = true;
					that.loginInfo = uni.getStorageSync("apply-userinfo");
					//联系客服
					if (_type == "relationService") {
						that.showService();
						//报名
					} else if (_type == "record") {
						that.handleOpenApplyPopup();
						//职位推送
					} else if (_type == "pushJob") {
						that.handlePushJob("allow");
					}
				})
			});
		},
		setType(e) {
			this.tabInfo.active = e;
		},
		goIm() {
			let that = this;
			that.F.wyyxGet(that.api.job_get_cus + "?jobId=" + that.jobDetail.id, {}, (cusData) => {
				uni.setStorageSync("jobim", JSON.stringify({
					cusData: cusData,
					jobDetail: that.jobDetail,
					uid: that.uid,
				}));
				uni.navigateTo({
					url: "/root/NEUIKit/index?item=" + (uni.getStorageSync("im-accid") + '|1|' + cusData.accid) + '&f=1',
				});
			});
		},
		switchRadioChange(e) {
			let that = this;
			if (e && e.detail && e.detail.value && e.detail.value[0] == "acheck") {
				that.pushJobChecked = true;
			} else {
				that.pushJobChecked = false;
			}
		},
		handlePushJob(_type) {
			let that = this;
			// console.log("that.pushJobChecked", that.pushJobChecked);
			if (_type == "allow") {
				if (this.loginInfo && this.loginInfo.tel) {
					that.autoDelivery();
				}
			} else {
				if (this.pushJobChecked) {
					uni.setStorageSync("pushJob_deadline", new Date().getTime());
				}
				that.showPushJobPop = false;
			}
		},
		autoDelivery() {
			let that = this;
			this.G.Post("/yishoudan/user/applyClue/autoDelivery", { tel: this.loginInfo.tel }, (res) => {
				// console.log("res", res);
				that.showPushJobPop = false;
				uni.setStorageSync("userAllowed", true);
			});
		},
	},
};
</script>

<style lang="scss">
page {
	padding-bottom: 120px;
	background-color: #ededed;
}

.canvas-card {
	width: 75%;
	height: 85%;
	background-image: url("https://bocai-cms.oss-cn-beijing.aliyuncs.com/web-resource/2023-09-01/7ca85384-9f22-474d-893f-092b61de684d_share.png");
	background-repeat: no-repeat;
	background-size: 100% 100%;
}

.shareVideo {
	position: absolute;
	bottom: 80px;
	right: 30px;
	width: 36px;
	height: 36px;
	text-align: center;
	z-index: 1111;
	background-color: #ffffff66;
	border-radius: 50%;

	.iconfont {
		color: #fff;
		font-size: 20px;
		line-height: 36px;

		&.icon-huidaodingbu {
			transform: rotate(180deg);
		}
	}
}

.p-root-detail-job {
	.g-components-panel-fixed {
		min-height: 0;
		padding-bottom: calc(12px + constant(safe-area-inset-bottom));
		padding-bottom: calc(12px + env(safe-area-inset-bottom));
	}

	.no_style {
		// height: 40px;
	}

	.m-boss {
		.box {
			background-color: rgba(0, 182, 102, 0.05);
		}
	}

	.m-banner {
		.u-swiper__wrapper__item {
			margin-right: 10px;
		}

		image {
			border-radius: 4px !important;
		}
		.banner-scroll {
			width: 100%;
			white-space: nowrap;

			.scroll-content {
				display: inline-block;
				white-space: nowrap;

				.scroll-item {
					display: inline-block;
					width: 58px;
					height: 58px;
					margin-right: 12px;
					vertical-align: top;

					&:last-child {
						margin-right: 0;
					}

					.videoContainer {
						position: relative;
						background-color: #000; // 黑色背景

						.theVideo {
							width: 100%;
							height: 100%;

							// 小图时隐藏控制栏
							::v-deep .uni-video-controls {
								display: none !important;
							}

							// 全屏时显示控制栏
							::v-deep .uni-video-fullscreen-controls {
								display: block !important;
							}
						}

						// 小图时只显示居中的播放按钮
						::v-deep .uni-video-cover-play-button {
							display: block !important;
							width: 40px;
							height: 40px;
							margin: auto;
						}
					}
				}
			}
		}
		// .swiper {

		// 	// 为最后一个视频项目添加特殊处理
		// 	swiper-item:last-child {
		// 		.videoContainer {
		// 			// 确保视频容器不会被裁剪
		// 			overflow: visible !important;

		// 			.theVideo {
		// 				// 确保视频元素能够完整显示
		// 				width: 100%;
		// 				height: 100%;
		// 			}

		// 			.shareVideo {
		// 				// 调整分享按钮位置，确保不会遮挡视频
		// 				right: 10px;
		// 				bottom: 10px;
		// 			}
		// 		}
		// 	}
		// }
	}

	.m-state {
		position: fixed;
		left: 0;
		bottom: 0;
		z-index: 1;
		box-shadow: 0px -4rpx 8rpx 0px rgba(218, 218, 218, 0.5);
	}

	.apply {
		.link {
			.item {
				.btn {
					width: 240rpx;
					height: 76rpx;
					border-radius: 42rpx;

					&:first-child {
						border: 2rpx solid #3578f6;
					}
				}

				.label {
					position: relative;

					&::before {
						content: "*";
						color: #ff0000;
					}
				}
			}
		}
	}

	.riliIcon {
		position: absolute;
		right: 15px;
		top: 50%;
		transform: translateY(-50%);
		z-index: 1;
	}

	.servicePrice {
		height: 64px;
		border: 1rpx solid #ff4400;
		background-color: #ffeee7;
		border-right-color: transparent;
		border-left-color: transparent;
		width: 100vw;
		margin-left: -20px;
	}

	.kefuBox {
		position: fixed;
		right: 25px;
		bottom: 182px;
		z-index: 9999;

		.iconBox {
			width: 48px;
			height: 48px;
			margin-bottom: 12px;
			border-radius: 50%;
			text-align: center;
			line-height: 48px;
			box-shadow: 2px 0 12px 2px rgba(108, 108, 108, 0.2);
			background: #fff;
			z-index: 9999;
		}
	}
}

.desp-copy {
	font-size: 12px;
	float: right;
	/* top: 11px;
  right: 8px;
  position: relative; */
	border-radius: 25rpx;
	padding: 0px 8px;
	height: 16px;
	line-height: 16px;

	margin-right: 16px;
}

.g_h_104s {
	padding-top: 12px;
	padding-bottom: constant(safe-area-inset-bottom);
	padding-bottom: env(safe-area-inset-bottom);
	min-height: 120px;
}
.pop-container {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	transform: translateY(-100%); /* 初始隐藏在屏幕外 */
	transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); /* 平滑下拉动画 */
	z-index: 9999; /* 确保在最上层 */
}
.pop-container.show {
	transform: translateY(-4px); /* 下拉显示 */
}
</style>
