longStrip.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <template>
  2. <div>
  3. <div class="position-item mb-3 job-closed" style="position: relative;" :class="val.active ? 'elevation-8' : 'elevation-3'"
  4. v-for="(val, i) in props.items" :key="i" @mouseenter="val.active = true" @mouseleave="val.active = false"
  5. >
  6. <div class="info-header">
  7. <div v-if="val.active && val.job.status === '0'" class="header-btn">
  8. <v-btn v-if="showCancelDeliveryResumeBtn && val.cvRel?.status === '0'" class="MiSans-Medium" color="primary" size="small" @click.stop="emits('cancelDeliveryResume', val.cvRel.id)">撤销投递简历</v-btn>
  9. <v-btn v-if="props.showCancelBtn" class="half-button ml-3 MiSans-Medium" color="primary" size="small" @click.stop="handleCancel(val)">取消收藏</v-btn>
  10. <v-btn class="half-button ml-3 MiSans-Medium" color="primary" size="small" @click.stop="toDetails(val)">立即沟通</v-btn>
  11. </div>
  12. <div v-if="val.job.status === '1'" class="font-size-14 header-btn color-error">职位已关闭</div>
  13. <div class="img-box">
  14. <v-avatar :image="getUserAvatar(val.contact.avatar, val.contact.sex)" size="x-small"></v-avatar>
  15. <span class="name">
  16. <span class="mx-3">{{ val.contact.name }}</span>
  17. <span class="gray">{{ val.contact.postNameCn }}</span>
  18. </span>
  19. </div>
  20. </div>
  21. <div class="info-content" >
  22. <div class="job-info">
  23. <div class="job-name ellipsis" :class="{'cursor-pointer': val.job.status === '0'}" v-ellipse-tooltip>
  24. <!-- <svg-icon v-if="val.job.bizId" name="jobFair" size="18" class="mr-1"></svg-icon> -->
  25. <span class="mr-3" :class="{'info-name': val.job.status === '0'}" @click.stop="handleToPositionDetails(val)">{{ formatName(val.job.name) }}</span>
  26. <span>
  27. [{{ !val.job.areaId ? '全国' : val.job.area?.str }}]
  28. </span>
  29. </div>
  30. <div class="job-other">
  31. <span v-if="!val.job.payFrom && !val.job.payTo" class="salary color-primary">面议</span>
  32. <span v-else class="salary color-primary">{{ val.job.payFrom ? val.job.payFrom + '-' : ''}}{{ val.job.payTo }}{{ val.job.payName ? '/' + val.job.payName : '' }}</span>
  33. <v-chip v-if="val.job?.expName" class="mx-3" color="primary" label size="small">{{ val.job.expName }}</v-chip>
  34. <v-chip v-if="val.job?.eduName" color="primary" label size="small">{{ val.job.eduName }}</v-chip>
  35. </div>
  36. </div>
  37. <div class="company-info ml-3" style="flex: 1;">
  38. <div style="height: 50px; width: 50px;">
  39. <v-img width="50" height="50" :src="val.enterprise.logoUrl || 'https://minio.citupro.com/dev/menduner/7.png'" rounded contain></v-img>
  40. </div>
  41. <div class="ml-3">
  42. <div class="cursor-pointer info-name" v-ellipse-tooltip @click.stop="jumpToEnterpriseDetail(val.enterprise.id)">{{ formatName(val.enterprise.anotherName || val.enterprise.name) }}</div>
  43. <div class="mt-3 ellipsis color-666 font-size-13" style="max-width: 260px;">
  44. <span v-for="(k, i) in desc" :key="k">
  45. {{ val.enterprise[k] }}
  46. <span v-if="i !== desc.length - 1 && val.enterprise[k] && val.enterprise[desc[i + 1]]" class="septal-line"></span>
  47. </span>
  48. </div>
  49. </div>
  50. </div>
  51. </div>
  52. </div>
  53. <!-- 快速登录 -->
  54. <loginPage v-if="showLogin" @loginSuccess="loginSuccess" @close="loginClose"></loginPage>
  55. </div>
  56. </template>
  57. <script setup>
  58. defineOptions({ name: 'longStrip'})
  59. import { getPersonJobUnfavorite } from '@/api/position'
  60. import { useI18n } from '@/hooks/web/useI18n'
  61. import Snackbar from '@/plugins/snackbar'
  62. import { getUserAvatar } from '@/utils/avatar'
  63. import { useRouter } from 'vue-router'
  64. import { ref } from 'vue'
  65. import { prologue, defaultText } from '@/hooks/web/useIM'
  66. import loginPage from '@/views/common/loginDialog.vue'
  67. import { getToken } from '@/utils/auth'
  68. import { checkPersonBaseInfo } from '@/utils/check'
  69. import dialogExtend from '@/plugins/dialogExtend'
  70. import { formatName } from '@/utils/getText'
  71. import { jumpToEnterpriseDetail } from '@/utils/position'
  72. const emits = defineEmits(['refresh', 'cancelDeliveryResume'])
  73. const { t } = useI18n()
  74. const props = defineProps({
  75. items: {
  76. type: Array,
  77. default: () => []
  78. },
  79. // 是否展示取消收藏按钮
  80. showCancelBtn: {
  81. type: Boolean,
  82. default: false
  83. },
  84. // 是否显示取消投递简历按钮
  85. showCancelDeliveryResumeBtn: {
  86. type: Boolean,
  87. default: false
  88. }
  89. })
  90. const router = useRouter()
  91. const desc = ['industryName', 'scaleName']
  92. const handleCancel = async (item) => {
  93. if (!item.job.id) return Snackbar.warning(t('sys.api.operationFailed'))
  94. await getPersonJobUnfavorite(item.job.id)
  95. emits('refresh')
  96. Snackbar.success(t('common.operationSuccessful'))
  97. }
  98. // 职位详情
  99. const handleToPositionDetails = (item) => {
  100. if (item.job.status === '1') return
  101. let path = `/recruit/personal/position/details/${item.job.id}`
  102. if (item.cvRel?.jobFairId) path += `?jobFairId=${item.cvRel.jobFairId}`
  103. router.push(path)
  104. }
  105. let toDetailsInfo = {}
  106. // 立即沟通
  107. const toDetails = async (info) => {
  108. if (info) toDetailsInfo = info // 快速登录弹窗回调使用
  109. else info = toDetailsInfo
  110. if (!getToken()) {
  111. showLogin.value = true // 打开快速登录弹窗
  112. Snackbar.warning('您还未登录,请先登录后再试')
  113. //
  114. loginCloseWarningWord = '您已取消登录,无法对职位进行沟通' // 取消登录提示语
  115. nextFunc.value = toDetails // 登录成功后要执行的操作 (toDetails执行不成功,原因未找到)
  116. return
  117. }
  118. if (!checkPersonBaseInfo()) { // 强制填写个人信息
  119. dialogExtend('necessaryInfoDialog').then(() => {
  120. toDetails(toDetailsInfo)
  121. })
  122. return
  123. }
  124. const userId = info.contact.userId
  125. const enterpriseId = info.contact.enterpriseId
  126. const textObj = {
  127. text: defaultText,
  128. positionInfo: { ...info.job, enterprise: info.enterprise, contact: info.contact },
  129. }
  130. await prologue({userId, enterpriseId, text: JSON.stringify(textObj)})
  131. let url = `/recruit/personal/message?id=${info.job.id}`
  132. if (info.contact.enterpriseId) {
  133. url += `&enterprise=${info.contact.enterpriseId}`
  134. }
  135. window.open(url)
  136. }
  137. const showLogin = ref(false)
  138. const nextFunc = ref(null)
  139. let loginCloseWarningWord = ''
  140. // 快速登录
  141. const loginSuccess = () => {
  142. showLogin.value = false
  143. Snackbar.success('登录成功')
  144. if (nextFunc.value) nextFunc.value()
  145. }
  146. const loginClose = () => {
  147. showLogin.value = false
  148. Snackbar.warning(loginCloseWarningWord)
  149. }
  150. </script>
  151. <style scoped lang="scss">
  152. .position-item {
  153. height: 144px;
  154. background-color: #fff;
  155. border-radius: 12px;
  156. .info-header {
  157. height: 48px;
  158. background: linear-gradient(90deg,#f5fcfc,#fcfbfa);
  159. border-radius: 12px;
  160. .img-box {
  161. padding: 12px 24px;
  162. .name {
  163. color: var(--color-222);
  164. font-weight: 400;
  165. font-size: 13px;
  166. .gray {
  167. color: var(--color-666);
  168. }
  169. }
  170. }
  171. .header-btn {
  172. padding: 10px 10px 0 0;
  173. float: right;
  174. .v-btn {
  175. z-index: 1;
  176. }
  177. }
  178. }
  179. .info-content {
  180. display: flex;
  181. padding: 16px 24px;
  182. justify-content: space-between;
  183. .job-info {
  184. width: 430px;
  185. min-width: 430px;
  186. max-width: 430px;
  187. font-weight: 500;
  188. font-size: 16px;
  189. .job-name {
  190. width: 100%;
  191. height: 22px;
  192. line-height: 22px;
  193. color: #0E100F;
  194. margin-bottom: 12px;
  195. }
  196. .job-other {
  197. color: var(--v-error-base);
  198. height: 22px;
  199. line-height: 22px;
  200. }
  201. }
  202. .company-info {
  203. display: flex;
  204. align-items: center
  205. }
  206. .interview-info {
  207. color: var(--color-333);
  208. font-size: 15px;
  209. }
  210. }
  211. }
  212. .info-name:hover {
  213. color: var(--v-primary-base);
  214. }
  215. </style>