123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- <template>
- <div class="nft">
- <div class="title">
- <div class="tag">
- <img class="logo" :src="saleData.nftProjectAvatar" />
- <font class="text">{{saleData.nftProjectName}}</font>
- <img class="tagImg" :src=" require('@/assets/img/icon-nft.png') " />
- </div>
- <div class="share" @click="share">
- <img :src=" require('@/assets/img/icon-ntf-share.png') " />
- </div>
- </div>
- <div class="content">
- <img :src="saleData.windowImagePath" />
- </div>
- <div class="buy" @click="buy">
- <button>Buy NFT</button>
- </div>
- </div>
- </template>
- <script setup>
- import { onBeforeMount, ref } from 'vue'
- import { getTwitterSaleNftProjectInfo } from '@/http/nft'
- import { pageUrl } from "@/http/configAPI.js"
- const saleData = ref({});
- const getSaleInfo = () => {
- let urlParams = window.location.search;
- let searchParams = new URLSearchParams(urlParams);
- let pathname = searchParams.get('pathname');
- let pathArr, account;
- if (pathname) {
- pathname = decodeURIComponent(pathname);
- pathname = pathname.slice(1);
- pathArr = pathname.split('/');
- account = pathArr[0];
- getSaleProjectInfo(account);
- }
- }
- const getSaleProjectInfo = (account) => {
- getTwitterSaleNftProjectInfo({
- params: {
- twitterAccount: account
- }
- }).then(res => {
- let { data } = res;
- if (data !== null) {
- // setData
- saleData.value = data;
- // postMessage
- chrome.tabs.getCurrent((tab) => {
- chrome.tabs.sendMessage(tab.id, { actionType: "IFRAME_NFT_SHOW_SALE" });
- })
- }
- })
- }
- const share = () => {
- let url = pageUrl + `/nft/${saleData.value.nftProjectId}`
- chrome.tabs.getCurrent((tab) => {
- chrome.tabs.sendMessage(tab.id, { actionType: "IFRAME_TWITTER_PUBLISH", publishRes: { srcContent: url } });
- })
- }
- const buy = () => {
- console.log(1111, saleData.value.nftProjectId)
- }
- onBeforeMount(() => {
- getSaleInfo()
- })
- </script>
- <style lang='scss'>
- body {
- margin: 0;
- padding: 0;
- }
- .nft {
- width: 100%;
- height:297px;
- user-select:none;
- border-radius:20px;
- background:#F7F9F9;
- .title {
- height:46px;
- display:flex;
- justify-content:space-between;
- align-items:center;
- .tag {
- display:flex;
- align-items:center;
- padding-left:15px;
- .logo {
- overflow:hidden;
- width:20px;
- height:20px;
- border-radius:50%;
- background-color:#eee;
- }
- .text {
- font-size:18px;
- font-weight:bold;
- margin:0 7px;
- }
- .tagImg {
- width:37px;
- height:22px;
- }
- }
- .share {
- cursor: pointer;
- padding-right:15px;
- img{
- width:19px;
- height:18px;
- }
- }
- }
- .content {
- height:190px;
- img {
- width:100%;
- height:100%;
- }
- }
- .buy {
- height:61px;
- display:flex;
- justify-content:center;
- align-items:center;
- button {
- width:310px;
- height:34px;
- cursor: pointer;
- color:#ffffff;
- font-size:15px;
- font-weight:bold;
- background:#000;
- border:0;
- border-radius:44px;
- }
- }
- }
- </style>
|