index.vue 33 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036
  1. <template>
  2. <view>
  3. <Navbar :textLeft="false" title="我的聊天" />
  4. <view class="box defaultBgc MiSans-Normal" :style="{'padding-top': navbarHeight + 'px', height: 'calc(100vh - ' + navbarHeight + 'px)'}">
  5. <view class="commonBackground"></view>
  6. <view class="box-top">
  7. <image class="box-top-image" :src="getUserAvatar(info.avatar, info.sex, info.channelID === 'system' ? true : false)" ></image>
  8. <view class="box-top-right MiSans-Normal">
  9. <view class="box-top-right-title">{{ info.name }}</view>
  10. <view class="box-top-right-subText">
  11. {{ info?.postName && info?.postName !== 'null' && info?.postName !== 'undefined' ? info.postName : '' }}
  12. <text v-if="info?.postName && info?.postName !== 'null' && info?.postName !== 'undefined' && info.enterpriseName" class="gun">|</text>
  13. {{ formatName(info.enterpriseName) }}
  14. </view>
  15. </view>
  16. <!-- <uni-notice-bar v-if="hasWaitingProcessingInterview" show-get-more single text="您有待处理的面试邀请,点击查看详情" @click="handleToCenter"/> -->
  17. </view>
  18. <!-- newsId 需要和聊天列表里面的id对应 永远取最后列表中的最后一个就可以做到发送消息即时滚动到底部 -->
  19. <scroll-view ref="chatRef" :scroll-with-animation="scrollAnimation" :scroll-into-view="newsId" class="box-main" scroll-y="true">
  20. <view class="box-main-more" v-if="hasMore">
  21. <text @click="handleMore">查看更多</text>
  22. </view>
  23. <view v-for="(val, index) in items" :key="val.id" :id="'s'+val.id+index">
  24. <view class="box-main-time MiSans-Normal">{{ timesTampChange(+(val.timestamp.padEnd(13, '0'))) }}</view>
  25. <template v-if="val.payload?.type === 102">
  26. <view class="jobCard">
  27. <view class="ss-m-b-12">
  28. <text class="jobCard-title MiSans-Medium ss-m-r-20"> {{ formatName(val.payload?.content?.positionInfo?.name) }}</text>
  29. <text
  30. v-if="!val.payload?.content?.positionInfo?.payFrom && !val.payload?.content?.positionInfo?.payTo"
  31. class="salary-text">
  32. 面议
  33. </text>
  34. <text
  35. v-else-if="val.payload?.content?.positionInfo?.payFrom-0 >= 1000"
  36. class="salary-text"
  37. >
  38. <text>{{ val.payload?.content?.positionInfo?.payFrom ? val.payload?.content?.positionInfo?.payFrom/1000 : ''}}</text>
  39. <text>-</text>
  40. <text>{{ val.payload?.content?.positionInfo?.payTo ? val.payload?.content?.positionInfo?.payTo/1000 : ''}}K</text>
  41. <text>{{ val.payload?.content?.positionInfo?.payName ? '/' + val.payload?.content?.positionInfo?.payName : '' }}</text>
  42. </text>
  43. <text
  44. v-else
  45. class="salary-text"
  46. >
  47. {{ val.payload?.content?.positionInfo?.payFrom || '' }}-{{ val.payload?.content?.positionInfo?.payTo || '' }}{{ val.payload?.content?.positionInfo?.payName ? '/' + val.payload?.content?.positionInfo?.payName : '' }}
  48. </text>
  49. </view>
  50. <view class="font-size-15 ss-m-b-15">
  51. <span class="desc-tag">
  52. <span class="MiSans-Normal">{{val.payload?.content?.positionInfo?.area?.str ?? '全国' }}</span>
  53. <span class="divider-mx" v-if="val.payload?.content?.positionInfo?.eduName">|</span>
  54. <span class="MiSans-Normal">{{val.payload?.content?.positionInfo?.eduName }}</span>
  55. <span class="divider-mx" v-if="val.payload?.content?.positionInfo?.expName">|</span>
  56. <span class="MiSans-Normal">{{val.payload?.content?.positionInfo?.expName }}</span>
  57. </span>
  58. </view>
  59. <view>
  60. </view>
  61. <view class="jobCard-tag">
  62. <view
  63. v-for="(v, i) in (val.payload?.content?.positionInfo?.enterprise?.welfareList || [])"
  64. :key="val.message_id + v + i"
  65. class="tagItem"
  66. >
  67. <!-- <uni-tag
  68. :text="v"
  69. :circle="true"
  70. size="mini"
  71. class="ss-p-5"
  72. type="success"
  73. /> -->
  74. <view class="tag">{{ v }}</view>
  75. </view>
  76. </view>
  77. <view class="jobCard-divider"></view>
  78. <!-- 企业信息 -->
  79. <view class="sub-li-bottom">
  80. <view class="avatarBox">
  81. <image
  82. class="enterAvatar ml default-border default-radius"
  83. :src="val.payload?.content?.positionInfo?.enterprise?.logoUrl || 'https://minio.menduner.com/dev/cd7f5e26a239fb0ab335585e04c709b065f52832fc31539b3a5423224fc6d16c.png'"
  84. ></image>
  85. </view>
  86. <view class="ss-m-l-35">
  87. <view class="mr MiSans-Normal default-text-color">{{ formatName(val.payload?.content?.positionInfo?.enterprise?.anotherName || val.payload?.content?.positionInfo?.enterprise?.name) }}</view>
  88. <span class="color-666 MiSans-Normal ss-m-r-10">{{ val.payload?.content?.positionInfo?.enterprise?.industryName || '' }}</span>
  89. <span class="mr color-666 MiSans-Normal">{{ val.payload?.content?.positionInfo?.enterprise?.scaleName || '' }}</span>
  90. </view>
  91. </view>
  92. <!-- <div class="jobCard-subtitle text-right" v-if="val.payload?.content?.positionInfo?.address">
  93. 地址:{{ val.payload.content.positionInfo.address }}
  94. </div> -->
  95. </view>
  96. </template>
  97. <view :class="['message-view_item', val.from_uid === IM.uid ? 'is-self' : 'is-other']">
  98. <view class="image">
  99. <image
  100. :data-target="getUserAvatar(info.avatar, info.sex, info.channelID === 'system' ? true : false)"
  101. class="header"
  102. :src="(
  103. val.from_uid === IM.uid ?
  104. getUserAvatar(useUserStore.baseInfo?.avatar, useUserStore.baseInfo?.sex) :
  105. getUserAvatar(info.avatar, info.sex, info.channelID === 'system' ? true : false)
  106. )"
  107. ></image>
  108. </view>
  109. <!-- 显示沟通职位 -->
  110. <template v-if="val.payload?.type === 102">
  111. <view class="message-text"
  112. :class="val.from_uid === IM.uid ? 'active' : ''"
  113. :style="{'border-radius': val.from_uid === IM.uid ? '20rpx 20rpx 9rpx 20rpx' : '20rpx 20rpx 20rpx 9rpx'}"
  114. style="background-color: #00B760; color: #fff;"
  115. >
  116. {{ val.payload?.content.text }}
  117. </view>
  118. </template>
  119. <!-- 发起面试邀请 -->
  120. <view class="message-text none" v-else-if="val.payload?.type === 101">
  121. <uni-tag text="发起了面试邀请" custom-style="background-color: #00B760; border-color: #00B760; color: #fff;" />
  122. </view>
  123. <view class="message-text none" v-else-if="val.payload?.type === 103">
  124. <uni-tag text="拒绝了面试邀请" type="error" />
  125. </view>
  126. <view class="message-text none" v-else-if="val.payload?.type === 104">
  127. <uni-tag text="接受了面试邀请" custom-style="background-color: #00B760; border-color: #00B760; color: #fff;" />
  128. </view>
  129. <view v-else-if="val.payload.type === 105" class="text-end">
  130. <uni-tag
  131. v-if="val.from_uid === IM.uid"
  132. :text="val.payload.content?.type === 1 ? '附件简历已发送' : '简历请求已发送'"
  133. custom-style="background-color: #00B760; border-color: #00B760; color: #fff;"
  134. />
  135. <view
  136. v-if="val.payload.content?.type !== 2 || val.from_uid !== IM.uid"
  137. class="message-text card"
  138. >
  139. <view class="text-left">
  140. <text class="MiSans-Normal" v-if="val.payload.content?.type === 1">{{
  141. val.payload.content?.query?.title || '附件简历' }}
  142. </text>
  143. <text class="MiSans-Normal" v-if="val.payload.content?.type === 2">
  144. 我想要一份您的简历,您是否同意
  145. </text>
  146. </view>
  147. <view class="btn-actions">
  148. <text class="btn MiSans-Normal" v-if="val.payload.content?.type === 1" @tap="handlePreview(val.payload)">点击预览附件简历</text>
  149. <text class="btn MiSans-Normal" v-if="val.payload.content?.type === 2" @tap="handleFindResume">点击发送附件简历</text>
  150. </view>
  151. </view>
  152. </view>
  153. <view v-else-if="val.payload.type === -1" class="message-text" :class="{ active: val.from_uid === IM.uid}" style="border-radius: 20rpx 20rpx 20rpx 9rpx;">
  154. {{ val.payload?.content?.text }}
  155. </view>
  156. <view v-else class="message-text" :class="{ active: val.from_uid === IM.uid}"
  157. :style="{'border-radius': val.from_uid === IM.uid ? '20rpx 20rpx 9rpx 20rpx' : '20rpx 20rpx 20rpx 9rpx'}"
  158. style="background-color: #00B760; color: #fff;"
  159. >
  160. {{ val.payload?.content }}
  161. </view>
  162. </view>
  163. </view>
  164. </scroll-view>
  165. <view class="box-bottom" v-if="channelItem?.channelID !== 'system'">
  166. <view class="box-bottom-tool" style="display: flex; justify-content: space-between;">
  167. <text class="toolBtn" :class="{ disabled: !isSendResume }" @tap="handleFindResume">{{ isSendResume ? '简历已投递' : '发送简历' }}</text>
  168. </view>
  169. <view class="d-flex align-end textBox" v-if="channelItem?.channelID !== 'system'">
  170. <textarea
  171. v-model="inputValue"
  172. placeholder="介绍自己回复率更高哦~"
  173. placeholder-style="color: #dddddd;"
  174. class="MiSans-Normal"
  175. :cursor-spacing="25"
  176. :show-confirm-bar="false"
  177. :disable-default-padding="true"
  178. confirm-type="send"
  179. auto-height
  180. @confirm="handleSend"
  181. />
  182. <text class="submitBtn MiSans-Medium" @tap="handleSend">发 送</text>
  183. </view>
  184. </view>
  185. <uni-popup ref="positionPopup" background-color="#fff">
  186. <view style="max-width: 85vw;">
  187. <view class="popup-title" style="min-width: 260px;">
  188. <text class="MiSans-Normal">请选择要投递的职位</text>
  189. <uni-icons type="closeempty" size="20" @tap="positionPopupClose"></uni-icons>
  190. </view>
  191. <view v-for="job in entPositionList" :key="job.value" class="popup-content" @tap="selectJobId = job.value">
  192. <view class="iconBox">
  193. <uni-icons
  194. v-show="selectJobId === job.value"
  195. type="checkmarkempty"
  196. size="20"
  197. :color="selectJobId === job.value ? '#43AC57' : '#999'">
  198. </uni-icons>
  199. </view>
  200. <text class="text" :class="selectJobId === job.value ? 'active' : ''">{{ job.label }}</text>
  201. </view>
  202. <view v-if="entPositionTotal > 5" class="popup-upload ss-m-x-30" @click="changePositionData">
  203. <text style="color: #43AC57;">{{ entPositionListLastData ? '没有更多职位了~ 再选一遍' : '换一批'}}</text>
  204. </view>
  205. </view>
  206. <view class="popup-actions">
  207. <button class="default" type="default" @click="selectPositionSubmit">确认</button>
  208. </view>
  209. </uni-popup>
  210. <uni-popup ref="popup" background-color="#fff">
  211. <view class="popup-title" style="min-width: 260px;">
  212. <text>发送简历选择</text>
  213. <uni-icons type="closeempty" size="20" @tap="handleClose"></uni-icons>
  214. </view>
  215. <view v-if="isStudent" class="ss-p-x-50" style="width: 272px;">
  216. <studentDeliveryForm ref="studentDeliveryFormRef" prefix="实习" formLabelWidth="110px" />
  217. </view>
  218. <view v-for="resume in resumeList" :key="resume.id" class="popup-content" @tap="resumeCheck = resume">
  219. <view class="iconBox">
  220. <uni-icons
  221. v-show="resumeCheck.id === resume.id"
  222. type="checkmarkempty"
  223. size="20"
  224. :color="resumeCheck.id === resume.id ? '#43AC57' : '#999'"></uni-icons>
  225. </view>
  226. <text class="text" :class="resumeCheck.id === resume.id ? 'active' : ''">{{ resume.title }}</text>
  227. </view>
  228. <view v-if="!resumeList.length" class="popup-upload" @click="handleUploadResume">
  229. <view class="popup-upload-box">
  230. <uni-icons type="plusempty" size="50" color="#f1f1f1"></uni-icons>
  231. </view>
  232. <text>温馨提示:您还未上传过简历,点击选取微信聊天文件投递。请在手机上打开此小程序进行文件上传,暂不支持在桌面版小程序中上传文件。</text>
  233. </view>
  234. <view v-if="resumeList.length" class="popup-actions">
  235. <button class="default" type="default" @click="handleSendResume">发送简历</button>
  236. </view>
  237. </uni-popup>
  238. <!-- <uni-popup ref="confirm" type="dialog">
  239. <uni-popup-dialog
  240. :type="isAgree ? 'success' : 'warn'"
  241. cancelText="取消"
  242. confirmText="确认"
  243. title="系统提示"
  244. :content="isAgree ? '确认接受面试吗?' : '确认拒绝面试吗?'"
  245. @confirm="handleConfirm"
  246. @close="handleCloseConfirm"
  247. ></uni-popup-dialog>
  248. </uni-popup> -->
  249. </view>
  250. </view>
  251. </template>
  252. <script setup>
  253. import { ref, watch, onMounted, computed } from 'vue'
  254. import { onLoad } from '@dcloudio/uni-app'
  255. import { useIMStore } from '@/store/im'
  256. import { userStore } from '@/store/user'
  257. import { initConnect, send, initChart, getMoreMessages, toChannel } from '@/hooks/useIM'
  258. import { getDict } from '@/hooks/useDictionaries'
  259. import { timesTampChange } from '@/utils/date'
  260. import { getUserAvatar } from '@/utils/avatar'
  261. import { formatName } from '@/utils/getText'
  262. import { preview } from '@/utils/preview'
  263. import { getPersonResumeCv, saveResume } from '@/api/user'
  264. import { uploadFile } from '@/api/file'
  265. import { chooseMessageFile, uploadAndSaveResume, handleFilePickerError } from '@/pagesA/utils/filePicker'
  266. import { getInterviewInviteListByInviteUserId, getMessageType } from '@/api/common'
  267. // import { userInterviewInviteReject } from '@/api/personalCenter'
  268. import {
  269. getJobAdvertisedSearch,
  270. jobCvRelSend,
  271. jobCvRelCheckSend,
  272. jobCvRelHireSend
  273. } from '@/api/position'
  274. import studentDeliveryForm from '@/components/studentDeliveryForm'
  275. import Navbar from '@/components/Navbar'
  276. const navbarHeight = ref(uni.getStorageSync('navbarHeight'))
  277. const useUserStore = userStore()
  278. const IM = useIMStore()
  279. const info = ref({})
  280. const chatRef = ref()
  281. const items = ref([])
  282. const channelItem = ref(null)
  283. const hasMore = ref(false)
  284. const popup = ref()
  285. const resumeCheck = ref({})
  286. const resumeList = ref([]) // 简历列表
  287. const pageSize = ref(1)
  288. // 求职者面试列表
  289. const interview = ref([])
  290. // 求职端-获取求职者与当前邀请人的面试记录
  291. const statusList = ref([])
  292. const inputValue = ref('')
  293. const newsId = ref('') // newsId 需要和聊天列表里面的id对应 永远取最后列表中的最后一个就可以做到发送消息即时滚动到底部
  294. const scrollAnimation = ref(false)
  295. const isSendResume = ref(false)
  296. const positionInfo = ref({})
  297. const isEmployment = ref('-1')
  298. const isStudent = ref(useUserStore?.baseInfo?.type && Boolean(Number(useUserStore.baseInfo.type) === 1))
  299. onMounted(() => {
  300. setTimeout(() => {
  301. scrollAnimation.value = true
  302. }, 1500)
  303. })
  304. const {
  305. conversationList,
  306. // updateConversation,
  307. updateUnreadCount,
  308. // deleteConversations,
  309. resetUnread
  310. } = initConnect(async (successful) => {
  311. if (!successful) {
  312. uni.showToast({
  313. title: '发送失败',
  314. icon: 'none',
  315. mask: true,
  316. })
  317. return
  318. }
  319. inputValue.value = ''
  320. // chatRef.value.reset()
  321. // // 发送成功
  322. const { list } = await getMoreMessages(1, channelItem.value)
  323. // updateConversation()
  324. items.value = list.value
  325. // chatRef.value.scrollBottom()
  326. })
  327. watch(
  328. () => conversationList.value,
  329. async (val) => {
  330. if (!channelItem.value) {
  331. return
  332. }
  333. const { list } = await getMoreMessages(1, channelItem.value)
  334. if (list.value.length) {
  335. const item = list.value[list.value.length - 1]
  336. const arr = [101, 103, 104]
  337. if (arr.includes(item.payload?.type)) {
  338. getInterviewInviteList()
  339. }
  340. }
  341. items.value = list.value
  342. setScrollBottom()
  343. // 清除未读消息
  344. resetUnread(channelItem.value)
  345. },
  346. {
  347. deep: true,
  348. immediate: true
  349. }
  350. )
  351. async function init(userId, enterpriseId) {
  352. const { channel, list, more } = await initChart(userId, enterpriseId)
  353. hasMore.value = more
  354. channelItem.value = channel.value
  355. items.value = list.value
  356. setScrollBottom()
  357. }
  358. const setScrollBottom = () => {
  359. if (items.value?.length) {
  360. const lastOne = items.value[items.value.length-1]
  361. const index = items.value.length-1
  362. newsId.value = 's' + lastOne.id + index // newsId 需要和聊天列表里面的id对应 永远取最后列表中的最后一个就可以做到发送消息即时滚动到底部
  363. }
  364. }
  365. const hasWaitingProcessingInterview = ref(false) // 是否有待接受的面试邀请
  366. async function getInterviewInviteList () {
  367. if (!info.value.id) return
  368. const { data } = await getInterviewInviteListByInviteUserId(info.value.id)
  369. interview.value = data ? data.slice(0, 1).map(e => {
  370. const statusItem = statusList.value.find(_e => _e.value === e.status)
  371. const statusText = statusItem?.label || ''
  372. const statusColor = ['5', '98', '99'].includes(e.status)
  373. return {
  374. ...e,
  375. statusColor: statusColor ? '#FE574A' : '#0E8E80',
  376. statusText
  377. }
  378. }) : []
  379. hasWaitingProcessingInterview.value = interview.value.some(e => e.status === '0')
  380. }
  381. const getStatusList = async () => {
  382. try {
  383. const { data } = await getDict('menduner_interview_invite_status')
  384. if (data.data.length) {
  385. statusList.value = data.data
  386. }
  387. } catch (error) {
  388. }
  389. }
  390. function handleSend () {
  391. if (!inputValue.value) {
  392. uni.showToast({ title: '不能发送空白信息', icon: 'none' })
  393. return
  394. }
  395. send(inputValue.value, channelItem.value)
  396. }
  397. function handleToCenter () {
  398. uni.navigateTo({
  399. url: '/pagesA/interview/index?index=1'
  400. })
  401. }
  402. // 预览简历
  403. function handlePreview (payload) {
  404. if (!payload?.content?.query?.src) {
  405. uni.showToast({ title: '简历地址不存在', icon: 'none' })
  406. return
  407. }
  408. preview(payload.content.query.src)
  409. }
  410. // 关闭职位列表窗口
  411. function positionPopupClose () {
  412. positionPopup.value.close()
  413. }
  414. // 打开职位列表窗口
  415. function positionPopupOpen () {
  416. positionPopup.value.open('center')
  417. }
  418. // 选中职位并投递
  419. const selectJobId = ref('')
  420. const positionPopup = ref()
  421. const selectPositionSubmit = async () => {
  422. if (!selectJobId.value) return uni.showToast({ title: '请选择要投递的职位', icon: 'none', duration: 3000 })
  423. positionPopupClose()
  424. handleFindResume() // 打开简历列表选择
  425. }
  426. const pageLoading = ref(false)
  427. const entPositionTotal = ref(0)
  428. const entPositionList = ref([])
  429. const entPositionListParams = ref({ pageNo: 1, pageSize: 5 })
  430. const entPositionListLastData = computed(() => entPositionListParams.value.pageNo * entPositionListParams.value.pageSize >= entPositionTotal.value)
  431. // 职位列表
  432. const getRecruitPositionList = async () => {
  433. const enterpriseId = info.value?.enterpriseId || null
  434. if (!enterpriseId) return uni.showToast({ title: '访问企业错误!', icon: 'none', duration: 3000 })
  435. pageLoading.value = true
  436. const res = await getJobAdvertisedSearch({ ...entPositionListParams.value, enterpriseId })
  437. const { list = [], total: number = 0 } = res?.data || {}
  438. if (!list?.length) return uni.showToast({ title: '企业暂无招聘中的职位,无法进行投递!', icon: 'none', duration: 3000 })
  439. entPositionTotal.value = number
  440. entPositionList.value = list.map(j => {
  441. const e = j?.job || null
  442. if (!e) return e
  443. const salary = e.payFrom && e.payTo ? `${e.payFrom ? e.payFrom + '-' : ''}${e.payTo}${e.payName ? '/' + e.payName : ''}` : '面议'
  444. return {
  445. label: `${formatName(e.name)}_${e.areaName ? e.area?.str : '全国'} ${salary}`,
  446. value: e.id,
  447. data: e
  448. }
  449. }).filter(Boolean)
  450. setTimeout(() => { pageLoading.value = false }, 300)
  451. }
  452. const changePositionData = () => {
  453. entPositionListParams.value.pageNo = entPositionListLastData.value ? 1 : entPositionListParams.value.pageNo + 1
  454. selectJobId.value = ''
  455. getRecruitPositionList()
  456. }
  457. // 获取简历
  458. async function handleFindResume () {
  459. if (isSendResume.value) {
  460. return
  461. }
  462. // 没有基于职位接收到的沟通,弹出职位列表让求职者选择。否则无法投递简历。
  463. if (!positionInfo.value.id && !selectJobId.value) {
  464. await getRecruitPositionList()
  465. if (entPositionTotal.value) positionPopupOpen()
  466. return
  467. }
  468. try {
  469. // 获取简历列表
  470. const { data } = await getPersonResumeCv()
  471. if (data.length === 0) {
  472. uni.showToast({
  473. title: '您还未上传过简历,请先上传简历后再投递',
  474. icon: 'none',
  475. mask: true,
  476. duration: 3000
  477. })
  478. }
  479. resumeList.value = data || []
  480. resumeCheck.value = data && data.length ? data[0] : ''
  481. popup.value.open('center')
  482. } finally {
  483. uni.hideLoading()
  484. }
  485. }
  486. // 关闭简历窗口
  487. function handleClose () {
  488. popup.value.close()
  489. }
  490. const studentDeliveryFormRef = ref()
  491. // 发送简历
  492. async function handleSendResume () {
  493. if (!Object.keys(resumeCheck.value).length) {
  494. uni.showToast({ title: '请选择要投递的简历', icon: 'none' })
  495. return
  496. }
  497. let practice = null
  498. if (isStudent.value) {
  499. practice = await studentDeliveryFormRef.value.getQueryParams()
  500. if (!practice) return
  501. }
  502. const text = {
  503. remark: '发送简历',
  504. query: {
  505. src: resumeCheck.value.url,
  506. title: resumeCheck.value.title,
  507. id: resumeCheck.value.id,
  508. },
  509. type: 1
  510. }
  511. try {
  512. if (isEmployment.value !== '-1') {
  513. await jobCvRelHireSend({
  514. jobId: positionInfo.value.id || selectJobId.value,
  515. // ...(jobFairId && { jobFairId }),
  516. url: resumeCheck.value.url,
  517. recommendUserId: isEmployment.value,
  518. ...(practice && { practice }),
  519. })
  520. } else {
  521. await jobCvRelSend({
  522. jobId: positionInfo.value.id || selectJobId.value,
  523. // ...(jobFairId && { jobFairId }),
  524. title: resumeCheck.value.title,
  525. url: resumeCheck.value.url,
  526. type: positionInfo.value.hire ? 1 : 0,
  527. ...(practice && { practice }),
  528. })
  529. }
  530. isSendResume.value = true
  531. send (JSON.stringify(text), channelItem.value, 105)
  532. popup.value.close()
  533. } catch (error) {
  534. if (error?.msg === '该职位已投递') {
  535. isSendResume.value = true
  536. }
  537. popup.value.close()
  538. }
  539. }
  540. // 查看更多
  541. async function handleMore () {
  542. try {
  543. uni.showLoading({
  544. title: '加载中...'
  545. })
  546. pageSize.value++
  547. const { list, more } = await getMoreMessages(pageSize.value, channelItem.value)
  548. items.value.unshift(...list.value)
  549. hasMore.value = more
  550. } finally {
  551. uni.hideLoading()
  552. }
  553. }
  554. // 上传简历
  555. async function handleUploadResume () {
  556. try {
  557. const fileInfo = await chooseMessageFile({
  558. count: 1,
  559. type: 'file',
  560. allowedTypes: ['pdf', 'docx', 'doc'],
  561. maxSize: 20
  562. })
  563. await uploadAndSaveResume(fileInfo, uploadFile, saveResume)
  564. handleFindResume()
  565. } catch (error) {
  566. handleFilePickerError(error)
  567. }
  568. }
  569. // 获取职位信息
  570. async function getMessageTypeSync () {
  571. try {
  572. const { data } = await getMessageType({
  573. fromUid: IM.uid,
  574. channelId: channelItem.value.channelID,
  575. type: 102,
  576. page: {
  577. current: 1,
  578. size: 1,
  579. orders: [
  580. { column: 'message_seq', asc: false }
  581. ]
  582. }
  583. })
  584. if (!data.records || !data.records.length) {
  585. return
  586. }
  587. const _item = data.records.pop()
  588. const _itemJSON = JSON.parse(_item.payload)
  589. const _content = JSON.parse(_itemJSON.content)
  590. positionInfo.value = _content.positionInfo
  591. const { data: check } = await jobCvRelCheckSend({ jobId: _content.positionInfo.id })
  592. isSendResume.value = check
  593. } catch (error) {
  594. console.log(345, error)
  595. }
  596. }
  597. // let jobFairId = ''
  598. onLoad(async (options) => {
  599. info.value = Object.keys(options).reduce((r, k) => {
  600. r[k] = decodeURIComponent(options[k])
  601. return r
  602. }, {})
  603. // jobFairId = info.value.jobFairId
  604. isEmployment.value = info.value.isEmployment
  605. channelItem.value = toChannel(info.value.channelID, info.value.channelType)
  606. if (channelItem.value.channelID === 'system') {
  607. const { list, more } = await getMoreMessages(1, channelItem.value)
  608. hasMore.value = more
  609. items.value = list.value
  610. setScrollBottom()
  611. // 清除未读消息
  612. resetUnread(channelItem.value)
  613. // 更新未读消息
  614. updateUnreadCount()
  615. return
  616. }
  617. await init(info.value.id, info.value.enterpriseId)
  618. // 获取最新的职位信息
  619. await getMessageTypeSync(info.value.id)
  620. await getStatusList()
  621. getInterviewInviteList()
  622. // 清除未读消息
  623. resetUnread(channelItem.value)
  624. // 更新未读消息
  625. updateUnreadCount()
  626. })
  627. </script>
  628. <style lang="scss" scoped>
  629. .mr { margin-right: 20rpx; }
  630. .salary-text {
  631. font-size: 30rpx;
  632. color: #00B760;
  633. text-align: center;
  634. font-family: MiSans-Bold;
  635. font-weight: 500;
  636. text-transform: none;
  637. }
  638. .divider-mx{
  639. margin: 0 10rpx;
  640. }
  641. .desc-tag {
  642. font-family: MiSans-Normal;
  643. font-weight: 400;
  644. font-size: 24rpx;
  645. color: #666666;
  646. text-align: left;
  647. font-style: normal;
  648. text-transform: none;
  649. }
  650. .white {
  651. color: #FFF !important;
  652. }
  653. .text-left {
  654. text-align: left !important;
  655. }
  656. .text-right {
  657. text-align: right !important;
  658. }
  659. .sub-li-bottom {
  660. display: flex;
  661. align-items: center;
  662. font-size: 13px;
  663. padding: 5px;
  664. border-radius: 0 0 12px 12px;
  665. margin-top: 10rpx;
  666. // margin-bottom: 20rpx;
  667. .avatarBox {
  668. // max-width: 40px;
  669. // max-height: 40px;
  670. .enterAvatar{
  671. width: 68rpx;
  672. height: 68rpx;
  673. // border-radius: 50%;
  674. margin: auto;
  675. }
  676. }
  677. }
  678. .box {
  679. width: 100%;
  680. // height: 100vh;
  681. display: flex;
  682. flex-direction: column;
  683. &-top {
  684. z-index: 1;
  685. // width: 100%;
  686. padding: 30rpx 30rpx 0 30rpx;
  687. display: flex;
  688. justify-content: center;
  689. &-image {
  690. width: 80rpx;
  691. height: 80rpx;
  692. border-radius: 50%;
  693. margin-right: 30rpx;
  694. }
  695. &-right {
  696. flex: 1;
  697. display: flex;
  698. flex-direction: column;
  699. justify-content: space-between;
  700. &-title {
  701. box-sizing: border-box;
  702. width: 100%;
  703. // text-align: center;
  704. overflow: hidden;
  705. white-space: nowrap;
  706. text-overflow: ellipsis;
  707. margin-bottom: 10rpx;
  708. }
  709. &-subText {
  710. font-size: .85em;
  711. color: #999;
  712. .gun {
  713. padding: 0 10rpx;
  714. }
  715. }
  716. }
  717. &-content {
  718. padding: 20rpx 50rpx;
  719. padding-bottom: 20rpx;
  720. border-bottom: 2rpx solid #eee;
  721. .color-666 {
  722. color: #666;
  723. }
  724. .font-weight-bold {
  725. font-weight: bold;
  726. }
  727. .color-primary {
  728. color: #00B760;
  729. }
  730. .ml-3 {
  731. margin-left: 40rpx;
  732. }
  733. .mt-1 {
  734. margin-top: 12rpx;
  735. }
  736. .font-size-14 {
  737. font-size: 24rpx;
  738. }
  739. .py-1 {
  740. padding: 4rpx 0;
  741. }
  742. .tipsText {
  743. font-size: .75em;
  744. color: #999;
  745. }
  746. &-t {
  747. display: flex;
  748. justify-content: space-between;
  749. }
  750. .btnBox {
  751. display: flex;
  752. padding: 20rpx 60rpx;
  753. justify-content: space-around;
  754. }
  755. }
  756. }
  757. &-main {
  758. flex: 1;
  759. height: 0;
  760. padding: 40rpx;
  761. // overflow-y: auto;
  762. box-sizing: border-box;
  763. &-more {
  764. display: flex;
  765. justify-content: center;
  766. align-items: center;
  767. color: #24bc3e;
  768. font-size: .9em;
  769. padding: 20rpx 0;
  770. }
  771. &-time {
  772. user-select: none;
  773. position: relative;
  774. top: 16rpx;
  775. margin: 40rpx 0;
  776. text-align: center;
  777. max-height: 40rpx;
  778. text-align: center;
  779. font-weight: 400;
  780. font-size: .85em;
  781. color: #999;
  782. }
  783. .jobCard {
  784. padding: 30rpx;
  785. background: #fbfbfb;
  786. margin: 20rpx 5px;
  787. max-width: unset;
  788. border-radius: 20rpx;
  789. box-shadow: 1px 2px 12px rgba(0, 0, 0, 0.1);
  790. &-title {
  791. // font-size: 1.2em;
  792. font-weight: 600;
  793. font-size: 36rpx;
  794. margin-bottom: 30rpx;
  795. }
  796. &-subtitle {
  797. padding: 10rpx 0;
  798. // font-size: .5em;
  799. }
  800. &-tag {
  801. display: flex;
  802. flex-wrap: wrap;
  803. .tagItem {
  804. margin: 0 5px 3px 0;
  805. .tag {
  806. color: #d4f1e4;
  807. background-color: #00B760;
  808. padding: 2px 8px;
  809. font-size: 24rpx;
  810. border-radius: 30rpx;
  811. font-family: MiSans-Normal;
  812. }
  813. }
  814. }
  815. }
  816. .message-view_item {
  817. display: flex;
  818. flex-direction: row;
  819. align-items: flex-end;
  820. // justify-content: end;
  821. margin: 16rpx 0;
  822. position: relative;
  823. .image {
  824. width: 60rpx;
  825. height: 60rpx;
  826. border-radius: 180rpx;
  827. // flex-grow: 1;
  828. // flex-shrink: 0;
  829. overflow: hidden;
  830. .header {
  831. width: 60rpx;
  832. height: 60rpx;
  833. }
  834. }
  835. .text-end {
  836. text-align: right !important;
  837. width: 400rpx;
  838. margin-right: 20rpx;
  839. }
  840. .message-text {
  841. overflow-wrap: break-word;
  842. background-color: #00B760;
  843. border-radius: 12rpx;
  844. max-width: 75%;
  845. padding: 20rpx;
  846. color: #fff;
  847. font-family: MiSans-Normal;
  848. &.active {
  849. background: #d5e6e8;
  850. }
  851. &.card {
  852. // background: #E2F2F0;
  853. background: #fff;
  854. color: #00B760 ;
  855. margin-top: 20rpx;
  856. max-width: unset;
  857. margin-right: 0;
  858. box-shadow: 1px 2px 12px rgba(0, 0, 0, 0.1);
  859. .btn-actions {
  860. margin: 40rpx auto 20rpx auto ;
  861. text-align: center;
  862. .btn {
  863. padding: 10rpx 30rpx;
  864. background: #C8E7D8;
  865. color: #43AC57;
  866. font-size: .75em;
  867. border-radius: 10rpx;
  868. }
  869. }
  870. }
  871. &.none {
  872. padding: 10rpx 0;
  873. background-color: unset;
  874. }
  875. &.active {
  876. background: #d5e6e8;
  877. }
  878. }
  879. }
  880. .is-self {
  881. flex-direction: row-reverse;
  882. display: flex;
  883. .message-text {
  884. margin-right: 20rpx;
  885. }
  886. }
  887. .is-other {
  888. .message-text {
  889. margin-left: 20rpx;
  890. }
  891. }
  892. }
  893. &-bottom {
  894. max-height: 300rpx;
  895. border-top: 2rpx solid #EEE;
  896. background: #fff;
  897. padding: 20rpx 40rpx 40rpx;
  898. box-sizing: border-box;
  899. &-tool {
  900. margin-bottom: 30rpx;
  901. .toolBtn {
  902. padding: 12rpx 20rpx;
  903. font-size: 24rpx;
  904. background: #00B760;
  905. color: #FFF;
  906. border-radius: 10rpx;
  907. }
  908. }
  909. .textBox {
  910. align-items: flex-end;
  911. }
  912. textarea {
  913. border-radius: 10rpx;
  914. width: 100%;
  915. min-height: 80rpx;
  916. max-height: 180rpx;
  917. padding: 20rpx;
  918. box-sizing: border-box;
  919. background: #f5f5f5;
  920. }
  921. .submitBtn {
  922. width: 140rpx;
  923. line-height: 80rpx;
  924. height: 80rpx;
  925. font-size: 28rpx;
  926. background: #00B760;
  927. color: #FFF;
  928. margin-left: 20rpx;
  929. text-align: center;
  930. border-radius: 10rpx;
  931. }
  932. }
  933. .popup-title {
  934. padding: 30rpx 20rpx;
  935. display: flex;
  936. justify-content: space-between;
  937. border-bottom: 2rpx solid #DDD;
  938. }
  939. .popup-content {
  940. padding: 20rpx 40rpx;
  941. color: #999;
  942. display: flex;
  943. align-content: center;
  944. justify-items: center;
  945. .iconBox {
  946. width: 40rpx;
  947. }
  948. .text {
  949. margin-left: 20rpx;
  950. &.active {
  951. color: #00B760;
  952. }
  953. }
  954. }
  955. .popup-upload {
  956. // display: flex;
  957. // align-items: center;
  958. // justify-content: center;
  959. // flex-direction: column;
  960. // width: 70%;
  961. width: 80vw;
  962. font-size: .75em;
  963. color: #999;
  964. padding: 40rpx;
  965. &-box {
  966. width: 200rpx;
  967. height: 200rpx;
  968. text-align: center;
  969. line-height: 200rpx;
  970. border: 4rpx solid #ddd;
  971. border-radius: 8rpx;
  972. margin: 0 auto;
  973. }
  974. }
  975. .popup-actions {
  976. padding: 60rpx;
  977. .default {
  978. background: #00B760;
  979. color: #DDD;
  980. font-size: .9em;
  981. }
  982. }
  983. }
  984. </style>