detail.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424
  1. <template>
  2. <div class="nft-detail-wrapper">
  3. <div class="back-bar">
  4. <img
  5. :src="require('@/assets/svg/icon-nft-back-arrow.svg')"
  6. class="icon-arrow"
  7. @click="back"
  8. />
  9. {{NFTInfo.nftItemName}}
  10. </div>
  11. <div class="content">
  12. <div class="nft-img">
  13. <img
  14. class="img"
  15. :src="NFTInfo.imagePath"
  16. @click="clickNFTImg"
  17. />
  18. </div>
  19. <div class="desc item" v-if="nftMetaData.description">
  20. <div class="title">Description</div>
  21. <div class="desc-content" v-html="nftMetaData.description"></div>
  22. </div>
  23. <div class="prop item" v-if="nftMetaData.properties && nftMetaData.properties.length">
  24. <div class="title">Properties</div>
  25. <div class="prop-content">
  26. <div
  27. class="prop-item"
  28. v-for="(filedValueItem, filedValueIndex) in nftMetaData.properties"
  29. :key="filedValueIndex"
  30. >
  31. {{ filedValueItem.name }}
  32. <div class="prop-name">
  33. {{ filedValueItem.value }}
  34. </div>
  35. {{ filedValueItem.description }}
  36. </div>
  37. </div>
  38. </div>
  39. <div class="about item" v-if="nftMetaData.about">
  40. <div class="title">About</div>
  41. <div class="about-content" v-html="nftMetaData.about"></div>
  42. </div>
  43. <div class="detail item" v-if="nftDetailData.details">
  44. <div class="title">Details</div>
  45. <div class="detail-content">
  46. <div class="detail-item">
  47. <div class="left">Contract Address</div>
  48. <div class="right address"
  49. @click="clickAddress">
  50. <span>{{nftDetailData.details.contractAddress}}</span>
  51. <span>{{nftDetailData.details.contractAddress}}</span>
  52. </div>
  53. </div>
  54. <div class="detail-item">
  55. <div class="left">Token ID</div>
  56. <div class="right token"
  57. @click="clickToken">
  58. {{nftDetailData.details.tokenId}}
  59. </div>
  60. </div>
  61. <div class="detail-item">
  62. <div class="left">Token Standard</div>
  63. <div class="right" >
  64. {{nftDetailData.details.tokenStandard}}
  65. </div>
  66. </div>
  67. <div class="detail-item">
  68. <div class="left">Blockchain</div>
  69. <div class="right" >
  70. {{nftDetailData.details.blockChain}}
  71. </div>
  72. </div>
  73. <div class="detail-item">
  74. <div class="left">Creator Fees</div>
  75. <div class="right" >
  76. {{nftDetailData.details.creatorFees}}
  77. </div>
  78. </div>
  79. <div class="detail-item">
  80. <div class="left">Transaction Royalties</div>
  81. <div class="right" >
  82. {{nftDetailData.details.transactionRoyalties}}
  83. </div>
  84. </div>
  85. </div>
  86. </div>
  87. <div class="date item" v-if="nftDetailData.dateOfPossession">
  88. <div class="title">Date of possession</div>
  89. <div class="date-content">{{nftDetailData.dateOfPossession}}</div>
  90. </div>
  91. <div class="price item" v-if="nftDetailData.purchasePrice">
  92. <div class="title">Purchase price</div>
  93. <div class="price-content">{{nftDetailData.purchasePrice}}</div>
  94. </div>
  95. </div>
  96. <div class="bottom-bar">
  97. <div class="default">NFT Sale function, coming soon</div>
  98. <!-- <div class="sell">
  99. <div class="sell-btn">
  100. Sell
  101. </div>
  102. </div>
  103. <div class="cancel-sale">
  104. <div class="left">
  105. 233 USDT
  106. <div class="final">
  107. (Final 203.5 USDT)
  108. </div>
  109. </div>
  110. <div class="cancel-btn">
  111. Cancel sale
  112. </div>
  113. </div> -->
  114. </div>
  115. </div>
  116. </template>
  117. <script setup>
  118. import { ref, onMounted } from "vue";
  119. import router from "@/router/popup.js";
  120. import {getNFTDetail} from "@/http/nft.js";
  121. let nftMetaData = ref({});
  122. let nftDetailData = ref({});
  123. let NFTInfo = ref({
  124. imagePath: '',
  125. nftItemName: ''
  126. });
  127. const back = () => {
  128. router.back();
  129. };
  130. const clickAddress = () => {
  131. let {contractAddressUrl = ''} = nftDetailData.value.details;
  132. if(contractAddressUrl) {
  133. window.open(contractAddressUrl);
  134. }
  135. }
  136. const clickToken = () => {
  137. let {tokenIdUrl = ''} = nftDetailData.value.details;
  138. if(tokenIdUrl) {
  139. window.open(tokenIdUrl);
  140. }
  141. }
  142. const clickNFTImg = () => {
  143. window.open(NFTInfo.value.imagePath);
  144. };
  145. const getDetail = () => {
  146. getNFTDetail({
  147. params: {
  148. nftItemId: NFTInfo.value.nftItemId
  149. }
  150. }).then(res => {
  151. if(res.code == 0) {
  152. console.log(res)
  153. let { metadata = '{}'} = res.data || {};
  154. nftDetailData.value = res.data;
  155. nftMetaData.value = JSON.parse(metadata);
  156. }
  157. }).catch((err)=>{
  158. })
  159. }
  160. onMounted(() => {
  161. let {params = '{}'} = router.currentRoute.value.query;
  162. NFTInfo.value = JSON.parse(params);
  163. getDetail();
  164. })
  165. </script>
  166. <style scoped lang="scss">
  167. .nft-detail-wrapper {
  168. width: 100%;
  169. height: 100%;
  170. .back-bar {
  171. height: 48px;
  172. background: #ffffff;
  173. box-shadow: 0px 0.5px 0px #d1d9dd;
  174. box-sizing: border-box;
  175. padding: 14px;
  176. font-weight: 500;
  177. font-size: 16px;
  178. display: flex;
  179. align-items: center;
  180. .icon-arrow {
  181. width: 24px;
  182. margin-right: 12px;
  183. cursor: pointer;
  184. }
  185. }
  186. .content {
  187. width: 100%;
  188. height: calc(100% - 120px);
  189. padding: 0 16px;
  190. box-sizing: border-box;
  191. overflow-y: auto;
  192. .nft-img {
  193. margin-top: 23px;
  194. margin-bottom: 20px;
  195. text-align: center;
  196. cursor: pointer;
  197. .img {
  198. width: 280px;
  199. border-radius: 26px;
  200. }
  201. }
  202. .item {
  203. border: 1px solid #e3e3e3;
  204. border-radius: 10px;
  205. padding: 14px;
  206. box-sizing: border-box;
  207. margin-bottom: 12px;
  208. .title {
  209. font-weight: 600;
  210. font-size: 14px;
  211. }
  212. }
  213. .desc {
  214. margin-top: 10px;
  215. .desc-content {
  216. font-weight: 500;
  217. font-size: 14px;
  218. color: #929292;
  219. span {
  220. color: #1d9bf0;
  221. }
  222. }
  223. }
  224. .prop {
  225. .prop-content {
  226. display: flex;
  227. flex-wrap: wrap;
  228. margin-top: 12px;
  229. .prop-item {
  230. width: 48%;
  231. height: 88px;
  232. background: #f8f8f8;
  233. border-radius: 10px;
  234. display: flex;
  235. flex-direction: column;
  236. justify-content: center;
  237. padding: 8px;
  238. box-sizing: border-box;
  239. align-items: center;
  240. font-weight: 500;
  241. font-size: 12px;
  242. color: #929292;
  243. margin-bottom: 10px;
  244. .prop-name {
  245. font-weight: 700;
  246. font-size: 17px;
  247. margin-top: 6px;
  248. margin-bottom: 8px;
  249. color: #000;
  250. }
  251. }
  252. .prop-item:nth-child(odd) {
  253. margin-right: 8px;
  254. }
  255. }
  256. }
  257. .about-content {
  258. margin-top: 22px;
  259. .section {
  260. font-weight: 400;
  261. font-size: 14px;
  262. margin-bottom: 20px;
  263. }
  264. }
  265. .section {
  266. font-weight: 400;
  267. font-size: 14px;
  268. margin-bottom: 10px;
  269. }
  270. .detail-content {
  271. margin-top: 15px;
  272. .detail-item {
  273. display: flex;
  274. align-items: center;
  275. justify-content: space-between;
  276. height: 24px;
  277. font-weight: 400;
  278. font-size: 14px;
  279. .right {
  280. color: #929292;
  281. }
  282. .token {
  283. color: #1d9bf0 !important;
  284. cursor: pointer;
  285. }
  286. .address {
  287. width: 100px;
  288. white-space: nowrap;
  289. color: #1d9bf0 !important;
  290. cursor: pointer;
  291. > span {
  292. display: inline-block;
  293. overflow: hidden;
  294. text-overflow: ellipsis;
  295. width: 50%;
  296. + span {
  297. width: calc(50% + 10px);
  298. direction: rtl;
  299. margin-left: -11px;
  300. }
  301. }
  302. }
  303. }
  304. }
  305. .date-content,
  306. .price-content {
  307. margin-top: 10px;
  308. font-weight: 500;
  309. font-size: 14px;
  310. color: #929292;
  311. }
  312. }
  313. .bottom-bar {
  314. background: #ffffff;
  315. box-shadow: inset 0px 1px 0px #ececec;
  316. height: 70px;
  317. padding: 15px 16px;
  318. box-sizing: border-box;
  319. display: flex;
  320. align-items: center;
  321. justify-content: center;
  322. .default {
  323. font-weight: 500;
  324. font-size: 16px;
  325. color: #a8a8a8;
  326. text-align: center;
  327. }
  328. .sell {
  329. width: 100%;
  330. height: 100%;
  331. .sell-btn {
  332. width: 120px;
  333. height: 40px;
  334. box-sizing: border-box;
  335. border: 1px solid #e9e9e9;
  336. border-radius: 100px;
  337. font-weight: 500;
  338. font-size: 16px;
  339. color: #1d9bf0;
  340. display: flex;
  341. align-items: center;
  342. justify-content: center;
  343. position: absolute;
  344. right: 16px;
  345. cursor: pointer;
  346. }
  347. }
  348. .cancel-sale {
  349. width: 100%;
  350. height: 100%;
  351. display: flex;
  352. align-items: center;
  353. justify-content: space-between;
  354. .left {
  355. font-weight: 500;
  356. font-size: 15px;
  357. .final {
  358. font-weight: 500;
  359. font-size: 12px;
  360. color: #929292;
  361. margin-top: 6px;
  362. }
  363. }
  364. .cancel-btn {
  365. width: 120px;
  366. height: 40px;
  367. box-sizing: border-box;
  368. border: 1px solid #e9e9e9;
  369. border-radius: 100px;
  370. font-weight: 500;
  371. font-size: 16px;
  372. color: #ff0000;
  373. display: flex;
  374. align-items: center;
  375. justify-content: center;
  376. cursor: pointer;
  377. }
  378. }
  379. }
  380. }
  381. </style>