修改页面
This commit is contained in:
parent
4d48b3df39
commit
e0e62c5252
@ -82,12 +82,14 @@ const getMyAssets = async () => {
|
|||||||
cursor: '',
|
cursor: '',
|
||||||
search_name: ''
|
search_name: ''
|
||||||
}
|
}
|
||||||
|
if(myADdress) {
|
||||||
try {
|
try {
|
||||||
let res = await apiAssetsState(myADdress, data)
|
let res = await apiAssetsState(myADdress, data)
|
||||||
nftList.value = res.rows
|
nftList.value = res.rows
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
console.log(e)
|
console.log(e)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const searchName = (id) => {
|
const searchName = (id) => {
|
||||||
|
@ -97,9 +97,11 @@ const getHistoryList = async () => {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(myAddress) {
|
||||||
let res = await apiHangingState(data)
|
let res = await apiHangingState(data)
|
||||||
console.log('getHistoryList', res)
|
console.log('getHistoryList', res)
|
||||||
nftList.value = res.rows
|
nftList.value = res.rows
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
@ -54,6 +54,7 @@ import { useTradingStore } from "@/store/trading"
|
|||||||
import {walletStore} from "@/store/wallet";
|
import {walletStore} from "@/store/wallet";
|
||||||
const localWalletStore = walletStore()
|
const localWalletStore = walletStore()
|
||||||
const marketplaceList = useTradingStore()
|
const marketplaceList = useTradingStore()
|
||||||
|
const myAddress = ref(localWalletStore.address)
|
||||||
|
|
||||||
const nftList = ref([])
|
const nftList = ref([])
|
||||||
const filterList = ref()
|
const filterList = ref()
|
||||||
@ -79,6 +80,7 @@ const clearAll = () => {
|
|||||||
|
|
||||||
// 获取nft信息
|
// 获取nft信息
|
||||||
const getNftData = async () => {
|
const getNftData = async () => {
|
||||||
|
if(myAddress.value) {
|
||||||
let nftDetailData = {}
|
let nftDetailData = {}
|
||||||
const { errcode, errmsg, data } = await nftDetail('0x0cf08c8661f87cbf823128d37ba75814cbcdf08b','6240603010010208')
|
const { errcode, errmsg, data } = await nftDetail('0x0cf08c8661f87cbf823128d37ba75814cbcdf08b','6240603010010208')
|
||||||
if(errcode == 0) {
|
if(errcode == 0) {
|
||||||
@ -88,18 +90,21 @@ const getNftData = async () => {
|
|||||||
}
|
}
|
||||||
// return nftDetailData
|
// return nftDetailData
|
||||||
console.log('nftDetailData',nftDetailData)
|
console.log('nftDetailData',nftDetailData)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const getHistoryList = async () => {
|
const getHistoryList = async () => {
|
||||||
const myAddress = localWalletStore.address
|
console.log(myAddress.value)
|
||||||
const data = {
|
const data = {
|
||||||
type: '0',
|
type: '0',
|
||||||
page_size: '20',
|
page_size: '20',
|
||||||
cursor: '',
|
cursor: '',
|
||||||
}
|
}
|
||||||
let res = await apiHistoryState(myAddress,data)
|
if(myAddress.value) {
|
||||||
|
let res = await apiHistoryState(myAddress.value,data)
|
||||||
nftList.value = res.rows
|
nftList.value = res.rows
|
||||||
console.log(res)
|
console.log(res)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
@ -19,11 +19,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-btn" v-if="nftData.nft.owner_address != localWalletStore.address">
|
<div class="card-btn" v-if="nftData.nft.owner_address != localWalletStore.address">
|
||||||
<div class="card-buy" @click="buyNft(nftData)">Buy Now</div>
|
<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="addCart(nftData)">
|
<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="">
|
<img src="@/assets/img/marketplace/Add shopping cart.png" alt="">
|
||||||
</div>
|
</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="">
|
<img src="@/assets/img/marketplace/Move out.png" alt="">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -63,6 +63,7 @@ const buyDataArr = ref([])
|
|||||||
|
|
||||||
// 确认购买弹窗
|
// 确认购买弹窗
|
||||||
const buyNft = async (val) => {
|
const buyNft = async (val) => {
|
||||||
|
buyDataArr.value = []
|
||||||
buyDataArr.value.push(val)
|
buyDataArr.value.push(val)
|
||||||
const buyResult = await createModal(BuyDialog, {
|
const buyResult = await createModal(BuyDialog, {
|
||||||
buyDataArr: buyDataArr.value,
|
buyDataArr: buyDataArr.value,
|
||||||
@ -117,6 +118,16 @@ const addCart = async (val) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 移除购物车
|
||||||
|
const clearCart = async (val) => {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 登录
|
||||||
|
const cardLogin = async () => {
|
||||||
|
await new BlockChain().connect()
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// console.log(JSON.parse(JSON.stringify(props.nftData)), "-=-=-");
|
// console.log(JSON.parse(JSON.stringify(props.nftData)), "-=-=-");
|
||||||
});
|
});
|
||||||
|
File diff suppressed because one or more lines are too long
@ -4,6 +4,9 @@ import { ethers } from "ethers"
|
|||||||
// 计算价格精度
|
// 计算价格精度
|
||||||
export const priceCalculated = (price) => {
|
export const priceCalculated = (price) => {
|
||||||
let str = Number(ethers.utils.formatUnits(price, 18)).toFixed(5)
|
let str = Number(ethers.utils.formatUnits(price, 18)).toFixed(5)
|
||||||
|
if(str == '0.00000') {
|
||||||
|
str = '<0.00001'
|
||||||
|
}
|
||||||
return str
|
return str
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user