index.tsx 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. import { ElButton, ElImage } from 'element-plus'
  2. import { defineComponent } from 'vue'
  3. import iconTeacher from '@/common/images/icon_teacher.png'
  4. export default defineComponent({
  5. name: 'item',
  6. props: {
  7. item: {
  8. type: Object,
  9. default: () => ({})
  10. },
  11. onOffCourse: {
  12. type: Function,
  13. default: (item: any) => {}
  14. }
  15. },
  16. render() {
  17. const item = this.item
  18. return (
  19. <div
  20. class="border border-[#E0E0E0] box-border rounded-[10px] w-[218px] m-auto overflow-hidden relative transition-all cursor-pointer"
  21. onClick={() => {
  22. // console.log(item)
  23. if (item.type === 'video') {
  24. if (
  25. item.shelvesFlag === 0 &&
  26. (item.status === 'UNPASS' || item.status === 'OUT_SALE')
  27. ) {
  28. this.$router.push({
  29. path: '/userInfo/videoOperation',
  30. query: {
  31. type: 'edit',
  32. groupId: item.id
  33. }
  34. })
  35. return
  36. } else {
  37. this.$router.push({
  38. path: '/videoDetail',
  39. query: {
  40. id: item.id
  41. }
  42. })
  43. }
  44. }
  45. if (
  46. item.type === 'live' &&
  47. (item.status === 'CANCEL' || item.status === 'OUT_SALE')
  48. ) {
  49. // 直播课
  50. this.$router.push({
  51. path: '/userInfo/liveOperation',
  52. query: {
  53. type: 'edit',
  54. groupId: item.courseGroupId
  55. }
  56. })
  57. }
  58. }}
  59. >
  60. {/* {item.subjectName && (
  61. <div class="absolute top-2 right-3 bg-black/40 text-white text-sm rounded-sm px-3 h-7 flex items-center justify-center z-10">
  62. {item.subjectName}
  63. </div>
  64. )} */}
  65. <div class="relative">
  66. <ElImage
  67. class="w-full h-[122px] align-middle"
  68. fit="cover"
  69. src={item.backgroundPic}
  70. />
  71. <div class="text-sm text-[#52FFDC] h-7 leading-7 px-3 flex items-center justify-between absolute left-0 right-0 bottom-0 bg-black/60">
  72. <div>
  73. <div class="text-base text-[#FF5F22] leading-none">
  74. {item.courseNum}课时
  75. </div>
  76. </div>
  77. <div>
  78. <i class="w-1 h-1 bg-[#52FFDC] rounded-full mr-1.5 inline-block"></i>
  79. {item.studentCount}人已学习
  80. </div>
  81. </div>
  82. </div>
  83. <div class="text-base px-2.5 pt-2 text-[#666666] leading-none font-semibold whitespace-nowrap overflow-hidden text-ellipsis">
  84. {item.courseGroupName}
  85. </div>
  86. {item.courseStartTime && (
  87. <p class="text-[#999] text-xs px-2.5 leading-none pt-1.5">
  88. 开课时间:{item.courseStartTime}
  89. </p>
  90. )}
  91. <div class="mx-2.5 pt-1.5 pb-2 flex items-center justify-between">
  92. {item.payType === 'VIP' ? (
  93. <div class="text-xl text-[#C76E21] font-semibold leading-none">
  94. 会员
  95. </div>
  96. ) : (
  97. <div class="text-xl text-[#F90000] font-semibold leading-none">
  98. <span class="text-sm leading-7">¥</span>
  99. {item.coursePrice}
  100. </div>
  101. )}
  102. {item.type === 'video' && item.status === 'PASS' && (
  103. <div>
  104. <ElButton
  105. type="primary"
  106. round
  107. onClick={(e: MouseEvent) => {
  108. e.stopPropagation()
  109. this.onOffCourse(item)
  110. }}
  111. >
  112. 下架课程
  113. </ElButton>
  114. </div>
  115. )}
  116. </div>
  117. </div>
  118. )
  119. }
  120. })