<template>
	<view class="p-root-detail-job g_pl_16 g_pr_16 g_pt_10">
		<!-- {{ from }} -->
		<!-- {{ selfJob }} -->

		<view v-if="speed == 0">
			<g-loading />
		</view>
		<view v-if="speed == 1">
			<view v-if="corpUserFlag" class="g_bg_f g_pl_16 g_pr_16 g_radius_8 g_mb_8">
				<view v-if="jobDetail.record.askAgencyName" class="g_flex_row_between flex_center g_h_45 g_border_e_b">
					<view class="g_flex_row_start" style="flex: none">
						<view class="g_fs_16 g_fw_600 g_mr_4 g_flex_column_center">来源</view>
					</view>
					<view class="g_c_6 g_mt_4">{{ jobDetail.record.askAgencyName }}</view>
				</view>
				<view class="g_flex_row_between flex_center g_h_45 g_fs_16">
					<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.supplier.supplierName }}</span>
					</view>
				</view>
			</view>
			<view class="g_bg_f g_pl_16 g_pr_16 g_radius_8 g_mb_10" @click="showFee">
				<view class="g_flex_row_between flex_center g_fs_16">
					<view class="g_flex_row_start" style="flex: none">
						<view class="g_fw_600 g_mr_4 g_h_67 g_flex_column_center">代理佣金</view>
						<icon :class="isServicePriceShow ? 'icon-zhengyan1' : 'icon-biyan1'" class="iconfont g_c_f40 g_fs_22 g_h_67 g_flex_column_center" v-if="userInfo.agencyStatus == 1" @click.stop="toggleReturnFee" style="width: 67px"></icon>
					</view>
					<view class="g_flex_row_end flex_center g_h_67" style="flex: 1">
						<span class v-if="isServicePriceShow && userInfo.agencyStatus == 1">{{ jobDetail.fuWuFei || "详询客服" }}</span>
						<span class wx:else>***</span>
						<view class="iconfont icon-gengduo11 g_fs_14 g_c_6 g_ml_4"></view>
					</view>
				</view>
			</view>
			<view class="g_bg_f g_pt_10 g_pl_16 g_pr_16 g_mt_10 g_kuaishou g_radius_8" hover-class="none" hover-stop-propagation="false">
				<view class="m-info g_mb_12">
					<view class="g_flex_1">
						<view class="g_mb_10 g_flex_row_between flex_center">
							<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" hover-class="none" hover-stop-propagation="false">
								{{ jobDetail.updateTime }}
							</view>
						</view>

						<template>
							<view class="g_c_9">
								<view class="g_flex_row_between flex_center g_mb_12">
									<view class="g_fs_14 g_ml_4 g_lh_1_2 g_flex_column_center">{{ (jobDetail.addss ? jobDetail.addss + "丨" : "") + jobDetail.genderRestrict + "丨" + jobDetail.age }} </view>
								</view>
							</view>
						</template>
					</view>
				</view>
				<view class="g_flex_row_start" v-if="jobDetail.jobRequestLabelNames.length > 0">
					<!-- :style="{ color: labelColor[index % labelColor.length], 'background-color': bgColor[index % bgColor.length] }" -->
					<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_8 g_pl_4 g_pr_4"> {{ item }}</view>
				</view>
				<view class="g_flex_row_between flex_center g_mt_8" hover-class="none" hover-stop-propagation="false">
					<view class="g_flex_row_start flex_center" hover-class="none" hover-stop-propagation="false">
						<view class="g_fs_16 g_fw_600 g_c_f40 g_lh_1_2 g_flex_column_center" v-if="jobDetail.priceStr" v-html="jobDetail.priceStr"> </view>
						<view class="g_fs_14 g_c_9" hover-class="none" hover-stop-propagation="false" v-if="jobDetail.monthPay">
							{{ jobDetail.monthPay ? "丨" + jobDetail.monthPay : "" }}
						</view>
					</view>
					<view v-if="corpUserFlag" class="g_flex_row_start g_c_main" @click.stop="setCopy('jobName')">
						<view class="iconfont icon-fuzhi mr4" style></view>
						<span class="f14 biggerSize">复制</span>
					</view>
				</view>

				<!-- 地址 -->
				<div>
					<view class="m-address g_mt_16 g_mb_16 g_pt_10 g_pb_10 g_flex_row_start g_border_e_t g_border_e_b" hover-class="thover" @click="goAddress" v-if="jobDetail.storeLat && jobDetail.storeLng">
						<view class="g_flex_none g_flex_column_center">
							<i class="iconfont icon-dizhi1 g_c_main g_mr_10 g_w_14 g_h_14"></i>
						</view>
						<view class="g_flex_1 g_ml_4 g_mr_4 g_flex_column_center">
							<view class="g_fs_16 g_c_3 g_ell_1">
								{{ jobDetail.storeAddr || "-" }}
							</view>
						</view>
						<view class="g_flex_none g_flex_column_center">
							<i class="iconfont icon-gengduo11 g_c_9 g_w_14 g_h_14"></i>
						</view>
					</view>
					<view v-else class="g_border_e_t g_mt_16"></view>
				</div>
				<view class="g_flex_row_center g_border_e_b" hover-class="none" hover-stop-propagation="false">
					<u-tabs 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="32" duration="0.05" height="76"></u-tabs>
				</view>
				<!-- <view class="m-address g_mt_16 g_mb_16 g_pt_10 g_pb_10 g_flex_row_start" v-else style="border-top: 1rpx solid #f5f5f5; border-bottom: 1rpx solid #f5f5f5" hover-class="thover">
          <view class="g_flex_none g_flex_column_center">
            <i class="iconfont icon-dizhi1 g_c_main g_mr_10 g_w_14 g_h_14"></i>
          </view>
          <view class="g_flex_1 g_ml_4 g_mr_4 g_flex_column_center">
            <view class="g_fs_16 g_c_3 g_ell_1">
              {{ "登录后查看" }}
            </view>
          </view>
          <view class="g_flex_none g_flex_column_center">
            <i class="iconfont icon-gengduo11 g_c_9 g_w_14 g_h_14"></i>
          </view>
			  </view> -->
				<!-- 轮播banner -->
				<view class="m-banner g_pb_16 g_border_f5_b" v-if="swiperArray.length > 0">
					<swiper class="swiper" :circular="false" :autoplay="false" :display-multiple-items="swiperArray.length < 5 ? swiperArray.length : 5" style="height: 58px">
						<swiper-item v-for="(item, index) in swiperArray" style="max-width: 58px; padding-right: 12px" :key="index" :class="index == 0 ? 'g_ml_0 g_mr_0' : ''">
							<u-image :radius="4" v-if="item.type == 'image'" :showLoading="true" :src="item.image" width="58px" height="58px" style="border-radius: 4px" @click="handleViewBig(item, index)"></u-image>
							<view class="g_w_58 g_h_58 g_radius_4 videoContainer" style="overflow: hidden" @click="showVideo(item)" v-else>
								<video class="theVideo" :show-fullscreen-btn="false" :show-play-btn="false" :show-center-play-btn="true" :enable-play-gesture="true" :id="item.id" :src="item.image" @fullscreenchange="fullScreen" :muted="muted" :show-mute-btn="true">
									<view class="shareVideo">
										<icon @click="shareVideo(item)" class="iconfont" :class="wxPlat == 'wxwork' ? 'icon-huidaodingbu' : 'icon-zhuanfa1'" hover-class="none" hover-stop-propagation="false"></icon>
									</view>
								</video>
							</view>
						</swiper-item>
					</swiper>
				</view>
				<view class="content_card" hover-class="none" hover-stop-propagation="false">
					<view v-if="tabInfo.active == 0" style="line-height: 24px" class="" hover-class="none" hover-stop-propagation="false">
						<view v-if="jobDetail.notes">
							<view class="detailH3">注意事项</view>
							<view class="pri g_c_f40" style="line-height: 24px; padding: 3px 8px; border-radius: 4px; text-align: justify">{{ jobDetail.notes }}</view>
						</view>
						<view class="detailH3">一、薪资待遇</view>
						<view class="g_radius_4">
							<view class="g_flex_row_between">
								<view class="rb1">1. 薪资明细：</view>
								<view class="textb1">{{ jobDetail.salaryDetail }}</view>
							</view>
						</view>
						<view class="detailH3">二、职位要求</view>
						<view class="g_radius_4">
							<view class="g_flex_row_between">
								<view class="rb1">1. 性别年龄：</view>
								<view class="textb1">{{ jobDetail.genderRestrict + " " + jobDetail.age }}</view>
							</view>
						</view>
						<view class="detailH3">三、岗位说明</view>
						<view class="g_radius_4">
							<view class="g_flex_row_between">
								<view class="rb1">1. 班次工时：</view>
								<view class="textb1">{{ jobDetail.workClasses }}</view>
							</view>
							<view class="g_flex_row_between">
								<view class="rb1">2. 其他说明：</view>
								<view class="textb1">{{ jobDetail.otherDesp }}</view>
							</view>
						</view>
						<view class="detailH3">四、面试对接</view>
						<view class="g_radius_4">
							<view class="g_flex_row_between">
								<view class="rb1">1. 面试地点：</view>
								<view class="textb1 g_flex_row_between g_flex_1">
									<view class>{{ jobDetail.interviewAddr || "-" }}</view>
									<i v-if="jobDetail.interviewLat" class="iconfont icon-dizhi11 f16 mr4 biggerSize" style="color: #027aff" data-type="interview"></i>
								</view>
							</view>
						</view>
						<view v-if="jobDetail.OtherInfo">
							<view class="detailH3">其它信息</view>
							<view class="pri" style="line-height: 24px; padding: 3px 8px; border-radius: 4px; color: #333">{{ jobDetail.OtherInfo }}</view>
						</view>
					</view>
					<!-- 职位描述富文本 -->
					<view class="g_flex_column_center" v-if="tabInfo.active == 1">
						<view class="g_fs_16 g_pb_32">
							<view class="g_c_3 g_pt_16 pri">
								<view @click="setCopy('new')" v-if="jobDetail.jobInfoWithoutReturnFee || jobDetail.jobInfo"> <span class="desp-copy g_c_main g_border_main">复制</span> </view>{{ jobDetail.jobInfoWithoutReturnFee || jobDetail.jobInfo || "-" }}</view
							>
							<view class="" v-if="isLogin" hover-class="none" hover-stop-propagation="false">
								<view class="contactInfo" style="white-space: pre-line" hover-class="none" hover-stop-propagation="false">{{ userInfo.noticeEndStr ? userInfo.noticeEndStr : "详情咨询：" + userInfo.tel }}</view>
								<view class="g_fs_14 g_text_c g_mt_16" v-if="userInfo.agencyStatus == 1">
									以上联系人，可以
									<span class="g_fw_600" @click="changeContact" style="color: #576b95; text-decoration: underline">改成我的</span>
								</view>
							</view>
						</view>
					</view>
					<view class="" v-if="tabInfo.active == 2" hover-class="none" hover-stop-propagation="false">
						<view class="g_pt_16 g_fs_16 pri" style="">
							<view @click.stop="setCopy('old')">
								<span class="desp-copy g_c_main g_border_main">复制</span>
							</view>
							<rich-text class style="text-align: justify" :nodes="jobDetail.lastNotice"></rich-text>
						</view>
					</view>
				</view>
			</view>

			<!-- 底部固定操作栏 -->
			<view class="g_h_104"></view>
			<g-panel-fixed>
				<slot>
					<view class="g_pl_20 g_pr_20 g_flex_row_center flex_center flex_nw" style="width: 100%">
						<!-- #ifdef MP-WEIXIN -->
						<!-- #endif -->
						<view class="g_flex_none g_flex_column_center" v-if="attention && from != 'bill'">
							<g-button btnText="客服" icon="icon-qiwei g_mr_4" class="g_fw_600 g_mr_12 g_w_100" size="small_auto" @clickBtn="kefu"> </g-button>
							<!-- <button class="g_pl_0 g_pr_0 g_bg_f g_mr_12 g_w_36 g_border_main" hover-class="thover" style="line-height: 1; border-radius: 0" @click="handleCollection">
								<icon v-if="isSc" class="iconfont icon-yishoucang g_fsi_16" style="color: #ff4400; line-height: 1; margin-top: -5px"></icon>
								<icon v-else class="iconfont icon-shoucang g_fsi_16" style="color: #787878; line-height: 1; margin-top: -5px"> </icon>
								<view class="g_fs_12 g_c_6" style="margin-top: 8px">{{ isSc ? "已收藏" : "收藏" }}</view>
							</button> -->
						</view>
						<view class="g_flex_1 g_flex_column_center">
							<view v-if="!isLogin" class="" hover-class="none" hover-stop-propagation="false">
								<quickLogin @successLogin="successLogin">
									<g-button btnText="立即报名" class="g_flex_1 g_fw_600" size="small_auto" type="primary"></g-button>
								</quickLogin>
							</view>
							<view v-else class="" hover-class="none" hover-stop-propagation="false">
								<g-button btnText="立即报名" class="g_flex_1 g_fw_600" size="small_auto" :type="jobDetail.recruitment == 2 || !attention ? 'infro' : 'primary'" @clickBtn="handleOpenApplyPopup"></g-button>
							</view>
						</view>
					</view>
				</slot>
			</g-panel-fixed>
		</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" hover-class="none" hover-stop-propagation="false">
				<!-- #ifdef MP-WEIXIN -->
				<image :src="canvasInfo.posterImg" class="g_row_center 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_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_row_center g_p_10" style="width: 90%; height: 118px; border-radius: 4px" hover-class="none" hover-stop-propagation="false">
							<view class="g_fs_16 g_fw_600 g_mb_8" hover-class="none" hover-stop-propagation="false">
								{{ jobDetail.jobName }}
							</view>
							<view class="g_flex_row_start" hover-class="none" hover-stop-propagation="false">
								<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" hover-class="none" hover-stop-propagation="false">
									<view class="g_c_f40 g_fs_16 g_mb_4" hover-class="none" hover-stop-propagation="false">
										<span class="g_fw_600 g_mr_4" hover-class="none" hover-stop-propagation="false" v-html="jobDetail.priceStr"> </span>
										<span class="g_fs_14" hover-class="none" hover-stop-propagation="false">
											{{ jobDetail.monthPay }}
										</span>
									</view>
									<view class="g_fs_12 g_c_6" hover-class="none" hover-stop-propagation="false">
										{{ jobDetail.shortDistrict }}
										<span class="g_fs_12" hover-class="none" hover-stop-propagation="false">
											{{ jobDetail.age }}
										</span>
									</view>
								</view>
							</view>
							<view class="g_flex_row_start g_fs_12 g_mt_8" hover-class="none" hover-stop-propagation="false">
								<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" hover-class="none" hover-stop-propagation="false">
							<view class="g_fs_12 g_c_f" hover-class="none" hover-stop-propagation="false"> 长按查看职位详情 </view>
							<view class="m-logo g_flex_c">
								<image
									:src="canvasInfo.wxCode"
									class="g_row_center"
									:style="{
										width: 141 + 'px',
										height: 141 + 'px',
										top: '302px',
									}"
								></image>
							</view>
							<view class="g_fs_14 g_c_f" hover-class="none" hover-stop-propagation="false"> 好工作 放心干 </view>
						</view>
					</view>
				</view>

				<!-- #endif -->
				<g-button btnText="保存到相册" type="primary" @clickBtn="saveToalbum"></g-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" @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="g_w_184 g_h_184" :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>

		<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 quickLogin from "../../components/quickLogin.vue";
