longStrip.vue 7.4 KB

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