index.vue 34 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099
  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.citupro.com/dev/menduner/company-avatar.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}">
  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 { getInterviewInviteListByInviteUserId, getMessageType } from '@/api/common'
  266. // import { userInterviewInviteReject } from '@/api/personalCenter'
  267. import {
  268. getJobAdvertisedSearch,
  269. jobCvRelSend,
  270. jobCvRelCheckSend,
  271. jobCvRelHireSend
  272. } from '@/api/position'
  273. import studentDeliveryForm from '@/components/studentDeliveryForm'
  274. import Navbar from '@/components/Navbar'
  275. const navbarHeight = ref(uni.getStorageSync('navbarHeight'))
  276. const useUserStore = userStore()
  277. const IM = useIMStore()
  278. const info = ref({})
  279. const chatRef = ref()
  280. const items = ref([])
  281. const channelItem = ref(null)
  282. const hasMore = ref(false)
  283. const popup = ref()
  284. const resumeCheck = ref({})
  285. const resumeList = ref([]) // 简历列表
  286. const pageSize = ref(1)
  287. // 求职者面试列表
  288. const interview = ref([])
  289. // 求职端-获取求职者与当前邀请人的面试记录
  290. const statusList = ref([])
  291. const inputValue = ref('')
  292. // const isAgree = ref(false)
  293. // const confirm = ref()
  294. // const chooseInvite = ref(null)
  295. const newsId = ref('') // newsId 需要和聊天列表里面的id对应 永远取最后列表中的最后一个就可以做到发送消息即时滚动到底部
  296. const scrollAnimation = ref(false)
  297. const isSendResume = ref(false)
  298. const positionInfo = ref({})
  299. const isEmployment = ref('-1')
  300. const isStudent = ref(useUserStore?.baseInfo?.type && Boolean(Number(useUserStore.baseInfo.type) === 1))
  301. onMounted(() => {
  302. setTimeout(() => {
  303. scrollAnimation.value = true
  304. }, 1500)
  305. })
  306. const {
  307. conversationList,
  308. // updateConversation,
  309. updateUnreadCount,
  310. // deleteConversations,
  311. resetUnread
  312. } = initConnect(async (successful) => {
  313. if (!successful) {
  314. uni.showToast({
  315. title: '发送失败',
  316. icon: 'none',
  317. mask: true,
  318. })
  319. return
  320. }
  321. inputValue.value = ''
  322. // chatRef.value.reset()
  323. // // 发送成功
  324. const { list } = await getMoreMessages(1, channelItem.value)
  325. // updateConversation()
  326. items.value = list.value
  327. // chatRef.value.scrollBottom()
  328. })
  329. watch(
  330. () => conversationList.value,
  331. async (val) => {
  332. if (!channelItem.value) {
  333. return
  334. }
  335. const { list } = await getMoreMessages(1, channelItem.value)
  336. if (list.value.length) {
  337. const item = list.value[list.value.length - 1]
  338. const arr = [101, 103, 104]
  339. if (arr.includes(item.payload?.type)) {
  340. getInterviewInviteList()
  341. }
  342. }
  343. items.value = list.value
  344. setScrollBottom()
  345. // 清除未读消息
  346. resetUnread(channelItem.value)
  347. },
  348. {
  349. deep: true,
  350. immediate: true
  351. }
  352. )
  353. async function init(userId, enterpriseId) {
  354. const { channel, list, more } = await initChart(userId, enterpriseId)
  355. hasMore.value = more
  356. channelItem.value = channel.value
  357. items.value = list.value
  358. setScrollBottom()
  359. }
  360. const setScrollBottom = () => {
  361. if (items.value?.length) {
  362. const lastOne = items.value[items.value.length-1]
  363. const index = items.value.length-1
  364. newsId.value = 's' + lastOne.id + index // newsId 需要和聊天列表里面的id对应 永远取最后列表中的最后一个就可以做到发送消息即时滚动到底部
  365. }
  366. }
  367. const hasWaitingProcessingInterview = ref(false) // 是否有待接受的面试邀请
  368. async function getInterviewInviteList () {
  369. if (!info.value.id) return
  370. const { data } = await getInterviewInviteListByInviteUserId(info.value.id)
  371. interview.value = data ? data.slice(0, 1).map(e => {
  372. const statusItem = statusList.value.find(_e => _e.value === e.status)
  373. const statusText = statusItem?.label || ''
  374. const statusColor = ['5', '98', '99'].includes(e.status)
  375. return {
  376. ...e,
  377. statusColor: statusColor ? '#FE574A' : '#0E8E80',
  378. statusText
  379. }
  380. }) : []
  381. hasWaitingProcessingInterview.value = interview.value.some(e => e.status === '0')
  382. }
  383. const getStatusList = async () => {
  384. try {
  385. const { data } = await getDict('menduner_interview_invite_status')
  386. if (data.data.length) {
  387. statusList.value = data.data
  388. }
  389. } catch (error) {
  390. }
  391. }
  392. function handleSend () {
  393. if (!inputValue.value) {
  394. uni.showToast({ title: '不能发送空白信息', icon: 'none' })
  395. return
  396. }
  397. send(inputValue.value, channelItem.value)
  398. }
  399. function handleToCenter () {
  400. uni.navigateTo({
  401. url: '/pagesA/interview/index?index=1'
  402. })
  403. }
  404. // 预览简历
  405. function handlePreview (payload) {
  406. if (!payload?.content?.query?.src) {
  407. uni.showToast({ title: '简历地址不存在', icon: 'none' })
  408. return
  409. }
  410. preview(payload.content.query.src)
  411. }
  412. // 关闭职位列表窗口
  413. function positionPopupClose () {
  414. positionPopup.value.close()
  415. }
  416. // 打开职位列表窗口
  417. function positionPopupOpen () {
  418. positionPopup.value.open('center')
  419. }
  420. // 选中职位并投递
  421. const selectJobId = ref('')
  422. const positionPopup = ref()
  423. const selectPositionSubmit = async () => {
  424. if (!selectJobId.value) return uni.showToast({ title: '请选择要投递的职位', icon: 'none', duration: 3000 })
  425. positionPopupClose()
  426. handleFindResume() // 打开简历列表选择
  427. }
  428. const pageLoading = ref(false)
  429. const entPositionTotal = ref(0)
  430. const entPositionList = ref([])
  431. const entPositionListParams = ref({ pageNo: 1, pageSize: 5 })
  432. const entPositionListLastData = computed(() => entPositionListParams.value.pageNo * entPositionListParams.value.pageSize >= entPositionTotal.value)
  433. // 职位列表
  434. const getRecruitPositionList = async () => {
  435. const enterpriseId = info.value?.enterpriseId || null
  436. if (!enterpriseId) return uni.showToast({ title: '访问企业错误!', icon: 'none', duration: 3000 })
  437. pageLoading.value = true
  438. const res = await getJobAdvertisedSearch({ ...entPositionListParams.value, enterpriseId })
  439. const { list = [], total: number = 0 } = res?.data || {}
  440. if (!list?.length) return uni.showToast({ title: '企业暂无招聘中的职位,无法进行投递!', icon: 'none', duration: 3000 })
  441. entPositionTotal.value = number
  442. entPositionList.value = list.map(j => {
  443. const e = j?.job || null
  444. if (!e) return e
  445. const salary = e.payFrom && e.payTo ? `${e.payFrom ? e.payFrom + '-' : ''}${e.payTo}${e.payName ? '/' + e.payName : ''}` : '面议'
  446. return {
  447. label: `${formatName(e.name)}_${e.areaName ? e.area?.str : '全国'} ${salary}`,
  448. value: e.id,
  449. data: e
  450. }
  451. }).filter(Boolean)
  452. setTimeout(() => { pageLoading.value = false }, 300)
  453. }
  454. const changePositionData = () => {
  455. entPositionListParams.value.pageNo = entPositionListLastData.value ? 1 : entPositionListParams.value.pageNo + 1
  456. selectJobId.value = ''
  457. getRecruitPositionList()
  458. }
  459. // 获取简历
  460. async function handleFindResume () {
  461. if (isSendResume.value) {
  462. return
  463. }
  464. // 没有基于职位接收到的沟通,弹出职位列表让求职者选择。否则无法投递简历。
  465. if (!positionInfo.value.id && !selectJobId.value) {
  466. await getRecruitPositionList()
  467. if (entPositionTotal.value) positionPopupOpen()
  468. return
  469. }
  470. try {
  471. // 获取简历列表
  472. const { data } = await getPersonResumeCv()
  473. if (data.length === 0) {
  474. uni.showToast({
  475. title: '您还未上传过简历,请先上传简历后再投递',
  476. icon: 'none',
  477. mask: true,
  478. duration: 3000
  479. })
  480. }
  481. resumeList.value = data || []
  482. resumeCheck.value = data && data.length ? data[0] : ''
  483. popup.value.open('center')
  484. } finally {
  485. uni.hideLoading()
  486. }
  487. }
  488. // 关闭简历窗口
  489. function handleClose () {
  490. popup.value.close()
  491. }
  492. const studentDeliveryFormRef = ref()
  493. // 发送简历
  494. async function handleSendResume () {
  495. if (!Object.keys(resumeCheck.value).length) {
  496. uni.showToast({ title: '请选择要投递的简历', icon: 'none' })
  497. return
  498. }
  499. let practice = null
  500. if (isStudent.value) {
  501. practice = await studentDeliveryFormRef.value.getQueryParams()
  502. if (!practice) return
  503. }
  504. const text = {
  505. remark: '发送简历',
  506. query: {
  507. src: resumeCheck.value.url,
  508. title: resumeCheck.value.title,
  509. id: resumeCheck.value.id,
  510. },
  511. type: 1
  512. }
  513. try {
  514. if (isEmployment.value !== '-1') {
  515. await jobCvRelHireSend({
  516. jobId: positionInfo.value.id || selectJobId.value,
  517. // ...(jobFairId && { jobFairId }),
  518. url: resumeCheck.value.url,
  519. recommendUserId: isEmployment.value,
  520. ...(practice && { practice }),
  521. })
  522. } else {
  523. await jobCvRelSend({
  524. jobId: positionInfo.value.id || selectJobId.value,
  525. // ...(jobFairId && { jobFairId }),
  526. title: resumeCheck.value.title,
  527. url: resumeCheck.value.url,
  528. type: positionInfo.value.hire ? 1 : 0,
  529. ...(practice && { practice }),
  530. })
  531. }
  532. isSendResume.value = true
  533. send (JSON.stringify(text), channelItem.value, 105)
  534. popup.value.close()
  535. } catch (error) {
  536. if (error?.msg === '该职位已投递') {
  537. isSendResume.value = true
  538. }
  539. popup.value.close()
  540. }
  541. }
  542. // 拒绝邀请
  543. // function handleRefuse (val) {
  544. // isAgree.value = false
  545. // chooseInvite.value = val
  546. // confirm.value.open()
  547. // }
  548. // 接受邀请
  549. // function handleAgree (val) {
  550. // isAgree.value = true
  551. // chooseInvite.value = val
  552. // confirm.value.open()
  553. // }
  554. // 确认
  555. // async function handleConfirm () {
  556. // // 拒绝
  557. // if (!isAgree.value) {
  558. // await userInterviewInviteReject(chooseInvite.value.id)
  559. // } else {
  560. // await userInterviewInviteReject(chooseInvite.value.id)
  561. // }
  562. // uni.showToast({ title: '操作成功', icon: 'none' })
  563. // send(JSON.stringify({ id: chooseInvite.value.id }), channelItem.value, isAgree.value ? 104 : 103)
  564. // }
  565. // 关闭
  566. // function handleCloseConfirm () {
  567. // confirm.value.close()
  568. // }
  569. // 查看更多
  570. async function handleMore () {
  571. try {
  572. uni.showLoading({
  573. title: '加载中...'
  574. })
  575. pageSize.value++
  576. const { list, more } = await getMoreMessages(pageSize.value, channelItem.value)
  577. items.value.unshift(...list.value)
  578. hasMore.value = more
  579. } finally {
  580. uni.hideLoading()
  581. }
  582. }
  583. // 上传简历
  584. function handleUploadResume () {
  585. wx.chooseMessageFile({
  586. count: 1,
  587. type: 'file',
  588. success (res) {
  589. // 限制文件上传大小
  590. const size = res.tempFiles[0].size
  591. if (size / (1024*1024) > 20) {
  592. uni.showToast({ icon: 'none', title: '文件大小不能超过20M' })
  593. return
  594. }
  595. const title = res.tempFiles[0].name
  596. const path = res.tempFiles[0].path
  597. const test = /\.(pdf|docx|doc)$/.test(title)
  598. if (!test) {
  599. uni.showToast({
  600. icon: 'none',
  601. title: '请上传pdf、doc、docx类型的文件',
  602. duration: 2000
  603. })
  604. return
  605. }
  606. //效验是否为支持的文件格式
  607. uploadFile(path, 'attachment').then(async (res) => {
  608. if (!res.data) {
  609. uni.showToast({
  610. title: '上传失败',
  611. icon: 'none'
  612. })
  613. return
  614. }
  615. await saveResume({ title, url: res.data })
  616. uni.showToast({
  617. title: '上传成功',
  618. icon: 'success'
  619. })
  620. handleFindResume()
  621. })
  622. }
  623. })
  624. }
  625. // 获取职位信息
  626. async function getMessageTypeSync () {
  627. try {
  628. const { data } = await getMessageType({
  629. fromUid: IM.uid,
  630. channelId: channelItem.value.channelID,
  631. type: 102,
  632. page: {
  633. current: 1,
  634. size: 1,
  635. orders: [
  636. { column: 'message_seq', asc: false }
  637. ]
  638. }
  639. })
  640. if (!data.records || !data.records.length) {
  641. return
  642. }
  643. const _item = data.records.pop()
  644. const _itemJSON = JSON.parse(_item.payload)
  645. const _content = JSON.parse(_itemJSON.content)
  646. positionInfo.value = _content.positionInfo
  647. const { data: check } = await jobCvRelCheckSend({ jobId: _content.positionInfo.id })
  648. isSendResume.value = check
  649. } catch (error) {
  650. console.log(345, error)
  651. }
  652. }
  653. // let jobFairId = ''
  654. onLoad(async (options) => {
  655. info.value = Object.keys(options).reduce((r, k) => {
  656. r[k] = decodeURIComponent(options[k])
  657. return r
  658. }, {})
  659. // jobFairId = info.value.jobFairId
  660. isEmployment.value = info.value.isEmployment
  661. channelItem.value = toChannel(info.value.channelID, info.value.channelType)
  662. if (channelItem.value.channelID === 'system') {
  663. const { list, more } = await getMoreMessages(1, channelItem.value)
  664. hasMore.value = more
  665. items.value = list.value
  666. setScrollBottom()
  667. // 清除未读消息
  668. resetUnread(channelItem.value)
  669. // 更新未读消息
  670. updateUnreadCount()
  671. return
  672. }
  673. await init(info.value.id, info.value.enterpriseId)
  674. // 获取最新的职位信息
  675. await getMessageTypeSync(info.value.id)
  676. await getStatusList()
  677. getInterviewInviteList()
  678. // 清除未读消息
  679. resetUnread(channelItem.value)
  680. // 更新未读消息
  681. updateUnreadCount()
  682. })
  683. </script>
  684. <style lang="scss" scoped>
  685. .mr { margin-right: 20rpx; }
  686. .salary-text {
  687. font-size: 30rpx;
  688. color: #00B760;
  689. text-align: center;
  690. font-family: MiSans-Bold;
  691. font-weight: 500;
  692. text-transform: none;
  693. }
  694. .divider-mx{
  695. margin: 0 10rpx;
  696. }
  697. .desc-tag {
  698. font-family: MiSans-Normal;
  699. font-weight: 400;
  700. font-size: 24rpx;
  701. color: #666666;
  702. text-align: left;
  703. font-style: normal;
  704. text-transform: none;
  705. }
  706. .white {
  707. color: #FFF !important;
  708. }
  709. .text-left {
  710. text-align: left !important;
  711. }
  712. .text-right {
  713. text-align: right !important;
  714. }
  715. .sub-li-bottom {
  716. display: flex;
  717. align-items: center;
  718. font-size: 13px;
  719. padding: 5px;
  720. border-radius: 0 0 12px 12px;
  721. margin-top: 10rpx;
  722. // margin-bottom: 20rpx;
  723. .avatarBox {
  724. // max-width: 40px;
  725. // max-height: 40px;
  726. .enterAvatar{
  727. width: 68rpx;
  728. height: 68rpx;
  729. // border-radius: 50%;
  730. margin: auto;
  731. }
  732. }
  733. }
  734. .box {
  735. width: 100%;
  736. // height: 100vh;
  737. display: flex;
  738. flex-direction: column;
  739. &-top {
  740. z-index: 1;
  741. // width: 100%;
  742. padding: 30rpx 30rpx 0 30rpx;
  743. display: flex;
  744. justify-content: center;
  745. &-image {
  746. width: 80rpx;
  747. height: 80rpx;
  748. border-radius: 50%;
  749. margin-right: 30rpx;
  750. }
  751. &-right {
  752. flex: 1;
  753. display: flex;
  754. flex-direction: column;
  755. justify-content: space-between;
  756. &-title {
  757. box-sizing: border-box;
  758. width: 100%;
  759. // text-align: center;
  760. overflow: hidden;
  761. white-space: nowrap;
  762. text-overflow: ellipsis;
  763. margin-bottom: 10rpx;
  764. }
  765. &-subText {
  766. font-size: .85em;
  767. color: #999;
  768. .gun {
  769. padding: 0 10rpx;
  770. }
  771. }
  772. }
  773. &-content {
  774. padding: 20rpx 50rpx;
  775. padding-bottom: 20rpx;
  776. border-bottom: 2rpx solid #eee;
  777. .color-666 {
  778. color: #666;
  779. }
  780. .font-weight-bold {
  781. font-weight: bold;
  782. }
  783. .color-primary {
  784. color: #009688;
  785. }
  786. .ml-3 {
  787. margin-left: 40rpx;
  788. }
  789. .mt-1 {
  790. margin-top: 12rpx;
  791. }
  792. .font-size-14 {
  793. font-size: 24rpx;
  794. }
  795. .py-1 {
  796. padding: 4rpx 0;
  797. }
  798. .tipsText {
  799. font-size: .75em;
  800. color: #999;
  801. }
  802. &-t {
  803. display: flex;
  804. justify-content: space-between;
  805. }
  806. .btnBox {
  807. display: flex;
  808. padding: 20rpx 60rpx;
  809. justify-content: space-around;
  810. }
  811. }
  812. }
  813. &-main {
  814. flex: 1;
  815. height: 0;
  816. padding: 40rpx;
  817. // overflow-y: auto;
  818. box-sizing: border-box;
  819. &-more {
  820. display: flex;
  821. justify-content: center;
  822. align-items: center;
  823. color: #24bc3e;
  824. font-size: .9em;
  825. padding: 20rpx 0;
  826. }
  827. &-time {
  828. user-select: none;
  829. position: relative;
  830. top: 16rpx;
  831. margin: 40rpx 0;
  832. text-align: center;
  833. max-height: 40rpx;
  834. text-align: center;
  835. font-weight: 400;
  836. font-size: .85em;
  837. color: #999;
  838. }
  839. .jobCard {
  840. padding: 30rpx;
  841. background: #fbfbfb;
  842. margin: 20rpx 5px;
  843. max-width: unset;
  844. border-radius: 20rpx;
  845. box-shadow: 1px 2px 12px rgba(0, 0, 0, 0.1);
  846. &-title {
  847. // font-size: 1.2em;
  848. font-weight: 600;
  849. font-size: 36rpx;
  850. margin-bottom: 30rpx;
  851. }
  852. &-subtitle {
  853. padding: 10rpx 0;
  854. // font-size: .5em;
  855. }
  856. &-tag {
  857. display: flex;
  858. flex-wrap: wrap;
  859. .tagItem {
  860. margin: 0 5px 3px 0;
  861. .tag {
  862. color: #d4f1e4;
  863. background-color: #00B760;
  864. padding: 2px 8px;
  865. font-size: 24rpx;
  866. border-radius: 30rpx;
  867. font-family: MiSans-Normal;
  868. }
  869. }
  870. }
  871. }
  872. .message-view_item {
  873. display: flex;
  874. flex-direction: row;
  875. align-items: flex-start;
  876. margin: 16rpx 0;
  877. position: relative;
  878. .image {
  879. width: 60rpx;
  880. height: 60rpx;
  881. border-radius: 180rpx;
  882. // flex-grow: 1;
  883. // flex-shrink: 0;
  884. overflow: hidden;
  885. .header {
  886. width: 60rpx;
  887. height: 60rpx;
  888. }
  889. }
  890. .text-end {
  891. text-align: right !important;
  892. width: 400rpx;
  893. margin-right: 20rpx;
  894. }
  895. .message-text {
  896. overflow-wrap: break-word;
  897. background-color: #f0f2f5;
  898. border-radius: 12rpx;
  899. max-width: 75%;
  900. padding: 20rpx;
  901. font-family: MiSans-Normal;
  902. &.active {
  903. background: #d5e6e8;
  904. }
  905. &.card {
  906. background: #E2F2F0;
  907. color: #009688 ;
  908. margin-top: 20rpx;
  909. max-width: unset;
  910. margin-right: 0;
  911. .btn-actions {
  912. margin: 40rpx auto 20rpx auto ;
  913. text-align: center;
  914. .btn {
  915. padding: 10rpx 30rpx;
  916. background: #C8E7D8;
  917. color: #43AC57;
  918. font-size: .75em;
  919. border-radius: 10rpx;
  920. }
  921. }
  922. }
  923. &.none {
  924. padding: 10rpx 0;
  925. background-color: unset;
  926. }
  927. &.active {
  928. background: #d5e6e8;
  929. }
  930. }
  931. }
  932. .is-self {
  933. flex-direction: row-reverse;
  934. display: flex;
  935. .message-text {
  936. margin-right: 20rpx;
  937. }
  938. }
  939. .is-other {
  940. .message-text {
  941. margin-left: 20rpx;
  942. }
  943. }
  944. }
  945. &-bottom {
  946. max-height: 300rpx;
  947. border-top: 2rpx solid #EEE;
  948. background: #fff;
  949. padding: 20rpx 40rpx 40rpx;
  950. box-sizing: border-box;
  951. &-tool {
  952. margin-bottom: 30rpx;
  953. .toolBtn {
  954. padding: 12rpx 20rpx;
  955. font-size: 24rpx;
  956. background: #18bc37;
  957. color: #FFF;
  958. border-radius: 10rpx;
  959. }
  960. }
  961. .textBox {
  962. align-items: flex-end;
  963. }
  964. textarea {
  965. border-radius: 10rpx;
  966. width: 100%;
  967. min-height: 80rpx;
  968. max-height: 180rpx;
  969. padding: 20rpx;
  970. box-sizing: border-box;
  971. background: #f5f5f5;
  972. }
  973. .submitBtn {
  974. width: 140rpx;
  975. line-height: 80rpx;
  976. height: 80rpx;
  977. font-size: 28rpx;
  978. background: #18bc37;
  979. color: #FFF;
  980. margin-left: 20rpx;
  981. text-align: center;
  982. border-radius: 10rpx;
  983. }
  984. }
  985. .popup-title {
  986. padding: 30rpx 20rpx;
  987. display: flex;
  988. justify-content: space-between;
  989. border-bottom: 2rpx solid #DDD;
  990. }
  991. .popup-content {
  992. padding: 20rpx 40rpx;
  993. color: #999;
  994. display: flex;
  995. align-content: center;
  996. justify-items: center;
  997. .iconBox {
  998. width: 40rpx;
  999. }
  1000. .text {
  1001. margin-left: 20rpx;
  1002. &.active {
  1003. color: #00B760;
  1004. }
  1005. }
  1006. }
  1007. .popup-upload {
  1008. // display: flex;
  1009. // align-items: center;
  1010. // justify-content: center;
  1011. // flex-direction: column;
  1012. // width: 70%;
  1013. width: 80vw;
  1014. font-size: .75em;
  1015. color: #999;
  1016. padding: 40rpx;
  1017. &-box {
  1018. width: 200rpx;
  1019. height: 200rpx;
  1020. text-align: center;
  1021. line-height: 200rpx;
  1022. border: 4rpx solid #ddd;
  1023. border-radius: 8rpx;
  1024. margin: 0 auto;
  1025. }
  1026. }
  1027. .popup-actions {
  1028. padding: 60rpx;
  1029. .default {
  1030. background: #00B760;
  1031. color: #DDD;
  1032. font-size: .9em;
  1033. }
  1034. }
  1035. }
  1036. // .commonBackground {
  1037. // z-index: 1;
  1038. // &::before {
  1039. // height: 100px !important;
  1040. // }
  1041. // }
  1042. </style>