videoCard.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <template>
  2. <div class="video-card" >
  3. <div class="img-box">
  4. <img :src="cardData.imgUrl">
  5. <i @click="cardClick"></i>
  6. </div>
  7. <h4 v-if="cardData.title" :title="cardData.title">{{cardData.title}}</h4>
  8. <p v-if="cardData.des">{{cardData.des}}</p>
  9. </div>
  10. </template>
  11. <script>
  12. export default {
  13. name: "videoCard",
  14. props: {
  15. cardData: {
  16. type: Object,
  17. default: () => ({})
  18. }
  19. },
  20. methods: {
  21. cardClick() {
  22. this.$emit('card-click', this.cardData)
  23. }
  24. }
  25. }
  26. </script>
  27. <style lang="scss" scoped>
  28. .video-card {
  29. width: 370px;
  30. height: 230px;
  31. .img-box {
  32. position: relative;
  33. background: greenyellow;
  34. width: inherit;
  35. height: inherit;
  36. overflow: hidden;
  37. border-radius: 10px;
  38. img {
  39. width: 100%;
  40. height: 100%;
  41. transition: all .5s ease;
  42. }
  43. &:hover{img{transform: scale(1.1);}}
  44. i {
  45. position: absolute;
  46. left: 50%;
  47. top: 50%;
  48. transform: translate(-30px,-30px);
  49. display: inline-block;
  50. width: 60px;
  51. height: 60px;
  52. background-image: url("~static/images/client/course/course-video-icon.svg");
  53. background-repeat: no-repeat;
  54. cursor: pointer;
  55. }
  56. }
  57. h4 {
  58. font-size: 24px;
  59. font-weight: 800;
  60. color: #333;
  61. text-align: center;
  62. margin-top: 25px;
  63. width: 100%;
  64. text-overflow: ellipsis;
  65. -o-text-overflow: ellipsis;
  66. overflow: hidden;
  67. word-wrap: break-word;
  68. white-space: nowrap;
  69. }
  70. p {
  71. font-size: 16px;
  72. font-weight: 500;
  73. color: #333;
  74. text-align: center;
  75. margin-top: 25px;
  76. }
  77. }
  78. @media (max-width: 768px) {
  79. .video-card {
  80. width: 100%;
  81. height: 100%;
  82. .img-box {
  83. position: relative;
  84. background: greenyellow;
  85. width: inherit;
  86. height: inherit;
  87. overflow: hidden;
  88. border-radius: 10px;
  89. img {
  90. width: 100%;
  91. min-height: 160px;
  92. transition: all .5s ease;
  93. }
  94. }
  95. h4 {
  96. font-size: 16px;
  97. font-weight: 800;
  98. color: #333;
  99. text-align: center;
  100. margin-top: 15px;
  101. }
  102. p {
  103. font-size: 12px;
  104. font-weight: 500;
  105. color: #333;
  106. text-align: center;
  107. margin-top: 15px;
  108. }
  109. }
  110. }
  111. </style>