open-box.vue 4.0 KB

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