index.vue 33 KB

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