nft-card.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <template>
  2. <div class="show" :style="{ zoom: zoom }">
  3. <div class="card" :class="item.modelName">
  4. <div class="logo">
  5. <img v-if="item.logoImagePath" :src="item.logoImagePath" alt="" />
  6. </div>
  7. <div class="member">{{ item.projectName === '' ? 'xxxx' : item.projectName }}</div>
  8. <div class="number">{{ nftItemId === '' ? '0000' : nftItemId }}</div>
  9. </div>
  10. <img class="bg" :src="item.modelImagePath" />
  11. </div>
  12. </template>
  13. <script setup>
  14. import { onBeforeMount, defineProps, ref } from 'vue'
  15. const zoom = ref(1);
  16. const props = defineProps({
  17. item: {
  18. type: Object,
  19. default: {},
  20. },
  21. nftItemId: {
  22. type: String,
  23. default: '0000',
  24. },
  25. width: {
  26. type: Number,
  27. default: 400
  28. }
  29. })
  30. onBeforeMount(() => {
  31. if (props.width) {
  32. zoom.value = props.width / 400
  33. }
  34. })
  35. </script>
  36. <style lang='scss' scoped>
  37. .show {
  38. position: relative;
  39. overflow: hidden;
  40. width: 400px;
  41. height: 400px;
  42. .card {
  43. position: absolute;
  44. left: 53px;
  45. top: 103px;
  46. width: 294px;
  47. height: 186px;
  48. .logo {
  49. position: absolute;
  50. top: 50%;
  51. left: 50%;
  52. transform: translate(-50%, -50%);
  53. width: 100px;
  54. height: 100px;
  55. border-radius: 50%;
  56. background-color: #fff;
  57. img {
  58. width: 100%;
  59. height: 100%;
  60. border-radius: 50%;
  61. object-fit: cover;
  62. }
  63. }
  64. .member {
  65. position: absolute;
  66. top: 11px;
  67. left: 11px;
  68. width: 228px;
  69. font-size: 12px;
  70. text-align: left;
  71. font-weight: 800;
  72. line-height: 13px;
  73. }
  74. .number {
  75. position: absolute;
  76. top: 11px;
  77. right: 10px;
  78. font-size: 12px;
  79. font-weight: 800;
  80. line-height: 13px;
  81. letter-spacing: 1px;
  82. }
  83. &.s1 {
  84. .member, .number {
  85. color: #ffffff;
  86. }
  87. }
  88. &.s2 {
  89. .member, .number {
  90. color: #4AC3E1;
  91. }
  92. }
  93. &.s3 {
  94. .member, .number {
  95. color: #606C94;
  96. }
  97. }
  98. &.s4 {
  99. .member, .number {
  100. color: #504215;
  101. }
  102. }
  103. }
  104. .bg {
  105. width: 100%;
  106. height: 100%;
  107. }
  108. }
  109. </style>