Ver código fonte

设置为招聘会职位

lifanagju_citu 1 mês atrás
pai
commit
7c08c3f342

+ 12 - 0
api/jobFair.js

@@ -12,6 +12,18 @@ export const getJobFairList = () => {
   })
 }
 
+// 当前企业白名单的招聘会
+export const getJobFairWhiteList = () => {
+  return request({
+    url: '/app-api/menduner/system/recruit/job-fair/list-by-enterprise',
+    method: 'GET',
+    custom: {
+      showLoading: false,
+      auth: true
+    }
+  })
+}
+
 // 效验是否有权限参加招聘会
 export const checkJobFairPermission = (jobFairId) => {
   return request({

+ 0 - 2
components/RichEditor/index.vue

@@ -117,8 +117,6 @@
 			// isExceedValidate(alert = false, isReturn = false, title = '字数超出限制') {
 			// 	const bool = Boolean(this.max-0 && (this.currentWordCount-0 > this.max-0)) 
 			// 	if (alert && bool) uni.showToast({ title, icon: 'none', duration: 2000 })
-			// 	console.log('字数超出限制:', bool)
-			// 	if (isReturn && bool) return true
 			// },
 			handleBlur() {
 				this.editorCtx.getContents({

+ 11 - 1
components/payPopup/index.vue

@@ -81,6 +81,7 @@ const payType = [
 const payTypeList = ref([])
 // 获取支付方式
 const getPayMethodsList = async () => {
+  console.log('获取支付方式:', )
   payTypeList.value = []
   try {
     const res = await getEnableCodeList({appId: 10})
@@ -102,6 +103,7 @@ const radioChange = (e) => {
 }
 
 const tabBarShow = (show = false) => { // 显示/隐藏TabBar
+  console.log('tabBarShow:', )
   const currentPage = getCurrentPages()
   if (!currentPage) return
   const currentTabBar = currentPage[0]?.getTabBar?.()
@@ -118,6 +120,7 @@ const handleClose = () => {
 const query = ref(null)
 const amount = ref('') // 支付金额
 const handleOpen = (val) => {
+  console.log('handleOpen:', )
   query.value = val
   amount.value = Number(val?.price) ? Number(val?.price)/100 : 0
   tabBarShow(false)
@@ -168,7 +171,8 @@ const bindWeiXin = () => {
 const socialType = 34; // 社交类型 - 微信小程序
 
 // 预支付
-const prepay = async (channel, orderData) => { 
+const prepay = async (channel, orderData) => {
+  console.log('预支付prepay:', )
   return new Promise(async (resolve, reject) => {
     let data = {
       id: orderData?.payOrder?.id,
@@ -207,6 +211,7 @@ const prepay = async (channel, orderData) => {
 let interTimer = null
 let payLoading = false
 const checkPayStatus = async (id) => {
+  console.log('checkPayStatus:', )
   if (!id) return
   uni.showLoading({ title: '加载中' })
   try {
@@ -234,6 +239,7 @@ const checkPayStatus = async (id) => {
 
 // 计时器
 const initIntervalFun = () => {
+  console.log('计时器initIntervalFun:', )
   if (interTimer) clearInterval(interTimer)
 
   // 查询是否已经支付
@@ -247,6 +253,7 @@ const initIntervalFun = () => {
 
 const orderInfo = ref({})
 const weChatMiniProgramPay = async (data) => {
+  console.log('weChatMiniProgramPay:', )
   orderInfo.value = data
   let res = await prepay(channelValue.value, data); // 预支付
   if (res?.code !== 0) {
@@ -279,6 +286,7 @@ const weChatMiniProgramPay = async (data) => {
 
 // 确认支付
 const handlePay = async (retry = false) => {
+  console.log('确认支付handlePay:', )
   if (!channelValue.value) {
     uni.showToast({ title: '请选择支付方式', icon: 'none'})
     return
@@ -303,6 +311,7 @@ const handlePay = async (retry = false) => {
 }
 
 const setOrderCreated = async () => {
+  console.log('setOrderCreated-createTradeOrder:', )
   const params = {
     spuId: query.value?.spuId, // 商品编号
     type: query.value?.type, // 订单类型 0平台订单|1发布职位|2发布众聘职位|3会员套餐|4企业会员套餐|5招聘会门票
@@ -322,6 +331,7 @@ onHide(() => {
 })
 
 const popupChange = (e) => {
+  console.log('popupChange:', )
   if (!e || e.show === undefined) return
   if (e.show) {
     // 支付弹窗打开

+ 32 - 8
components/positionItem/components/baseInfo.vue

@@ -1,6 +1,13 @@
 <template>
 	<view class="f-straight wrapper">
 		<uni-forms ref="form" :modelValue="formData" :rules="rules" validateTrigger="bind" label-width="90px" label-align="right">
+      <template v-if="!props.isFair && jobFairLIst?.length">
+        <!-- 设置为招聘会职位 -->
+        <uni-forms-item label="招聘会" name="bizId" >
+          <uni-data-picker class="picker" popup-title="请选择招聘会" v-model="formData.bizId" :localdata="jobFairLIst" :clear-icon="false" :map="{ text: 'title', value: 'id'}"></uni-data-picker>
+          <view style="color: #777; font-size: 12px;" class="ss-m-t-8 ss-m-l-10">职位会在对应的招聘会显示</view>
+        </uni-forms-item>
+      </template>
 			<uni-forms-item label="职位类型" name="positionId" required>
         <view class="positionTemplate">
           <uni-data-picker class="picker" popup-title="请选择职位类型" v-model="formData.positionId" :localdata="dictObj?.positionTreeData || []" :clear-icon="false" :map="{ text: 'nameCn', value: 'id'}"></uni-data-picker>
@@ -19,10 +26,10 @@
         </view>
 			</uni-forms-item>
       <uni-forms-item label="岗位职责" name="content" required>
-        <RichEditor ref="contentRef" :richValue="formData.content" @blur="val => editorBlur('content', val)" :max="1500" />
+        <RichEditor ref="contentRef" :richValue="formData.content" @blur="val => editorBlur('content', val)" :max="5000" />
 			</uni-forms-item>
       <uni-forms-item label="岗位要求 " name="requirement" required>
-        <RichEditor ref="requirementRef" :richValue="formData.requirement" @blur="val => editorBlur('requirement', val)" :max="1500" />
+        <RichEditor ref="requirementRef" :richValue="formData.requirement" @blur="val => editorBlur('requirement', val)" :max="5000" />
 			</uni-forms-item>
 		</uni-forms>
     <!-- 确认框 -->
@@ -45,15 +52,21 @@ import { dictObj } from '@/utils/position.js'
 import { getNextDate } from '@/utils/date'
 import { getRecruitPositionDetails } from '@/api/new/position'
 import { dateToTimestamp } from '@/utils/date.js'
+import { getJobFairWhiteList } from '@/api/jobFair'
 import RichEditor from '@/components/RichEditor'
 const props = defineProps({
   data: {
     type: Object,
     default: () => {}
+  },
+  isFair: {
+    type: Boolean,
+    default: false
   }
 })
 
 const formData = ref({
+  bizId: props.data?.bizId || '',
   positionId: props.data?.positionId || '',
   name: props.data?.name || '', // + new Date().getTime().toString()
   expireTime: props.data?.expireTime || getNextDate(15, 'YYYY-MM-DD', 'day'),
@@ -73,6 +86,9 @@ const expireTimeChange = (e) => {
 }
 
 const rules = {
+	positionId:{
+		rules: [{required: true, errorMessage: '请选择职位类型' }]
+	},
 	positionId:{
 		rules: [{required: true, errorMessage: '请选择职位类型' }]
 	},
@@ -94,6 +110,15 @@ const editorBlur = (key, val) => {
   formData.value[key] = val || ''
 }
 
+// 获取企业已加入的招聘会列表
+const jobFairLIst = ref(false)
+const getJobFairData = async () => {
+  if (props.isFair) return
+  const res = await getJobFairWhiteList()
+  jobFairLIst.value = res?.data || []
+}
+getJobFairData()
+
 const pushTemplate = () => {
   formData.value.content = jobTemplateRes.value.content
   formData.value.requirement = jobTemplateRes.value.requirement
@@ -121,7 +146,7 @@ const useJobTemplate = async () => {
   if (!formData.value.positionId) return Snackbar.warning('请先选择职位类型')
   // 获取职位模板内容-赋值
   const res = await getRecruitPositionDetails(formData.value.positionId)
-  if (!res?.data || !res.data .content || !res.data .requirement) {
+  if (!res?.data || !res.data .content || !res.data.requirement) {
     uni.showToast({ title: '此职位类型没有可使用的模板!', icon: 'none', duration: 2000 })
     return
   }
@@ -150,9 +175,7 @@ const getQuery = async () => {
     ...formData.value
   }
 
-  // obj.contentLength = contentRef.value?.currentWordCount || 0
-  // obj.requirementLength = requirementValid.value?.currentWordCount || 0
-
+  obj.source = obj.bizId ? '2' : '0' // 职位来源(0职位管理|1众聘职位|2招聘会)
   obj.expireTime = obj.soFar ? null : dateToTimestamp(obj.expireTime)
   obj && Object.keys(obj).length && Object.keys(obj).forEach(key => { if (['areaId', 'eduType', 'expType'].includes(key) && obj[key] === -1)  obj[key] = null })
   return obj
@@ -174,7 +197,8 @@ defineExpose({
 }
 
 :deep(.uni-forms-item__content) {
-	max-width: 100%;
-	overflow: hidden;
+  width: 100% !important;
+	overflow: hidden !important;
 }
+
 </style>

+ 14 - 4
components/positionItem/components/requirement.vue

@@ -54,7 +54,7 @@
 	</view>
 </template>
 <script setup>
-import { ref, unref, computed } from 'vue'
+import { ref, unref, watch, computed } from 'vue'
 import { dictObj } from '@/utils/position.js'
 import { getEnterprisePubJobTypePermission } from '@/api/new/position'
 import portrait from './portrait.vue'
@@ -68,22 +68,32 @@ const props = defineProps({
 
 const formData = ref({
   type: props.data?.type || '',
-  eduType: props.data?.eduType ? props.data?.eduType : props.data ? -1 : '',
-  expType: props.data?.expType ? props.data?.expType : props.data ? -1 : '',
+  eduType: props.data?.eduType ? props.data?.eduType : props.data?.eduType === null ? -1 : '',
+  expType: props.data?.expType ? props.data?.expType : props.data?.expType === null ? -1 : '',
   payFrom: props.data?.payFrom || '',
   payTo: props.data?.payTo || '',
   payUnit: props.data?.payUnit || '',
-  areaId: props.data?.areaId ? props.data?.areaId : props.data ? -1 : '',
+  areaId: props.data?.areaId ? props.data?.areaId : props.data?.areaId === null ? -1 : '',
   address: props.data?.address || '',
 })
 const tagList = ref(props.data?.tagList?.length ? props.data.tagList : [])
 
+watch(
+  () => props.data, 
+  (newVal) => {
+    salary.value = newVal?.payUnit === null ? [1] : []
+  },
+  { immediate: true },
+  { deep: true }
+)
+
 const salaryDisabled = computed(() => {
   return Boolean(salary?.value.length)
 })
 
 const salaryCheckboxChange = (e) => {
   // const bool = e.detail.value.length ? e.detail.value[0] : ''
+  // salary.value = bool ? [1] : []
 }
 
 const rules = {

+ 21 - 20
components/positionItem/index.vue

@@ -5,7 +5,7 @@
         <view class="decoration decoration1">1</view>
       </template>
       <!-- 基本信息 -->
-      <baseInfo ref="baseInfoRef" :data="itemData"></baseInfo>
+      <baseInfo ref="baseInfoRef" :isFair="Boolean(fairId)" :data="itemData"></baseInfo>
     </uni-section>
     <uni-section v-if="show" class="ss-m-y-20" title="岗位要求">
       <template v-slot:decoration>
@@ -46,16 +46,17 @@ import {
   getJobAdvertisedExtend,
 } from '@/api/new/position'
 const props = defineProps({
-  jobId: String
+  jobId: String,
+  fairId: String,
 })
 
-let jobId = ''
-let fairId = ''
+const jobId = ref('')
+const fairId = ref('')
 onLoad((options) => {
-  jobId = options?.jobId || props.jobId || ''
-  fairId = options?.fairId || ''
-  console.log('jobId:', jobId); console.log('fairId:', fairId)
-  if (jobId) getPositionDetail(jobId)
+  console.log('options:', options) //
+  jobId.value = options?.jobId || props.jobId || ''
+  fairId.value = options?.fairId || props.fairId || ''
+  if (jobId.value) getPositionDetail(jobId.value)
   else {
     show.value = showExtend.value = true
   }
@@ -79,8 +80,8 @@ const getPositionDetail = async (id) => {
 // 获取实习扩展信息
 const showExtend = ref(false)
 const extendData = ref({})
-const getPositionExtendDetail = async (jobId) => {
-  const res = await getJobAdvertisedExtend(jobId)
+const getPositionExtendDetail = async (id) => {
+  const res = await getJobAdvertisedExtend(id)
   extendData.value = res?.data || {}
   showExtend.value = true // 实习表单显示
 }
@@ -93,18 +94,20 @@ const getSubmitParams = async() => {
   const baseInfo = await baseInfoRef.value.getQuery()
   const requirement = await requirementRef.value.getQuery()
   if (!baseInfo || !requirement) return
-  // if (baseInfo.contentLength > 1500) uni.showToast({ title: '岗位职责字数超出限制', icon: 'none', duration: 2000 })
-  // if (baseInfo.requirementLength > 1500) uni.showToast({ title: '岗位要求字数超出限制', icon: 'none', duration: 2000 })
+
+  // if (cleanedHtml(baseInfo.content)?.length > 5000) return uni.showToast({ title: '岗位职责字数超出限制', icon: 'none', duration: 2000 })
+  // if (cleanedHtml(baseInfo.requirement)?.length > 5000) return uni.showToast({ title: '岗位要求字数超出限制', icon: 'none', duration: 2000 })
   
   submitParams = {
     ...baseInfo,
     ...requirement,
-    fair: Boolean(fairId), // fair:是否为招聘会职位编辑-必填
+    fair: Boolean(fairId.value), // fair:是否为招聘会职位编辑-必填
     currency_type: 0, // currency_type: 写死0(人民币)
-    source: fairId ? '2' : '0', // source: 0职位管理|1招聘会
-    bizId:  fairId ? fairId : null,
+    source: fairId.value || baseInfo.bizId ? '2' : '0', // source: 0职位管理|1招聘会
+    bizId:  fairId.value || baseInfo.bizId || null,
   }
-  if (jobId) submitParams.id = jobId  // 有id则为编辑
+  
+  if (jobId.value) submitParams.id = jobId.value  // 有id则为编辑
   saveEmit()
 }
 // 
@@ -120,18 +123,16 @@ const saveEmit = async (retry) => {
     // status:99为待支付职位,弹窗支付
     if (submitParams?.status && submitParams?.status === '99') {
       showPay.value = true
-      console.log('1payRef:', payRef.value)
       uni.showToast({ title: '当前可发布职位额度不足,请支付', icon: 'none', duration: 2000 })
       nextTick(() => {
         // 金额*100,页面展示/100
-        console.log('2payRef:', payRef.value?.handleOpen)
         payRef.value && payRef.value.handleOpen({ spuId: _jobId||'', spuName: submitParams?.name||'', price, type: 1 })
       })
       return
     }
     uni.switchTab({ url: '/pages/index/position' })
-    // const title = itemData.value?.status === '99' '编辑成功,请前往支付' : 
-    setTimeout(() => { uni.showToast({ title: jobId ? '编辑成功' : '发布成功', icon: 'success' }) }, 1000)
+    // const title = itemData.value?.status === '99' '编辑成功,请前往支付' : jobId.value ? '编辑成功' : '发布成功'
+    setTimeout(() => { uni.showToast({ title: jobId.value ? '编辑成功' : '发布成功', icon: 'success' }) }, 1000)
 
   } catch (error) {
     console.log('error:', error)