index.tsx 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. import { defineComponent, PropType } from 'vue'
  2. import styles from './index.module.less'
  3. export const getAssetsHomeFile = (fileName: string) => {
  4. const path = `./images/${fileName}`
  5. const modules = import.meta.globEager('./images/*')
  6. return modules[path].default
  7. }
  8. export default defineComponent({
  9. name: 'col-steps',
  10. props: {
  11. type: {
  12. type: String,
  13. default: 'small' as 'small' | 'medium' | 'large'
  14. },
  15. active: {
  16. type: Number,
  17. default: 0
  18. }
  19. },
  20. data() {
  21. return {
  22. list: {
  23. small: [
  24. {
  25. title: '课程信息',
  26. iconActive: getAssetsHomeFile('6.png')
  27. },
  28. {
  29. title: '课程安排',
  30. icon: getAssetsHomeFile('4.png'),
  31. iconActive: getAssetsHomeFile('4_active.png')
  32. },
  33. {
  34. title: '教学计划',
  35. icon: getAssetsHomeFile('2.png'),
  36. iconActive: getAssetsHomeFile('2_active.png')
  37. },
  38. {
  39. title: '开课条件',
  40. icon: getAssetsHomeFile('3.png'),
  41. iconActive: getAssetsHomeFile('3_active.png')
  42. }
  43. ],
  44. medium: [
  45. {
  46. title: '实名认证',
  47. iconActive: getAssetsHomeFile('7.png')
  48. },
  49. {
  50. title: '基本信息',
  51. icon: getAssetsHomeFile('1.png'),
  52. iconActive: getAssetsHomeFile('1_active.png')
  53. },
  54. {
  55. title: '学历信息',
  56. icon: getAssetsHomeFile('8.png'),
  57. iconActive: getAssetsHomeFile('8_active.png')
  58. }
  59. ],
  60. large: [
  61. {
  62. title: '课程信息',
  63. iconActive: getAssetsHomeFile('6.png')
  64. },
  65. {
  66. title: '课程内容',
  67. icon: getAssetsHomeFile('5.png'),
  68. iconActive: getAssetsHomeFile('5_active.png')
  69. }
  70. ]
  71. }
  72. }
  73. },
  74. render() {
  75. return (
  76. <div class={[styles.steps, 'flex items-center bg-white']}>
  77. {this.list[this.type].map((item: any, index: number) => (
  78. <div
  79. class={[
  80. styles.step,
  81. styles[this.type],
  82. this.active >= index && styles.active
  83. ]}
  84. >
  85. <div class="w-[30px] h-[30px] rounded-full overflow-hidden bg-slate-600 mr-3">
  86. {index === 0 || this.active >= index ? (
  87. <img src={item.iconActive} />
  88. ) : (
  89. <img src={item.icon} />
  90. )}
  91. </div>
  92. {item.title}
  93. </div>
  94. ))}
  95. </div>
  96. )
  97. }
  98. })