export default {
	onReady() {
		this.G.setNavStyle();
	},
	onShareAppMessage() {
		let that = this;
		// this.attention = false;
		let path;
		if (this.isMember) {
			path = `/root/detail/work?id=${that.jobDetail.id}&from=home&userId=${that.userInfo.user.id}`;
		} else {
			path = `/root/detail/work?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: "你想找的厂都有，立即查看👇",
						title: " ",
						imageUrl: res.tempFilePath,
						// path: "/root/detail/work?id=" + that.jobDetail.id + "&from=home",
						path,
						// path: '/pages/shareList/index'
					});

					// return
				});
			}),
		};
		// return this.G.shareFun("/root/detail/work?id=" + this.jobDetail.id + '&from="home"');
	},
	mounted() {
		var obj = dateTimePicker.dateTimePicker(this.startYear, this.endYear, this.currentTime);
		this.currentTime = dateUtil.formatDateYMD(new Date().toLocaleDateString()) + " 06:00";
		this.dateTimeArray = obj.dateTimeArray;
		this.dateTime = obj.dateTime;
	},
	components: {
		applyPanel,
		quickLogin,
	},
	data() {
		return {
			globalData: getApp().globalData,
			isUseNewJob: getApp().globalData.isUseNewJob,
			appid: getApp().globalData.appId,
			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: "", // 来源页面
			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: {},
			isServicePriceShow: false, // 服务费显示隐藏
			tabInfo: {
				list: [
					{
						name: "职位详情",
						key: "0",
					},
					{
						name: "通告分享",
						key: "1",
					},
					{
						name: "原始通告",
						key: "2",
					},
				],
				active: 0,
			},
		};
	},
	onLoad(options) {
		console.log("详情", options);
		console.log("this.G.store().cdnBaseImg", this.G.store().cdnBaseImg);
		if (options.id) {
			this.uid = options.id;
		}
		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: "/pages/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);
		}
		this.getDetail().then((res) => {
			console.log("res", res);
			// this.toKnowInfo(res.agencyId);
		});
		this.loginInfo = uni.getStorageSync("apply-userinfo");

		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;
		uni.getSystemInfo({
			success: function (res) {
				console.log(res);
				that.wxPlat = res.hostName;
			},
		});
	},

	methods: {
		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;
		// 	});
		// },
		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.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);

					that.G.disposeJobListData(res);

					// res.ageStr = setData.age;
					// res.priceStr = that.G.getSalaryClassifyValue(res.salaryClassify, res.salaryClassifyValue);
					res.priceStr = that.G.getSalaryClassifyValueHtml(res.salaryClassify, res.salaryClassifyValue);
					res.fuWuFei = that.G.setReturnFee(res.returnFee, res.returnFeeType);
					res.monthPay = res.minMonthlyPay / 100 + "-" + res.maxMonthlyPay / 100;
					res.updateTime = that.G.setDeadLine(res.updateTime, "jiaofu");
					res.genderRestrict = that.G.getGenderByMinAge(res);
					// 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.jobSpecialLabelNames = that.jobDetail.jobSpecialLabelNames.split(",");
					console.log("that.jobDetail", that.jobDetail);
					// that.jobDetail.jobName = '三顿饭卡加斯冯老师独立开发技术的返利看打两发慷慨激昂收代理费'
					that.jobDetail.logo = that.jobDetail.logo.indexOf("http:") > -1 ? that.jobDetail.logo.replace("http:", "https:") : that.jobDetail.logo;
					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 = 56; // 标题字体大小
			line1 = 68; // 第一行距顶部距离
			line2 = 90;
			line3 = 200;
			line4 = 280;
			line5 = 350;
			line6 = 380;
			line7 = 460;

			// 绘制基础白色背景
			console.log("that.jobDetail", that.jobDetail);
			that.G.roundRect1(ctx, 0, 0, 750, 600, 0, "#fff");
			return new Promise(function (imgres) {
				// that.G.fillTextLineBreak(ctx, that.userInfo.agencyName, baseLeft + 48 + 10, line1 + 35, 400, 48, "#999", mainFontSize - 6, "600"); // 代理名称

				that.G.fillTextLineBreak(ctx, that.jobDetail.jobName, baseLeft, line2, 800, 20, "#000", titleFontSize, "500", "left"); // 岗位标题
				console.log("isLogin", that.isLogin);
				// if (that.isLogin) {
				console.log("innerLogin", that.isLogin);
				that.G.fillTextLineBreak(ctx, that.jobDetail.monthPay, 750 - ctx.measureText(that.jobDetail.monthPay).width, line3, 400, 20, "#ff4400", titleFontSize, "400"); // 月工资
				// that.G.fillTextLineBreak(ctx, "工价", baseLeft + logoSize + 10, line2 + 50, 100, 30, "#ff4400", titleFontSize - 8, "500", "left"); // 工价
				that.G.fillTextLineBreak(ctx, that.G.getSalaryClassifyValue(that.jobDetail.salaryClassify, that.jobDetail.salaryClassifyValue), baseLeft + 10, line3, 400, 40, "#ff4400", titleFontSize + 6, "600", "left"); // 时薪
				// } else {
				// 	console.log("notLogin", that.isLogin);
				// 	that.G.fillTextLineBreak(ctx, "工价登录后查看", baseLeft + logoSize + 10, line3 - 40, 400, 20, "#ff4400", titleFontSize - 6, "400"); // 时薪
				// }
				if (that.jobDetail.jobRequestLabelNames.length > 0) {
					that.jobDetail.jobRequestLabelNames.forEach((item1, index) => {
						if (index <= 3) {
							that.G.fillTextLineBreak(ctx, item1, baseLeft + labelLeft + 12, line4 + 4, 400, 40, "#666", mainFontSize); // 标签字符
							that.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) {
							that.G.roundRect1(ctx, baseLeft + labelLeft, line5 - 38, ctx.measureText(item1).width + 24, 56, 8, "#00000012");
							that.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) {
							that.G.fillTextLineBreak(ctx, item1, baseLeft + labelLeft + 12, line4 + 4, 400, 40, "#666", mainFontSize); // 标签字符
							that.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) {
							that.G.roundRect1(ctx, baseLeft + labelLeft, line5 - 38, ctx.measureText(item1).width + 24, 56, 8, "#00000012");
							that.G.fillTextLineBreak(ctx, item1, baseLeft + labelLeft + 12, line5 + 4, 400, 40, "#666", mainFontSize); // 标签字符
							labelLeft += ctx.measureText(item1).width + 32;
						}
					});
				}

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

				// 绘制立即咨询
				// 根据标签数量调整立即咨询背景位置
				// that.G.roundRect1(ctx, mycenter - 712 / 2, line7 + (that.jobDetail.jobSpecialLabelNames.length > 3 ? 0 : -70), 712, 100, 4, "#3b80fa"); // 立即咨询背景
				that.G.roundRect1(ctx, mycenter - 712 / 2, line7, 712, 100, 4, "#3b80fa"); // 立即咨询背景
				// 根据标签数量调整立即咨询位置
				// that.G.fillTextLineBreak(ctx, "立即咨询", mycenter - 24 - ctx.measureText("立即咨询").width / 2, line7 + (that.jobDetail.jobSpecialLabelNames.length > 3 ? 70 : 0), 300, 120, "#fff", titleFontSize, "500"); // 立即咨询
				that.G.fillTextLineBreak(ctx, "立即咨询", mycenter - 24 - ctx.measureText("立即咨询").width / 2, line7 + 65, 300, 120, "#fff", titleFontSize, "500"); // 立即咨询
				// 绘制职位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 = () => {
				// 			that.G.roundRect(ctx, img, baseLeft, line2, logoSize, logoSize, 8);

				// 		};
				// 	},
				// 	fail(err) {
				// 		console.log("logodownloadFile err", err);
				// 	},
				// });
				uni.downloadFile({
					url: "https://matripe-cms.oss-cn-beijing.aliyuncs.com/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) => {
								// 根据标签数量调整安全标识位置
								// that.G.fillTextLineBreak(ctx, item1, baseLeft + safeMarkPosition, line6 + (that.jobDetail.jobSpecialLabelNames.length > 3 ? 0 : -70) + 40, 100, 32, "#fca025");
								// that.G.roundRect(ctx, img, baseLeft + safeMarkPosition - 36, line6 + (that.jobDetail.jobSpecialLabelNames.length > 3 ? 0 : -70) + 12, 32, 32, 12);
								that.G.fillTextLineBreak(ctx, item1, baseLeft + safeMarkPosition, line6 + 40, 100, 32, "#fca025");
								that.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;
			// if (that.data.checkedList.length == 1) {
			baseTop = 2 * 370;
			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) => {
				that.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) {
						that.G.fillTextLineBreak(ctx, item1, 60 * 2 + labelLeft, baseTop + markTop + 30 * 2, 400 * 2, 20, "#333", monthlyPaySize); // 标签字符
						that.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;
					}
				});
				that.G.fillTextLineBreak(ctx, that.jobDetail.jobName, logoLeft, baseTop, 500 * 2, 20, "#333", titleSize, "600", "left"); // 岗位标题
				that.G.fillTextLineBreak(ctx, that.G.getSalaryClassifyValue(that.jobDetail.salaryClassify, that.jobDetail.salaryClassifyValue), salaryClassifyValueLeft, baseTop + salaryClassifyValueTop, 400 * 2, 20, "#ff4400", titleSize, "600"); // 时薪

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

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

				that.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
				that.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
				// that.G.fillTextLineBreak(ctx, "长按查看职位详情", mycenter - ctx.measureText("长按查看职位详情").width / 2, baseTop + bottomSloganTop - 30, 300 * 2, 20, "#fff", monthlyPaySize); // 底部slogan
				// - ctx.measureText("好工作  放心干").width / 3.2
				that.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);
							that.G.roundRect1(ctx, mycenter - 580 / 2, baseTop + 740, 580, 580, 0, "#fff");
							that.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 = () => {
							// 			that.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;
			uni.previewImage({
				urls: that.swiperArray.map((item) => {
					return item.image;
				}),
				current: $index,
			});
		},
		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://matripe-cms.oss-cn-beijing.aliyuncs.com/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: "/pages/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: "/pages/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/other/quickApplication?jobId=" + this.jobDetail.id + "&jobName=" + this.jobDetail.jobName + "&title=报名&type=" + that.jobDetail.jobType,
			});
			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;
			if (e == "new") {
				text = that.jobDetail.jobInfoWithoutReturnFee || that.jobDetail.jobInfo;
			} else if (e == "old") {
				text = that.jobDetail.lastNotice;
			} else if (e == "jobName") {
				text = that.jobDetail.jobName + "@" + that.jobDetail.supplier.supplierName;
			}
			uni.setClipboardData({
				data: text,
				success(res) {
					uni.getClipboardData({
						success(res) {
							console.log(res.data); // data
							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;
			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",
				// });

				uni.navigateTo({
					url: "/root/other/result",
					success: function (res) {
						callBack(true);
					},
				});
			});
		},
		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();
			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;
			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,
			});
		},
		successLogin(e) {
			console.log("e", e);
			this.isLogin = true;
			this.handleOpenApplyPopup();
		},
		tobeAgencyToast() {
			uni.showModal({
				title: "",
				content: "抱歉，您需先成为伯才代理以获得使用权限。",
				confirmColor: "#1890ff",
				confirmText: "成为代理",
				cancelText: "知道了",
				success(res) {
					if (res.confirm) {
						wx.navigateTo({
							url: "/pages/tobeAgency/index",
						});
					}
				},
			});
		},
		showFee() {
			let that = this;
			if (!that.userInfo.agencyStatus == 1) {
				this.tobeAgencyToast();
				return;
			}
			let content, title;
			if (that.jobDetail.returnFeeDesp) {
				title = that.userInfo.agencyStatus == 1 ? "佣金: " + that.jobDetail.fuWuFei : "";
				content = that.userInfo.agencyStatus == 1 ? that.jobDetail.returnFeeDesp : "抱歉，您需先成为伯才代理以获得使用权限。";
			} else {
				title = "详询客服";
				content = "因三方项目政策变动太快，详情请咨询客服。页面左下角点击“联系客服”直接联系我哟~";
			}
			uni.showModal({
				title,
				content,
				contentColor: "#ccc",
				confirmColor: "#1890ff",
				confirmText: "确定",
				showCancel: false,
				success(res) {},
			});
		},
		setType(e) {
			this.tabInfo.active = e;
		},
		toggleReturnFee() {
			this.isServicePriceShow = !this.isServicePriceShow;
		},
		changeContact() {
			wx.navigateTo({
				url: `/root/detail/configAnnunciate`,
			});
		},
	},
};
</script>

<style lang="scss">
page {
	padding-bottom: 120px;
	background-color: #f5f5f5;
}
.canvas-card {
	width: 75%;
	height: 85%;
	background-image: url("https://matripe-cms.oss-cn-beijing.aliyuncs.com/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 {
	.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;
		}
	}

	.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;
}
.detailH3 {
	font-size: 16px;
	font-weight: 400;
	color: #000;
	line-height: 22px;
	margin-top: 16px;
	margin-bottom: 8px;
}
.pri {
	white-space: pre-line;
}
.pri:empty:before,
.textb1:empty:before {
	content: "-" !important;
	color: #333;
}
.rb1 {
	font-size: 14px;
	color: #666;
	text-align: center;
	width: 95px;
}
.textb1 {
	white-space: pre-line;
	color: #333;
	flex: 1;
	line-height: 1.8;
}
</style>
