Browse Source

招聘会:职位新增、编辑

Xiao_123 12 hours ago
parent
commit
176ad4deae

+ 22 - 20
components/positionItem/components/baseInfo.vue

@@ -10,15 +10,14 @@
 			<uni-forms-item required label="职位名称" name="name">
         <uni-easyinput v-model="formData.name" placeholder="请填写职位名称"></uni-easyinput>
 			</uni-forms-item>
-      <template v-if="!props.isFair && jobFairList?.length">
-        <!-- 设置为招聘会职位 -->
+      <!-- <template v-if="!props.isFair && jobFairList?.length">
         <uni-forms-item label="招聘会" name="bizId" >
           <view style="max-width: calc(100vw - 110px);">
             <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>
           <view style="color: #777; font-size: 12px;" class="ss-m-t-8 ss-m-l-10">发布的职位会在对应的招聘会显示</view>
         </uni-forms-item>
-      </template>
+      </template> -->
       <!-- <uni-forms-item label="到期时间" name="expireTime" required>
 				<view class="d-flex">
           <picker mode="date" :value="formData.expireTime" :disabled="expireTimeDisabled" :start="startDate" @change="expireTimeChange">
@@ -113,21 +112,21 @@ const editorBlur = (key, val) => {
 }
 
 // 获取企业已加入的招聘会列表
-const jobFairList = ref(false)
-const getJobFairData = async () => {
-  if (props.isFair) return
-  const res = await getJobFairWhiteList()
-  jobFairList.value = res?.data || []
-  if (formData.value.bizId) {
-    if (!jobFairList.value?.length) {
-      formData.value.bizId = '' // 企业已经不在任何招聘会白名单中
-      return
-    }
-    const jobFairItem = jobFairList.value.find(e => e.id === formData.value.bizId)
-    if (!jobFairItem) formData.value.bizId = '' // 招聘会已经关闭 或者已被移除招聘会白名单
-  }
-}
-getJobFairData()
+// const jobFairList = ref(false)
+// const getJobFairData = async () => {
+//   if (props.isFair) return
+//   const res = await getJobFairWhiteList()
+//   jobFairList.value = res?.data || []
+//   if (formData.value.bizId) {
+//     if (!jobFairList.value?.length) {
+//       formData.value.bizId = '' // 企业已经不在任何招聘会白名单中
+//       return
+//     }
+//     const jobFairItem = jobFairList.value.find(e => e.id === formData.value.bizId)
+//     if (!jobFairItem) formData.value.bizId = '' // 招聘会已经关闭 或者已被移除招聘会白名单
+//   }
+// }
+// getJobFairData()
 
 const pushTemplate = () => {
   formData.value.content = jobTemplateRes.value.content
@@ -182,12 +181,15 @@ const getQuery = async () => {
     hirePrice: 0,
     // soFar: Boolean(soFar.value?.length),
     hire: false,
+    expireTime: null,
     ...formData.value
   }
 
-  obj.source = obj.bizId ? '2' : '0' // 职位来源(0职位管理|1众聘职位|2招聘会)
+  // obj.source = props.isFair ? '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 })
+  obj && Object.keys(obj).length && Object.keys(obj).forEach(key => { 
+    if (['areaId', 'eduType', 'expType'].includes(key) && obj[key] === -1)  obj[key] = null 
+  })
 
   return obj
 }

+ 13 - 10
components/positionItem/index.vue

@@ -5,7 +5,7 @@
         <view class="decoration decoration1">1</view>
       </template>
       <!-- 基本信息 -->
-      <baseInfo ref="baseInfoRef" :isFair="Boolean(fairId)" :data="itemData"></baseInfo>
+      <baseInfo ref="baseInfoRef" :data="itemData"></baseInfo>
     </uni-section>
     <uni-section class="ss-m-y-20" title="岗位要求">
       <template v-slot:decoration>
@@ -33,16 +33,16 @@
 <script setup>
 import baseInfo from './components/baseInfo.vue'
 import requirement from './components/requirement.vue'
