From b85a05cc20cfcc17e7a0fdcc867b7c6ede205a8a Mon Sep 17 00:00:00 2001 From: yuyongdong Date: Thu, 18 Jul 2024 17:40:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8F=8C=E9=87=8D=E7=99=BB?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/assets/centralization.vue | 24 ++++++++++++++++++++--- src/components/assets/staking.vue | 25 +++++++++++++++++++++--- src/router/index.js | 1 - src/utils/marketplace.js | 12 ++++++------ 4 files changed, 49 insertions(+), 13 deletions(-) diff --git a/src/components/assets/centralization.vue b/src/components/assets/centralization.vue index 6665ea0..8bfb962 100644 --- a/src/components/assets/centralization.vue +++ b/src/components/assets/centralization.vue @@ -18,7 +18,8 @@
- Please log into the wallet holding your Founder’s Tag to view details. + Please log into the wallet holding your Centralized Assets to view details. +
Login
@@ -38,6 +39,7 @@ import NftId from "@/configs/item.json" import { apiHeroList } 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([]) @@ -96,10 +98,12 @@ const getMyAssets = async () => { fields: [] } } - if(myADdress) { + const bc = new BlockChain() + if(bc.passportLogined) { try { let nftListBox - let res = await apiHeroList( data) + const ptoken = await bc.passportToken() + let res = await apiHeroList(data, ptoken) // console.log(res,'----------------------') // return nftList.value = [...nftList.value, ...res.rows] @@ -136,6 +140,10 @@ const handleScroll = () => { } } +const passportLogin = () => { + +} + watch(localWalletStore,() => { // console.log('localWalletStore.token',localWalletStore.address,localWalletStore.token) if(!localWalletStore.token) { @@ -226,6 +234,16 @@ onUnmounted(() => { 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; diff --git a/src/components/assets/staking.vue b/src/components/assets/staking.vue index 41f7d36..42c2012 100644 --- a/src/components/assets/staking.vue +++ b/src/components/assets/staking.vue @@ -18,7 +18,8 @@
- Please log into the wallet holding your Founder’s Tag to view details. + Please log into the wallet holding your Centralized Assets to view details. +
Login
@@ -38,6 +39,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([]) @@ -82,10 +84,12 @@ const getMyAssets = async () => { cursor: next_cursor.value, search_name: overviewValue.value } - if(myADdress) { + const bc = new BlockChain() + if(bc.passportLogined) { try { let nftListBox - let res = await apiAssetsState(myADdress, data) + const ptoken = await bc.passportToken() + let res = await apiAssetsState(myADdress, 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) @@ -120,6 +124,11 @@ const handleScroll = () => { } } +const passportLogin = async () => { + await new BlockChain().appendPassport() + getMyAssets() +} + watch(localWalletStore,() => { // console.log('localWalletStore.token',localWalletStore.address,localWalletStore.token) if(!localWalletStore.token) { @@ -210,6 +219,16 @@ onUnmounted(() => { 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; diff --git a/src/router/index.js b/src/router/index.js index 9d0be8f..04d6ed4 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -39,7 +39,6 @@ const routes = [ path: "/detail", name: "CDetail", component: Detail, - props: true, meta: { title: "Counter Fire-Detail", canonical: "https://.counterfire.games", diff --git a/src/utils/marketplace.js b/src/utils/marketplace.js index 7c872e8..71413f8 100644 --- a/src/utils/marketplace.js +++ b/src/utils/marketplace.js @@ -55,9 +55,9 @@ export const apiGetPrice = async (data) => { } // 获取我拥有得资产 -export const apiAssetsState = async (account_address, data) => { +export const apiAssetsState = async (account_address, data, token) => { const url = `${API_BASE}/api/asset/${net_id}/${account_address}` - return httpGet(url, data) + return httpGet(url, data, token) } // 获取上架出售得NFTS @@ -73,9 +73,9 @@ export const apiHistoryState = async (account_address,data) => { } // 账号游戏内资产 -export const apiLockState = async (account_address,data) => { +export const apiLockState = async (account_address,data, token) => { const url = `${API_BASE}/api/market/product/lock/${net_id}/${account_address}` - return httpPost(url, data) + return httpPost(url, data, token) } // 详情 @@ -120,9 +120,9 @@ export const apiCecInfo = async(address) => { } // 获取游戏内资产 -export const apiHeroList = async(data) => { +export const apiHeroList = async(data, token) => { const url = `${API_BASE}/api/ingame/asset/hero/list` - return httpPost(url, data) + return httpPost(url, data, token) } export const apiUnlockOrMint = async (data, token) => {