hotJobs.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <template>
  2. <div class="default-width mb-6 d-flex align-center justify-center">
  3. <span class="color-primary font-weight-bold" style="width: 80px; min-width: 80px;">{{ $t('position.popularPosition') }}:</span>
  4. <div class="overflow-hidden py-3 pl-2" style="height: 60px; ">
  5. <v-hover v-slot="{ isHovering, props }" v-for="(item, index) in jobs" :key="index">
  6. <span
  7. v-bind="props"
  8. v-ripple.center
  9. label
  10. size="small"
  11. class="mr-2 mb-4 tag"
  12. :class="isHovering ? 'elevation-5' : 'elevation-1'"
  13. @click.stop="handleClick(item)"
  14. >
  15. {{ item.nameCn }}
  16. </span>
  17. </v-hover>
  18. </div>
  19. </div>
  20. </template>
  21. <script setup>
  22. import { getHotPositionList } from '@/api/common/index'
  23. import Snackbar from '@/plugins/snackbar'
  24. import { ref } from 'vue';
  25. defineOptions({ name:'personal-hotJobs-list'})
  26. const handleClick = (item) => {
  27. if (!item?.id) {
  28. return Snackbar.warning('岗位信息失效,请更换岗位查看详情')
  29. }
  30. window.open('/recruit/personal/position?positionId=' + item.id)
  31. }
  32. // 获取行业树形
  33. let jobs = ref(null)
  34. const getTreeData = async () => {
  35. const res = await getHotPositionList()
  36. jobs.value = res.splice(0, 10) || []
  37. }
  38. getTreeData()
  39. </script>
  40. <style lang="scss" scoped>
  41. .tag {
  42. background-color: #fff !important;
  43. color: var(--v-primary-base);
  44. padding: 5px 20px;
  45. display: inline-block;
  46. border-radius: 6px;
  47. font-size: 15px;
  48. cursor: pointer;
  49. }
  50. </style>