longStrip.vue 7.0 KB

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