添加双重登录

This commit is contained in:
yuyongdong 2024-07-18 17:40:11 +08:00
parent 9847e3cc21
commit b85a05cc20
4 changed files with 49 additions and 13 deletions

View File

@ -18,7 +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 Founders Tag to view details.</span>
<span v-if="localWalletStore.walletType != 3">Please log into the wallet holding your Centralized Assets to view details.</span>
<div @click="passportLogin">Login</div>
</div>
<div class="no-data-img">
<img src="@/assets/img/marketplace/Empty_state.png" alt="">
@ -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;

View File

@ -18,7 +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 Founders Tag to view details.</span>
<span v-if="!localWalletStore.refreshToken">Please log into the wallet holding your Centralized Assets to view details.</span>
<div @click="passportLogin">Login</div>
</div>
<div class="no-data-img">
<img src="@/assets/img/marketplace/Empty_state.png" alt="">
@ -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;

View File

@ -39,7 +39,6 @@ const routes = [
path: "/detail",
name: "CDetail",
component: Detail,
props: true,
meta: {
title: "Counter Fire-Detail",
canonical: "https://.counterfire.games",

View File

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