From 4eb341e815b83d70e4e8e5eb6297cc7827148bd0 Mon Sep 17 00:00:00 2001 From: yuyongdong Date: Thu, 18 Jul 2024 19:11:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=8C=E6=AC=A1=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E6=98=BE=E7=A4=BA=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/assets/centralization.vue | 11 ++++-- src/components/assets/collectibles.vue | 3 +- src/components/assets/founder.vue | 50 +++++++++++++++++++++--- src/components/assets/staking.vue | 9 +++-- src/utils/marketplace.js | 2 +- 5 files changed, 61 insertions(+), 14 deletions(-) diff --git a/src/components/assets/centralization.vue b/src/components/assets/centralization.vue index 8bfb962..cfa3a5b 100644 --- a/src/components/assets/centralization.vue +++ b/src/components/assets/centralization.vue @@ -18,8 +18,8 @@
- Please log into the wallet holding your Centralized Assets to view details. -
Login
+ Please log into the wallet holding your Centralized Assets to view details. +
Login
@@ -76,6 +76,7 @@ const renewMyNft = async() => { }, 2000); } +const isPassprotLogin = ref(false) const next_cursor = ref() const getMyAssets = async () => { // nftList.value = [] @@ -99,6 +100,7 @@ const getMyAssets = async () => { } } const bc = new BlockChain() + isPassprotLogin.value = bc.passportLogined if(bc.passportLogined) { try { let nftListBox @@ -140,8 +142,9 @@ const handleScroll = () => { } } -const passportLogin = () => { - +const passportLogin = async () => { + await new BlockChain().appendPassport() + getMyAssets() } watch(localWalletStore,() => { diff --git a/src/components/assets/collectibles.vue b/src/components/assets/collectibles.vue index 90e35e0..02d0954 100644 --- a/src/components/assets/collectibles.vue +++ b/src/components/assets/collectibles.vue @@ -86,7 +86,8 @@ const getMyAssets = async () => { if(myADdress) { try { let nftListBox - let res = await apiAssetsState(myADdress, data) + const net_id = import.meta.env.VUE_APP_NET_ID + let res = await apiAssetsState(myADdress, net_id, data) nftList.value = [...nftList.value, ...res.rows] nftListBox = nftList.value.reduce((acc, obj) => { const existingObj = acc.find(item => item.token_id == obj.token_id) diff --git a/src/components/assets/founder.vue b/src/components/assets/founder.vue index 90e35e0..68c5c3f 100644 --- a/src/components/assets/founder.vue +++ b/src/components/assets/founder.vue @@ -18,7 +18,11 @@
-
+
+ Please log into the wallet holding your Founder's Tag to view details. +
Login
+
+

No NFT yet

@@ -37,6 +41,7 @@ import NftId from "@/configs/item.json" import { apiAssetsState } from "@/utils/marketplace" import {useMarketplaceStore} from "@/store/marketplace"; import {walletStore} from "@/store/wallet"; +import { BlockChain } from "@/components/chain/BlockChain" const marketplaceStore = useMarketplaceStore() const localWalletStore = walletStore() const nftList = ref([]) @@ -73,6 +78,7 @@ const renewMyNft = async() => { }, 2000); } +const isEoaLoginedLogin = ref(false) const next_cursor = ref() const getMyAssets = async () => { // nftList.value = [] @@ -83,10 +89,14 @@ const getMyAssets = async () => { cursor: next_cursor.value, search_name: overviewValue.value } - if(myADdress) { + const bc = new BlockChain() + isEoaLoginedLogin.value = bc.eoaLogined + console.log(bc.eoaLogined) + if(bc.eoaLogined) { try { let nftListBox - let res = await apiAssetsState(myADdress, data) + let net_id = import.meta.env.VUE_APP_NET_ID_MAIN + let res = await apiAssetsState(myADdress, net_id, data) nftList.value = [...nftList.value, ...res.rows] nftListBox = nftList.value.reduce((acc, obj) => { const existingObj = acc.find(item => item.token_id == obj.token_id) @@ -121,6 +131,11 @@ const handleScroll = () => { } } +const eoaLoginedLogin = async () => { + await new BlockChain().restoreEoa() + getMyAssets() +} + watch(localWalletStore,() => { // console.log('localWalletStore.token',localWalletStore.address,localWalletStore.token) if(!localWalletStore.token) { @@ -202,7 +217,32 @@ onUnmounted(() => { .pages-no { position: relative; margin-top: 256px; - div { + margin-top: 256px; + .no-data-tips { + position: absolute; + left: 50%; + transform: translateX(-50%); + width: 100%; + text-align: center; + color: #fff; + margin-bottom: 20px; + font-size: 28px; + z-index: 99; + div { + width: 120px; + height: 50px; + border-radius: 30px; + margin: 0 auto; + margin-top: 10px; + border: 2px solid #A767FF; + cursor: pointer; + } + } + .no-data-img { + position: absolute; + top: 50px; + left: 50%; + transform: translateX(-50%); margin: 0 auto; width: 401px; height: 322px; @@ -213,7 +253,7 @@ onUnmounted(() => { } p { position: absolute; - top: 260px; + top: 310px; left: 52%; transform: translateX(-50%); font-family: 'Poppins'; diff --git a/src/components/assets/staking.vue b/src/components/assets/staking.vue index a6d248b..c095d11 100644 --- a/src/components/assets/staking.vue +++ b/src/components/assets/staking.vue @@ -18,8 +18,8 @@
- Please log into the wallet holding your Centralized Assets to view details. -
Login
+ Please log into the wallet holding your Centralized Assets to view details. +
Login
@@ -75,6 +75,7 @@ const renewMyNft = async() => { }, 2000); } +const isPassprotLogin = ref(false) const next_cursor = ref() const getMyAssets = async () => { const myADdress = localWalletStore.passportAddress @@ -85,11 +86,13 @@ const getMyAssets = async () => { search_name: overviewValue.value } const bc = new BlockChain() + isPassprotLogin.value = bc.passportLogined if(bc.passportLogined) { try { let nftListBox const ptoken = await bc.passportToken() - let res = await apiAssetsState(myADdress, data, ptoken) + const net_id = import.meta.env.VUE_APP_NET_ID + let res = await apiAssetsState(myADdress, net_id, data, ptoken) nftList.value = [...nftList.value, ...res.rows] nftListBox = nftList.value.reduce((acc, obj) => { const existingObj = acc.find(item => item.token_id == obj.token_id) diff --git a/src/utils/marketplace.js b/src/utils/marketplace.js index 71413f8..1dfeb20 100644 --- a/src/utils/marketplace.js +++ b/src/utils/marketplace.js @@ -55,7 +55,7 @@ export const apiGetPrice = async (data) => { } // 获取我拥有得资产 -export const apiAssetsState = async (account_address, data, token) => { +export const apiAssetsState = async (account_address, net_id, data, token) => { const url = `${API_BASE}/api/asset/${net_id}/${account_address}` return httpGet(url, data, token) }