hotJobs.vue 1.3 KB

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