You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3231 lines
105 KiB
Vue

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<template>
<view class="p-root-home-jobForm g_kuaishou g_bg_page" v-if="showPage">
<!-- <view class="" @click="getNumberByRegular(aitext)" > 123123 </view> -->
<!-- <xe-event-source ref="EventSourceRef" :url="eventSourceUrl" :options="eventSourceOptions" @callback="handleCallback"></xe-event-source> -->
<gao-ChatSSEClient ref="sseTest" @onOpen="openCore" @onError="errorCore" @onMessage="messageCore" @onFinish="finishCore" />
<!-- #ifdef APP-PLUS -->
<!-- #endif -->
<!-- #ifdef MP-WEIXIN -->
<u-line-progress class="g_position_abso" v-if="ailoading" style="position: fixed; width: 100vw; top: -13px; left: 0px; z-index: 99999" active-color="#3578f6" :percent="defaultPercent" :round="false" height="8" :show-percent="false" inactiveColor="#f5f5f5"> </u-line-progress>
<!-- #endif -->
<!-- #ifdef APP-PLUS -->
<u-line-progress class="g_position_abso" v-if="ailoading" style="position: fixed; width: 100vw; top: 0px; left: 0px; z-index: 99999" active-color="#3578f6" :percent="defaultPercent" :round="false" height="8" :show-percent="false" inactiveColor="#f5f5f5"> </u-line-progress>
<!-- #endif -->
<!-- v-if="ailoading" -->
<!-- ref="formInfo" -->
<form class="g_fs_16">
<!-- :scroll-into-view="scrollTo" -->
<scroll-view ref="scrollViewRef" id="scrollView" class="" :scroll-top="scrollTop" :show-scrollbar="false" :scroll-y="true" :scroll-with-animation="true" style="height: calc(100vh - 78px); padding: 0 0; box-sizing: border-box; position: relative" :style="{ bottom: isIosWxapp ? pbc : '0' }" :scroll-into-view-offset="-200">
<view class="g_ml_10 g_mr_10 g_mt_10">
<!-- <view> -->
<!-- <view class="g_flex_row_start g_mb_8 g_pl_10"> 通告内容 </view> -->
<view class="g_bg_f g_pl_12 g_pt_4 g_pb_12 g_pr_12" :class="AIUnfold ? 'AISticky' : ' g_radius_8'">
<view class="g_flex_row_between">
<view class="g_flex_1">
<textarea class=" " data-type="desp" v-model="aitext" placeholder="粘贴现有通告 或输入文本AI智能填表" placeholder-style="color:#999" :maxlength="-1" :style="{ width: '100%', height: AIUnfold ? '262px' : '104px' }"></textarea>
</view>
</view>
<div class="g_flex_row_between g_pt_4">
<view class="g_flex_row_start">
<!-- <view class="g_w_24 g_h_24 g_radius_50 g_bg_f5 g_flex_row_center flex_center" @click="AIUnfold = !AIUnfold">
<i class="iconfont" :class="AIUnfold ? 'g_fs_10 icon-a-quanpingzhankai1x1' : 'g_fs_12 icon-a-quanpingshouqi1x1'"></i>
</view> -->
<!-- <view class="g_w_24 g_h_24 g_radius_50 g_bg_f5 g_flex_row_center flex_center" :class="AISticky ? 'g_c_f g_bg_main' : 'g_c_0 g_bg_f5'" @click="AISticky = !AISticky">
<i class="iconfont icon-pushpin g_fs_12"></i>
</view> -->
</view>
<view class="g_flex_row_end">
<view class="g_mr_8 g_w_72 g_fw_600" @click.stop="getClipboard">
<rh-button size="small_auto" type="default" height="24" :fontSize="12" :btnText="(aitext ? '清空' : '粘贴') + '内容'"></rh-button>
</view>
<view @click.stop="getCoze" class="g_w_72 g_fw_600">
<rh-button size="small_auto" gradual="linear-gradient(-130deg, #5c6cf7, #9963f9)" icon="icon-aitubiao" type="gradual" height="24" :fontSize="12" btnText="AI填表"></rh-button>
</view>
</view>
</div>
</view>
<!-- </view> -->
<view class="g_bg_f g_mt_10 g_radius_8 g_pl_16 g_pr_16">
<view class="g_flex_row_between heightSet flex_center">
<view class="g_fw_600 g_fs_16">基本信息</view>
</view>
<view class="g_flex_row_start flex_center heightSet g_border_e_t g_position_rela" id="jobName">
<view class="loadBox">
<gfot text="empty" size="22" minHeight="0" v-if="loadingControl.jobName"></gfot>
</view>
<u-input v-model="formInfo.jobName" :customStyle="{}" class=" " style="width: 97%" :placeholder="loadingControl.jobName ? '' : '职位名称'" placeholder-style="color:#999;" />
</view>
<view class="showdoc g_border_e_t heightSet g_position_rela" id="jobMark">
<view class="loadBox">
<gfot text="empty" size="22" minHeight="0" v-if="loadingControl.jobMark"></gfot>
</view>
<view class="menu-obj" @click="showMarkCheck">
<view class="g_flex_row_between flex_center">
<view :scroll-x="true" enable-flex style="max-width: calc(100% - 40px); overflow-x: auto" v-if="jobMark.length > 0" class="g_flex_row_start flex_center flex_nw g_flex_1 g_clear_scroll g_h_26">
<view class="menu-btn menu-active" v-for="item in jobMark">
<view class="btn g_radius_4 g_pl_8 g_pr_8 g_fs_12">{{ item.name }}</view>
</view>
</view>
<view class="menu-btn g_text_s">
<view class="g_c_9" v-if="jobMark.length == 0 && !loadingControl.jobMark">职位标签</view>
</view>
<view class="iconfont icon-gengduo11 g_c_9 g_fs_12"> </view>
</view>
</view>
</view>
<view class="g_flex_row_between flex_center g_border_e_t heightSet g_position_rela" id="ageSex">
<view class="loadBox" style="right: 20px">
<gfot text="empty" size="22" minHeight="0" v-if="loadingControl.ageSex"></gfot>
</view>
<view class="showdoc g_flex_row_between flex_center vertical_line_after" style="min-width: 80px" @click="showPop('age')">
<view class="g_c_3">
<template v-for="(item, index) in ageSex.list" :key="index">
<view v-if="ageSex.ageSexActive == item.id">
<view class="">{{ item.text }}</view>
</view>
</template>
</view>
<view class="iconfont icon-gengduo11 g_c_9 g_fs_12"> </view>
</view>
<!-- v-if='ageSex.ageSexActive != 1' -->
<view class="g_flex_row_between flex_center g_pl_10 g_radius_8 g_flex_1" v-if="ageSex.ageSexActive != 1" @click="ageShow = true">
<!-- <view class="g_mr_16">
{{ageSex.list[ageSex.ageSexActive].text}}
</view> -->
<!-- <u-input v-model="ageHandler" class=" g_flex_1" placeholder="如20-30" placeholder-style="color:#999" /> -->
<!-- <view :class="">选择年龄</view> -->
<picker mode="multiSelector" class="g_flex_1" @columnchange="handlerAge($event, 'man')" @cancel="cancelAge" @change="getAgeValue($event, 'all')" :value="ageValue" :range="ageList">
<view class="g_flex_row_between">
<view class="g_flex_1 g_text_r" :class="ageHandler ? 'g_c_3' : 'g_c_9'">{{ ageHandler || (loadingControl.ageSex ? "" : "请选择") }}</view>
<view class="g_flex_none g_ml_4">岁</view>
</view>
</picker>
<!-- <view class=""> 岁 </view> -->
</view>
<view class="g_flex_row_around flex_center g_flex_1" v-else>
<view class="g_flex_row_around flex_center g_pl_10 g_flex_1 g_radius_8">
<view class=""> 男 </view>
<!-- <u-input v-model="manAgeHandler" class=" g_pl_16 g_flex_1" placeholder="如20-30" placeholder-style="color:#999" /> -->
<picker mode="multiSelector" class="g_flex_1" @columnchange="handlerAge($event, 'man')" @cancel="cancelAge" @change="getAgeValue($event, 'man')" :value="ageValue" :range="ageList">
<view class="g_ml_6 g_text_r" :class="manAgeHandler ? 'g_c_3' : 'g_c_9'">{{ manAgeHandler || "请选择" }}</view>
</picker>
<view class="g_ml_4"> 岁 </view>
</view>
<view class=""> </view>
<view class="g_flex_row_around flex_center g_flex_1 g_radius_8">
<view class=""> 女 </view>
<!-- <u-input v-model="womanAgeHandler" class=" g_pl_16 g_flex_1" placeholder="如20-30" placeholder-style="color:#999" /> -->
<picker mode="multiSelector" class="g_flex_1" @columnchange="handlerAge($event, 'woman')" @cancel="cancelAge" @change="getAgeValue($event, 'woman')" :value="ageWomanValue" :range="ageList">
<view class="g_ml_6 g_text_r" :class="womanAgeHandler ? 'g_c_3' : 'g_c_9'">{{ womanAgeHandler || "请选择" }}</view>
</picker>
<view class="g_ml_4"> 岁 </view>
</view>
</view>
</view>
<view class="g_flex_row_between flex_center g_border_e_t heightSet g_position_rela" id="salary">
<view class="loadBox" style="right: 56px">
<gfot text="empty" size="22" minHeight="0" v-if="loadingControl.salary"></gfot>
</view>
<view class="showdoc g_flex_row_between flex_center vertical_line_after" style="min-width: 80px" @click="showPop('salary')">
<view class="g_c_3" style="line-height: 1">
<template v-for="(item, index) in staffPrice.list" :key="item.id">
<view v-if="formInfo.salaryClassify == item.id" class="">
<view class="">{{ item.text }}</view>
</view>
</template>
</view>
<view class="iconfont icon-gengduo11 g_c_9 g_fs_12"> </view>
</view>
<view class="g_flex_row_around flex_center g_pl_10 g_radius_8 g_flex_1" v-if="formInfo.salaryClassify != 4 && formInfo.salaryClassify != 6 && formInfo.salaryClassify != 7">
<u-input v-model="formInfo.salaryClassifyValue" type="digit" class="g_flex_1" :customStyle="{ textAlign: 'right' }" :placeholder="loadingControl.salary ? '' : currentPrice.placeholder" placeholder-style="color:#999" />
<view class="g_ml_4">
{{ currentPrice.suffix || "" }}
</view>
</view>
<view class="g_flex_row_end flex_center g_pl_10 g_radius_8 g_flex_1" v-else>
<view class="g_mr_16" v-if="formInfo.salaryClassify == 4 || formInfo.salaryClassify == 6">
{{ currentPrice.pre }}
</view>
<u-input v-model="monthValue" v-if="formInfo.salaryClassify == 7" class="g_flex_1" :customStyle="{ textAlign: 'right' }" :placeholder="loadingControl.salary ? '' : currentPrice.placeholder" placeholder-style="color:#999" />
<view class="g_ml_4">
{{ currentPrice.suffix || "" }}
</view>
</view>
</view>
<view class="g_flex_row_start flex_center g_border_e_t g_position_rela" id="salaryDetail" style="min-height: 48px">
<view class="loadBox">
<gfot text="empty" size="22" minHeight="0" v-if="loadingControl.salaryDetail"></gfot>
</view>
<!-- {{isIosWxapp}} -->
<!-- :adjust-position="isIosWxapp ? false : true" -->
<u-input v-model="formInfo.salaryDetail" maxlength="1000" type="textarea" height="44" class="g_flex_1" :placeholder="loadingControl.salaryDetail ? '' : '请填写薪资说明'" placeholder-style="color:#999" :clearable="false" @focus="onInputFocus" :customStyle="{ marginLeft: isios ? '-5px' : 0 }" id="input1" />
</view>
<view class="" v-if="false && formInfo.salaryClassify != 7">
<view class="g_flex_row_start g_mb_8 g_pl_10">
综合月薪
<!-- <view class="xing g_c_fa2b"> * </view> -->
</view>
<view class="g_flex_row_around flex_center heightSet g_pl_10 g_pr_10 g_radius_8">
<u-input v-model="monthValue" class="g_flex_1" placeholder="如5000-7000" placeholder-style="color:#999" />
<view class=""> 元/月 </view>
</view>
</view>
<!-- <view class="" v-if="false">
<view class="g_flex_row_start g_mb_8 g_pl_10"> 驻场信息 </view>
<view class="g_flex_row_start flex_center heightSet g_pl_10 g_pr_10 g_flex_1 g_radius_8" @click="handleOpenModal">
<view class="g_flex_row_start" v-if="selectedOnsite.length > 0">
<view class="onsiteSub" v-for="(item, index) in selectedOnsite" @click.stop="delSelectedOnsite(index, item)" :key="item.id">
<view class="g_flex_row_start flex_center">
{{ item.userName }}
<i class="iconfont icon-guanbi g_fsi_6 g_ml_10"></i>
</view>
</view>
</view>
<view class="g_c_9 g_fs_15" v-else> 请选择驻场信息 </view>
</view>
</view> -->
</view>
<view class="g_bg_f g_mt_10 g_radius_8 g_pl_16 g_pr_16">
<view class="">
<view class="g_flex_row_start flex_center heightSet">
<u-input v-model="formInfo.storeName" class=" " style="width: 97%" placeholder="请填写招聘企业" placeholder-style="color:#999" />
</view>
</view>
<view class="g_border_e_t" id="storeAddr">
<view class="g_flex_row_around flex_center heightSet g_position_rela">
<view class="loadBox" style="left: 0px">
<gfot text="empty" size="22" minHeight="0" v-if="loadingControl.storeAddr"></gfot>
</view>
<u-input v-model="formInfo.storeAddr" :clearable="false" class="g_flex_1" :placeholder="loadingControl.storeAddr ? '' : '企业地址'" placeholder-style="color:#999" />
<view class="g_text_c g_c_main" @click="chooseAddress">
<view class="iconfont icon-dizhi1 g_fs_16 g_mb_2" style="line-height: 1"></view>
<view class="g_fs_10" style="line-height: 1"> 位置 </view>
</view>
</view>
</view>
</view>
<view class="g_mt_10">
<view class="g_bg_f g_pl_16 g_pr_16 g_pb_12 g_radius_8" id="jobDesp" style="min-height: 240px">
<view class="g_flex_row_between heightSet flex_center">
<view class="g_fw_600 g_fs_16">职位描述</view>
<view class="g_c_sub g_fs_14" @click="showEmpty = !showEmpty">{{ showEmpty ? "隐藏空字段" : "显示空字段" }}</view>
</view>
<!-- <textarea class=" " bindinput="bothwayBind" data-type="desp" v-model="formInfo.jobInfo" placeholder="请描述薪资、岗位、吃住等" placeholder-style="color:#999" :maxlength="-1" auto-height style="min-height: 137px; width: 100%"></textarea> -->
<view class="g_border_e_t g_pt_12 g_fs_16" style="min-height: 120px">
<!-- <textarea class="g_flex_1" :value="formInfo.jobDesp" height="44" placeholder="职位的详细描述" placeholder-style="color:#999" :auto-height="true" :style="{ marginLeft: isios ? '-5px' : 0 }"> </textarea> -->
<template v-for="(item, index) in templateArr" :key="index">
<view class="" v-if="item.type != 'unset' && item.show">
<view class="g_flex_row_start flex_center g_fw_600 g_fs_16 g_mt_12 g_mb_8">
<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" style="line-height: 32px; padding-left: 15px" v-if="inner.show">
<view class="g_flex_row_start flex_start g_w_all">
<!-- <view class="g_mr_4"> </view> -->
<view class="g_flex_row_start g_fw_600">
{{ `${inner.num}. ${inner.key}:&nbsp` }}
</view>
<view
class="g_fw_400 g_flex_1"
style=""
:style="{ color: inner.value ? '#333' : 'transparent' }"
@click="
() => {
inner.edit = true;
}
"
v-if="!inner.edit"
>
{{ inner.value || " 123" }}
</view>
<u-input v-model="inner.value" v-if="inner.edit" class="g_flex_1 g_ml_8" @blur="inner.edit = false" maxlength="1000" :focus="true" type="textarea" :placeholder="inner.key" placeholder-style="color:#999;line-height: 32px" :clearable="false" :customStyle="{ marginLeft: isios ? '-5px' : 0, lineHeight: '32px', paddingTop: 0 }" />
</view>
<!-- @blur="inner.edit = false" -->
</view>
</template>
</view>
</template>
<view class="g_position_rela">
<view class="loadBox">
<gfot text="empty" size="22" minHeight="0" v-if="loadingControl.jobDesp"></gfot>
</view>
<u-input v-model="formInfo.jobDesp" maxlength="1000" type="textarea" height="44" class="g_flex_1" :placeholder="loadingControl.jobDesp ? '' : '职位的详细描述'" placeholder-style="color:#999" :clearable="false" :customStyle="{ marginLeft: isios ? '-5px' : 0 }" />
</view>
</view>
<view class="g_flex_row_start g_mt_12">
<view class="g_mr_12 g_mb_12" v-for="(item, index) in imgList" :key="index" style="position: relative">
<i class="iconfont icon-guanbi img-close" @click="delImg(item.url)"></i>
<image :src="item.url" mode="" class="g_w_56 g_h_56 g_radius_6" @click="showImgs(item.url)" v-if="item.type == 'image'"></image>
<view class="g_w_56 g_h_56 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="false" :enable-play-gesture="true" :id="item.id" :src="item.url" @fullscreenchange="fullScreen"></video>
</view>
</view>
<!-- <view class="g_w_56 g_h_56 g_bg_f5 g_text_c g_flex_column_center g_radius_6" @click="chooseMedia">
<i class="iconfont icon-tianjia g_mb_8 g_c_6"></i>
<view class="g_fs_10 g_c_6"> 添加图片 </view>
</view> -->
</view>
</view>
</view>
<view class="g_bg_f g_pl_16 g_pr_16 g_radius_8 g_mt_10">
<view class="g_flex_row_start flex_center g_fw_600 g_fs_16 heightSet">佣金</view>
<view class="g_flex_row_between flex_center g_border_e_t g_position_rela" id="returnFee">
<view class="loadBox" style="right: 56px">
<gfot text="empty" size="22" minHeight="0" v-if="loadingControl.returnFee"></gfot>
</view>
<view class="showdoc g_flex_row_between flex_center vertical_line_after heightSet" style="min-width: 80px" @click="showPop('serviceFee')">
<view class="g_c_3" style="line-height: 1">
<template v-for="(item, index) in serviceFee.list" :key="item.id">
<view v-if="formInfo.returnFeeType == item.id" class="">
<view class="">{{ item.text }}</view>
</view>
</template>
</view>
<view class="iconfont icon-gengduo11 g_c_9 g_fs_12"> </view>
</view>
<view class="g_flex_row_around flex_center g_bg_f heightSet g_pl_10 g_radius_8 g_flex_1" v-if="formInfo.returnFeeType != 7">
<!-- <view class="g_mr_16">
{{serviceFee.list[formInfo.returnFeeType].pre}}
</view> -->
<u-input v-model="formInfo.returnFee" type="digit" class="g_flex_1" :customStyle="{ textAlign: 'right' }" :placeholder="loadingControl.returnFee ? '' : '仅数字'" placeholder-style="color:#999" />
<view class="g_ml_4">
{{ serviceFee.list[formInfo.returnFeeType] && serviceFee.list[formInfo.returnFeeType]["suffix"] }}
</view>
</view>
<view class="g_flex_row_end flex_center g_bg_f heightSet g_pl_10 g_radius_8 g_flex_1" v-else>
<view class="g_mr_16">
{{ serviceFee.list[formInfo.returnFeeType].pre }}
</view>
</view>
</view>
<view class="g_border_e_t">
<view class="g_flex_row_around flex_center g_position_rela" style="min-height: 48px">
<view class="loadBox" style="left: 0">
<gfot text="empty" size="22" minHeight="0" v-if="loadingControl.returnFeeDesp"></gfot>
</view>
<u-input v-model="formInfo.returnFeeDesp" maxlength="1000" type="textarea" height="44" class="g_flex_1" :placeholder="loadingControl.returnFeeDesp ? '' : '请填写佣金说明'" placeholder-style="color:#999" @keyboardheightchange="bindkeyboardheightchange" :adjustPosition="!isios" :clearable="false" :customStyle="{ marginLeft: isios ? '-5px' : 0 }" />
</view>
</view>
</view>
<view class="g_h_10"></view>
<!-- <view :style="{'height':bottomHeight}"></view> -->
</view>
<!-- <g-panel-fixed>
<slot> -->
<!-- </slot>
</g-panel-fixed> -->
</scroll-view>
</form>
<view class="g_bg_f g_pt_12 g_pl_10 g_pr_10 g_border_e_t g_pb_24 g_flex_row_center flex_center" style="position: fixed; bottom: 0px; left: 0; z-index: 100; width: 100vw">
<!-- <view class="" @click="isOnsiteShow = true">123</view> -->
<view class="g_mr_12 g_flex_column_center flex_center" hover-class="none" hover-stop-propagation="false" @click="resetInfo('reset')">
<view class="iconfont icon-clear g_fs_16 g_mb_4" hover-class="none" hover-stop-propagation="false"> </view>
<view class="g_c_6 g_fs_12">清空内容</view>
</view>
<view class="g_mr_12 g_flex_column_center flex_center" hover-class="none" hover-stop-propagation="false" @click="jobConfigShow = true">
<view class="iconfont icon-shezhi g_fs_16 g_mb_4" hover-class="none" hover-stop-propagation="false"> </view>
<view class="g_c_6 g_fs_12">职位配置</view>
</view>
<view class="g_mr_12 g_w_100">
<rh-button :type="formInfo.jobName ? 'default' : 'infro'" size="default_auto" btnText="预览" @clickBtn="showPreview"></rh-button>
</view>
<view class="g_flex_1" hover-class="none" hover-stop-propagation="false">
<rh-button type="primary" size="default_auto" :btnText="jobId ? '确定' : '发布职位'" @clickBtn="onSubmit"></rh-button>
</view>
</view>
<u-popup v-model="isOnsiteShow" mode="bottom" :zIndex="10780" border-radius="16" height="1000" :mask-close-able="true">
<view class="g_fs_18 g_c_3 g_flex_row_center g_pt_16"> 选择驻场 </view>
<scroll-view scroll-y="true" style="height: 770rpx">
<view class="g_pl_12 g_pr_12">
<view class="g_flex_row_between g_pt_16 g_pb_16 g_border_d_b" v-for="(item, index) in residentList" :key="index" @click="handleChooseResident(item, index)">
<view class="g_fs_17 g_c_3">{{ item.userName }}</view>
<view class="g_flex_column_center">
<i
class="iconfont icon-a-duigoubeifen2"
style="font-size: 18px"
:style="{
color: item.isSelected ? '#3578f6' : '#fff',
}"
></i>
</view>
</view>
</view>
</scroll-view>
<view class="g_flex_row_center g_mt_16 g_pb_16">
<rh-button type="primary" btnText="确定" @clickBtn="submitRes"></rh-button>
</view>
</u-popup>
<u-popup v-model="isOnsiteShow" mode="bottom" :zIndex="10780" border-radius="16" height="1000" :mask-close-able="true">
<view class="g_fs_18 g_c_3 g_flex_row_center g_pt_16"> 选择驻场 </view>
<scroll-view scroll-y="true" style="height: 770rpx">
<view class="g_pl_12 g_pr_12">
<view class="g_flex_row_between g_pt_16 g_pb_16 g_border_d_b" v-for="(item, index) in residentList" :key="index" @click="handleChooseResident(item, index)">
<view class="g_fs_17 g_c_3">{{ item.userName }}</view>
<view class="g_flex_column_center">
<i
class="iconfont icon-a-duigoubeifen2"
style="font-size: 18px"
:style="{
color: item.isSelected ? '#3578f6' : '#fff',
}"
></i>
</view>
</view>
</view>
</scroll-view>
<view class="g_flex_row_center g_mt_16 g_pb_16">
<rh-button type="primary" btnText="确定" @clickBtn="submitRes"></rh-button>
</view>
</u-popup>
<u-popup v-model="isRangeShow" mode="bottom" :zIndex="10780" border-radius="16" height="1000" :mask-close-able="true">
<view class="g_flex_column_between g_h_all">
<view class="">
<view class="g_fs_18 g_c_3 g_flex_row_center g_pt_16"> 选择可见范围 </view>
<view class="g_pl_20 g_mt_20">
<radio-group class="dib" @change="getRangeType">
<view class="g_fs_14">
<view class="g_mb_8 g_flex_row_start"> <radio :checked="rangeConfig.type == 0" :value="0" class="dib" color="#3578f6" style="transform: scale(0.7)"></radio><span class="g_flex_1" @click="[authInfo.realNameAuth !== 2 ? '' : getRangeType({ detail: { value: 0 } })]">仅自己可见(发布到商家后台,仅内部成员可见)</span></view>
<view class="g_flex_row_start"> <radio :checked="rangeConfig.type == 1" :disabled="authInfo.realNameAuth !== 2" :value="1" class="dib" color="#3578f6" style="transform: scale(0.7)"></radio><span class="g_flex_1" @click="[authInfo.realNameAuth !== 2 ? '' : getRangeType({ detail: { value: 1 } })]">部分可见</span></view>
</view>
</radio-group>
<view class="g_pl_20" v-if="rangeConfig.type == 1">
<u-checkbox-group @change="getRangeVal" shape="shape">
<view class="g_mt_12">
<u-checkbox v-model="rangeConfig.val1" name="1" :disabled="authInfo.realNameAuth !== 2" active-color="#3578f6"> 老乡(发布到招工小程序)</u-checkbox>
</view>
<view class="g_mt_12">
<u-checkbox v-model="rangeConfig.val2" name="2" :disabled="authInfo.realNameAuth !== 2" active-color="#3578f6"> 代理(发布到报名助手)</u-checkbox>
</view>
<view class="g_mt_12">
<u-checkbox v-model="rangeConfig.val3" name="3" :disabled="authInfo.certificationAuth !== 2" active-color="#3578f6"> 平台(发布到人海云平台)</u-checkbox>
</view>
</u-checkbox-group>
</view>
</view>
</view>
<view class="g_flex_row_center g_mt_16 g_pb_16">
<rh-button type="primary" btnText="确定" @clickBtn="submitRange"></rh-button>
</view>
</view>
</u-popup>
<!-- 薪资 性别 佣金类型选择 -->
<u-popup v-model="popShow" mode="bottom" border-radius="16" :mask-close-able="true">
<view class="g_pb_64">
<view class="popText g_fw_600 g_bg_f g_fs_18 g_c_3 g_flex_row_center g_pt_16"> {{ popText }} </view>
<view class="g_p_16">
<view class="g_flex_cloumn_center" v-if="popText == '选择薪资类型'">
<view v-for="(item, index) in staffPrice.list" :key="item.id" class="g_mt_12" :class="formInfo.salaryClassify == item.id ? 'g_c_main' : ''" @click="changeSex(item, 'staffPrice')">
<view class="g_p_12 g_bg_f5 g_radius_8 g_text_c">{{ item.text }}</view>
</view>
</view>
<view class="g_flex_cloumn_center" v-if="popText == '选择性别要求'">
<view v-for="(item, index) in ageSex.list" :key="index" class="g_mt_12" :class="ageSex.ageSexActive == item.id ? 'g_c_main' : ''" @click="changeSex(item, 'ageSex')">
<view class="g_p_12 g_bg_f5 g_radius_8 g_text_c">{{ item.text }}</view>
</view>
</view>
<view class="g_flex_cloumn_center" v-if="popText == '选择佣金类型'">
<view v-for="(item, index) in serviceFee.list" :key="item.id" class="g_mt_12" :class="formInfo.returnFeeType == item.id ? 'g_c_main' : ''" @click="changeSex(item, 'serviceFee')">
<view class="g_p_12 g_bg_f5 g_radius_8 g_text_c">{{ item.text }}</view>
</view>
</view>
</view>
</view>
</u-popup>
<!-- 职位标签选择弹窗 -->
<u-popup v-model="markCheck" mode="bottom" border-radius="16" :mask-close-able="true">
<view class="g_pl_20 g_pr_20" style="height: 80vh">
<view class="sub" id="xzfl">
<view class="title">薪资待遇</view>
<view class="content">
<view @click.stop="setActive($event, item.id, index, 'tagArray1')" :class="item.active != 0 ? 'active' : ''" hover-class="none" :hover-stop-propagation="false" v-for="(item, index) in typeMark.tagArray1" :key="index"> {{ item.name }}</view>
</view>
</view>
<view class="sub" id="ssbz">
<view class="title">吃饭住宿</view>
<view class="content">
<view @click.stop="setActive($event, item.id, index, 'tagArray3')" :class="item.active != 0 ? 'active' : ''" hover-class="none" :hover-stop-propagation="false" v-for="(item, index) in typeMark.tagArray3" :key="index"> {{ item.name }}</view>
</view>
</view>
<view class="sub" id="bzxx">
<view class="title">工作休息</view>
<view class="content">
<view @click.stop="setActive($event, item.id, index, 'tagArray0')" :class="item.active != 0 ? 'active' : ''" hover-class="none" :hover-stop-propagation="false" v-for="(item, index) in typeMark.tagArray0" :key="index"> {{ item.name }}</view>
</view>
</view>
<view class="sub" id="msts">
<view class="title">面试特色</view>
<view class="content">
<view @click.stop="setActive($event, item.id, index, 'tagArray4')" :class="item.active != 0 ? 'active' : ''" hover-class="none" :hover-stop-propagation="false" v-for="(item, index) in typeMark.tagArray4" :key="index"> {{ item.name }}</view>
</view>
</view>
<view class="sub g_pb_64" id="qtts">
<view class="title">其它特色</view>
<view class="content">
<view @click.stop="setActive($event, item.id, index, 'tagArray2')" :class="item.active == item.id ? 'active' : ''" hover-class="none" :hover-stop-propagation="false" v-for="(item, index) in typeMark.tagArray2" :key="index"> {{ item.name }}</view>
</view>
</view>
<view class="g_pt_16 g_pb_24 btnBox g_border_e_t">
<rh-button type="primary" btnText="确定" @clickBtn="setMark"></rh-button>
</view>
</view>
</u-popup>
<!-- 职位配置弹窗 -->
<u-popup v-model="jobConfigShow" mode="bottom" border-radius="16" :mask-close-able="true">
<view class="g_pl_20 g_pr_20" style="min-height: 40vh">
<view class="g_fs_18 g_c_3 g_flex_row_center g_pt_16"> 职位配置 </view>
<view class="">
<view class="g_flex_row_between flex_center g_border_e_b g_p_16">
<view class="">发布后默认开招</view>
<view class="">
<u-switch v-model="jobConfig.recruitment" class="" size="44" activeColor="#07C160"></u-switch>
</view>
</view>
<!-- <view class="g_flex_row_between flex_center g_border_e_b g_p_16">
<view class="">发布到平台</view>
<view class="g_flex_1 g_text_r" @click="checkAuth">
<u-switch v-model="jobConfig.daotian" :disabled="authInfo.certificationAuth !== 2" class="" size="44" activeColor="#07C160"></u-switch>
</view>
</view> -->
<view class="g_flex_row_between flex_center g_border_e_b g_p_16">
<view class="">置顶(招工小程序)</view>
<view class="g_flex_1 g_text_r">
<u-switch v-model="jobConfig.top" :disabled="true" class="" size="44" activeColor="#07C160"></u-switch>
</view>
</view>
<!-- <view class="g_flex_row_between flex_center g_border_e_b g_p_16" @click="isServiceShow = true">
<view class="">客服</view>
<view class="g_flex_row_end flex_center g_flex_1">
{{ selectedService.length > 0 ? selectedService[0].aliasName : "" }}
<i class="iconfont icon-gengduo11 g_c_9"></i>
</view>
</view>
<view class="g_flex_row_between flex_center g_p_16" @click="isOnsiteShow = true">
<view class="">驻场</view>
<view class="g_flex_row_end flex_center g_flex_1">
{{ selectedOnsite && selectedOnsite.length > 0 ? selectedOnsite[0].aliasName : "" }}
<i class="iconfont icon-gengduo11 g_c_9"></i>
</view>
</view> -->
<view class="g_flex_row_between flex_center g_p_16" @click="isRangeShow = true">
<view class="">可见范围</view>
<view class="g_flex_row_end flex_center g_flex_1">
{{ rangeConfig.text }}
<i class="iconfont icon-gengduo11 g_c_9"></i>
</view>
</view>
</view>
<view class="g_pt_16 g_pb_24 btnBox g_border_e_t">
<rh-button type="primary" btnText="确定" @clickBtn="jobConfigShow = false"></rh-button>
</view>
</view>
</u-popup>
<!-- 职位预览弹窗 -->
<u-popup v-model="previewShop" class="" mode="bottom" border-radius="16" :closeable="true" :mask-close-able="true">
<scroll-view :scroll-y="true" enable-flex class="g_flex_column_start flex_nw g_bg_f_5" style="height: 95vh; box-sizing: border-box">
<view class="g_pl_16 g_pr_16 g_pb_32">
<view class="g_h_42 g_bg_ed g_position_sticky"> </view>
<view class="g_bg_f g_radius_8 g_pl_16 g_pr_16 g_flex_row_between flex_center g_fs_16" style="flex: none" @click="showFee">
<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>
</view>
<view class="g_flex_row_end flex_center g_h_67" style="flex: 1">
<span class>{{ formInfo.returnFee ? formInfo.returnFee + serviceFee.list[formInfo.returnFeeType]["suffix"] : "请填写佣金" }}</span>
<view class="iconfont icon-gengduo11 g_fs_14 g_c_6 g_ml_4"></view>
</view>
</view>
<view class="g_flex_1 g_bg_f g_radius_8 g_pt_10 g_pl_16 g_pr_16 g_mt_10">
<view class="m-info">
<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">{{ formInfo.jobName || "职位名称" }}</view>
<view class="g_fs_14 g_c_9">
{{ formInfo.updateTime }}
</view>
</view>
<view class="g_c_9">
<view class="g_flex_row_start flex_center g_mb_8 g_fs_14">
<view class="g_lh_1_2">{{ formInfo.storeAddr ? G.setJobInfoPositionv3(formInfo.storeAddr) + "丨" : "企业位置" + "丨" }} </view>
<view class="" v-if="ageSex.ageSexActive != 1">
{{ ageSex.list[ageSex.ageSexActive].text + "丨" }}
</view>
<view class="">
{{ (ageSex.ageSexActive != 1 ? ageHandler : "男" + manAgeHandler + "; " + "女" + womanAgeHandler) || "年龄要求" }}
</view>
</view>
</view>
</view>
<view class="g_flex_row_start g_fs_14">
<!-- :style="{ color: labelColor[index % labelColor.length], 'background-color': bgColor[index % bgColor.length] }" -->
<view v-for="(item, index) in jobMark" :style="{ color: `${labelColor[index % labelColor.length].textColor}`, 'background-color': `${labelColor[index % labelColor.length].bgColor}` }" class="g_mr_8 g_mb_8 g_pl_4 g_pr_4"> {{ item.name }}</view>
<view class="g_c_9 g_pl_4 g_pr_4 g_radius_4" v-if="jobMark.length == 0" style="background: rgba(204, 204, 204, 0.2); border: 1rpx solid transparent; color: #666666; white-space: nowrap">职位标签</view>
</view>
<view class="g_flex_row_between flex_center g_mt_8 g_mb_12">
<view class="g_flex_row_start flex_center">
<view class="g_fs_16 g_fw_600 g_c_f40 g_lh_1_2 g_flex_column_center" v-html="formInfo.salaryClassifyValue ? G.getSalaryClassifyValueHtml(formInfo.salaryClassify, formInfo.salaryClassifyValue * 100) : '职位薪资'"> </view>
<view class="g_fs_14 g_c_9">
{{ monthValue ? "丨" + monthValue : "丨" + "综合月薪" }}
</view>
</view>
</view>
<view class="g_fs_14 g_border_e_t g_pb_20 g_flex_column_start">
<template v-for="(item, index) in templateArr" :key="index">
<view class="" v-if="item.type != 'unset'">
<view class="g_flex_row_start flex_center g_fw_600 g_mt_12 g_mb_8 g_fs_16" v-if="item.show && item.preview">
<view class="" v-if="item.typePreNum == 1">一、</view>
<view class="" v-if="item.typePreNum == 2">二、</view>
<view class="" v-if="item.typePreNum == 3">三、</view>
<view class="" v-if="item.typePreNum == 4">四、</view>
<view class="" v-if="item.typePreNum == 5">五、</view>
<view class="" v-if="item.typePreNum == 6">六、</view>
<view class="">
{{ item.type }}
</view>
</view>
<template v-for="(inner, index) in item.children" :key="index">
<view class="g_flex_row_start" style="line-height: 22px; padding-left: 16px" v-if="inner.show && inner.value">
<view class="g_flex_row_start flex_start g_fw_600">
<view class="g_mr_4" hover-class="none" hover-stop-propagation="false">
{{ `${inner.subPreNum}. ` }}
</view>
<view class="g_flex_1">
{{ `${inner.key}: ` }}
<text class="g_fw_400 g_ml_4" selectable="false" space="false" decode="false">
{{ inner.value }}
</text>
</view>
</view>
<!-- @blur="inner.edit = false" -->
</view>
</template>
</view>
</template>
<view class="g_c_9 g_pt_12 g_flex_1" v-if="templateArr.length <= 0"> 职位的详细描述 </view>
</view>
</view>
</view>
</scroll-view>
</u-popup>
<!-- 发布职位确认框 -->
<u-modal v-model="submitConfirm" negativeTop="52" confirmText="发布职位" :showTitle="false" :confirmStyle="{ color: '#576b95', 'font-weight': 600 }" :cancelStyle="{ color: '#000', 'font-weight': 600 }" :showConfirmButton="false">
<div class="g_fs_17 g_c_6 g_text_c">
<div class="g_pt_42 g_pb_36">
<div>请确认是否发布职位</div>
<div class="g_fs_14 g_flex_row_center flex_center g_pt_12" @click="checkAuth">
<radio :checked="jobConfig.daotian" :disabled="authInfo.certificationAuth !== 2" class="dib biggerSize" color="#3578f6" style="zoom: 0.6" />
同步至全平台
</div>
</div>
<div class="g_flex_row_center flex_center g_fw_600 g_border_e_t">
<div class="g_flex_1 g_h_50 g_text_c g_c_0 g_border_e_r" hover-class="thover" @click="submitConfirm = false" style="line-height: 50px">取消</div>
<div class="g_flex_1 g_h_50 g_text_c g_c_sub" hover-class="thover" @click="finallySubmit" style="line-height: 50px">发布职位</div>
</div>
</div>
</u-modal>
</view>
</template>
<script setup>
import { h, ref, onMounted, onBeforeMount, watch, getCurrentInstance, computed, nextTick } from "vue";
import { onLoad, onShow, onHide } from "@dcloudio/uni-app";
// const G = "./utils/ajax.js";
const G = getCurrentInstance().appContext.app.config.globalProperties.G;
const api = getCurrentInstance().appContext.app.config.globalProperties.api;
let sseTest = ref(null); // sse请求的实例
import { locationList } from "./utils/locationList";
import color from "../../uni_modules/vk-uview-ui/libs/function/color";
import gfot from "../components/dotLoading.vue";
// import gaoChatSSEClient from "../../uni_modules/gao-ChatSSEClient/components/gao-ChatSSEClient/gao-ChatSSEClient.vue";
// 创建响应式数据
const labelColor = ref([
{
textColor: "#c41d7f",
bgColor: "#fff0f6",
},
{
textColor: "#096dd9",
bgColor: "#e6f7ff",
},
{
textColor: "#531dab",
bgColor: "#f9f0ff",
},
{
textColor: "#d46b08",
bgColor: "#fff7e6",
},
{
textColor: "#389e0d",
bgColor: "#f6ffed",
},
{
textColor: "#08979c",
bgColor: "#e6fffb",
},
{
textColor: "#cf1322",
bgColor: "#fff1f0",
},
]);
const jobConfig = ref({
daotian: false,
});
const jobConfigShow = ref(false);
const AIUnfold = ref(false);
const AISticky = ref(false);
const sseModule = ref(null);
const systemInfo = ref("");
const scrollTo = ref(""); // 页面滚动
const isios = ref(false); // ios判断
const allHeight = ref(48);
const aitext = ref(""); // 输入的工单内容
const popShow = ref(false);
const popText = ref("");
const middleJson = ref({
标题: { content: "", end: false },
性别年龄: { content: "", end: false },
标签: { content: "", end: false },
薪资: { content: "", end: false },
End: { content: "", end: false },
});
const aiConfig = ref({
token: "",
id: "",
});
const templateArrCopy = ref([
// 职位描述模板
{
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: [],
},
{
type: "unset",
show: false,
childrenType: ["佣金", "佣金详情", "企业位置", "职位标签", "职位标题", "职位分类"],
children: [],
},
]);
const templateArr = ref([]);
const jsonStr = ref({});
const ailoading = ref(false);
const defaultPercent = ref(0);
const timer = ref(null); // inter定时器
const timer1 = ref(null); // inter定时器
let formInfo = ref({
jobName: "",
returnFeeType: 0,
salaryClassify: 0,
});
const jobMark = ref([]);
const ageShow = ref(false);
const ageValue = ref([0, 44]);
const ageWomanValue = ref([0, 44]);
const imgList = ref([]); // 上传图片的列表
const serviceFee = ref({
// 服务费类型
list: [
{
id: 0,
text: "按小时",
pre: "按时",
suffix: "元/小时",
},
{
id: 1,
text: "按天数",
pre: "按天",
suffix: "元/天",
},
{
id: 2,
text: "按月数",
pre: "按月",
suffix: "元/月",
},
{
id: 3,
text: "按次数",
pre: "按次",
suffix: "元/次",
},
{
id: 4,
text: "按件数",
pre: "按件",
suffix: "元/件",
},
{
id: 5,
text: "工人收入",
pre: "工人收入",
suffix: "%",
},
{
id: 6,
text: "共计",
pre: "共计",
suffix: "元",
},
{
id: 7,
text: "待定",
pre: "待定",
suffix: "待定",
},
],
});
let staffPrice = ref({
// 薪资类型
list: [
{
id: 0,
text: "时薪",
placeholder: "仅数字",
pre: "时薪",
suffix: "元/小时",
},
{
id: 1,
text: "日薪",
placeholder: "仅数字",
pre: "日薪",
suffix: "元/天",
},
{
id: 7,
text: "月薪",
placeholder: "如5000-7000",
pre: "月薪",
suffix: "元/月",
},
// {
// id: 2,
// text: "补贴",
// placeholder: "仅数字",
// pre: "补贴",
// suffix: "元",
// },
// {
// id: 3,
// text: "返费",
// placeholder: "仅数字",
// pre: "返费",
// suffix: "元",
// },
// {
// id: 4,
// text: "计件",
// placeholder: "",
// pre: "计件",
// suffix: "",
// },
// {
// id: 5,
// text: "保底",
// placeholder: "仅数字",
// pre: "保底",
// suffix: "元",
// },
// {
// id: 6,
// text: "面议",
// placeholder: "",
// pre: "面议",
// suffix: "",
// },
],
});
const currentPrice = ref({
id: 0,
text: "时薪",
placeholder: "仅数字",
pre: "时薪",
suffix: "元/小时",
});
const ageSex = ref({
// 性别年龄类型
list: [
{
id: 0,
text: "男女不限",
},
{
id: 1,
text: "男女不同",
},
{
id: 2,
text: "仅限男生",
},
{
id: 3,
text: "仅限女生",
},
],
ageSexActive: 0,
});
const ageHandler = ref("");
const manAgeHandler = ref("");
const womanAgeHandler = ref("");
const monthValue = ref("");
const jobId = ref("");
const residentList = ref([]);
const isServiceShow = ref(false);
const isOnsiteShow = ref(false);
const isRangeShow = ref(false); // 可见范围弹窗
const selectedOnsite = ref([]); // 选中的驻场列表
const selectedService = ref([]); // 选中的客服列表
const submitConfirm = ref(false); // 发布职位确认框
// 显示职位描述的空字段
const showEmpty = ref(false);
watch(showEmpty, (val) => {
console.log(val);
// 显示空字段
formatJSON();
});
const allSpecial = ref([]); // 全部职位标签
const typeMark = ref({
tagArray0: [],
tagArray1: [],
tagArray2: [],
tagArray3: [],
tagArray4: [],
}); // 分类的职位标签
const markCheck = ref(false); // 职位标签弹窗显示
const ageList = computed(() => {
let val = [[], []];
for (let i = 0; i <= 60; i++) {
if (i >= 16) {
val[0].push(i);
val[1].push(i);
}
}
return val;
});
/**
* 获取页面元素的初始位置,便于滚动
*/
const domTopInfo = ref({
jobName: 0,
jobMark: 0,
ageSex: 0,
salary: 0,
salaryDetail: 0,
storeAddr: 0,
jobDesp: 0,
returnFee: 0,
});
const loadingControl = ref({
jobName: false,
jobMark: false,
ageSex: false,
salary: false,
salaryDetail: false,
storeAddr: false,
jobDesp: false,
returnFee: false,
returnFeeDesp: false,
});
const scrollViewRef = ref(null); // 添加 ref
// 获取 scroll-view 的 scrollTop
const getScrollViewScrollTop = () => {
uni
.createSelectorQuery()
.select("#scrollView")
.fields({ scrollTop: true }, (res) => {
if (res) {
console.log("scroll-view 已经滑动的高度:", res.scrollTop);
// 你可以在这里处理获取到的高度
} else {
console.log("元素未找到");
}
})
.exec();
};
const agencyInfo = uni.getStorageSync("agencyInfo");
const authInfo = ref({});
const getAuthInfo = () => {
return new Promise((reso) => {
G.Get(api.get_supplier_info, { agencyId: agencyInfo ? agencyInfo.id : "" }, (res) => {
console.log("resresresresresres", res);
authInfo.value = res;
reso();
// authInfo.value.certificationAuth = 1;
// authInfo.value.realNameAuth = 1;
});
});
};
const getResident = () => {
return new Promise((reso) => {
G.Post(
api.order_residentList,
{
agencyId: uni.getStorageSync("apply-agencyId"),
keys: "",
pageNum: 1,
pageSize: 1000,
},
(res) => {
console.log("驻场列表:", res);
if (res.recordCount == 0) {
residentList.value = [];
} else {
res.recordList.forEach((item) => {
item.isSelected = false;
});
residentList.value = res.recordList;
}
reso();
}
);
});
};
const isIosWxapp = ref(false);
isIosWxapp.value = uni.getSystemInfoSync().platform == "ios" && uni.getSystemInfoSync().uniPlatform == "mp-weixin";
const keyboardHeight = ref(0);
const pbc = ref("0");
const bottomHeight = ref("100px");
const bindkeyboardheightchange = (e) => {
// 只对 ios 处理
console.log(isIosWxapp.value);
const height = e.detail.height;
// const idName = e.target.id;
// console.log("键盘高度变化:", height, idName);
// console.log(e);
// if (!isIosWxapp.value) {
// return;
// }
if (height === 0) {
pbc.value = "0";
// bottomHeight.value = '100px'
// scrollToInput(0, 0);
// return;
} else {
pbc.value = height - 70 + "px";
// bottomHeight.value = '0px'
}
// try {
// uni
// .createSelectorQuery()
// .select(`#${idName}`)
// .boundingClientRect((res) => {
// console.log(res);
// // 可使用窗口高度
// // const windowHeight = uni.getSystemSetting().windowHeight;
// const windowHeight = uni.getSystemInfoSync().windowHeight;
// // 键盘的高度
// // 除去键盘的剩余高度
// let restHeight = windowHeight - height;
// // 元素左下角坐标
// let bottom = res.bottom;
// console.log("可使用窗口高度" + windowHeight);
// console.log("除去键盘的剩余高度" + restHeight);
// console.log("元素左下角坐标" + bottom);
// // 只有当元素被软键盘覆盖的时候才上推页面
// if (bottom <= restHeight) return;
// // 现阶段需要滚动的大小
// let scrollTopNew = bottom - restHeight;
// console.log("键盘高度 滑动距离");
// console.log(height, scrollTopNew);
// scrollToInput(height, scrollTopNew);
// })
// .exec();
// } catch (error) {
// console.error("处理键盘高度变化出错:", error);
// }
};
// 获取页面滚动条位置
const getScrollOffset = () => {
return new Promise((resolve) => {
try {
uni
.createSelectorQuery()
.selectViewport()
.scrollOffset((res) => {
console.log("滚动条位置" + res.scrollTop);
resolve(res.scrollTop);
})
.exec();
} catch (error) {
resolve(0);
}
});
};
// 监听页面软键盘弹起手动推动页面
const scrollToInput = async (newKeyboardHeight, scrollTopNew) => {
keyboardHeight.value = newKeyboardHeight;
if (scrollTopNew) {
try {
const lastScrollTop = await getScrollOffset();
console.log("监听页面软键盘弹起手动推动页面");
console.log(lastScrollTop);
console.log("滑动距离");
console.log(scrollTopNew);
console.log(lastScrollTop ? lastScrollTop + scrollTopNew : scrollTopNew);
// setTimeout(()=>{
// scrollTop.value = lastScrollTop ? lastScrollTop + scrollTopNew : scrollTopNew
// },200)
// uni.pageScrollTo({
// scrollTop: 1000000,
// duration: 10
// });
} catch (error) {
console.error("页面滚动出错:", error);
}
}
};
onBeforeMount(() => {
getResident();
getMemberList();
});
onMounted(() => {
getScrollViewScrollTop();
// 给佣金和薪资重新赋默认值
formInfo.value.returnFeeType = 0;
formInfo.value.salaryClassify = 0;
setTimeout(() => {
for (const k in domTopInfo.value) {
getTop(k);
}
console.log("domTopInfo.value", domTopInfo.value);
}, 1000);
// setTimeout(() => {
showPage.value = true;
// }, 1000);
systemInfo.value = uni.getSystemInfoSync();
console.log("systemInfo", systemInfo.value);
if (systemInfo.value.system.indexOf("iOS") > -1) {
isios.value = true;
} else {
isios.value = false;
}
// scrollTop.value = 10000;
// uni.pageScrollTo({
// scrollTop: 99999, // 一个足够大的数值,确保滚动到底部
// duration: 100 // 滚动动画持续时间,单位为毫秒
// });
// getClass();
});
watch(
() => ageSex.ageSexActive,
(val) => {
if (val != 1) {
sexHandler(ageHandler.value);
} else {
formInfo.value.minAgeWoman = "";
formInfo.value.maxAgeWoman = "";
formInfo.value.minAgeMan = "";
formInfo.value.maxAgeMan = "";
sexHandler(manAgeHandler.value, womanAgeHandler.value, "all");
}
}
);
watch(
() => formInfo.value.salaryClassify,
(val) => {
console.log("formInfo.salaryClassify", val);
// formInfo.salaryClassifyValue = ''
priceHandler(formInfo.value.salaryClassifyValue);
}
);
watch(
() => monthValue,
(val) => {
if (val != "") {
priceHandler(val);
}
}
);
watch(ageHandler, (val) => {
console.log("ageHandler", val);
sexHandler(val);
});
watch(manAgeHandler, (val) => {
sexHandler(val, "", "man");
});
watch(womanAgeHandler, (val) => {
sexHandler(val, "", "woman");
});
onHide(() => {
clearInterval(timer.value);
clearTimeout(timer1.value);
});
const showPage = ref(false);
onLoad((options) => {
console.log("formInfo", formInfo.value);
console.log(options);
resetInfo();
if (options.id) {
uni.setNavigationBarTitle({
title: "编辑职位",
});
jobId.value = options.id;
uni.showLoading({
title: "加载中...",
});
getClass().then(() => {
// getResident().then(() => {
getJobDetail();
getAuthInfo();
// });
});
} else {
uni.setNavigationBarTitle({
title: "发布职位",
});
getClass().then(() => {
getAuthInfo().then(() => {
// authInfo.value.certificationAuth = 1;
// authInfo.value.realNameAuth = 1;
if (authInfo.value.certificationAuth == 2) {
rangeConfig.value.subVal = [3];
setRangeText();
}
});
});
}
getAiToken();
});
// onShow(() => {
// console.log("onShow");
// });
const openCore = (respons) => {
console.log("open sse", respons);
};
const errorCore = (err) => {
console.log("error sse", err);
};
const messageCore = (msg) => {
console.log("message sse", msg);
if (msg.event == "Done") {
if (!formInfo.value.jobName) {
clearInterval(timer.value);
ailoading.value = false;
}
} else {
let job = JSON.parse(msg.data);
checkDataInfo(job);
}
};
const finishCore = () => {};
const memberList = ref([]);
const getMemberList = () => {
G.Get(api.order_peopleList, { pageSize: 500, pageNum: 1 }, (res) => {
console.log("报名人列表:", res);
memberList.value = res.recordList;
});
};
// 需要往职位描述里添加的标签信息 通过空格拼接
const setMark = () => {
jobMark.value = [];
for (const k in typeMark.value) {
typeMark.value[k].forEach((item) => {
console.log("item", item);
if (item.active != 0) {
jobMark.value.push(item);
}
});
}
markCheck.value = false;
};
const getClass = () => {
return new Promise((reso) => {
G.Get(
"/labels/getListByTypeAndIndustryForGyl",
{ type: 90, industry: 2, hasJob: 1 },
(res) => {
console.log("getListByTypeAndIndustry", res);
allSpecial.value = res;
allSpecial.value.forEach((item) => {
item.active = 0;
if (item.typeClassify == "0") {
typeMark.value["tagArray0"].push(item);
} else if (item.typeClassify == "1") {
typeMark.value["tagArray1"].push(item);
} else if (item.typeClassify == "2") {
typeMark.value["tagArray2"].push(item);
} else if (item.typeClassify == "3") {
typeMark.value["tagArray3"].push(item);
} else if (item.typeClassify == "4") {
typeMark.value["tagArray4"].push(item);
}
});
reso();
},
(res) => {
console.log(res);
reso();
}
);
});
};
const showMarkCheck = () => {
markCheck.value = true;
};
const setActive = (e, id, index, str) => {
console.log("id", id);
if (typeMark.value[str][index].active == id) {
//已选中状态 取消选中
typeMark.value[str][index].active = 0;
// jobRequestLabelIds.value = jobRequestLabelIds.value.filter((id1) => id1 != id);
} else {
typeMark.value[str][index].active = id;
// jobRequestLabelIds.value.push(id);
}
};
/**
* 阻止滚动穿透
*/
const scroll = () => {
return false;
};
const getAiToken = () => {
G.Get("/yishoudan/common/structure/getConfig", {}, (res) => {
console.log("res", res);
aiConfig.value = {
token: res.token,
id: res.workflowId,
};
});
};
let scrollTop = ref(0);
const getTop = (id) => {
uni
.createSelectorQuery()
.select("#" + id)
.boundingClientRect((data) => {
console.log("data", data);
domTopInfo.value[id] = data.top;
// scrollTop.value = data.top - 200;
})
.exec();
};
const setTop = (id) => {
if (id) {
scrollTop.value = domTopInfo.value[id] - 200;
} else {
scrollTop.value = 10000;
}
};
const getClipboard = () => {
if (aitext.value) {
aitext.value = "";
} else {
uni.getClipboardData({
success(res) {
console.log(res);
aitext.value = res.data;
},
fail() {
uni.showToast({
title: "读取剪切板失败",
icon: "none",
});
},
});
}
};
const getCoze = () => {
let that = this;
if (!aitext.value) {
uni.showToast({
title: "请粘贴内容",
icon: "none",
});
return false;
}
// 重置内容
resetInfo("ai").then((res) => {
console.log("res", res);
if (res) {
middleJson.value = {
标题: { content: "", end: false },
性别年龄: { content: "", end: false },
标签: { content: "", end: false },
薪资: { content: "", end: false },
End: { content: "", end: false },
};
ailoading.value = true;
defaultPercent.value = 3;
timer.value = setInterval(() => {
defaultPercent.value = defaultPercent.value < 15 ? (defaultPercent.value = 15) : defaultPercent.value + 1;
console.log("12313123123123123");
setJobData();
if (defaultPercent.value >= 99) {
clearInterval(timer.value);
}
}, 500);
timer1.value = setTimeout(() => {
console.log("5687678678678678678");
ailoading.value = false;
clearInterval(timer.value);
setLoading();
}, 30000);
// #ifdef MP-WEIXIN
appCoze();
// miniAppCoze();
// #endif
// #ifdef APP-PLUS
appCoze();
// #endif
}
});
};
const appCoze = () => {
sseTest.value.startChat({
/**
* 将它换成你的地址
* 注意:
* 如果使用 sse-server.js 要在手机端使用的话请确保你的手机和电脑处在一个局域网下并且是正常的ip地址
*/
url: "https://api.coze.cn/v1/workflow/stream_run",
// 请求头
headers: {
Authorization: "Bearer " + aiConfig.value.token,
"Content-Type": "application/json;charset=UTF-8",
},
// 默认为 post
method: "post",
body: {
parameters: {
notice_text: aitext.value,
},
// workflow_id: aiConfig.value.id,
workflow_id: "7492238568816656410",
},
});
};
const miniAppCoze = () => {
let stream = uni.request({
url: "https://api.coze.cn/v1/workflow/stream_run",
method: "POST",
responseType: "arraybuffer",
header: {
Authorization: "Bearer " + aiConfig.value.token,
"Content-Type": "application/json;charset=UTF-8",
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
},
enableChunked: true,
data: {
parameters: {
notice_text: aitext.value,
},
// workflow_id: aiConfig.value.id,
workflow_id: "7492238568816656410",
},
//
// || aiConfig.value.id
success: function (res) {
console.log("res", res);
},
});
stream.onChunkReceived((response) => {
// 收到流式数据,根据返回值进行相对应数据解码
let val = buf2str(response.data);
console.log("response.data", val);
const regex = /{(?:[^{}]|{(?:[^{}]*?)})*?}/g;
if (val.indexOf("content") > -1) {
let valList = val.match(regex);
console.log("valList", valList);
valList.forEach((item) => {
let job = JSON.parse(item);
// for (const k in job) {
// if (typeof job[k] == "string" && k == "node_title") {
// job[k] = toHalfWidth(job[k].trim());
// }
// }
checkDataInfo(job);
});
}
});
};
/**
* 返回的数据类型判断
*/
const checkDataInfo = (_val) => {
console.log("_val", _val);
if ((_val.content == "无" || _val.content == "") && _val.node_title == "标题") {
ailoading.value = false;
setTimeout(() => {
clearInterval(timer.value);
setLoading();
uni.showToast({
title: "识别失败",
icon: "none",
});
}, 500);
return;
}
if (!_val.hasOwnProperty("debug_url")) {
console.log("_val1", _val);
middleJson.value[_val.node_title].content += _val.content;
if (_val.node_is_finish) {
middleJson.value[_val.node_title].end = true;
}
}
if (_val.node_type == "End") {
console.log("checkDataInfo1", dataError.value);
if (!dataError.value.ageSex) {
console.log("checkDataInfo2", dataError.value);
middleJson.value["性别年龄"].end = true;
middleJson.value["薪资"].end = true;
}
}
console.log(" middleJson", middleJson.value);
};
const setLoading = (type) => {
for (const k in loadingControl.value) {
loadingControl.value[k] = false;
}
if (type) loadingControl.value[type] = true;
};
/**
* 根据返回的数据按顺序处理
*/
const setJobData = (_val) => {
try {
if (!formInfo.value.jobName) {
setLoading("jobName");
}
if (!formInfo.value.jobName && middleJson.value["标题"].end == true) {
middleJson.value["标题"].end = false;
setVal(middleJson.value["标题"].content.split("**********")[0], "jobName");
setTop("jobName");
setLoading("jobMark");
// scrollTo.value = "jobName";
defaultPercent.value += 7;
}
if (formInfo.value.jobName && jobMark.value.length <= 0 && middleJson.value["标签"].end == true) {
middleJson.value["标签"].end = false;
setTimeout(() => {
setJobMark(middleJson.value["标签"].content);
setTop("jobMark");
setLoading("ageSex");
// scrollTo.value = "jobMark";
defaultPercent.value += 7;
}, 500);
}
// console.log('middleJson.value["性别年龄"].end', middleJson.value["性别年龄"].end);
if (formInfo.value.jobName && (jobMark.value.length > 0 || dataError.value.jobMark) && !womanAgeHandler.value && !manAgeHandler.value && !ageHandler.value && middleJson.value["性别年龄"].end == true) {
middleJson.value["性别年龄"].end = false;
setTimeout(() => {
if (middleJson.value["性别年龄"].content) {
setAge(middleJson.value["性别年龄"].content.split("**********")[0]);
setTimeout(() => {
if (ageSex.value.ageSexActive == 0 || ageSex.value.ageSexActive == 2 || ageSex.value.ageSexActive == 3) {
checkAge(ageHandler.value);
} else {
checkAge(womanAgeHandler.value) ? checkAge(manAgeHandler.value) : "";
}
}, 100);
} else {
checkAge("error");
}
setTop("ageSex");
setLoading("salary");
// scrollTo.value = "ageSex";
defaultPercent.value += 7;
}, 500);
}
console.log('middleJson.value["薪资"].end', middleJson.value["薪资"].end);
if (formInfo.value.jobName && (jobMark.value.length > 0 || dataError.value.jobMark) && (womanAgeHandler.value || manAgeHandler.value || ageHandler.value || dataError.value.ageSex) && !formInfo.value.salaryClassifyValue && middleJson.value["薪资"].end == true) {
middleJson.value["薪资"].end = false;
console.log('middleJson.value["薪资"]', middleJson.value["薪资"].content.split("**********"));
setTimeout(() => {
setSalary(middleJson.value["薪资"].content.split("**********")[0]);
setMonth(middleJson.value["薪资"].content.split("**********")[1]);
setTop("salary");
setLoading("salaryDetail");
// scrollTo.value = "salary";
defaultPercent.value += 7;
setTimeout(() => {
setVal(middleJson.value["薪资"].content.split("**********")[2], "salaryDetail");
// scrollTo.value = "salaryDetail";
setTop("salaryDetail");
setLoading("storeAddr");
defaultPercent.value += 7;
setTimeout(() => {
setVal(middleJson.value["标题"].content.split("**********")[1], "storeAddr");
if (!formInfo.value.storeAddr) {
dataError.value.storeAddr = true;
} else {
// 根据地址获取经纬度
let coordObj = getCoordByaddress(formInfo.value.storeAddr);
formInfo.value.storeLat = coordObj.latitude;
formInfo.value.storeLng = coordObj.longitude;
}
setTop("storeAddr");
setLoading("jobDesp");
defaultPercent.value += 7;
// scrollTo.value = "storeAddr";
}, 500);
}, 500);
}, 500);
}
if (formInfo.value.jobName && (jobMark.value.length > 0 || dataError.value.jobMark) && (womanAgeHandler.value || manAgeHandler.value || ageHandler.value || dataError.value.ageSex) && (formInfo.value.salaryClassifyValue || monthValue.value || dataError.value.salary) && (formInfo.value.storeAddr || dataError.value.storeAddr) && middleJson.value["End"].end == true) {
middleJson.value["End"].end = false;
console.log('middleJson.value["End"]', middleJson.value["End"]);
setJobInfo(middleJson.value["End"].content);
setTop("jobDesp");
setLoading("returnFee");
}
} catch (error) {
console.log("error", error);
}
};
const buf2str = (buffer) => {
let encodedString = String.fromCodePoint.apply(null, new Uint8Array(buffer));
let decodedString = decodeURIComponent(escape(encodedString)); //没有这一步中文会乱码
return decodedString;
};
const getChange = () => {
// console.log("jsonStr", jsonStr);
};
/* 综合月薪 正则规则
* 价格中间的特殊字符
*/
const specStrReg = ($str) => {
let list = ["~", "!", "@", "#", "%", "^", "&", "*", "(", ")", "", "", "", "+", "`", "-", "=", "·", "q", "w", "e", "r", "t", "y", "u", "i", "o", "p", "[", "]", "{", "}", "|", "|", "a", "s", "d", "f", "g", "h", "j", "k", "l", ";", ":", "'", '"', "", "“", "”", "z", "x", "c", "v", "b", "n", "m", ",", ".", "/", "<", ">", "?", "《", "》", "", "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "A", "S", "D", "F", "G", "H", "J", "K", "L", "Z", "X", "C", "V", "B", "N", "M", " ", "——", " -", "- ", " - "],
obj = {
min: 0,
max: 0,
};
if ($str) {
list.forEach((item, index) => {
if ($str.indexOf(item) > -1 && $str.split(item)[1]) {
let newlist = [$str.split(item)[0], $str.split(item)[1]];
newlist.sort(function (a, b) {
return a - b;
});
obj = {
min: newlist[0],
max: newlist[1],
};
}
});
}
return obj;
};
const sexHandler = (val, val1, type) => {
// 性别年龄特殊处理
console.log(val);
console.log(val1);
console.log(type);
let ageObj = specStrReg(val);
let ageObj1 = null;
if (type == "all") {
ageObj1 = specStrReg(val1);
}
if (ageSex.value.ageSexActive == 0) {
formInfo.value.minAgeWoman = ageObj.min;
formInfo.value.maxAgeWoman = ageObj.max;
formInfo.value.minAgeMan = ageObj.min;
formInfo.value.maxAgeMan = ageObj.max;
} else if (ageSex.value.ageSexActive == 1) {
if (type == "man") {
formInfo.value.minAgeMan = ageObj.min;
formInfo.value.maxAgeMan = ageObj.max;
} else if (type == "woman") {
formInfo.value.minAgeWoman = ageObj.min;
formInfo.value.maxAgeWoman = ageObj.max;
} else if (type == "all") {
formInfo.value.minAgeMan = ageObj.min;
formInfo.value.maxAgeMan = ageObj.max;
formInfo.value.minAgeWoman = ageObj1.min;
formInfo.value.maxAgeWoman = ageObj1.max;
}
console.log(formInfo.value);
} else if (ageSex.value.ageSexActive == 2) {
formInfo.value.minAgeWoman = 0;
formInfo.value.maxAgeWoman = 0;
formInfo.value.minAgeMan = ageObj.min;
formInfo.value.maxAgeMan = ageObj.max;
} else if (ageSex.value.ageSexActive == 3) {
formInfo.value.minAgeMan = 0;
formInfo.value.maxAgeMan = 0;
formInfo.value.minAgeWoman = ageObj.min;
formInfo.value.maxAgeWoman = ageObj.max;
}
console.log(formInfo.value);
};
// 格式错误标识
let dataError = ref({
jobName: false,
jobMark: false,
ageSex: false,
salary: false,
salaryDetail: false,
storeAddr: false,
jobDesp: false,
returnFee: false,
returnFeeDesp: false,
});
/**
* 校验年龄信息
*/
const checkAge = (val) => {
console.log("val checkAgecheckAge", val);
let ageObj = specStrReg(val);
const regex = /\D/;
if (val == "error" || val == "") {
resetAge();
ageValue.value = [16, 60];
dataError.value.ageSex = true;
return false;
} else if (regex.test(ageObj.min.trim()) || regex.test(ageObj.max.trim())) {
resetAge();
ageValue.value = [16, 60];
dataError.value.ageSex = true;
return false;
} else {
dataError.value.ageSex = false;
return true;
}
};
/**
* 年龄选择的回调
*/
const getAgeValue = (e, type) => {
let val;
val = ageList.value[0][e.detail.value[0]] + "-" + ageList.value[1][e.detail.value[1]];
console.log("e", e);
console.log("val", val);
console.log("type", type);
if (type == "all") {
manAgeHandler.value = "";
womanAgeHandler.value = "";
ageHandler.value = val;
} else if (type == "man") {
ageHandler.value = "";
manAgeHandler.value = val;
} else if (type == "woman") {
ageHandler.value = "";
womanAgeHandler.value = val;
}
};
/**
* 选择列变化回调(最大最小年龄联动)
*/
const handlerAge = (e, type) => {
console.log(e, type);
// e: { column: 1,index: 41}
if (type == "woman") {
ageWomanValue.value[e.detail.column] = e.detail.value;
if (e.detail.column == 0) {
if (e.detail.value > ageWomanValue.value[1]) {
ageWomanValue.value[1] = e.detail.value;
}
} else {
if (e.detail.value < ageWomanValue.value[0]) {
ageWomanValue.value[0] = e.detail.value;
}
}
} else {
ageValue.value[e.detail.column] = e.detail.value;
if (e.detail.column == 0) {
if (e.detail.value > ageValue.value[1]) {
ageValue.value[1] = e.detail.value;
}
} else {
if (e.detail.value < ageValue.value[0]) {
ageValue.value[0] = e.detail.value;
}
}
}
};
// 年龄选择取消事件
const cancelAge = (e) => {
console.log("cancel", e);
};
const priceHandler = (val) => {
// 薪资的特殊处理
console.log("val", val);
formInfo.value.minMonthlyPay = "";
formInfo.value.maxMonthlyPay = "";
if (formInfo.value.salaryClassify == 7) {
let ageObj = specStrReg(val);
console.log("ageObj", ageObj);
formInfo.value.minMonthlyPay = ageObj.min * 100;
formInfo.value.maxMonthlyPay = ageObj.max * 100;
formInfo.value.salaryClassifyValue = "";
} else if (formInfo.value.salaryClassify == 4) {
formInfo.value.salaryClassifyValue = "";
// monthValue.value = "";
} else if (formInfo.value.salaryClassify == 6) {
formInfo.value.salaryClassifyValue = "";
// monthValue.value = "";
}
console.log(formInfo.value);
};
const toHalfWidth = (str) => {
return str.replace(/[\uff01-\uff5e]/g, function (match) {
var charCode = match.charCodeAt(0) - 0xfee0; // 65248 in hex is 0xfee0
console.log("String.fromCharCode(charCode)", String.fromCharCode(charCode));
return String.fromCharCode(charCode);
});
};
/**
* 格式化显示JSON数据
*/
const formatJSON = (jsonStr) => {
let objMiddle = {};
if (jsonStr) {
objMiddle = JSON.parse(jsonStr);
}
// 判断职位描述的对象是否已经赋值, 没有的话进行初始化
let hasVal = false;
templateArr.value.forEach((item) => {
if (item.children.length) {
hasVal = true;
}
});
if (!hasVal) {
templateArr.value = JSON.parse(JSON.stringify(templateArrCopy.value));
}
console.log("showEmpty.value", showEmpty.value);
console.log(" templateArr.value", templateArr.value);
// 大类编辑时的数字
let typeNum = 1;
// 大类预览时的数字
let typePreNum = 1;
templateArr.value.forEach((item) => {
// 内容编辑时的数字
let subNum = 1;
// 内容预览时的数字
let subPreNum = 1;
item.childrenType.forEach((innerItem, ind) => {
console.log("objMiddle[innerItem] ", objMiddle[innerItem]);
if (item.children[ind]) {
// 有值的, 隐藏的时候不隐藏, 显示的时候显示
item.children[ind] = {
key: innerItem,
value: item.children[ind].value || objMiddle[innerItem] || "",
num: subNum,
subPreNum,
show: item.children[ind].value || objMiddle[innerItem] || showEmpty.value ? true : false,
edit: false,
};
item.children[ind].num = subNum;
} else {
// 子元素的增添
item.children.push({
key: innerItem,
value: objMiddle[innerItem] || "",
num: subNum,
subPreNum,
show: objMiddle[innerItem] || showEmpty.value ? true : false,
edit: false,
});
}
if (item.children[ind].show == true) {
subNum += 1;
if (item.children[ind].value) {
subPreNum += 1;
}
console.log("num", subNum);
}
});
item.num = typeNum;
item.typePreNum = typePreNum;
console.log("item.children", item.children);
// 父元素的显隐(如果只有最后一个子元素显示的话, 因为其num依旧为1, 因此需要判断其show是否为true)
if (item.children[item.children.length - 1].show == true || item.children[item.children.length - 1].num != 1) {
item.show = true;
typeNum += 1;
if (showEmpty.value && item.children.every((obj) => obj.value === "")) {
// 大类预览时, 如果所有子元素都为空切为显示所有空字段, 则不显示
item.preview = false;
} else {
// 否则大类预览数加一且显示
typePreNum += 1;
item.preview = true;
}
} else {
item.show = false;
}
});
};
const setJobInfo = (res) => {
let that = this;
let jsonStr = JSON.parse(res);
// for (const k in jsonStr) {
// if (k == "性别年龄" && jsonStr[k] != "" && typeof jsonStr[k] == "string") {
// jsonStr[k] = toHalfWidth(jsonStr[k]);
// }
// }
// ailoading = false;
console.log("解析ai数据", res);
formatJSON(res);
// jsonStr = arr;
// defaultPercent = 100;
// setVal(jsonStr["职位标题"], "jobName");
// setVal(jsonStr["企业位置"], "storeAddr");
// setVal(jsonStr["薪资明细"], "salaryDetail");
// jobMark = jsonStr["职位标签"].split(",");
// if (jsonStr["职位标签"]) {
// setJobMark(jsonStr["职位标签"]);
// }
// if (jsonStr["岗位薪资"]) {
// setSalary(jsonStr["岗位薪资"]);
// }
setTimeout(() => {
setReturnFee(jsonStr["佣金"]);
setLoading("returnFeeDesp");
setTop();
setTimeout(() => {
setVal(jsonStr["佣金详情"], "returnFeeDesp");
setLoading();
defaultPercent.value = 100;
ailoading.value = false;
clearInterval(timer.value);
uni.showToast({
title: "识别完成",
icon: "none",
});
}, 800);
}, 500);
// if (jsonStr["性别年龄"]) {
// setAge(jsonStr["性别年龄"]);
// }
// if (jsonStr["综合月薪"]) {
// setMonth(jsonStr["综合月薪"]);
// }
};
const setFlow = (targetValue, value, index = 0) => {
let that = this;
console.log("targetValue, value", targetValue, "\n", value);
return new Promise((res, rej) => {
function flowStyle() {
console.log(new Date().getTime());
if (!formInfo.value[targetValue]) {
formInfo.value[targetValue] = "";
}
if (index < value.length) {
// 追加文字
// console.log("value[index++]", value[index++]);
formInfo.value[targetValue] += value[index++];
setTimeout(flowStyle, 300);
} else {
res();
}
}
flowStyle();
});
};
/**
* 不需要处理的信息直接赋值
*/
const setVal = (_val, _type) => {
console.log("setVal", _val, _type);
formInfo.value[_type] = _val;
};
/**
* 正则提取所有的数字
*/
const getNumberByRegular = (_val) => {
let regex = /\d+(\.\d+)?/g;
console.log("_val.match(regex).sort()", _val.match(regex));
let list = [];
if (_val.match(regex)) {
list = _val
.match(regex)
.map((item) => {
return Number(item);
})
.sort((a, b) => {
return a - b;
});
}
console.log("list", list);
return list;
};
/**
* 正则提取所有的汉字
*/
const getHanziByRegular = (_val) => {
const regex = /[\u4e00-\u9fff]+/g;
console.log("123123123");
console.log("_val.match(regex).sort()", _val.match(regex));
let list = [];
list = _val.match(regex);
return list;
};
/**
* 处理综合月薪
*/
const setMonth = (_val) => {
let monthList = getNumberByRegular(_val);
console.log("monthList", monthList);
if (monthList.length == 0) {
resetMonth();
dataError.value.salary = true;
return;
} else {
monthValue.value = monthList[0] + "-" + monthList[1];
priceHandler(monthValue.value);
}
// matches;
};
/**
* 处理薪资
*/
const setSalary = (_type) => {
console.log("_type123", _type);
if (_type) {
let _id = 0;
if (_type.indexOf("元/时") > -1 || _type.indexOf("元/小时") > -1) {
_id = 0;
currentPrice.value.placeholder = "纯数字";
currentPrice.value.suffix = "元/小时";
} else if (_type.indexOf("元/天") > -1 || _type.indexOf("元/日") > -1) {
_id = 1;
currentPrice.value.placeholder = "纯数字";
currentPrice.value.suffix = "元/天";
}
// else if (_type.indexOf("补贴") > -1) {
// _id = 2;
// currentPrice.value.placeholder = "补贴";
// currentPrice.value.suffix = "元";
// formInfo.value.salaryClassifyValue = _type.split("补贴")[0];
// } else if (_type.indexOf("返费") > -1) {
// _id = 3;
// currentPrice.value.placeholder = "返费";
// currentPrice.value.suffix = "元";
// formInfo.value.salaryClassifyValue = _type.split("返费")[0];
// } else if (_type.indexOf("保底") > -1) {
// _id = 5;
// currentPrice.value.placeholder = "保底";
// currentPrice.value.suffix = "元";
// formInfo.value.salaryClassifyValue = _type.split("保底")[0];
// } else if (_type.indexOf("计件") > -1) {
// _id = 4;
// currentPrice.value.placeholder = "计件";
// currentPrice.value.suffix = "";
// } else if (_type.indexOf("面议") > -1) {
// _id = 6;
// currentPrice.value.placeholder = "面议";
// currentPrice.value.suffix = "";
// }
else if (_type.indexOf("月薪") > -1 || _type.indexOf("元/月") > -1) {
_id = 7;
currentPrice.value.pre = "月薪";
currentPrice.value.placeholder = "如5000-7000";
currentPrice.value.suffix = "元/月";
}
let monthList = getNumberByRegular(_type);
console.log("_id", _id);
formInfo.value.salaryClassify = _id;
console.log("monthList123123", monthList);
if (_id != 7) {
if (monthList.length == 0) {
resetSalary();
} else {
formInfo.value.salaryClassifyValue = monthList[0];
}
}
}
};
/**
* 处理职位标签
*/
const setJobMark = (val) => {
console.log("setJobMarksetJobMarksetJobMark", val);
allSpecial.value.forEach((item) => {
getHanziByRegular(val).forEach((innerItem) => {
if (innerItem == item.name) {
item.active = item.id;
jobMark.value.push(item);
}
});
});
if (jobMark.value.length == 0) {
dataError.value.jobMark = true;
}
};
/**
* 处理佣金
*/
const setReturnFee = (_type) => {
let _id;
if (_type.indexOf("时") > -1 || _type.indexOf("小时") > -1) {
_id = 0;
} else if (_type.indexOf("天") > -1 || _type.indexOf("日") > -1) {
_id = 1;
} else if (_type.indexOf("月") > -1) {
_id = 2;
} else if (_type.indexOf("次") > -1) {
_id = 3;
} else if (_type.indexOf("件") > -1) {
_id = 4;
} else if (_type.indexOf("工人收入") > -1) {
_id = 5;
} else if (_type.indexOf("共计") > -1) {
_id = 6;
} else if (_type.indexOf("待定") > -1) {
_id = 7;
formInfo.value.returnFee = "";
}
let monthList = getNumberByRegular(_type);
formInfo.value.returnFeeType = _id;
if (_id != 7) {
if (monthList.length == 0) {
resetReturnFee();
} else {
formInfo.value.returnFee = monthList[0];
}
}
};
/**
* 处理返回数据中的性别年龄字段
*/
const setAge = (_item) => {
let ageTypeList = _item.split(/[;|]/) || [_item];
// ageValue.value = [res.minAgeWoman];
// ageWomanValue.value;
console.log("ageTypeList", ageTypeList);
if (getNumberByRegular(ageTypeList[0]).length == 0) {
resetAge();
ageValue.value = [16, 60];
dataError.value.ageSex = true;
return;
}
//如果有三个那么基本可以确定是男女不限
if (ageTypeList.length == 3) {
ageSex.value.ageSexActive = 0;
//男女不限的情况下, 如果年龄区间是相同的, 则可以判断是否是男女不同
let manAgeRange, womanAgeRange;
if (ageTypeList[0].indexOf("男") > -1) {
// manAgeRange = ageTypeList[0].split("男")[1];
// womanAgeRange = ageTypeList[1].split("女")[1];
manAgeRange = configAge(getNumberByRegular(ageTypeList[0]));
womanAgeRange = configAge(getNumberByRegular(ageTypeList[1]));
} else {
manAgeRange = configAge(getNumberByRegular(ageTypeList[1]));
womanAgeRange = configAge(getNumberByRegular(ageTypeList[0]));
// manAgeRange = ageTypeList[1].split("男")[1];
// womanAgeRange = ageTypeList[0].split("女")[1];
}
console.log("manAgeRange == womanAgeRange", manAgeRange);
console.log("manAgeRange == womanAgeRange", womanAgeRange);
// 判断男女年龄区间是否相同
if (manAgeRange == womanAgeRange) {
// 相同的情况
ageHandler.value = manAgeRange;
ageValue.value = [manAgeRange.split("-")[0].trim(), manAgeRange.split("-")[1].trim()];
console.log("ageValue.value", ageValue.value);
sexHandler(ageHandler.value);
} else {
// 不同的情况
ageSex.value.ageSexActive = 1;
womanAgeHandler.value = womanAgeRange;
manAgeHandler.value = manAgeRange;
ageValue.value = [manAgeRange.split("-")[0].trim(), manAgeRange.split("-")[1].trim()];
ageWomanValue.value = [womanAgeRange.split("-")[0].trim(), womanAgeRange.split("-")[1].trim()];
console.log("ageValue.value", ageValue.value);
console.log("ageWomanValue.value", ageWomanValue.value);
sexHandler(manAgeHandler.value, womanAgeHandler.value, "all");
}
// 判断只有两个的情况, 通过第二个是否是年龄区间来判断第二个是否是备注(不稳定)
} else if (ageTypeList.length == 2) {
// 判断第二个不是备注的情况
if ((ageTypeList[0].indexOf("男") > -1 && ageTypeList[1].indexOf("女") > -1 && ageTypeList[1].indexOf("-") > -1 && ageTypeList[1].trim().length < 10) || (ageTypeList[0].indexOf("女") > -1 && ageTypeList[1].indexOf("男") > -1 && ageTypeList[1].indexOf("-") > -1 && ageTypeList[1].trim().length < 10)) {
ageSex.value.ageSexActive = 0;
let manAgeRange, womanAgeRange;
if (ageTypeList[0].indexOf("男") > -1) {
manAgeRange = configAge(getNumberByRegular(ageTypeList[0]));
womanAgeRange = configAge(getNumberByRegular(ageTypeList[1]));
} else {
manAgeRange = configAge(getNumberByRegular(ageTypeList[1]));
womanAgeRange = configAge(getNumberByRegular(ageTypeList[0]));
}
console.log("manAgeRange == womanAgeRange", manAgeRange);
console.log("manAgeRange == womanAgeRange", womanAgeRange);
// 判断男女年龄区间是否相同
if (manAgeRange == womanAgeRange) {
// 相同的情况
ageHandler.value = manAgeRange;
ageValue.value = [manAgeRange.split("-")[0].trim(), manAgeRange.split("-")[1].trim()];
sexHandler(ageHandler.value);
} else {
// 不同的情况
ageSex.value.ageSexActive = 1;
womanAgeHandler.value = womanAgeRange;
manAgeHandler.value = manAgeRange;
ageValue.value = [manAgeRange.split("-")[0].trim(), manAgeRange.split("-")[1].trim()];
ageWomanValue.value = [womanAgeRange.split("-")[0].trim(), womanAgeRange.split("-")[1].trim()];
console.log("ageValue.value", ageValue.value);
console.log("ageWomanValue.value", ageWomanValue.value);
sexHandler(manAgeHandler.value, womanAgeHandler.value, "all");
}
// 如果第二个是备注, 则该职位就是只收男或只收女
} else {
// 只收男性
if (ageTypeList[0].indexOf("男") > -1) {
console.log("ageTypeList[0].split男", ageTypeList[0].split("男"));
ageSex.value.ageSexActive = 2;
ageHandler.value = ageTypeList[0].split("男")[1];
ageValue.value = [ageTypeList[0].split("男")[1].split("-")[0].trim(), ageTypeList[0].split("男")[1].split("-")[1].trim()];
//只收女性
} else if (ageTypeList[0].indexOf("女") > -1) {
console.log("ageTypeList[0].split女", ageTypeList[0].split("女"));
ageSex.value.ageSexActive = 3;
ageHandler.value = ageTypeList[0].split("女")[1];
ageValue.value = [ageTypeList[0].split("女")[1].split("-")[0].trim(), ageTypeList[0].split("女")[1].split("-")[1].trim()];
}
sexHandler(ageHandler.value);
}
// 只有一个那么可以判断是只收男或女
} else {
if (ageTypeList[0].indexOf("男") > -1) {
ageSex.value.ageSexActive = 2;
ageHandler.value = ageTypeList[0].split("男")[1];
ageValue.value = [ageTypeList[0].split("男")[1].split("-")[0].trim(), ageTypeList[0].split("男")[1].split("-")[1].trim()];
} else if (ageTypeList[0].indexOf("女") > -1) {
ageSex.value.ageSexActive = 3;
ageHandler.value = ageTypeList[0].split("女")[1];
// womanAgeHandler.value = ageTypeList[0].split("女")[1];
ageValue.value = [ageTypeList[0].split("女")[1].split("-")[0].trim(), ageTypeList[0].split("女")[1].split("-")[1].trim()];
}
sexHandler(ageHandler.value);
}
// 不知名原因需要同意减16才能正常显示
ageValue.value = [ageValue.value[0] * 1 - 16, ageValue.value[1] * 1 - 16];
ageWomanValue.value = [ageWomanValue.value[0] * 1 - 16, ageWomanValue.value[1] * 1 - 16];
// console.log("ageValue1", ageValue);
// console.log("ageWomanValue1", ageWomanValue);
};
const configAge = (_list) => {
console.log("_list", _list);
return _list.length > 1 ? _list[0] + "-" + _list[1] : _list[0] + "-" + _list[0];
};
/**
* 显示选择弹窗
*/
const showPop = (_type) => {
popShow.value = true;
console.log("_type", _type);
switch (_type) {
case "salary":
popText.value = "选择薪资类型";
break;
case "age":
popText.value = "选择性别要求";
break;
case "serviceFee":
popText.value = "选择佣金类型";
break;
case "jobDesp":
popText.value = "编辑职位描述";
break;
}
};
const previewShop = ref(false);
/**
* 职位预览
*/
const showPreview = () => {
formatJSON();
previewShop.value = true;
};
let middleInfo = ref({});
// 新增职位的提交
const onSubmit = (e) => {
console.log(e);
let newImg = [];
imgList.value.forEach((item) => {
newImg.push(item.url);
});
let onloadInfo = {
jobName: formInfo.value.jobName,
salaryDetail: formInfo.value.salaryDetail,
returnFeeDesp: formInfo.value.returnFeeDesp,
storeAddr: formInfo.value.storeAddr,
storeLat: formInfo.value.storeLat,
storeLng: formInfo.value.storeLng,
storeName: formInfo.value.storeName,
jobDesp: formInfo.value.jobDesp,
minAgeWoman: formInfo.value.minAgeWoman,
maxAgeWoman: formInfo.value.maxAgeWoman,
minAge: formInfo.value.minAge,
maxAge: formInfo.value.maxAge,
minAgeMan: formInfo.value.minAgeMan,
maxAgeMan: formInfo.value.maxAgeMan,
minAge: formInfo.value.minAge,
salaryClassify: formInfo.value.salaryClassify,
returnFeeType: formInfo.value.returnFeeType,
otherInfo: formInfo.value.jobDesp,
// daotian: jobConfig.value.daotian ? 1 : 0,
recruitment: jobConfig.value.recruitment ? 1 : 2,
// jobInfoYuQue: formInfo.value.jobInfo,
// imgs: newImg.join(","),
};
console.log(formInfo.value);
if (!formInfo.value.jobName) {
uni.showToast({
title: "请输入职位名称",
icon: "none",
});
return;
}
if (formInfo.value.returnFeeType != 7 && !formInfo.value.returnFee) {
uni.showToast({
title: "请输入佣金信息",
icon: "none",
});
return;
} else {
onloadInfo.returnFee = Number(formInfo.value.returnFee).toFixed(2) * 100;
}
let priceWatch = false;
if (monthValue.value) {
let ageObj = specStrReg(monthValue.value);
formInfo.value.minMonthlyPay = ageObj.min * 100;
formInfo.value.maxMonthlyPay = ageObj.max * 100;
}
if (onloadInfo.salaryClassify != 4 && onloadInfo.salaryClassify != 6) {
if (formInfo.value.salaryClassifyValue === "" && !formInfo.value.minMonthlyPay) {
uni.showToast({
title: "请输入薪资信息",
icon: "none",
});
priceWatch = true;
} else {
priceWatch = false;
onloadInfo.minMonthlyPay = formInfo.value.minMonthlyPay || "";
onloadInfo.maxMonthlyPay = formInfo.value.maxMonthlyPay || "";
onloadInfo.salaryClassifyValue = Number(formInfo.value.salaryClassifyValue).toFixed(2) * 100;
}
}
if (priceWatch) {
return;
}
if (!formInfo.value.minAgeMan && !formInfo.value.maxAgeMan && !formInfo.value.minAgeWoman && !formInfo.value.maxAgeWoman) {
uni.showToast({
title: "请输入年龄信息",
icon: "none",
});
return;
}
if (onloadInfo.salaryClassifyValue >= 10000000) {
uni.showToast({
title: "请输入少于10万的薪资",
icon: "none",
});
return;
}
if (onloadInfo.returnFee >= 10000000) {
uni.showToast({
title: "请输入少于10万的佣金",
icon: "none",
});
return;
}
let newArr = [formInfo.value.minAgeMan, formInfo.value.maxAgeMan, formInfo.value.minAgeWoman, formInfo.value.maxAgeWoman];
newArr.sort();
console.log("newArr", newArr);
onloadInfo.minAge = newArr[0] == 0 ? newArr[2] : newArr[0];
onloadInfo.maxAge = newArr[3];
let onsite = [];
selectedOnsite.value.forEach((item) => {
onsite.push(item.id);
});
console.log("selectedService.value", selectedService.value);
onloadInfo.customServiceUserIds = selectedService.value.length > 0 ? selectedService.value[0].id : "";
onloadInfo.onSiteUserIds = onsite.join(",");
if (rangeConfig.value.subVal.length > 0) {
onloadInfo.visibleRange = rangeConfig.value.subVal.sort().join("");
} else {
onloadInfo.visibleRange = 0;
}
let obj = {};
let subMark = jobMark.value
.filter((item) => item.active)
.map((item) => item.name)
.join(" ");
// 职位描述的JSON字段空值判断
let despEmpty = true;
templateArr.value.forEach((item) => {
item.children.forEach((innerItem) => {
if (innerItem.value) {
despEmpty = false;
}
obj[innerItem.key] = innerItem.value;
switch (innerItem.key) {
case "职位标签":
obj[innerItem.key] = subMark;
break;
case "职位标题":
obj[innerItem.key] = onloadInfo.jobName;
break;
}
});
});
if (JSON.stringify(obj) != "{}" && !despEmpty) {
onloadInfo.cozeStructureRes = JSON.stringify(obj);
}
onloadInfo.lastNotice = aitext.value;
onloadInfo.jobSpecialLabelId = jobMark.value
.filter((item) => item.active)
.map((item) => item.id)
.join(",");
console.log("onloadInfo", onloadInfo);
// return
onloadInfo.recordId = jobId.value;
submitConfirm.value = true;
middleInfo.value = onloadInfo;
return;
G.handleConfirm({
content: "请确认是否发布职位",
confirmText: "发布职位",
success: (res) => {
if (res.confirm) {
// if (jobId.value) {
G.Post(jobId.value ? "/yishoudan/custom/job/updateRecordByCoze" : "/yishoudan/custom/job/addRecordByCoze", onloadInfo, (res) => {
uni.showToast({
title: "发布成功",
icon: "success",
});
setTimeout(() => {
uni.navigateBack({
delta: -1,
});
}, 1000);
});
// } else {
// G.Post("/yishoudan/custom/job/addRecordByCoze", onloadInfo, (res) => {
// uni.showToast({
// title: "发布成功",
// icon: "success",
// });
// setTimeout(() => {
// uni.navigateBack({
// delta: -1,
// });
// }, 1000);
// });
// }
}
},
});
};
const subLoading = ref(false);
// 自定义确认框点击确定后的回调
const finallySubmit = () => {
if (subLoading.value) {
return;
}
subLoading.value = true;
G.Post(jobId.value ? "/yishoudan/custom/job/updateRecordByCoze" : "/yishoudan/custom/job/addRecordByCoze", { ...middleInfo.value, daotian: jobConfig.value.daotian ? 1 : 0 }, (res) => {
subLoading.value = false;
uni.showToast({
title: "发布成功",
icon: "success",
});
setTimeout(() => {
uni.navigateBack({
delta: -1,
});
}, 1000);
});
};
const changeSex = (e, type) => {
// 年龄, 服务费, 薪资, 类型变化
console.log(e);
if (type == "ageSex") {
ageSex.value.ageSexActive = e.id;
} else if (type == "serviceFee") {
formInfo.value.returnFeeType = e.id;
} else if (type == "staffPrice") {
console.log("eeechangeSex", e);
formInfo.value.salaryClassify = e.id;
currentPrice.value = staffPrice.value.list[staffPrice.value.list.findIndex((item) => item.id == e.id)];
}
popShow.value = false;
// ageSex.ageSexActive = item.id
};
// 地址选择的回调
const chooseAddress = () => {
console.log("chooseAddress");
new Promise((resolve) => {
if (formInfo.value.storeAddr) {
if (formInfo.value.storeLat || formInfo.value.storeLng) {
console.log("formInfo.value", formInfo.value);
resolve({
latitude: formInfo.value.storeLat,
longitude: formInfo.value.storeLng,
});
} else {
console.log("noLat");
let coordObj = getCoordByaddress(formInfo.value.storeAddr);
resolve(coordObj);
}
} else {
resolve({});
}
}).then((info) => {
console.log("info", info);
let obj = {};
if (info.latitude) {
obj = {
latitude: info.latitude.toFixed(2),
longitude: info.longitude.toFixed(2),
};
}
// #ifdef MP-WEIXIN
uni.chooseLocation({
...obj,
success(e) {
console.log(e);
var reg = /.+?(省|市|自治区|自治州|县|区)/g; // 省市区的正则
let arr = [];
if (e.address) {
arr = e.address.match(reg);
}
console.log("arr123123", arr);
formInfo.value.storeDistrict = arr.length > 0 ? [arr[0], arr[1]].join(",") : "";
formInfo.value.storeAddr = arr.length > 0 ? arr[0] + e.name : e.name;
formInfo.value.storeLat = e.latitude;
formInfo.value.storeLng = e.longitude;
},
fail(e) {
console.log("err", e);
},
});
// #endif
});
return;
};
// 编辑职位获取信息
const getJobDetail = () => {
let that = this;
G.Get("/yishoudan/custom/job/detailV2/" + jobId.value, "", (res) => {
console.log("resresresres", res);
res = { ...res, ...res.record };
if (res.salaryClassify == 7 && res.minMonthlyPay != "") {
monthValue.value = res.minMonthlyPay / 100 + "-" + res.maxMonthlyPay / 100;
} else if (res.salaryClassify == 4) {
res.salaryClassifyValue = 0;
} else if (res.salaryClassify == 6) {
res.salaryClassifyValue = 0;
} else {
res.salaryClassifyValue = res.salaryClassifyValue / 100;
}
currentPrice.value = staffPrice.value.list[staffPrice.value.list.findIndex((item) => item.id == res.salaryClassify)];
console.log("currentPrice.value", currentPrice.value);
// imgList.value = img;
console.log("imgList.value", imgList.value);
if (res.returnFeeType != 7) {
res.returnFee = res.returnFee / 100;
}
console.log("ageList.value", ageList.value);
console.log(ageList.value[0].indexOf(res.minAgeWoman));
if (Boolean(res.minAgeWoman) === true && Boolean(res.minAgeMan) === false) {
// 女 4
ageSex.value.ageSexActive = 3;
ageHandler.value = res.minAgeWoman + "-" + res.maxAgeWoman;
ageValue.value[0] = ageList.value[0].indexOf(res.minAgeWoman);
ageValue.value[1] = ageList.value[0].indexOf(res.maxAgeWoman);
} else if (Boolean(res.minAgeWoman) === false && Boolean(res.minAgeMan) === true) {
// 男 3
ageSex.value.ageSexActive = 2;
ageHandler.value = res.minAgeMan + "-" + res.maxAgeMan;
ageValue.value[0] = ageList.value[0].indexOf(res.minAgeMan);
ageValue.value[1] = ageList.value[0].indexOf(res.maxAgeMan);
} else {
if (res.minAgeMan == res.minAgeWoman && res.maxAgeMan == res.maxAgeWoman) {
// 男女不限 1
ageSex.value.ageSexActive = 0;
ageHandler.value = res.minAgeMan + "-" + res.maxAgeMan;
ageValue.value[0] = ageList.value[0].indexOf(res.minAgeMan);
ageValue.value[1] = ageList.value[0].indexOf(res.maxAgeMan);
} else {
// 男女不同 2
ageSex.value.ageSexActive = 1;
womanAgeHandler.value = res.minAgeWoman + "-" + res.maxAgeWoman;
manAgeHandler.value = res.minAgeMan + "-" + res.maxAgeMan;
ageValue.value[0] = ageList.value[0].indexOf(res.minAgeMan);
ageValue.value[1] = ageList.value[0].indexOf(res.maxAgeMan);
// 女性年龄选择列表单独处理
ageWomanValue.value[0] = ageList.value[0].indexOf(res.minAgeWoman);
ageWomanValue.value[1] = ageList.value[0].indexOf(res.maxAgeWoman);
}
}
if (res.visibleRange) {
rangeConfig.value.subVal = res.visibleRange.toString().split("");
setRangeText();
}
console.log("rangeConfig.value.val", rangeConfig.value.val);
console.log("res.onSiteUsers", res.onSiteUsers);
selectedOnsite.value = res.onSiteUsers;
selectedService.value = res.customServiceUsers;
console.log("selectedOnsite.value", selectedOnsite.value);
// 格式化显示职位描述的多个字段
// if (res.cozeStructureRes) {
formatJSON(res.cozeStructureRes);
// }
// 处理职位标签
if (res.jobSpecialLabelNames) {
setJobMark(res.jobSpecialLabelNames);
}
aitext.value = res.lastNotice;
// memberList.value.forEach((item) => {
// selectedService.value.forEach((item1) => {
// if (item.id == item1.userId) {
// item.isSelected = true;
// item1.id = item1.userId;
// }
// });
// });
// residentList.value.forEach((item) => {
// selectedOnsite.value.forEach((item1) => {
// if (item.id == item1.id) {
// item.isSelected = true;
// }
// });
// });
jobConfig.value = {
daotian: res.daotian === 0 ? false : true,
recruitment: res.recruitment == 2 ? false : true,
};
formInfo.value = {...res};
// setTimeout(() => {
// showPage.value = true;
// }, 2000);
console.log("formInfo.value", formInfo.value);
uni.hideLoading();
});
};
// 驻场上拉框的选择
const handleChooseResident = ($item, $index) => {
let that = this;
residentList.value.forEach((item, index) => {
if (index == $index) {
if (item.isSelected) {
item.isSelected = false;
} else {
item.isSelected = true;
}
} else {
item.isSelected = false;
}
});
};
// 客服上拉框的选择
const handleChooseService = ($item, $index) => {
memberList.value.forEach((item, index) => {
if (index == $index) {
if (item.isSelected) {
item.isSelected = false;
} else {
item.isSelected = true;
}
} else {
item.isSelected = false;
}
});
};
// 打开驻场上拉框
const handleOpenModal = () => {
// 处理回显
// let ids = orderDetail.onSiteUsers.length == 0 ? '' : orderDetail.onSiteUsers.map(item => {
// return item.userId;
// }).join(',');
// residentList.filter(item => {
// return ids.indexOf(item.userId) > -1
// }).forEach((item,index) => {
// item.isSelected = true;
// })
isOnsiteShow.value = true;
};
const delSelectedOnsite = (ind, i) => {
selectedOnsite.value.splice(ind, 1);
residentList.value.forEach((item) => {
if (item.id == i.id) {
item.isSelected = false;
}
});
};
// 上传媒体文件
const chooseMedia = () => {
let that = this;
G.uploadMedia((res) => {
console.log(res);
if (res.status == "上传成功") {
let newArr = [];
res.imgList.forEach((item, index) => {
let obj = {};
if (item.indexOf(".mp4") > -1) {
obj.type = "video";
} else {
obj.type = "image";
}
obj.url = item;
obj.id = imgList.value.length == 0 ? index : imgList.value[imgList.value.length - 1].id + 1 + index;
newArr.push(obj);
});
if (imgList.value.length != 0) {
imgList.value = imgList.value.concat(newArr);
} else {
imgList.value = newArr;
}
uni.showToast({
title: "上传成功",
icon: "success",
});
}
uni.hideLoading();
});
};
const delImg = (e) => {
imgList.value.splice(
imgList.value.findIndex((item) => e == item),
1
);
};
// 显示
const showImgs = (e) => {
console.log(e);
let curr = [];
imgList.value.forEach((item) => {
curr.push(item.url);
});
console.log(curr);
uni.previewImage({
current: e, // 当前显示图片的 http 链接
urls: curr, // 需要预览的图片 http 链接列表
});
};
// 显示视频
const showVideo = (e) => {
videoContext.value = uni.createVideoContext(`${e.id}`, this);
videoContext.value.requestFullScreen();
videoContext.value.hideStatusBar();
videoContext.value.play();
};
const fullScreen = (e) => {
console.log(e);
if (!e.detail.fullScreen) {
videoContext.value.stop();
}
};
/**
* 驻场弹出框按钮确认
*/
const submitRes = () => {
let selectedOnsiteInfo = [];
selectedOnsiteInfo = residentList.value.filter((item) => {
return item.isSelected;
});
if (selectedOnsiteInfo.length > 3) {
uni.showToast({
title: "最多选择3个驻场人员",
icon: "none",
});
return false;
}
console.log(selectedOnsiteInfo);
isOnsiteShow.value = false;
selectedOnsite.value = selectedOnsiteInfo;
};
/**
* 客服弹出框按钮确认
*/
const submitService = () => {
let selectedServiceInfo = [];
selectedServiceInfo = memberList.value.filter((item) => {
return item.isSelected;
});
console.log(selectedServiceInfo);
isServiceShow.value = false;
selectedService.value = selectedServiceInfo;
};
const resetInfo = (type = "init") => {
if (type == "init") {
templateArr.value = JSON.parse(JSON.stringify(templateArrCopy.value));
} else {
let hasVal = false;
for (const k in formInfo.value) {
if (formInfo.value[k]) {
hasVal = true;
}
}
templateArr.value.forEach((item) => {
item.children.forEach((innerItem, ind) => {
if (innerItem.value) {
hasVal = true;
}
});
});
return new Promise((reso) => {
if (hasVal) {
G.handleConfirm({
content: type == "ai" ? "AI填表会覆盖所填内容确定要清空内容并重新填写吗" : "确定要清空内容吗?",
success: function (res) {
console.log("res", res);
if (res.confirm) {
formInfo.value.jobName = "";
formInfo.value.salaryDetail = "";
formInfo.value.returnFeeDesp = "";
formInfo.value.storeAddr = "";
formInfo.value.storeLat = "";
formInfo.value.storeLng = "";
formInfo.value.storeName = "";
formInfo.value.jobDesp = "";
jobMark.value = [];
showEmpty.value = false;
resetAge();
resetSalary();
resetMonth();
resetReturnFee();
// 重置职位描述的内容
templateArr.value = JSON.parse(JSON.stringify(templateArrCopy.value));
reso(true);
} else {
reso(false);
}
},
});
} else {
if (type == "ai") {
reso(true);
} else {
uni.showToast({
title: "您还没有填写内容",
icon: "none",
});
}
}
});
}
};
/**
* 重置月薪字段
*/
const resetMonth = () => {
monthValue.value = "";
};
/**
* 重置薪资字段
*/
const resetSalary = () => {
formInfo.value.salaryClassify = 0;
formInfo.value.salaryClassifyValue = "";
};
/**
* 重置佣金相关的字段
*/
const resetReturnFee = () => {
formInfo.value.returnFee = "";
formInfo.value.returnFeeType = 0;
};
/**
* 重置性别年龄相关的字段
*/
const resetAge = () => {
ageSex.value.ageSexActive = 0;
formInfo.value.minAgeWoman = "";
formInfo.value.maxAgeWoman = "";
formInfo.value.minAgeMan = "";
formInfo.value.maxAgeMan = "";
ageHandler.value = "";
manAgeHandler.value = "";
womanAgeHandler.value = "";
dataError.value.ageSex = false;
};
const showFee = () => {
let that = this;
let title = "佣金: " + (formInfo.value.returnFee || "请填写");
let content = formInfo.value.returnFeeDesp || "请填写佣金详情";
uni.showModal({
title,
content,
contentColor: "#ccc",
confirmColor: "#576b95",
confirmText: "确定",
showCancel: false,
success(res) {},
});
};
const getCoordByaddress = (address) => {
// 默认显示北京
let coordObj = { latitude: 39.9042, longitude: 116.4074 };
for (const k in locationList) {
if (address.indexOf(k) != -1) {
coordObj = locationList[k].center;
for (const k_in in locationList[k]) {
if (address.indexOf(k_in) != -1) {
coordObj = locationList[k][k_in];
}
}
} else {
for (const k_in in locationList[k]) {
if (address.indexOf(k_in) != -1) {
coordObj = locationList[k][k_in];
}
}
}
}
return coordObj;
};
const checkAuth = () => {
if (authInfo.value.certificationAuth !== 2) {
G.handleConfirm({
content: "行业资质未认证,暂无法发布到平台。",
confirmText: "去认证",
success: function (res) {
if (res.confirm) {
uni.navigateTo({
url: authInfo.value.realNameAuth !== 2 ? "/root/other/companyAuthentic?stepIndex=0" : "/root/other/companyAuthentic?stepIndex=1", // 跳转到行业资质认证页面
});
}
},
});
} else {
jobConfig.value.daotian = !jobConfig.value.daotian;
}
};
const rangeConfig = ref({
type: 0,
val: [],
subVal: [],
val1: false,
val2: false,
val3: false,
text: "仅自己可见",
});
watch(isRangeShow, (res) => {
console.log("resrsers", res);
if (res) {
setRangeText();
console.log("rangeConfig.value.val", rangeConfig.value.val);
}
});
const getRangeType = (e) => {
console.log(e);
rangeConfig.value.type = e.detail.value;
if (e.detail.value == 0) {
rangeConfig.value.val = [];
rangeConfig.value.val1 = false;
rangeConfig.value.val2 = false;
rangeConfig.value.val3 = false;
}
};
const getRangeVal = (e) => {
console.log(e);
rangeConfig.value.val = e;
};
const submitRange = () => {
let rangeText = [];
console.log("rangeConfig.value", rangeConfig.value);
if (rangeConfig.value.type == 0) {
rangeConfig.value.text = "仅自己可见";
} else {
if (!rangeConfig.value.val1 && !rangeConfig.value.val2 && !rangeConfig.value.val3) {
uni.showToast({
icon: "none",
title: "请至少选择一项",
});
return false;
}
if (rangeConfig.value.val1) rangeText.push("老乡");
if (rangeConfig.value.val2) rangeText.push("代理");
if (rangeConfig.value.val3) rangeText.push("平台");
rangeConfig.value.text = rangeText.join("、") + "可见";
}
rangeConfig.value.subVal = JSON.parse(JSON.stringify(rangeConfig.value.val));
isRangeShow.value = false;
console.log("rangeConfig.value", rangeConfig.value);
};
// 回显设置
const setRangeText = () => {
let rangeText = [];
rangeConfig.value.val = JSON.parse(JSON.stringify(rangeConfig.value.subVal));
rangeConfig.value.val1 = false;
rangeConfig.value.val2 = false;
rangeConfig.value.val3 = false;
if (rangeConfig.value.val.length == 0) {
rangeConfig.value.type = "0";
} else {
rangeConfig.value.type = "1";
rangeConfig.value.val.forEach((item) => {
if (item == "1") {
rangeConfig.value.val1 = true;
} else if (item == "2") {
rangeConfig.value.val2 = true;
} else if (item == "3") {
rangeConfig.value.val3 = true;
}
});
if (rangeConfig.value.val1) rangeText.push("老乡");
if (rangeConfig.value.val2) rangeText.push("代理");
if (rangeConfig.value.val3) rangeText.push("平台");
rangeConfig.value.text = rangeText.join("、") + "可见";
}
};
</script>
<style lang="scss">
@import "@/static/css/filtercss.css";
// page {
// background-color: #f5f5f5;
// // padding: 10px 10px;
// box-sizing: border-box;
// }
.p-root-home-jobForm {
font-size: 16px;
position: relative;
min-height: 100%;
.heightSet {
height: 48px;
line-height: 48px;
}
.m-emask {
position: fixed;
left: 0;
top: 0;
width: 100vw;
height: 100vh;
background-color: rgba(0, 0, 0, 0.5);
z-index: 999;
}
.showdoc {
// box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04), 0 0 6px rgba(0, 0, 0, 0.02);
.menu-obj {
// min-width: 422px;
.menu-btn {
margin-right: 8px;
.btn {
background: rgba(204, 204, 204, 0.2);
border: 1rpx solid transparent;
color: #666666;
white-space: nowrap;
}
}
.menu-active {
.btn {
background: #3578f622;
border: 1rpx solid #3578f6;
color: #3578f6;
box-sizing: border-box;
height: 24px;
line-height: 22px;
}
}
}
}
.bottom-btn {
position: fixed;
width: 100%;
bottom: 0;
left: 0;
background-color: #fff;
padding-top: 12px;
padding-bottom: constant(safe-area-inset-bottom); /*兼容 IOS<11.2*/
padding-bottom: env(safe-area-inset-bottom); /*兼容 IOS>11.2*/
// padding: 16px 0;
min-height: 72px;
border-top: 1rpx solid #eee;
}
.onsiteSub {
padding-left: 8px;
padding-right: 8px;
margin-right: 8px;
height: 24px;
background: #3578f622;
border: 1px solid #3578f6;
border-radius: 4px;
color: #3578f6;
}
.input-close {
// position: absolute;
// width: 18px;
// height: 18px;
// right: 7px;
// top: 2px;
// z-index: 99;
// background-color: #ccc;
// color: #fff;
// font-size: 8px;
// text-align: center;
// line-height: 18px;
// border-radius: 50%;
}
.img-close {
position: absolute;
width: 18px;
height: 18px;
right: -6px;
top: -6px;
z-index: 99;
background-color: #ccc;
color: #fff;
font-size: 8px;
text-align: center;
line-height: 18px;
border-radius: 50%;
}
.btnBox {
position: sticky;
bottom: 0;
padding-top: 12px;
display: flex;
height: unset;
justify-content: center;
background-color: #fff;
}
.popText {
position: sticky;
top: 0;
}
.vertical_line_after {
position: relative;
&::after {
content: "";
position: absolute;
right: -4px;
top: 50%;
transform: translateY(-50%);
width: 1rpx;
height: 48px;
background-color: #eee;
}
}
.vertical_line_before {
position: relative;
&::before {
content: "";
position: absolute;
left: -10px;
top: 50%;
transform: translateY(-50%);
width: 1rpx;
height: 20px;
background-color: #eee;
}
}
.loadBox {
position: absolute;
top: 50%;
transform: translateY(-53%);
}
.u-input__input {
font-size: 16px !important;
}
.AISticky {
position: sticky;
top: 0px;
z-index: 100;
transform: translateX(-10px);
width: 100vw;
height: 300px;
border-bottom: 1px solid #eee;
}
}
</style>