hotPromoted.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  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>{{ 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-if="item?.enterprise?.welfareTagStr" style="padding: 6px 0; border-bottom: 1px solid #EBEBEB">
  24. <div v-ellipse-tooltip class="px-5 welfareTag ellipsis-tag">{{ item.enterprise.welfareTagStr }}</div>
  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 :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. // import Ellipsis from '@/components/Ellipsis'
  65. const props = defineProps({
  66. items: {
  67. type: Array,
  68. default: () => []
  69. }
  70. })
  71. const router = useRouter()
  72. const isTextOverflow = ref({})
  73. const companyNameRefs = ref({})
  74. // 检查文本是否溢出
  75. const checkTextOverflow = () => {
  76. Object.entries(companyNameRefs.value).forEach(([index, element]) => {
  77. if (element) {
  78. isTextOverflow.value[index] = element.scrollWidth > element.clientWidth
  79. }
  80. })
  81. }
  82. const list = ref([])
  83. watch(
  84. () => props.items,
  85. (newVal) => {
  86. list.value = newVal
  87. nextTick(() => {
  88. checkTextOverflow()
  89. })
  90. },
  91. { immediate: true },
  92. { deep: true }
  93. )
  94. const desc = ['areaName', 'eduName', 'expName']
  95. // 职位详情
  96. const handleClickPosition = (k) => {
  97. router.push(`/recruit/personal/position/details/${k.id}`)
  98. }
  99. // 查看更多职位
  100. const handleMoreEnterprise = (item) => {
  101. if (!item.enterprise.id) return
  102. // window.open(`/recruit/personal/company/details/${item.enterprise.id}?key=recruitmentPositions`)
  103. const name = formatName(item.enterprise.anotherName || item.enterprise.name)
  104. window.open(`/recruit/personal/position?content=${name.includes('&') ? encodeURIComponent(name) : name}`)
  105. }
  106. </script>
  107. <style lang="scss" scoped>
  108. .hot-box {
  109. display: flex;
  110. flex-wrap: wrap;
  111. }
  112. .sub-li {
  113. position: relative;
  114. width: calc((100% - 24px) / 3);
  115. min-width: calc((100% - 24px) / 3);
  116. max-width: calc((100% - 24px) / 3);
  117. margin: 0 12px 12px 0;
  118. height: 370px;
  119. border-radius: 12px;
  120. padding: 0;
  121. overflow: hidden;
  122. transition: all .2s linear;
  123. background-color: #fff;
  124. box-shadow: 0 2px 20px 0 rgba(37, 39, 48, .2);
  125. &:nth-child(3n) {
  126. margin-right: 0;
  127. }
  128. }
  129. .ellipsis-tag {
  130. white-space: nowrap;
  131. overflow: hidden;
  132. text-overflow: ellipsis;
  133. color: #cec149 !important;
  134. }
  135. .company-info {
  136. float: left;
  137. margin-left: 16px;
  138. width: 262px;
  139. }
  140. .company-info-top {
  141. display: flex;
  142. height: 90px;
  143. margin: 12px 12px 0 12px;
  144. padding: 0 12px;
  145. overflow: hidden;
  146. border-bottom: 1px solid #EBEBEB;
  147. border-radius: 8px;
  148. }
  149. .welfareTag {
  150. color: #CEC149;
  151. font-size: 13px;
  152. }
  153. .company-info h3 {
  154. height: 22px;
  155. font-size: 18px;
  156. font-weight: 700;
  157. color: #404040;
  158. line-height: 22px;
  159. margin: 0 0 4px 0;
  160. padding: 0;
  161. max-width: 100%;
  162. overflow: hidden;
  163. white-space: nowrap;
  164. text-overflow: ellipsis;
  165. &:hover {
  166. color: var(--v-primary-base);
  167. }
  168. }
  169. .company-info p {
  170. height: 18px;
  171. font-size: 13px;
  172. font-weight: 400;
  173. color: var(--color-999);
  174. line-height: 18px;
  175. }
  176. .company-job-list {
  177. padding: 4px 10px 12px;
  178. }
  179. ul li {
  180. list-style: none
  181. }
  182. .company-job-item {
  183. display: block;
  184. height: auto;
  185. padding: 12px 10px;
  186. margin: 0;
  187. border-radius: 8px;
  188. }
  189. .salary {
  190. font-size: 16px;
  191. float: right;
  192. font-weight: 700;
  193. color: #CEC149;
  194. line-height: 22px;
  195. max-width: none;
  196. text-align: right;
  197. flex: 1;
  198. }
  199. .name {
  200. position: relative;
  201. // max-width: 200px;
  202. line-height: 22px;
  203. font-weight: 700;
  204. color: #404040;
  205. margin-right: 8px;
  206. overflow: hidden;
  207. text-overflow: ellipsis;
  208. white-space: nowrap;
  209. transition: all linear .2s;
  210. }
  211. .moreBtn {
  212. position: absolute;
  213. width: 100%;
  214. bottom: 0;
  215. height: 47px;
  216. color: #fff;
  217. cursor: pointer;
  218. font-size: 14px;
  219. background: linear-gradient(to right, #12ebb0, #427daa);
  220. &:hover {
  221. font-size: 16px;
  222. span {
  223. font-weight: 700;
  224. }
  225. }
  226. }
  227. </style>