index.vue 30 KB

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