open-box.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <template>
  2. <!-- gif -->
  3. <div class="box_content">
  4. <img :src="require('@/assets/gif/box.gif')" class="box" v-show="state.box.show" />
  5. <div class="nft" v-for="item in state.nft.data" v-show="item.show">
  6. <div class="detail">
  7. <img :src="item.imagePath" alt="" />
  8. </div>
  9. <p>{{ item.nftItemName }}</p>
  10. </div>
  11. </div>
  12. </template>
  13. <script setup>
  14. import { reactive, onMounted, inject } from 'vue'
  15. import router from "@/router/buy-nft.js";
  16. let pay_info = inject('pay_info');
  17. let state = reactive({
  18. box: {
  19. show: true
  20. },
  21. nft: {
  22. data: []
  23. }
  24. })
  25. const setAllNoShow = () => {
  26. state.nft.data.forEach((item) => {
  27. item.show = false
  28. })
  29. }
  30. const showNFTs = () => {
  31. let len = state.nft.data.length
  32. if (len == 0) {
  33. return
  34. }
  35. let i = 0
  36. setAllNoShow()
  37. state.nft.data[i].show = true
  38. i++
  39. let timer = setInterval(() => {
  40. if (len > i) {
  41. setAllNoShow()
  42. state.nft.data[i].show = true
  43. } else {
  44. clearInterval(timer)
  45. chrome.tabs.getCurrent((tab) => {
  46. chrome.tabs.sendMessage(tab.id, {
  47. actionType: "IFRAME_TWITTER_HIDE_BUY_NFT",
  48. }, (res) => { });
  49. chrome.tabs.sendMessage(tab.id, {
  50. actionType: "IFRAME_TWITTER_SHOW_POPUP_PAGE",
  51. }, (res) => { });
  52. router.replace('/')
  53. })
  54. }
  55. i++
  56. }, 2000)
  57. }
  58. onMounted(() => {
  59. state.nft.data = pay_info.buy_items || []
  60. setTimeout(() => {
  61. state.box.show = false
  62. showNFTs()
  63. }, 2000)
  64. })
  65. </script>
  66. <style lang="scss" scoped>
  67. .box_content {
  68. position: fixed;
  69. text-align: center;
  70. display: flex;
  71. justify-content: center;
  72. z-index: 2;
  73. .box {
  74. width: 200px;
  75. position: absolute;
  76. top: 40%;
  77. left: 50%;
  78. margin-top: -100px;
  79. margin-left: -100px;
  80. }
  81. .nft {
  82. position: absolute;
  83. top: 40%;
  84. margin-top: -200px;
  85. width: 400px;
  86. height: 450px;
  87. animation: myfirst 0.5s;
  88. display: flex;
  89. flex-direction: column;
  90. .detail {
  91. flex: 1;
  92. text-align: center;
  93. img {
  94. width: 100%;
  95. height: 100%;
  96. border: 3px solid white;
  97. border-radius: 10px;
  98. }
  99. }
  100. p {
  101. margin: 0;
  102. padding: 0;
  103. margin-top: 20px;
  104. color: #FFFFFF;
  105. font-size: 16px;
  106. font-weight: 700;
  107. }
  108. }
  109. }
  110. @keyframes myfirst {
  111. 0% {
  112. width: 300px;
  113. height: 300px;
  114. }
  115. 50% {
  116. width: 450px;
  117. height: 500px;
  118. margin-top: -210px;
  119. }
  120. 100% {
  121. margin-top: -200px;
  122. width: 400px;
  123. height: 450px;
  124. }
  125. }
  126. </style>