index.vue 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <div class="default-width d-flex" ref="scrollBox">
  3. <div class="mr-3 pt-3">
  4. <v-card id="leftCadId" width="240" max-width="240" height="440" class="positionSticky">
  5. <v-list>
  6. <v-list-subheader class="title">简历目录</v-list-subheader>
  7. <v-list-item v-for="(item, i) in items" :key="i" :value="item" :disabled="!item.id" color="primary" @click="handleClick(item)">
  8. <template v-slot:prepend>
  9. <v-icon :icon="item.icon"></v-icon>
  10. </template>
  11. <v-list-item-title v-text="item.text"></v-list-item-title>
  12. <!-- <template v-slot:append>
  13. <v-icon color="primary">mdi-check</v-icon>
  14. </template> -->
  15. </v-list-item>
  16. </v-list>
  17. </v-card>
  18. </div>
  19. <div class=" pt-3">
  20. <component
  21. v-for="item in comList"
  22. :key="item.id"
  23. ref="component"
  24. class="mb-3"
  25. :is="item.path"
  26. :id="item.domId"
  27. />
  28. </div>
  29. </div>
  30. </template>
  31. <script setup>
  32. defineOptions({ name: 'resume-index' })
  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. import { useI18n } from '@/hooks/web/useI18n'
  42. const { t } = useI18n()
  43. import { ref } from 'vue'
  44. import { onMounted } from 'vue';
  45. const scrollBox = ref()
  46. const comList = [
  47. { path: basicInfo, id: 'resumeBasicInfo', domId: 'basicInfo' }, // domId与items中的id保持一致
  48. { path: selfEvaluation, id: 'resumeSelfEvaluation', domId: 'selfEvaluation' },
  49. { path: jobIntention, id: 'resumeJobIntention', domId: 'jobIntention' },
  50. { path: educationExp, id: 'resumeEducationExp', domId: 'educationExp' },
  51. { path: workExperience, id: 'resumeProjectExperience', domId: 'workExperience' },
  52. { path: projectExperience, id: 'resumeProjectExperience', domId: 'projectExperience' },
  53. { path: trainingExperience, id: 'resumeTrainingExperience', domId: 'trainingExperience' },
  54. { path: vocationalSkills, id: 'resumeVocationalSkills', domId: 'vocationalSkills' },
  55. ]
  56. const items = [
  57. { text: t('resume.basicInfo'), icon: 'mdi-account-outline', id: 'basicInfo' },
  58. { text: t('resume.personalAdvantages'), icon: 'mdi-account-star-outline', id: 'selfEvaluation' },
  59. { text: t('resume.jobIntention'), icon: 'mdi-briefcase-variant-outline', id: 'jobIntention' },
  60. { text: t('resume.educationExp'), icon: 'mdi-school-outline', id: 'educationExp' },
  61. { text: t('resume.workExperience'), icon: 'mdi-ballot-outline', id: 'workExperience' },
  62. { text: t('resume.projectExperience'), icon: 'mdi-card-text-outline', id: 'projectExperience' },
  63. { text: t('resume.trainingExperience'), icon: 'mdi-flag-outline', id: 'trainingExperience' },
  64. { text: t('resume.vocationalSkills'), icon: 'mdi-star-check-outline', id: 'vocationalSkills' }
  65. ]
  66. onMounted(() => {
  67. const selector = document.getElementById('leftCadId')
  68. if (!selector) return
  69. selector.style.top = `${scrollBox.value.offsetTop + 12}px`
  70. })
  71. const handleClick = (item) => {
  72. if (item.id) {
  73. const selector = document.getElementById(item.id)
  74. if (!selector) return
  75. window.scrollTo({
  76. top: selector.offsetTop - scrollBox.value.offsetTop - 12,
  77. behavior: 'smooth'
  78. })
  79. }
  80. }
  81. </script>
  82. <style lang="scss" scoped>
  83. .positionSticky {
  84. position: sticky;
  85. // top: 62px;
  86. }
  87. .title {
  88. color: #333;
  89. font-weight: 600;
  90. font-size: 20px;
  91. }
  92. </style>