Browse Source

没有基于职位接收到的沟通,弹出职位列表让求职者选择。否则无法投递简历。

lifanagju_citu 2 months ago
parent
commit
65df57bbb4
1 changed files with 100 additions and 5 deletions
  1. 100 5
      pagesA/chart/index.vue

+ 100 - 5
pagesA/chart/index.vue

@@ -171,8 +171,34 @@
         <text class="submitBtn" @tap="handleSend">发 送</text>
       </view>
     </view>
+
+    <uni-popup ref="positionPopup" background-color="#fff">
+      <view style="max-width: 85vw;">
+        <view class="popup-title" style="min-width: 260px;">
+          <text>请选择要投递的职位</text>
+          <uni-icons type="closeempty" size="20" @tap="positionPopupClose"></uni-icons>
+        </view>
+        <view v-for="job in entPositionList" :key="job.value" class="popup-content" @tap="selectJobId = job.value">
+          <view class="iconBox">
+            <uni-icons
+              v-show="selectJobId === job.value"
+              type="checkmarkempty"
+              size="20"
+              :color="selectJobId === job.value ? '#43AC57' : '#999'"></uni-icons>
+          </view>
+          <text class="text" :class="selectJobId === job.value ? 'active' : ''">{{ job.label }}</text>
+        </view>
+        <view v-if="entPositionTotal > 5" class="popup-upload ss-m-x-30" @click="changePositionData">
+          <text style="color: #43AC57;">{{ entPositionListLastData ? '没有更多职位了~ 再选一遍' : '换一批'}}</text>
+        </view>
+      </view>
+      <view class="popup-actions">
+        <button class="default" type="default" @click="selectPositionSubmit">确认</button>
+      </view>
+    </uni-popup>
+
     <uni-popup ref="popup" background-color="#fff">
-      <view class="popup-title">
+      <view class="popup-title" style="min-width: 260px;">
         <text>发送简历选择</text>
         <uni-icons type="closeempty" size="20" @tap="handleClose"></uni-icons>
       </view>
@@ -215,7 +241,7 @@
 </template>
 
 <script setup>
-import { ref, watch, onMounted } from 'vue'
+import { ref, watch, onMounted, computed } from 'vue'
 import { onLoad } from '@dcloudio/uni-app'
 import { useIMStore } from '@/store/im'
 import { userStore } from '@/store/user'
@@ -230,6 +256,7 @@ import { uploadFile } from '@/api/file'
 import { getInterviewInviteListByInviteUserId, getMessageType } from '@/api/common'
 // import { userInterviewInviteReject } from '@/api/personalCenter'
 import {
+  getJobAdvertisedSearch,
   jobCvRelSend,
   jobCvRelCheckSend,
   jobCvRelHireSend
@@ -392,11 +419,75 @@ function handlePreview (payload) {
   }
   preview(payload.content.query.src)
 }
+
+// 关闭职位列表窗口
+function  positionPopupClose () {
+  positionPopup.value.close()
+}
+
+// 打开职位列表窗口
+function positionPopupOpen () {
+  positionPopup.value.open('center')
+}
+
+// 选中职位并投递
+const selectJobId = ref('')
+const positionPopup = ref()
+const selectPositionSubmit = async () => {
+  if (!selectJobId.value) return uni.showToast({ title: '请选择要投递的职位', icon: 'none', duration: 3000 })
+  positionPopupClose()
+  handleFindResume() // 打开简历列表选择
+}
+
+const pageLoading = ref(false)
+const entPositionTotal = ref(0)
+const entPositionList = ref([])
+const entPositionListParams = ref({ pageNo: 1, pageSize: 5 })
+const entPositionListLastData = computed(() => entPositionListParams.value.pageNo * entPositionListParams.value.pageSize >=  entPositionTotal.value)
+// 职位列表
+const getRecruitPositionList = async () => {
+  const enterpriseId = info.value?.enterpriseId || null
+  if (!enterpriseId) return uni.showToast({ title: '访问企业错误!', icon: 'none', duration: 3000 })
+
+  pageLoading.value = true
+  const res = await getJobAdvertisedSearch({ ...entPositionListParams.value, enterpriseId })
+  const { list = [], total: number = 0 } = res?.data || {}
+  if (!list?.length) return uni.showToast({ title: '企业暂无招聘中的职位,无法进行投递!', icon: 'none', duration: 3000 })
+
+  entPositionTotal.value = number
+  entPositionList.value = list.map(j => {
+    const e = j?.job || null
+    if (!e) return e
+    const salary = e.payFrom && e.payTo ? `${e.payFrom ? e.payFrom + '-' : ''}${e.payTo}${e.payName ? '/' + e.payName : ''}` : '面议'
+    return {
+      label: `${formatName(e.name)}_${e.areaName ? e.area?.str : '全国'} ${salary}`,
+      value: e.id,
+      data: e
+    }
+  }).filter(Boolean)
+  
+  setTimeout(() => { pageLoading.value = false }, 300)
+}
+
+const changePositionData = () => {
+  entPositionListParams.value.pageNo = entPositionListLastData.value ? 1 : entPositionListParams.value.pageNo + 1
+  selectJobId.value = ''
+  getRecruitPositionList()
+}
+
 // 获取简历
 async function handleFindResume () {
   if (isSendResume.value) {
     return
   }
+
+  // 没有基于职位接收到的沟通,弹出职位列表让求职者选择。否则无法投递简历。
+  if (!positionInfo.value.id && !selectJobId.value) {
+    await getRecruitPositionList()
+    if (entPositionTotal.value) positionPopupOpen()
+    return
+  }
+
   try {
     // 获取简历列表
     const { data } = await getPersonResumeCv()
@@ -444,11 +535,10 @@ async function handleSendResume () {
     },
     type: 1
   }
-  send (JSON.stringify(text), channelItem.value, 105)
   try {
     if (isEmployment.value !== '-1') {
       await jobCvRelHireSend({
-        jobId: positionInfo.value.id,
+        jobId: positionInfo.value.id || selectJobId.value,
         // ...(jobFairId && { jobFairId }),
         url: resumeCheck.value.url,
         recommendUserId: isEmployment.value,
@@ -456,7 +546,7 @@ async function handleSendResume () {
       })
     } else {
       await jobCvRelSend({
-        jobId: positionInfo.value.id,
+        jobId: positionInfo.value.id || selectJobId.value,
         // ...(jobFairId && { jobFairId }),
         title: resumeCheck.value.title,
         url: resumeCheck.value.url,
@@ -465,8 +555,13 @@ async function handleSendResume () {
       })
     }
     isSendResume.value = true
+    send (JSON.stringify(text), channelItem.value, 105)
     popup.value.close()
   } catch (error) {
+    if (error?.msg === '该职位已投递') {
+      isSendResume.value = true
+    }
+    popup.value.close()
   }
 }