修改二次登录显示按钮

This commit is contained in:
yuyongdong 2024-07-18 19:11:09 +08:00
parent 987cdf1979
commit 4eb341e815
5 changed files with 61 additions and 14 deletions

View File

@ -18,8 +18,8 @@
</div>
<div class="pages-no" v-show="nftList == undefined || nftList.length <= 0">
<div class="no-data-tips">
<span v-if="localWalletStore.walletType != 3">Please log into the wallet holding your Centralized Assets to view details.</span>
<div @click="passportLogin">Login</div>
<span v-if="!isPassprotLogin">Please log into the wallet holding your Centralized Assets to view details.</span>
<div v-if="!isPassprotLogin" @click="passportLogin">Login</div>
</div>
<div class="no-data-img">
<img src="@/assets/img/marketplace/Empty_state.png" alt="">
@ -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,() => {

View File

@ -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)

View File

@ -18,7 +18,11 @@
</li>
</div>
<div class="pages-no" v-show="nftList == undefined || nftList.length <= 0">
<div>
<div class="no-data-tips">
<span v-if="!isEoaLoginedLogin">Please log into the wallet holding your Founder's Tag to view details.</span>
<div v-if="!isEoaLoginedLogin" @click="eoaLoginedLogin">Login</div>
</div>
<div class="no-data-img">
<img src="@/assets/img/marketplace/Empty_state.png" alt="">
</div>
<p>No NFT yet</p>
@ -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';

View File

@ -18,8 +18,8 @@
</div>
<div class="pages-no" v-show="nftList == undefined || nftList.length <= 0">
<div class="no-data-tips">
<span v-if="!localWalletStore.refreshToken">Please log into the wallet holding your Centralized Assets to view details.</span>
<div v-if="!localWalletStore.refreshToken" @click="passportLogin">Login</div>
<span v-if="!isPassprotLogin">Please log into the wallet holding your Centralized Assets to view details.</span>
<div v-if="!isPassprotLogin" @click="passportLogin">Login</div>
</div>
<div class="no-data-img">
<img src="@/assets/img/marketplace/Empty_state.png" alt="">
@ -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)

View File

@ -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)
}