index.vue 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098
  1. <template>
  2. <view>
  3. <Navbar :textLeft="false" title="我的聊天" />
  4. <view class="box defaultBgc" :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: 36rpx;
  688. color: #00B760;
  689. text-align: center;
  690. font-family: MiSans-Normal;
  691. font-weight: 500;
  692. text-transform: none;
  693. }
  694. .divider-mx{
  695. margin: 0 10rpx;
  696. }
  697. .desc-tag {
  698. font-family: MiSans, MiSans;
  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-bottom: 20rpx;
  722. .avatarBox {
  723. // max-width: 40px;
  724. // max-height: 40px;
  725. .enterAvatar{
  726. width: 68rpx;
  727. height: 68rpx;
  728. // border-radius: 50%;
  729. margin: auto;
  730. }
  731. }
  732. }
  733. .box {
  734. width: 100%;
  735. // height: 100vh;
  736. display: flex;
  737. flex-direction: column;
  738. &-top {
  739. z-index: 1;
  740. // width: 100%;
  741. padding: 30rpx 30rpx 0 30rpx;
  742. display: flex;
  743. justify-content: center;
  744. &-image {
  745. width: 80rpx;
  746. height: 80rpx;
  747. border-radius: 50%;
  748. margin-right: 30rpx;
  749. }
  750. &-right {
  751. flex: 1;
  752. display: flex;
  753. flex-direction: column;
  754. justify-content: space-between;
  755. &-title {
  756. box-sizing: border-box;
  757. width: 100%;
  758. // text-align: center;
  759. overflow: hidden;
  760. white-space: nowrap;
  761. text-overflow: ellipsis;
  762. margin-bottom: 10rpx;
  763. }
  764. &-subText {
  765. font-size: .85em;
  766. color: #999;
  767. .gun {
  768. padding: 0 10rpx;
  769. }
  770. }
  771. }
  772. &-content {
  773. padding: 20rpx 50rpx;
  774. padding-bottom: 20rpx;
  775. border-bottom: 2rpx solid #eee;
  776. .color-666 {
  777. color: #666;
  778. }
  779. .font-weight-bold {
  780. font-weight: bold;
  781. }
  782. .color-primary {
  783. color: #009688;
  784. }
  785. .ml-3 {
  786. margin-left: 40rpx;
  787. }
  788. .mt-1 {
  789. margin-top: 12rpx;
  790. }
  791. .font-size-14 {
  792. font-size: 24rpx;
  793. }
  794. .py-1 {
  795. padding: 4rpx 0;
  796. }
  797. .tipsText {
  798. font-size: .75em;
  799. color: #999;
  800. }
  801. &-t {
  802. display: flex;
  803. justify-content: space-between;
  804. }
  805. .btnBox {
  806. display: flex;
  807. padding: 20rpx 60rpx;
  808. justify-content: space-around;
  809. }
  810. }
  811. }
  812. &-main {
  813. flex: 1;
  814. height: 0;
  815. padding: 40rpx;
  816. // overflow-y: auto;
  817. box-sizing: border-box;
  818. &-more {
  819. display: flex;
  820. justify-content: center;
  821. align-items: center;
  822. color: #24bc3e;
  823. font-size: .9em;
  824. padding: 20rpx 0;
  825. }
  826. &-time {
  827. user-select: none;
  828. position: relative;
  829. top: 16rpx;
  830. margin: 40rpx 0;
  831. text-align: center;
  832. max-height: 40rpx;
  833. text-align: center;
  834. font-weight: 400;
  835. font-size: .85em;
  836. color: #999;
  837. }
  838. .jobCard {
  839. padding: 30rpx;
  840. background: #fbfbfb;
  841. margin: 20rpx 5px;
  842. max-width: unset;
  843. border-radius: 20rpx;
  844. box-shadow: 1px 2px 12px rgba(0, 0, 0, 0.1);
  845. &-title {
  846. // font-size: 1.2em;
  847. font-weight: 600;
  848. font-size: 30rpx;
  849. margin-bottom: 30rpx;
  850. }
  851. &-subtitle {
  852. padding: 10rpx 0;
  853. // font-size: .5em;
  854. }
  855. &-tag {
  856. display: flex;
  857. flex-wrap: wrap;
  858. .tagItem {
  859. margin: 0 5px 3px 0;
  860. .tag {
  861. color: #d4f1e4;
  862. background-color: #00B760;
  863. padding: 2px 8px;
  864. font-size: 24rpx;
  865. border-radius: 30rpx;
  866. font-family: MiSans-Normal;
  867. }
  868. }
  869. }
  870. }
  871. .message-view_item {
  872. display: flex;
  873. flex-direction: row;
  874. align-items: flex-start;
  875. margin: 16rpx 0;
  876. position: relative;
  877. .image {
  878. width: 60rpx;
  879. height: 60rpx;
  880. border-radius: 180rpx;
  881. // flex-grow: 1;
  882. // flex-shrink: 0;
  883. overflow: hidden;
  884. .header {
  885. width: 60rpx;
  886. height: 60rpx;
  887. }
  888. }
  889. .text-end {
  890. text-align: right !important;
  891. width: 400rpx;
  892. margin-right: 20rpx;
  893. }
  894. .message-text {
  895. overflow-wrap: break-word;
  896. background-color: #f0f2f5;
  897. border-radius: 12rpx;
  898. max-width: 75%;
  899. padding: 20rpx;
  900. font-family: MiSans-Normal;
  901. &.active {
  902. background: #d5e6e8;
  903. }
  904. &.card {
  905. background: #E2F2F0;
  906. color: #009688 ;
  907. margin-top: 20rpx;
  908. max-width: unset;
  909. margin-right: 0;
  910. .btn-actions {
  911. margin: 40rpx auto 20rpx auto ;
  912. text-align: center;
  913. .btn {
  914. padding: 10rpx 30rpx;
  915. background: #C8E7D8;
  916. color: #43AC57;
  917. font-size: .75em;
  918. border-radius: 10rpx;
  919. }
  920. }
  921. }
  922. &.none {
  923. padding: 10rpx 0;
  924. background-color: unset;
  925. }
  926. &.active {
  927. background: #d5e6e8;
  928. }
  929. }
  930. }
  931. .is-self {
  932. flex-direction: row-reverse;
  933. display: flex;
  934. .message-text {
  935. margin-right: 20rpx;
  936. }
  937. }
  938. .is-other {
  939. .message-text {
  940. margin-left: 20rpx;
  941. }
  942. }
  943. }
  944. &-bottom {
  945. max-height: 300rpx;
  946. border-top: 2rpx solid #EEE;
  947. background: #fff;
  948. padding: 20rpx 40rpx 40rpx;
  949. box-sizing: border-box;
  950. &-tool {
  951. margin-bottom: 30rpx;
  952. .toolBtn {
  953. padding: 12rpx 20rpx;
  954. font-size: 24rpx;
  955. background: #18bc37;
  956. color: #FFF;
  957. border-radius: 10rpx;
  958. }
  959. }
  960. .textBox {
  961. align-items: flex-end;
  962. }
  963. textarea {
  964. border-radius: 10rpx;
  965. width: 100%;
  966. min-height: 80rpx;
  967. max-height: 180rpx;
  968. padding: 20rpx;
  969. box-sizing: border-box;
  970. background: #f5f5f5;
  971. }
  972. .submitBtn {
  973. width: 140rpx;
  974. line-height: 80rpx;
  975. height: 80rpx;
  976. font-size: 28rpx;
  977. background: #18bc37;
  978. color: #FFF;
  979. margin-left: 20rpx;
  980. text-align: center;
  981. border-radius: 10rpx;
  982. }
  983. }
  984. .popup-title {
  985. padding: 30rpx 20rpx;
  986. display: flex;
  987. justify-content: space-between;
  988. border-bottom: 2rpx solid #DDD;
  989. }
  990. .popup-content {
  991. padding: 20rpx 40rpx;
  992. color: #999;
  993. display: flex;
  994. align-content: center;
  995. justify-items: center;
  996. .iconBox {
  997. width: 40rpx;
  998. }
  999. .text {
  1000. margin-left: 20rpx;
  1001. &.active {
  1002. color: #00B760;
  1003. }
  1004. }
  1005. }
  1006. .popup-upload {
  1007. // display: flex;
  1008. // align-items: center;
  1009. // justify-content: center;
  1010. // flex-direction: column;
  1011. // width: 70%;
  1012. width: 80vw;
  1013. font-size: .75em;
  1014. color: #999;
  1015. padding: 40rpx;
  1016. &-box {
  1017. width: 200rpx;
  1018. height: 200rpx;
  1019. text-align: center;
  1020. line-height: 200rpx;
  1021. border: 4rpx solid #ddd;
  1022. border-radius: 8rpx;
  1023. margin: 0 auto;
  1024. }
  1025. }
  1026. .popup-actions {
  1027. padding: 60rpx;
  1028. .default {
  1029. background: #00B760;
  1030. color: #DDD;
  1031. font-size: .9em;
  1032. }
  1033. }
  1034. }
  1035. // .commonBackground {
  1036. // z-index: 1;
  1037. // &::before {
  1038. // height: 100px !important;
  1039. // }
  1040. // }
  1041. </style>