hotPromoted.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <template>
  2. <div class="hot-box">
  3. <div class="sub-li" v-for="(item, index) in list" :key="index">
  4. <div v-if="item">
  5. <!-- 公司信息 -->
  6. <div class="company-info-top align-center" :class="{'elevation-5': item.active}" @click.stop="jumpToEnterpriseDetail(item.enterprise.id, false)" @mouseenter="item.active = true" @mouseleave="item.active = false">
  7. <div class="float-left">
  8. <v-img :src="item?.enterprise.logoUrl || 'https://minio.citupro.com/dev/menduner/company-avatar.png'" alt="" width="77" height="77" style="border-radius: 4px;"/>
  9. </div>
  10. <div class="company-info cursor-pointer">
  11. <!-- <h3 v-ellipse-tooltip.top>{{ formatName(item.enterprise.anotherName || item.enterprise.name) }}</h3> -->
  12. <h3 :ref="el => { if(el) companyNameRefs[index] = el }">
  13. {{ formatName(item.enterprise.anotherName || item.enterprise.name) }}
  14. <v-tooltip v-if="isTextOverflow[index]" activator="parent" location="top">{{ formatName(item.enterprise.anotherName || item.enterprise.name) }}</v-tooltip>
  15. </h3>
  16. <p>
  17. {{ item?.enterprise.scaleName }}
  18. <span class="septal-line" v-if="item.enterprise.industryName"></span>
  19. {{ item?.enterprise.industryName }}
  20. </p>
  21. </div>
  22. </div>
  23. <div v-ellipse-tooltip.top class="px-5 py-1 ellipsis-tag" :style="{'height': '33px', 'border-bottom': item.enterprise.welfareList && item.enterprise.welfareList.length ? '1px solid #EBEBEB' : 'none'}">
  24. <span class="welfareTag" v-for="(k, i) in item.enterprise.welfareList" :key="i">{{ spaces(i ? 4 : 0) + k }}</span>
  25. </div>
  26. <!-- 职位列表 -->
  27. <ul class="company-job-list pt-3">
  28. <li v-for="(k, i) in item.jobList" :key="i" @mouseenter="k.active = true" @mouseleave="k.active = false" @click="handleClickPosition(k)">
  29. <v-card :elevation="k.active ? 5 : 0" class="company-job-item cursor-pointer mb-3">
  30. <div class="mb-2 d-flex">
  31. <span v-ellipse-tooltip.top :class="['name', 'cursor-pointer', {'default-active': k.active }]" :style="{'max-width': !k.payFrom && !k.payTo ? '290px' : '200px'}">{{ formatName(k.name) }}</span>
  32. <span v-if="!k.payFrom && !k.payTo" class="salary">面议</span>
  33. <span v-else class="salary">{{ k.payFrom ? k.payFrom + '-' : '' }}{{ k.payTo }}{{ k.payName ? '/' + k.payName : '' }}</span>
  34. </div>
  35. <div class="d-flex font-size-13" style="height: 24px; overflow: hidden; color: #808080; line-height: 24px;">
  36. <div class="text-truncate mr-3" style="flex: 1">
  37. <span v-for="(j, index) in desc" :key="index">
  38. <span v-if="k[j] || j === 'areaName'" class="mr-1">
  39. {{ j === 'areaName' ? !k.areaId ? '全国' : k.area?.str : k[j] }}
  40. </span>
  41. <span v-if="index !== desc.length - 1 && (k[j] || j === 'areaName') && k[desc[index + 1]]" class="septal-line ml-1"></span>
  42. </span>
  43. </div>
  44. <div style="width: 73px;">{{ timesTampChange(k.updateTime, 'Y-M-D') }}</div>
  45. </div>
  46. </v-card>
  47. </li>
  48. </ul>
  49. <div class="moreBtn d-flex align-center justify-center" @click.stop="handleMoreEnterprise(item)">
  50. <span>{{ $t('position.moreBtn') }}</span>
  51. <v-icon>mdi-menu-right</v-icon>
  52. </div>
  53. </div>
  54. </div>
  55. </div>
  56. </template>
  57. <script setup name="hotPromoted">
  58. import { nextTick, ref, watch } from 'vue'
  59. import { timesTampChange } from '@/utils/date'
  60. import { formatName } from '@/utils/getText'
  61. import { jumpToEnterpriseDetail } from '@/utils/position'
  62. import { useRouter } from 'vue-router'
  63. import { spaces } from '@/utils/index.js'
  64. const props = defineProps({
  65. items: {
  66. type: Array,
  67. default: () => []
  68. }
  69. })
  70. const router = useRouter()
  71. const isTextOverflow = ref({})
  72. const companyNameRefs = ref({})
  73. // 检查文本是否溢出
  74. const checkTextOverflow = () => {
  75. Object.entries(companyNameRefs.value).forEach(([index, element]) => {
  76. if (element) {
  77. isTextOverflow.value[index] = element.scrollWidth > element.clientWidth
  78. }
  79. })
  80. }
  81. const list = ref([])
  82. watch(
  83. () => props.items,
  84. (newVal) => {
  85. list.value = newVal
  86. nextTick(() => {
  87. checkTextOverflow()
  88. })
  89. },
  90. { immediate: true },
  91. { deep: true }
  92. )
  93. const desc = ['areaName', 'eduName', 'expName']
  94. // 职位详情
  95. const handleClickPosition = (k) => {
  96. router.push(`/recruit/personal/position/details/${k.id}`)
  97. }
  98. // 查看更多职位
  99. const handleMoreEnterprise = (item) => {
  100. if (!item.enterprise.id) return
  101. // window.open(`/recruit/personal/company/details/${item.enterprise.id}?key=recruitmentPositions`)
  102. const name = formatName(item.enterprise.anotherName || item.enterprise.name)
  103. window.open(`/recruit/personal/position?content=${name.includes('&') ? encodeURIComponent(name) : name}`)
  104. }
  105. </script>
  106. <style lang="scss" scoped>
  107. .hot-box {
  108. display: flex;
  109. flex-wrap: wrap;
  110. }
  111. .sub-li {
  112. position: relative;
  113. width: calc((100% - 24px) / 3);
  114. min-width: calc((100% - 24px) / 3);
  115. max-width: calc((100% - 24px) / 3);
  116. margin: 0 12px 12px 0;
  117. height: 370px;
  118. border-radius: 12px;
  119. padding: 0;
  120. overflow: hidden;
  121. transition: all .2s linear;
  122. background-color: #fff;
  123. box-shadow: 0 2px 20px 0 rgba(37, 39, 48, .2);
  124. &:nth-child(3n) {
  125. margin-right: 0;
  126. }
  127. }
  128. .ellipsis-tag {
  129. white-space: nowrap;
  130. overflow: hidden;
  131. text-overflow: ellipsis;
  132. color: #cec149 !important;
  133. }
  134. .company-info {
  135. float: left;
  136. margin-left: 16px;
  137. width: 262px;
  138. }
  139. .company-info-top {
  140. display: flex;
  141. height: 90px;
  142. margin: 12px 12px 0 12px;
  143. padding: 0 12px;
  144. overflow: hidden;
  145. border-bottom: 1px solid #EBEBEB;
  146. border-radius: 8px;
  147. // &:hover {
  148. // background-color: #f2f4f7;
  149. // }
  150. }
  151. .welfareTag {
  152. color: #CEC149;
  153. font-size: 13px;
  154. }
  155. .company-info h3 {
  156. height: 22px;
  157. font-size: 18px;
  158. font-weight: 700;
  159. color: #404040;
  160. line-height: 22px;
  161. margin: 0 0 4px 0;
  162. padding: 0;
  163. max-width: 100%;
  164. overflow: hidden;
  165. white-space: nowrap;
  166. text-overflow: ellipsis;
  167. &:hover {
  168. color: var(--v-primary-base);
  169. }
  170. }
  171. .company-info p {
  172. height: 18px;
  173. font-size: 13px;
  174. font-weight: 400;
  175. color: var(--color-999);
  176. line-height: 18px;
  177. }
  178. .company-job-list {
  179. padding: 4px 10px 12px;
  180. }
  181. ul li {
  182. list-style: none
  183. }
  184. .company-job-item {
  185. display: block;
  186. height: auto;
  187. padding: 12px 10px;
  188. margin: 0;
  189. border-radius: 8px;
  190. // &-hover {
  191. // background-color: #f2f4f7;
  192. // }
  193. }
  194. .salary {
  195. font-size: 16px;
  196. float: right;
  197. font-weight: 700;
  198. color: #CEC149;
  199. line-height: 22px;
  200. max-width: none;
  201. text-align: right;
  202. flex: 1;
  203. }
  204. .name {
  205. position: relative;
  206. // max-width: 200px;
  207. line-height: 22px;
  208. font-weight: 700;
  209. color: #404040;
  210. margin-right: 8px;
  211. overflow: hidden;
  212. text-overflow: ellipsis;
  213. white-space: nowrap;
  214. transition: all linear .2s;
  215. }
  216. .moreBtn {
  217. position: absolute;
  218. width: 100%;
  219. bottom: 0;
  220. height: 47px;
  221. color: #fff;
  222. cursor: pointer;
  223. font-size: 14px;
  224. background: linear-gradient(to right, #12ebb0, #427daa);
  225. &:hover {
  226. // color: #cec149;
  227. font-size: 16px;
  228. span {
  229. font-weight: 700;
  230. text-decoration: underline;
  231. }
  232. }
  233. }
  234. </style>