-import extendInfo from './components/extend.vue'
+// import extendInfo from './components/extend.vue'
 import { ref, nextTick } from 'vue'
 import { onLoad } from '@dcloudio/uni-app'
 import payPopup from '@/components/payPopup'
 import { dealDictObjData } from '@/utils/position'
 import {
   saveJobAdvertised,
-  saveJobAdvertisedExtend,
+  // saveJobAdvertisedExtend,
   getJobDetails,
-  getJobAdvertisedExtend,
+  // getJobAdvertisedExtend,
 } from '@/api/new/position'
 const props = defineProps({
   jobId: String,
@@ -50,10 +50,8 @@ const props = defineProps({
 })
 
 const jobId = ref('')
-const fairId = ref('')
 onLoad((options) => {
   jobId.value = options?.jobId || props.jobId || ''
-  fairId.value = options?.fairId || props.fairId || ''
   if (jobId.value) getPositionDetail(jobId.value)
   else {
     show.value = true
@@ -110,11 +108,11 @@ const getSubmitParams = async() => {
   submitParams = {
     ...baseInfo,
     ...requirement,
-    fair: Boolean(fairId.value), // fair:是否为招聘会职位编辑-必填
+    fair: props.fairId ? true : false, // fair:是否为招聘会职位编辑-必填
     currency_type: 0, // currency_type: 写死0(人民币)
-    source: fairId.value || baseInfo.bizId ? '2' : '0', // source: 0职位管理|1招聘会
-    bizId:  fairId.value || baseInfo.bizId || null,
+    source: props.fairId ? '2' : '0', // source: 职位来源(0职位管理|1众聘职位|2招聘会)
   }
+  if (props.fairId) submitParams.bizId = props.fairId // 招聘会职位添加招聘会id
   
   if (!submitParams.salary) {
     if (!submitParams.payFrom) return uni.showToast({ title: '请填写最低薪资', icon: 'none', duration: 2000 })
@@ -143,7 +141,12 @@ const saveEmit = async (retry) => {
       })
       return
     }
-    uni.switchTab({ url: '/pages/index/position' })
+    if (!props.fairId) uni.switchTab({ url: '/pages/index/position' })
+    else {
+      uni.reLaunch({
+        url: `/pagesB/jobFair/details?id=${props.fairId}`
+      })
+    }
     // const title = itemData.value?.status === '99' '编辑成功,请前往支付' : jobId.value ? '编辑成功' : '发布成功'
     setTimeout(() => { uni.showToast({ title: jobId.value ? '编辑成功' : '发布成功', icon: 'success' }) }, 1000)
 

+ 12 - 0
pages.json

@@ -231,6 +231,18 @@
 					"style": {
 						"navigationBarTitleText": "邀请面试"
 					}
+				},
+				{
+					"path": "jobFair/addJob",
+					"style": {
+						"navigationBarTitleText": "招聘会职位新增"
+					}
+				},
+				{
+					"path": "jobFair/editJob",
+					"style": {
+						"navigationBarTitleText": "招聘会职位编辑"
+					}
 				}
 			]
 		}

+ 16 - 0
pagesB/jobFair/addJob.vue

@@ -0,0 +1,16 @@
+<template>
+  <view>
+    <position :fairId="jobFairId" />
+  </view>
+</template>
+
+<script setup>
+import { ref } from 'vue'
+import { onLoad } from '@dcloudio/uni-app'
+import position from '@/components/positionItem'
+
+const jobFairId = ref('')
+onLoad((options) => {
+	jobFairId.value = options.jobFairId
+})
+</script>

+ 57 - 1
pagesB/jobFair/details.vue

@@ -18,10 +18,17 @@
 			<uni-load-more v-else status="noMore" />
 		</scroll-view>
 
+    <view class="addBtn" @tap="handleClickAdd">
+      <view class="addBox">
+        <view class="icon">+</view>
+        <view class="text">发布新职位</view>
+      </view>
+    </view>
+
 		<view class="bottom-sticky">
 			<view class="bottom-content">
 				<button class="btnStyle bgButtons ss-m-l-15" type="primary" plain="true" @tap.stop="handleToShare">我的分享海报</button>
-        <button class="buttons btnStyle" type="primary" @tap.stop="handleJoinJobFair">职位加入</button>
+        <button class="buttons btnStyle" type="primary" @tap.stop="handleJoinJobFair">克隆已有职位发布</button>
       </view>
 		</view>
 	</view>
@@ -34,6 +41,8 @@ import { getJobFair, getJobFairPosition } from '@/api/jobFair.js'
 import { getJobAdvertisedList } from '@/api/new/position'
 import { dealDictArrayData } from '@/utils/position.js'
 import JobItem from './jobItem.vue'
+import { getAccessToken } from '@/utils/request'
+import { showAuthModal } from '@/hooks/useModal'
 
 const id = ref(null)
 const tab = ref(0)
@@ -114,6 +123,19 @@ const tabChange = (e) => {
   getProgressJobList()
 }
 
+// 职位新增
+const handleClickAdd = () => {
+  if (!getAccessToken()) {
+		uni.showToast({
+			title: '请先登录',
+			icon: 'none'
+		})
+		showAuthModal()
+		return
+	}
+  uni.navigateTo({ url: '/pagesB/jobFair/addJob?jobFairId=' + id.value })
+}
+
 onLoad((options) => {
 	id.value = options.id
 	if (!id.value) {
@@ -207,4 +229,38 @@ const handleToShare = () => {
   padding-bottom: 100rpx;
   box-sizing: border-box;
 }
+.addBtn{
+  position: fixed;
+  margin-bottom: 20px;
+  right: 35rpx;
+  bottom: calc(env(safe-area-inset-bottom) + 60px);
+  width: 70px;
+  .addBox {
+    position: relative;
+    .icon {
+      font-size: 42px;
+      color: #fff;
+      background-color: #00B760;
+      width: 50px;
+      height: 50px;
+      line-height: 46px;
+      text-align: center;
+      border-radius: 50%;
+      margin: 0 auto;
+      box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
+    }
+    .text {
+      position: absolute;
+      top: 42px;
+      font-size: 12px;
+      color: #00B760;
+      background-color: #ffffffc9;
+      text-align: center;
+      padding: 2px 4px;
+      margin: 0 auto;
+      border-radius: 6px;
+      // box-shadow: 0 36px 6px rgba(0, 0, 0, 0.1);
+    }
+  }
+}
 </style>

+ 18 - 0
pagesB/jobFair/editJob.vue

@@ -0,0 +1,18 @@
+<template>
+  <view>
+    <position :jobId="jobId" :fairId="jobFairId" />
+  </view>
+</template>
+
+<script setup>
+import { ref } from 'vue'
+import { onLoad } from '@dcloudio/uni-app'
+import position from '@/components/positionItem'
+
+const jobId = ref('')
+const jobFairId = ref('')
+onLoad((options) => {
+	jobFairId.value = options.jobFairId
+  jobId.value = options.jobId
+})
+</script>

+ 8 - 2
pagesB/positionDetail/index.vue

@@ -156,10 +156,15 @@ async function getPositionDetail () {
 
 // 职位编辑
 const handleEdit = async () => {
-  if (!isEdit.value) {
+  if (!isJobFair.value && !isEdit.value) {
     uni.showToast({ title: '职位发布时间超过24小时的不支持编辑', icon: 'none', duration: 2000 })
     return
   }
+  // 已关闭的招聘会职位不支持编辑
+  if (isJobFair.value && info.value.status === '1') {
+    uni.showToast({ title: '职位已关闭', icon: 'none', duration: 2000 })
+    return
+  }
   uni.showLoading({ title: '加载中 . . . ' })
   try {
     const res = await getEnterprisePubJobTypePermission()
@@ -167,7 +172,8 @@ const handleEdit = async () => {
       uni.showToast({ title: '没有该操作权限,请联系平台管理员升级后再试', icon: 'none', duration: 2000 })
       return
     }
-    uni.navigateTo({ url: `/pagesB/positionEdit/index?jobId=${jobId}` })
+    const url = isJobFair.value ? `/pagesB/jobFair/editJob?jobId=${jobId}&jobFairId=${info.value.bizId}` : `/pagesB/positionEdit/index?jobId=${jobId}`
+    uni.navigateTo({ url })
     // 跳转编辑页面
   } finally {
     uni.hideLoading()