index.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <template>
  2. <div>
  3. <div class="tabHeader">
  4. <ProgressBar :num="completeNum" :total="items?.length"></ProgressBar>
  5. <v-tabs v-model="tab" align-tabs="start" color="primary" bg-color="#f7f8fa">
  6. <v-tab v-for="k in items" :key="k.path" :value="k.value" @click="handleClick(k)">
  7. {{ k.text }}
  8. <template v-slot:append>
  9. <template v-if="k.status === false">
  10. <v-icon color="orange">mdi-information-outline</v-icon>
  11. <v-tooltip activator="parent" location="top">请完善{{ k.text }}</v-tooltip>
  12. </template>
  13. </template>
  14. </v-tab>
  15. </v-tabs>
  16. </div>
  17. <div class="pt-3 contentBox px-1" id="contentBox" ref="scrollBox">
  18. <component
  19. v-for="(val, index) in items"
  20. :key="val.id"
  21. class="mb-3 elevation-2"
  22. :is="paths[index]"
  23. :id="val.id"
  24. @complete="complete"
  25. />
  26. </div>
  27. </div>
  28. </template>
  29. <script setup>
  30. defineOptions({ name: 'person-center-resume-online'})
  31. import { ref, onMounted } from 'vue'
  32. import { useI18n } from '@/hooks/web/useI18n'
  33. import basicInfo from './components/basicInfo.vue'
  34. import selfEvaluation from './components/selfEvaluation.vue'
  35. import jobIntention from './components/jobIntention.vue'
  36. import trainingExperience from './components/trainingExperience.vue'
  37. import educationExp from './components/educationExp.vue'
  38. import workExperience from './components/workExperience.vue'
  39. import projectExperience from './components/projectExperience.vue'
  40. import vocationalSkills from './components/vocationalSkills.vue'
  41. const { t } = useI18n()
  42. const scrollBox = ref()
  43. const tab = ref(0)
  44. const paths = [basicInfo, selfEvaluation, jobIntention, educationExp, workExperience, projectExperience, trainingExperience, vocationalSkills]
  45. const items = ref([
  46. { text: t('resume.basicInfo'), id: 'basicInfo', status: false },
  47. { text: t('resume.personalAdvantages'), id: 'selfEvaluation', status: false },
  48. { text: t('resume.jobIntention'), id: 'jobIntention', status: false },
  49. { text: t('resume.educationExp'), id: 'educationExp', status: false },
  50. { text: t('resume.workExperience'), id: 'workExperience', status: false },
  51. { text: t('resume.projectExperience'), id: 'projectExperience', status: false },
  52. { text: t('resume.trainingExperience'), id: 'trainingExperience', status: false },
  53. { text: t('resume.vocationalSkills'), id: 'vocationalSkills', status: false }
  54. ])
  55. onMounted(() => {
  56. const selector = document.getElementById('contentBox')
  57. if (!selector) return
  58. selector.style.top = `${scrollBox.value.offsetTop + 12}px`
  59. })
  60. const handleClick = (item) => {
  61. if (item.id) {
  62. const selector = document.getElementById(item.id)
  63. if (!selector) {
  64. scrollBox.value.scrollTo({
  65. top: 0,
  66. behavior: 'smooth'
  67. })
  68. return
  69. }
  70. scrollBox.value.scrollTo({
  71. top: selector.offsetTop - scrollBox.value.offsetTop - 12,
  72. behavior: 'smooth'
  73. })
  74. }
  75. }
  76. // 简历完成度
  77. const completeNum = ref(0)
  78. const complete = (val) => {
  79. if (!val?.id) return
  80. completeNum.value = 0
  81. items.value.forEach(e => {
  82. if (e.id === val.id) {
  83. e.status = val.status || false
  84. }
  85. if (e.status) {
  86. completeNum.value++
  87. }
  88. })
  89. }
  90. </script>
  91. <style scoped lang="scss">
  92. .tabHeader {
  93. position: sticky;
  94. }
  95. .contentBox {
  96. height: calc(100vh - 251px);
  97. overflow: auto;
  98. }
  99. ::-webkit-scrollbar {
  100. width: 0;
  101. height: 0;
  102. }
  103. ::-webkit-scrollbar-thumb, .temporaryAdd ::-webkit-scrollbar-thumb, .details_edit ::-webkit-scrollbar-thumb {
  104. // 滚动条-颜色
  105. background: #c3c3c379;
  106. }
  107. ::-webkit-scrollbar-track, .temporaryAdd ::-webkit-scrollbar-track, .details_edit ::-webkit-scrollbar-track {
  108. // 滚动条-底色
  109. background: #e5e5e58f;
  110. }
  111. </style>