card.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <template>
  2. <view
  3. class="card-wrapper"
  4. :style="{
  5. backgroundImage: 'url(' + ossurl.box.lotteryBg + ')'
  6. }"
  7. >
  8. <view class="level">
  9. <image
  10. :src="LEVEL_MAP[data.level].titleText"
  11. mode="aspectFit"
  12. /></view>
  13. <view class="title">{{ data.name }}</view>
  14. <image
  15. class="super-image"
  16. :src="data.cover"
  17. mode="aspectFit"
  18. :style="{
  19. top: coverSize.top + 'rpx',
  20. width: coverSize.width + 'rpx',
  21. height: coverSize.height + 'rpx'
  22. }"
  23. />
  24. </view>
  25. </template>
  26. <script>
  27. import { LEVEL_MAP } from '@/utils/config'
  28. import resource from '@/utils/resource'
  29. import ossurl from '@/utils/ossurl'
  30. export default {
  31. props: {
  32. data: Object,
  33. size: {
  34. default: { width: 287, height: 436 },
  35. type: Object
  36. },
  37. coverSize: {
  38. default: { width: 234, height: 296, top: 26 },
  39. type: Object
  40. },
  41. textSize: {
  42. default: { width: 184, height: 81, bottom: 32 },
  43. type: Object
  44. },
  45. addSize: {
  46. default: { width: 186, height: 42 },
  47. type: Object
  48. },
  49. showAdd: Boolean
  50. },
  51. data() {
  52. return {
  53. resource,
  54. ossurl,
  55. LEVEL_MAP
  56. }
  57. }
  58. }
  59. </script>
  60. <style lang="scss" scoped>
  61. .card-wrapper {
  62. position: relative;
  63. width: 210rpx;
  64. height: 300rpx;
  65. background-size: 100% 100%;
  66. padding: 24rpx;
  67. text-align: center;
  68. .level {
  69. font-size: 24rpx;
  70. font-family: Source Han Sans, Source Han Sans;
  71. font-weight: 700;
  72. color: #000000;
  73. image{
  74. width: 90rpx;
  75. height: 32rpx;
  76. }
  77. }
  78. .title {
  79. font-size: 20rpx;
  80. font-family: Source Han Sans, Source Han Sans;
  81. font-weight: 350;
  82. color: #b58100;
  83. text-overflow: ellipsis;
  84. overflow: hidden;
  85. white-space: nowrap;
  86. }
  87. .super {
  88. position: absolute;
  89. left: 0;
  90. top: 0;
  91. width: 100%;
  92. height: 100%;
  93. }
  94. .super-image {
  95. width: 100%;
  96. height: 450rpx;
  97. }
  98. .super-text {
  99. width: 182rpx;
  100. height: 56rpx;
  101. position: absolute;
  102. bottom: 40rpx;
  103. }
  104. .add-1 {
  105. position: absolute;
  106. opacity: 0;
  107. bottom: 0;
  108. &.add-animal {
  109. animation: add-bottom-top 2s forwards;
  110. }
  111. }
  112. @keyframes add-bottom-top {
  113. 0% {
  114. bottom: 30%;
  115. opacity: 0.3;
  116. }
  117. 60% {
  118. bottom: 50%;
  119. opacity: 1;
  120. }
  121. 100% {
  122. bottom: 65%;
  123. opacity: 0;
  124. }
  125. }
  126. }
  127. </style>