index.vue 31 KB

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