Card.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <template>
  2. <div class="card" :class="`${chapter}-theme`">
  3. <div class="card-img">
  4. <img
  5. :src="
  6. getEnvImagePath(
  7. Array.isArray(detail?.img)
  8. ? detail?.img[initImgIndex || 0]
  9. : detail?.img
  10. )
  11. "
  12. />
  13. </div>
  14. <div class="card-inner">
  15. <p class="card__title">{{ detail?.name }}</p>
  16. <p class="card__size">尺寸:{{ detail?.size }}</p>
  17. </div>
  18. </div>
  19. </template>
  20. <script setup>
  21. import { getEnvImagePath } from "@enamel/base/utils";
  22. defineProps(["detail", "initImgIndex", "chapter"]);
  23. </script>
  24. <style lang="scss" scoped>
  25. .card {
  26. max-width: 350px;
  27. cursor: pointer;
  28. &.chapter2-theme {
  29. .card-img {
  30. background-image: url("@/assets/images/20-min.png");
  31. }
  32. }
  33. &.chapter3-theme {
  34. .card-img {
  35. background-image: url("@/assets/images/21-min.png");
  36. }
  37. }
  38. &.chapter4-theme {
  39. .card-img {
  40. background-image: url("@/assets/images/22-min.png");
  41. }
  42. }
  43. &-img {
  44. padding: 30px;
  45. width: 331px;
  46. height: 229px;
  47. background: url("@/assets/images/19-min.png") no-repeat center / contain;
  48. img {
  49. display: block;
  50. width: 100%;
  51. height: 100%;
  52. object-fit: contain;
  53. }
  54. }
  55. &-inner {
  56. position: relative;
  57. padding: 15px 0 0 44px;
  58. text-indent: 0;
  59. &::before {
  60. content: "";
  61. position: absolute;
  62. top: 17px;
  63. left: 0;
  64. width: 25px;
  65. height: 25px;
  66. background: url("@/assets/images/14-min.png") no-repeat center / contain;
  67. }
  68. }
  69. &__title {
  70. color: #1f1f1f;
  71. line-height: 32px;
  72. }
  73. &__size {
  74. margin-top: 8px;
  75. color: #767676;
  76. font-size: 15px;
  77. line-height: 18px;
  78. letter-spacing: 1px;
  79. }
  80. }
  81. </style>