已完成
This commit is contained in:
parent
2ca64a7396
commit
3b36b36eb0
@ -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;
|
||||
|
@ -17,6 +17,7 @@
|
||||
<div class="content-nfts">
|
||||
<div class="content-nfts-top">
|
||||
<div class="content-nfts-top-left">
|
||||
<!-- <img :src="props.sellDataArr.image" alt /> -->
|
||||
<ImgCard :nftData="props.sellDataArr" />
|
||||
</div>
|
||||
<div class="content-nfts-top-right">
|
||||
@ -24,13 +25,20 @@
|
||||
<div class="content-nfts-top-right-price">
|
||||
<li>
|
||||
<div class="price-top-input">
|
||||
<!-- <a-input v-model:value="priceValue" placeholder="Enter Listing Price" :parser="value =>value.replace(/^\D*(\d*(?:\.\d{0,5})?).*$/g,'$1')" @pressEnter="sellConfirm">
|
||||
</a-input>-->
|
||||
<input
|
||||
type="text"
|
||||
maxlength="7"
|
||||
v-model="priceValue"
|
||||
placeholder="Enter Listing Price"
|
||||
@input="handleInput"
|
||||
onkeyup="value=value.replace(/[^0-9.]/g,'').replace(/\.{5,}/g,'.').replace(/^(\-)*(\d+)\.(\d\d\d\d\d).*$/,'$1$2.$3')"
|
||||
onafterpaste="value=value.replace(/[^0-9.]/g,'').replace(/\.{5,}/g,'.').replace(/^(\-)*(\d+)\.(\d\d\d\d\d).*$/,'$1$2.$3')"
|
||||
/>
|
||||
<!--
|
||||
@input="handleInput"
|
||||
onkeyup="value=value.replace(/[^0-9.]/g,'').replace(/\.{5,}/g,'.').replace(/^(\-)*(\d+)\.(\d\d\d\d\d).*$/,'$1$2.$3')"
|
||||
onafterpaste="value=value.replace(/[^0-9.]/g,'').replace(/\.{5,}/g,'.').replace(/^(\-)*(\d+)\.(\d\d\d\d\d).*$/,'$1$2.$3')" -->
|
||||
</div>
|
||||
<div class="net-price">
|
||||
<span>ETH</span>
|
||||
@ -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");
|
||||
}
|
||||
};
|
||||
|
@ -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()
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
<div class="card-name">
|
||||
<div>
|
||||
<span v-if="nftData.type == 1">GENESIS HERO</span>
|
||||
<span v-if="nftData.type == 11">GOLD CARD</span>
|
||||
</div>
|
||||
<div class="no-sell" v-show="nftData.on_sale == 1" @click="cancelNft(nftData)">
|
||||
<img src="@/assets/img/marketplace/On_SeLL.png" alt="">
|
||||
@ -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.')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
<div class="card-name">
|
||||
<div>
|
||||
<span v-if="nftData.nft.type == 1">GENESIS HERO</span>
|
||||
<span v-if="nftData.nft.type == 11">GOLD CARD</span>
|
||||
</div>
|
||||
<div>{{nftData.nft.name}}</div>
|
||||
</div>
|
||||
@ -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.')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
<li v-else>
|
||||
<div class="gold-img">
|
||||
<img v-if="props.nftData.item_id == 10017" src="@/assets/img/marketplace/Coin_icon_1000.png" alt="">
|
||||
<img v-if="props.nftData.item_id == 10000" src="@/assets/img/marketplace/Coin_icon_10000.png" alt="">
|
||||
<img v-else-if="props.nftData.item_id == 10018" src="@/assets/img/marketplace/Coin_icon_10000.png" alt="">
|
||||
</div>
|
||||
</li>
|
||||
</div>
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user