修改页面

This commit is contained in:
yuyongdong 2024-06-28 16:15:59 +08:00
parent 4d48b3df39
commit e0e62c5252
6 changed files with 58 additions and 35 deletions

View File

@ -82,6 +82,7 @@ const getMyAssets = async () => {
cursor: '',
search_name: ''
}
if(myADdress) {
try {
let res = await apiAssetsState(myADdress, data)
nftList.value = res.rows
@ -89,6 +90,7 @@ const getMyAssets = async () => {
console.log(e)
}
}
}
const searchName = (id) => {
return NftId[id].name

View File

@ -97,10 +97,12 @@ const getHistoryList = async () => {
]
}
}
if(myAddress) {
let res = await apiHangingState(data)
console.log('getHistoryList', res)
nftList.value = res.rows
}
}
onMounted(() => {
getHistoryList()

View File

@ -54,6 +54,7 @@ import { useTradingStore } from "@/store/trading"
import {walletStore} from "@/store/wallet";
const localWalletStore = walletStore()
const marketplaceList = useTradingStore()
const myAddress = ref(localWalletStore.address)
const nftList = ref([])
const filterList = ref()
@ -79,6 +80,7 @@ const clearAll = () => {
// nft
const getNftData = async () => {
if(myAddress.value) {
let nftDetailData = {}
const { errcode, errmsg, data } = await nftDetail('0x0cf08c8661f87cbf823128d37ba75814cbcdf08b','6240603010010208')
if(errcode == 0) {
@ -89,18 +91,21 @@ const getNftData = async () => {
// return nftDetailData
console.log('nftDetailData',nftDetailData)
}
}
const getHistoryList = async () => {
const myAddress = localWalletStore.address
console.log(myAddress.value)
const data = {
type: '0',
page_size: '20',
cursor: '',
}
let res = await apiHistoryState(myAddress,data)
if(myAddress.value) {
let res = await apiHistoryState(myAddress.value,data)
nftList.value = res.rows
console.log(res)
}
}
onMounted(() => {
getHistoryList()

View File

@ -19,11 +19,11 @@
</div>
</div>
<div class="card-btn" v-if="nftData.nft.owner_address != localWalletStore.address">
<div class="card-buy" @click="buyNft(nftData)">Buy Now</div>
<div v-if="nftData.in_shopcart == 0" class="card-cat" @click.stop="addCart(nftData)">
<div class="card-buy" @click="localWalletStore.address == '' ? cardLogin() : buyNft(nftData)">Buy Now</div>
<div v-if="nftData.in_shopcart == 0" class="card-cat" @click.stop="localWalletStore.address == '' ? cardLogin() : addCart(nftData)">
<img src="@/assets/img/marketplace/Add shopping cart.png" alt="">
</div>
<div v-else class="card-cat" @click.stop="addCart(nftData)">
<div v-else class="card-cat" @click.stop="clearCart(nftData)">
<img src="@/assets/img/marketplace/Move out.png" alt="">
</div>
</div>
@ -63,6 +63,7 @@ const buyDataArr = ref([])
//
const buyNft = async (val) => {
buyDataArr.value = []
buyDataArr.value.push(val)
const buyResult = await createModal(BuyDialog, {
buyDataArr: buyDataArr.value,
@ -117,6 +118,16 @@ const addCart = async (val) => {
}
}
//
const clearCart = async (val) => {
}
//
const cardLogin = async () => {
await new BlockChain().connect()
}
onMounted(() => {
// console.log(JSON.parse(JSON.stringify(props.nftData)), "-=-=-");
});

File diff suppressed because one or more lines are too long

View File

@ -4,6 +4,9 @@ import { ethers } from "ethers"
// 计算价格精度
export const priceCalculated = (price) => {
let str = Number(ethers.utils.formatUnits(price, 18)).toFixed(5)
if(str == '0.00000') {
str = '<0.00001'
}
return str
}