longStrip.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  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 ellipsis" :class="{'cursor-pointer': val.job.status === '0'}">
  23. <span class="mr-3" :class="{'info-name': val.job.status === '0'}" @click="handleToPositionDetails(val)">{{ formatName(val.job.name) }}</span>
  24. <span v-if="val?.job?.areaName || !val.job.areaId">[{{ !val.job.areaId ? '全国' : 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)">{{ formatName(val.enterprise.anotherName || 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. <loginPage v-if="showLogin" @loginSuccess="loginSuccess" @close="loginClose"></loginPage>
  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. import { checkPersonBaseInfo } from '@/utils/check'
  65. import dialogExtend from '@/plugins/dialogExtend'
  66. import { formatName } from '@/utils/getText'
  67. const emits = defineEmits(['refresh'])
  68. const { t } = useI18n()
  69. const props = defineProps({
  70. items: {
  71. type: Array,
  72. default: () => []
  73. },
  74. showCancelBtn: {
  75. type: Boolean,
  76. default: false
  77. }
  78. })
  79. const router = useRouter()
  80. const desc = ['industryName', 'scaleName']
  81. const handleCancel = async (item) => {
  82. if (!item.job.id) return Snackbar.warning(t('sys.api.operationFailed'))
  83. await getPersonJobUnfavorite(item.job.id)
  84. emits('refresh')
  85. Snackbar.success(t('common.operationSuccessful'))
  86. }
  87. // 职位详情
  88. const handleToPositionDetails = (item) => {
  89. if (item.job.status === '1') return
  90. router.push(`/recruit/personal/position/details/${item.job.id}`)
  91. }
  92. // 企业详情
  93. const handleToEnterprise = (item) => {
  94. router.push(`/recruit/personal/company/details/${item.enterprise.id}?key=briefIntroduction`)
  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. &:hover {
  148. 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;
  149. }
  150. .info-header {
  151. height: 48px;
  152. background: linear-gradient(90deg,#f5fcfc,#fcfbfa);
  153. border-radius: 12px;
  154. .img-box {
  155. padding: 12px 24px;
  156. .name {
  157. color: var(--color-222);
  158. font-weight: 400;
  159. font-size: 13px;
  160. .gray {
  161. color: var(--color-666);
  162. }
  163. }
  164. }
  165. .header-btn {
  166. padding: 10px 10px 0 0;
  167. float: right;
  168. .v-btn {
  169. z-index: 1;
  170. }
  171. }
  172. }
  173. .info-content {
  174. display: flex;
  175. padding: 16px 24px;
  176. justify-content: space-between;
  177. .job-info {
  178. width: 430px;
  179. min-width: 430px;
  180. max-width: 430px;
  181. font-weight: 500;
  182. font-size: 16px;
  183. .job-name {
  184. width: 100%;
  185. height: 22px;
  186. line-height: 22px;
  187. color: var(--color-222);
  188. margin-bottom: 12px;
  189. }
  190. .job-other {
  191. color: var(--v-error-base);
  192. height: 22px;
  193. line-height: 22px;
  194. }
  195. }
  196. .company-info {
  197. display: flex;
  198. align-items: center
  199. }
  200. .interview-info {
  201. color: var(--color-333);
  202. font-size: 15px;
  203. }
  204. }
  205. }
  206. .info-name:hover {
  207. color: var(--v-primary-base);
  208. }
  209. </style>