longStrip.vue 7.3 KB

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