zhengnaiwen_citu hai 7 meses
pai
achega
b096fd0b38
Modificáronse 4 ficheiros con 94 adicións e 22 borrados
  1. 12 0
      api/common.js
  2. 4 3
      pages/index/communicate.vue
  3. 68 17
      pagesA/chart/index.vue
  4. 10 2
      pagesB/positionDetail/index.vue

+ 12 - 0
api/common.js

@@ -259,6 +259,18 @@ export const deleteConversation = async (data) => {
     }
   })
 }
+// 获取type类型聊天记录
+export const getMessageType = async (data) => {
+  return request({
+    url: '/app-api/im/im/history/messages',
+    method: 'POST',
+    data,
+    custom: {
+      showLoading: false,
+      auth: true
+    }
+  })
+}
 
 // 求职端-根据邀请人id获取面试邀约列表
 export const getInterviewInviteListByInviteUserId = async (inviteUserId) => {

+ 4 - 3
pages/index/communicate.vue

@@ -62,13 +62,13 @@ const useUserStore = userStore()
 const items = ref([])
 watch([() => useUserStore.refreshToken, () => IM.newMsg], () => {
 	// 检测实例是否存在
-	if (!IM.uid.value) {
+	if (!IM.uid?.value) {
 		return
 	}
 	init()
 })
 
-watch(() => IM.uid.value, (val) => {
+watch(() => IM.uid, (val) => {
 	if (!val) {
 		return
 	}
@@ -87,7 +87,8 @@ onShow(() => {
 
 
 
-const handleTo = ({ userInfoVo, thatName, postNameCn, enterpriseAnotherName, channel_id }) => {
+const handleTo = (item) => {
+	const { userInfoVo, thatName, postNameCn, enterpriseAnotherName, channel_id } = item
 	const query = {
 		id: userInfoVo?.userInfoResp?.userId,
 		name: thatName,

+ 68 - 17
pagesA/chart/index.vue

@@ -147,7 +147,7 @@
     <!-- </view> -->
     <view class="box-bottom">
       <view class="box-bottom-tool">
-        <uni-tag text="发送简历" type="success" @tap="handleFindResume"/>
+        <uni-tag :text="isSendResume ? '简历已投递' : '发送简历'" :disabled="isSendResume" type="success" @tap="handleFindResume"/>
       </view>
       
       <textarea
@@ -208,8 +208,13 @@ import { timesTampChange } from '@/utils/date'
 import { getUserAvatar } from '@/utils/avatar'
 import { preview } from '@/utils/preview'
 import { getPersonResumeCv, saveResume } from '@/api/user'
-import { getInterviewInviteListByInviteUserId } from '@/api/common'
+import { getInterviewInviteListByInviteUserId, getMessageType } from '@/api/common'
 import { userInterviewInviteReject, userInterviewInviteConsent } from '@/api/personalCenter'
+import {
+  jobCvRelSend,
+  jobCvRelCheckSend,
+  jobCvRelHireSend
+} from '@/api/position'
 
 const useUserStore = userStore()
 const IM = useIMStore()
@@ -237,6 +242,10 @@ const chooseInvite = ref(null)
 
 const scrollInto = ref(0)
 
+const isSendResume = ref(false)
+const positionInfo = ref({})
+const isEmployment = ref('-1')
+
 const {
   conversationList,
   // updateConversation,
@@ -340,6 +349,9 @@ function handlePreview (payload) {
 }
 // 获取简历
 async function handleFindResume () {
+  if (isSendResume.value) {
+    return
+  }
   uni.showLoading({
     title: '真正查找简历'
   })
@@ -368,7 +380,7 @@ function handleClose () {
 }
 
 // 发送简历
-function handleSendResume () {
+async function handleSendResume () {
   if (!Object.keys(resumeCheck.value).length) {
     uni.showToast({ title: '请选择要投递的简历', icon: 'none' })
     return
@@ -376,16 +388,34 @@ function handleSendResume () {
   const text = {
     remark: '发送简历',
     query: {
-      src: resumeCheck.url,
-      title: resumeCheck.title,
-      id: resumeCheck.id,
+      src: resumeCheck.value.url,
+      title: resumeCheck.value.title,
+      id: resumeCheck.value.id,
     },
     type: 1
   }
   send (JSON.stringify(text), channelItem.value, 105)
-  // 提交简历
-  // {jobId, title, type, url}
-  popup.value.close()
+  console.log(isEmployment.value, positionInfo.value)
+  try {
+    if (isEmployment.value !== '-1') {
+      await jobCvRelHireSend({
+        jobId: positionInfo.value.id,
+        url: resumeCheck.value.url,
+        recommendUserId: isEmployment.value
+      })
+    } else {
+      await jobCvRelSend({
+        jobId: positionInfo.value.id,
+        title: resumeCheck.value.title,
+        url: resumeCheck.value.url,
+        type: positionInfo.value.hire ? 1 : 0
+      })
+    }
+    isSendResume.value = true
+    popup.value.close()
+  } catch (error) {
+
+  }
 }
 
 // 拒绝邀请
@@ -471,13 +501,32 @@ function handleUploadResume () {
   })
 }
 
-// 根据id检测是否有发过简历
-async function checkResume (jobId) {
+// 获取职位信息
+async function getMessageTypeSync () {
   try {
-    const { data } = await getJobFavoriteCheck({ jobId })
-    console.log(data)
+    const { data } = await getMessageType({
+      fromUid: IM.uid,
+      channelId: channelItem.value.channelID,
+      type: 102,
+      page: {
+        current: 1,
+        size: 1,
+        orders: [
+          { column: 'message_seq', asc: false }
+        ]
+      }
+    })
+    if (!data.records || !data.records.length) { 
+      return
+    }
+    const _item = data.records.pop()
+    const _itemJSON = JSON.parse(_item.payload)
+    const _content = JSON.parse(_itemJSON.content)
+    positionInfo.value = _content.positionInfo
+    const { data: check } = await jobCvRelCheckSend({ jobId: _content.positionInfo.id })
+    isSendResume.value = check
   } catch (error) {
-    
+    console.log(345, error)
   }
 }
 
@@ -486,9 +535,11 @@ onLoad(async (options) => {
     r[k] = decodeURIComponent(options[k])
     return r
   }, {})
-  // console.log(info.value)
-  // await checkResume(info.value.enterpriseId)
-  await init(options.id, options.enterpriseId)
+  isEmployment.value = info.value.isEmployment
+  await init(info.value.id, info.value.enterpriseId)
+  // 获取最新的职位信息
+  await getMessageTypeSync(info.value.id)
+
   await getStatusList()
   getInterviewInviteList()
   // 清除未读消息

+ 10 - 2
pagesB/positionDetail/index.vue

@@ -212,7 +212,7 @@ import {
 import { getPersonResumeCv, saveResume } from '@/api/user'
 import { dealDictObjData } from '@/utils/position'
 import { getAccessToken } from '@/utils/request'
-import { onLoad,onShareAppMessage,onShareTimeline } from '@dcloudio/uni-app'
+import { onLoad,onShareAppMessage,onShareTimeline, onShow } from '@dcloudio/uni-app'
 import { prologue, defaultText } from '@/hooks/useIM'
 
 const sharePopup = ref()
@@ -258,9 +258,16 @@ onLoad((options) => {
   }
 })
 
+onShow(() => {
+  if (!jobId) {
+    return
+  }
+  deliveryCheck()
+})
+
 // 效验是否有投递过简历
 const delivery = ref(false) // 是否已投递简历
-const deliveryCheck = async () => {
+async function deliveryCheck () {
   try {
     if (!getAccessToken()) return delivery.value = false
     const { data } = await jobCvRelCheckSend({ jobId })
@@ -346,6 +353,7 @@ async function handleSend () {
   // 跳转
   const query = {
 		id: userId,
+    isEmployment: isEmployment.value ? isEmployment.value : '-1',
 		name: info.value?.contact?.name,
 		postName: info.value?.contact?.postNameCn,
 		enterpriseName: info.value?.enterprise?.anotherName,