diff --git a/src/components/Dialogs/buyDialog.vue b/src/components/Dialogs/buyDialog.vue index 082c82b..ae543f2 100644 --- a/src/components/Dialogs/buyDialog.vue +++ b/src/components/Dialogs/buyDialog.vue @@ -86,7 +86,7 @@ const buyConfirm = async () => { hideModal({errcode: 0, res}); } } catch (err) { - console.log("buy fail", err); + console.log("buy fail", err.message); hideModal({errcode: 1, err}); } }; @@ -209,25 +209,33 @@ onMounted(() => { height: 164px; // border: 1px solid #fff; margin-left: 50px; - .card-img-common { + :deep(.card-img-common) { + width: 100%; + height: 100%; + li { + width: 100%; + height: 100%; + font-size: 12px; .img-top { - width: 100px; - height: 30px; - top: 20px; - left: 20px; + width: 40px; + height: 15px; + top: 5px; + left: 5px; } .img-btm { - bottom: 30px; - left: 30px; + bottom: 8px; + left: 10px; >div { - width: 120px; - height: 40px; + width: 30px; + height: 15px; } div:nth-child(2) { margin-left: 8px; } } } + + } } .nft-name { font-weight: bold; diff --git a/src/components/Dialogs/sellDialog.vue b/src/components/Dialogs/sellDialog.vue index ecff6b0..18b5e8e 100644 --- a/src/components/Dialogs/sellDialog.vue +++ b/src/components/Dialogs/sellDialog.vue @@ -17,6 +17,7 @@
+
@@ -24,13 +25,20 @@
  • + +
    ETH @@ -191,8 +199,6 @@ const sellConfirm = async () => { currencyAmount: ethers.utils.parseEther(priceValue.value).toString(), orderExpiry: orderData, }; - console.log(data) - // return try { const bc = new BlockChain(); let res = await bc.market.beginSellERC721(data); @@ -204,11 +210,13 @@ const sellConfirm = async () => { }, 2000); } } catch (e) { - console.log(e) - message.error("Your product failed to be listed"); + if(e.message.indexOf('rejected') > -1) { + message.error('User rejected the request') + } else { + message.error("Your product failed to be listed"); + } } } else { - // alert("Price cannot be empty"); message.error("Price cannot be empty"); } }; diff --git a/src/components/assets/collectibles.vue b/src/components/assets/collectibles.vue index 2d102c2..78de06b 100644 --- a/src/components/assets/collectibles.vue +++ b/src/components/assets/collectibles.vue @@ -63,6 +63,7 @@ const statusChild = (val) => { // 更新数据 const renewMyNft = async() => { let timer = setTimeout(() => { + nftList.value = [] getMyAssets() // location.reload() clearTimeout(timer); @@ -118,8 +119,9 @@ const handleScroll = () => { } watch(localWalletStore,() => { + console.log('localWalletStore.token',localWalletStore.address,localWalletStore.token) if(!localWalletStore.token) { - getMyAssets() + nftList.value = [] } else { getMyAssets() } diff --git a/src/components/assets/myCard.vue b/src/components/assets/myCard.vue index 2bdb0a0..19a639f 100644 --- a/src/components/assets/myCard.vue +++ b/src/components/assets/myCard.vue @@ -8,6 +8,7 @@
    GENESIS HERO + GOLD CARD
    @@ -119,7 +120,11 @@ const cancelNft = async (val) => { }, 2000); } } catch (e) { - message.error('Your item has failed to be unlisted.') + if(e.message.indexOf('rejected') > -1) { + message.error('User rejected the request') + } else { + message.error('Your item has failed to be unlisted.') + } } } @@ -147,13 +152,16 @@ const lockToGameConfirm = async () => { try { const bc = new BlockChain() let res = await bc.locker.lock(toRaw(props.nftData).contract_address, [toRaw(props.nftData).token_id]) - // console.log('lockToGame success', res) message.success('lockToGame success') // router.go(-1) emit('renewMyNft') // router.push('/assets') } catch (e) { - message.error('lockToGame fail.') + if(e.message.indexOf('rejected') > -1) { + message.error('User rejected the request') + } else { + message.error('lockToGame fail.') + } } } diff --git a/src/components/common/card.vue b/src/components/common/card.vue index 9bd8307..00ba574 100644 --- a/src/components/common/card.vue +++ b/src/components/common/card.vue @@ -7,6 +7,7 @@
    GENESIS HERO + GOLD CARD
    {{nftData.nft.name}}
    @@ -72,11 +73,9 @@ const buyNft = async (val) => { buyDataArr.value = [] buyDataArr.value.push(props.nftData) console.log("buy",buyDataArr.value) - // return const buyResult = await createModal(BuyDialog, { buyDataArr: buyDataArr.value, }).show() - console.log(buyResult) if(buyResult.errcode == 0) { if(buyResult.res == 'Insufficient Balance') { message.error('Insufficient Balance.') @@ -84,7 +83,11 @@ const buyNft = async (val) => { message.success('Success! Buy.') } } else { - message.error('Buy fail.') + if(buyResult.err.message.indexOf('rejected') > -1) { + message.error('User rejected the request') + } else { + message.error('Buy fail.') + } } } @@ -99,8 +102,11 @@ const cancelNft = async (val) => { emit('renewNft') } } catch (e) { - console.log(e) - message.error('Your item has failed to be unlisted.') + if(e.message.indexOf('rejected') > -1) { + message.error('User rejected the request') + } else { + message.error('Your item has failed to be unlisted.') + } } } diff --git a/src/components/common/imgCard.vue b/src/components/common/imgCard.vue index 0e9d524..e0b6f74 100644 --- a/src/components/common/imgCard.vue +++ b/src/components/common/imgCard.vue @@ -13,7 +13,7 @@
  • - +
  • @@ -43,43 +43,43 @@ const props = defineProps({ } li { position: relative; + .img-top { + position: absolute; + display: flex; + align-items: center; + justify-content: center; + background: url('@/assets/img/marketplace/icon_coinTime.png') no-repeat; + background-size: 100% 100%; + color: #000; + } + .img-btm { + position: absolute; + display: flex; + align-items: center; + justify-content: center; + color: #fff; + >div { + display: flex; + align-items: center; + justify-content: center; + padding-left: 15px; + box-sizing: border-box; + } + div:nth-child(1) { + background: url('@/assets/img/marketplace/icon_wealth.png') no-repeat; + background-size: 100% 100%; + box-sizing: border-box; + } + div:nth-child(2) { + background: url('@/assets/img/marketplace/icon_luck .png') no-repeat; + background-size: 100% 100%; + box-sizing: border-box; + } + } } .gold-img { border: 2px solid #fff; background: rgb(60, 50, 26); } - .img-top { - position: absolute; - display: flex; - align-items: center; - justify-content: center; - background: url('@/assets/img/marketplace/icon_coinTime.png') no-repeat; - background-size: 100% 100%; - color: #000; - } - .img-btm { - position: absolute; - display: flex; - align-items: center; - justify-content: center; - color: #fff; - >div { - display: flex; - align-items: center; - justify-content: center; - padding-left: 15px; - box-sizing: border-box; - } - div:nth-child(1) { - background: url('@/assets/img/marketplace/icon_wealth.png') no-repeat; - background-size: 100% 100%; - box-sizing: border-box; - } - div:nth-child(2) { - background: url('@/assets/img/marketplace/icon_luck .png') no-repeat; - background-size: 100% 100%; - box-sizing: border-box; - } - } } \ No newline at end of file diff --git a/src/views/DetailView.vue b/src/views/DetailView.vue index 371e965..6bad349 100644 --- a/src/views/DetailView.vue +++ b/src/views/DetailView.vue @@ -203,10 +203,17 @@ const buyNow = async () => { const buyResult = await createModal(BuyDialog, { buyDataArr: buyDataArr.value, }).show() - if(buyResult.errcode) { - message.success('buy fail') - return + console.log(buyResult.errcode) + if(buyResult.errcode == 0) { + message.success('buy success') + } else if(buyResult.errcode == 1) { + if(buyResult.err.message.indexOf() > -1) { + message.error('User rejected the request') + } else { + message.error('buy fail') + } } + } // 添加购物车 @@ -284,8 +291,12 @@ const lockToGameConfirm = async () => { message.success('lockToGame success') router.go(-1) } catch (e) { - message.error('lockToGame fail.') - } + if(e.message.indexOf('rejected') > -1) { + message.error('User rejected the request') + } else { + message.error('lockToGame fail.') + } + } } @@ -309,23 +320,27 @@ const cancelSell = async() => { if(res.result) { let timer = setTimeout(() => { getDetail() + message.success('Your item has been unlisted.') clearTimeout(timer) }, 2000); } - // console.log('cancelSell success') } catch (e) { - try { - let res = await new BlockChain().market.cancelOrdersOnChain([detailData.value.event.data.id]) - if(res.result) { - let timer = setTimeout(() => { - getDetail() - clearTimeout(timer) - }, 2000); - } - } catch (e2) { - // console.log('cancelSell fail', e.message) + // try { + // let res = await new BlockChain().market.cancelOrdersOnChain([detailData.value.event.data.id]) + // if(res.result) { + // let timer = setTimeout(() => { + // getDetail() + // clearTimeout(timer) + // }, 2000); + // } + // } catch (e2) { + // // console.log('cancelSell fail', e.message) + // } + if(e.message.indexOf('rejected') > -1) { + message.error('User rejected the request') + } else { + message.error('Your item has failed to be unlisted.') } - // console.log('cancelSell fail', e.message) } }