金币卡下链完成、修改文案

This commit is contained in:
yuyongdong 2024-07-05 13:06:38 +08:00
parent 8206fd760a
commit ca67d99e8f
11 changed files with 61 additions and 101 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

@ -17,7 +17,6 @@
<div class="content-nfts"> <div class="content-nfts">
<div class="content-nfts-top"> <div class="content-nfts-top">
<div class="content-nfts-top-left"> <div class="content-nfts-top-left">
<!-- <img :src="props.sellDataArr.image" alt /> -->
<ImgCard :nftData="props.sellDataArr" /> <ImgCard :nftData="props.sellDataArr" />
</div> </div>
<div class="content-nfts-top-right"> <div class="content-nfts-top-right">
@ -25,14 +24,12 @@
<div class="content-nfts-top-right-price"> <div class="content-nfts-top-right-price">
<li> <li>
<div class="price-top-input"> <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 <input
type="text" type="text"
maxlength="7"
v-model="priceValue" v-model="priceValue"
placeholder="Enter Listing Price" placeholder="Enter Listing Price"
onkeyup="value=value.replace(/[^0-9.]/g,'').replace(/\.{5,}/g,'.').replace(/^(\-)*(\d+)\.(\d\d\d\d\d).*$/,'$1$2.$3')" @input="handleInput"
onafterpaste="value=value.replace(/[^0-9.]/g,'').replace(/\.{5,}/g,'.').replace(/^(\-)*(\d+)\.(\d\d\d\d\d).*$/,'$1$2.$3')"
/> />
</div> </div>
<div class="net-price"> <div class="net-price">
@ -175,10 +172,16 @@ const optionDayValue = ref("86400000");
const priceValue = ref(); const priceValue = ref();
const isPriceListShow = ref(false); const isPriceListShow = ref(false);
const handleInput = (event) => {
// 使7
const value = event.target.value;
priceValue.value = value.replace(/[^\d]/g, '').slice(0, 7)
};
// //
const currency = import.meta.env.VUE_APP_MARKET_CURRENCY; const currency = import.meta.env.VUE_APP_MARKET_CURRENCY;
const sellConfirm = async () => { const sellConfirm = async () => {
if (priceValue.value) { if (priceValue.value && Number(priceValue.value) > 0) {
let curDate = new Date(); let curDate = new Date();
let orderData = new Date(curDate.getTime() + Number(optionDayValue.value)); let orderData = new Date(curDate.getTime() + Number(optionDayValue.value));
const data = { const data = {

View File

@ -88,6 +88,10 @@ const logos = ref([
imgeSrc: new URL("@/assets/img/home/investor_GSR.png", import.meta.url) imgeSrc: new URL("@/assets/img/home/investor_GSR.png", import.meta.url)
.href, .href,
}, },
{
imgeSrc: new URL("@/assets/img/home/investor_lmmutable.png", import.meta.url)
.href,
},
]); ]);
const emit = defineEmits(["goToSlide"]); const emit = defineEmits(["goToSlide"]);

View File

@ -40,6 +40,7 @@ const nftList = ref([])
const navTable = (i) => { const navTable = (i) => {
navIndex.value = i navIndex.value = i
window.scrollTo(0, 0)
} }
const filterList = ref([]) const filterList = ref([])

View File

@ -101,7 +101,6 @@ const getMyAssets = async () => {
} }
const handleScroll = () => { const handleScroll = () => {
const myADdress = localWalletStore.address
var scrollTop = var scrollTop =
document.documentElement.scrollTop || document.body.scrollTop; //windowHeight document.documentElement.scrollTop || document.body.scrollTop; //windowHeight
var windowHeight = var windowHeight =
@ -110,19 +109,11 @@ const handleScroll = () => {
document.documentElement.scrollHeight || document.body.scrollHeight; document.documentElement.scrollHeight || document.body.scrollHeight;
if (scrollTop + windowHeight == scrollHeight) { if (scrollTop + windowHeight == scrollHeight) {
// //
// this.seeMoreSchoolList();
// console.log('scrollTop + windowHeight == scrollHeight',toRaw(marketplaceStore.cursorObj), scrollTop, windowHeight, scrollHeight) // console.log('scrollTop + windowHeight == scrollHeight',toRaw(marketplaceStore.cursorObj), scrollTop, windowHeight, scrollHeight)
// if(myADdress) {
if(toRaw(marketplaceStore.cursorObj).remaining != 0) { if(toRaw(marketplaceStore.cursorObj).remaining != 0) {
// getMyAssets() getMyAssets()
// } else {
console.log('请求coll')
} else {
console.log('不用请求coll')
// return false;
} }
return false; return false;
// }
} }
} }

View File

@ -6,7 +6,7 @@
<div class="content-right"> <div class="content-right">
<div class="content-right-content"> <div class="content-right-content">
<div class="pages-horizontal"> <div class="pages-horizontal">
<Card :nftData="nftList" /> <Card :nftData="nftList" @renewMyNft="renewMyNft" />
</div> </div>
</div> </div>
</div> </div>
@ -71,25 +71,23 @@ const getHistoryList = async () => {
} }
}; };
// const handleScrollListing = () => { //
// var scrollTop = document.documentElement.scrollTop || document.body.scrollTop; //windowHeight const renewMyNft = () => {
// var windowHeight = document.documentElement.clientHeight || document.body.clientHeight; //scrollHeight getHistoryList()
// var scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight; }
// console.log("next_cursor.value",scrollTop, windowHeight, scrollHeight);
// return; const handleScrollListing = () => {
// if (scrollTop + windowHeight == scrollHeight) { var scrollTop = document.documentElement.scrollTop || document.body.scrollTop; //windowHeight
var windowHeight = document.documentElement.clientHeight || document.body.clientHeight; //scrollHeight
var scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight;
if (scrollTop + windowHeight == scrollHeight) {
// // // // // //
// // // this.seeMoreSchoolList(); if (next_cursor.value.remaining != 0) {
// // // console.log('scrollTop + windowHeight == scrollHeight',toRaw(marketplaceStore.cursorObj), scrollTop, windowHeight, scrollHeight) getHistoryList()
// console.log("next_cursor.value", next_cursor.value); }
// if (next_cursor.value.remaining != 0) { return false;
// // getHistoryList() }
// console.log("list"); };
// } else {
// console.log("list");
// }
// }
// };
watch(localWalletStore, () => { watch(localWalletStore, () => {
if (!localWalletStore.token) { if (!localWalletStore.token) {
@ -101,11 +99,11 @@ watch(localWalletStore, () => {
onMounted(() => { onMounted(() => {
getHistoryList(); getHistoryList();
// window.removeEventListener("scroll", handleScrollListing); window.addEventListener("scroll", handleScrollListing);
}); });
onUnmounted(() => { onUnmounted(() => {
// window.removeEventListener("scroll", handleScrollListing); window.removeEventListener("scroll", handleScrollListing);
}); });
</script> </script>

View File

@ -125,12 +125,10 @@ const cancelNft = async (val) => {
// 使 // 使
const lockToGame = async(type) => { const lockToGame = async(type) => {
// console.log('lockToGame',toRaw(props.nftData).contract_address, [toRaw(props.nftData).token_id])
// return
if(type == 'redeem') { if(type == 'redeem') {
const confirmResult = await createModal(ConfirmDialog, { const confirmResult = await createModal(ConfirmDialog, {
title: '', title: '',
message: 'Once enabled, the gold coin card will be consumed, and you will receive corresponding gold coins in the game. Do you wish to continue with this?' message: `Redeem ${props.nftData.detail.gold_coins} Gold to your game account. Do you wish to proceed?`
}).show() }).show()
if (confirmResult.errcode == 0) { if (confirmResult.errcode == 0) {
lockToGameConfirm() lockToGameConfirm()
@ -138,24 +136,23 @@ const lockToGame = async(type) => {
} else if(type == 'convert') { } else if(type == 'convert') {
const confirmResult = await createModal(ConfirmDialog, { const confirmResult = await createModal(ConfirmDialog, {
title: '', title: '',
message: 'After the hero links, you can use in the game, and can auto re-link after the game test ending, whether to continue the next link?' message: 'After converting, you will be able to use the hero in the game. At the end of Season 1, the hero will automatically be returned to your wallet or Immutable Passport. Do you want to proceed?'
}).show() }).show()
// console.log('confirmResult',confirmResult)
if (confirmResult.errcode == 0) { if (confirmResult.errcode == 0) {
lockToGameConfirm() lockToGameConfirm()
} }
} }
} }
const lockToGameConfirm = async () => { const lockToGameConfirm = async () => {
try { try {
const bc = new BlockChain() const bc = new BlockChain()
let res = await bc.locker.lock(toRaw(props.nftData).contract_address, [toRaw(props.nftData).token_id]) let res = await bc.locker.lock(toRaw(props.nftData).contract_address, [toRaw(props.nftData).token_id])
// console.log('lockToGame success', res) // console.log('lockToGame success', res)
message.success('lockToGame success') message.success('lockToGame success')
router.go(-1) // router.go(-1)
emit('renewMyNft')
// router.push('/assets')
} catch (e) { } catch (e) {
// console.log('lockToGame fail', e.message)
message.error('lockToGame fail.') message.error('lockToGame fail.')
} }
} }

View File

@ -93,10 +93,7 @@ const handleScrollTrad = () => {
// this.seeMoreSchoolList(); // this.seeMoreSchoolList();
// console.log('scrollTop + windowHeight == scrollHeight',toRaw(marketplaceStore.cursorObj), scrollTop, windowHeight, scrollHeight) // console.log('scrollTop + windowHeight == scrollHeight',toRaw(marketplaceStore.cursorObj), scrollTop, windowHeight, scrollHeight)
if(next_cursor.value.remaining != 0) { if(next_cursor.value.remaining != 0) {
// getHistoryList() getHistoryList()
console.log('请求trad')
} else {
console.log('不用请求trad')
} }
return false; return false;
} }

View File

@ -12,8 +12,8 @@
</li> </li>
<li v-else> <li v-else>
<div class="gold-img"> <div class="gold-img">
<img v-if="props.nftData.detail.gold_coins == 1000" src="@/assets/img/marketplace/Coin_icon_1000.png" alt=""> <img v-if="props.nftData.item_id == 10017" src="@/assets/img/marketplace/Coin_icon_1000.png" alt="">
<img v-if="props.nftData.detail.gold_coins == 10000" src="@/assets/img/marketplace/Coin_icon_10000.png" alt=""> <img v-if="props.nftData.item_id == 10000" src="@/assets/img/marketplace/Coin_icon_10000.png" alt="">
</div> </div>
</li> </li>
</div> </div>

View File

@ -136,6 +136,10 @@ const logos = ref([
imgeSrc: new URL("@/assets/img/home/investor_GSR.png", import.meta.url) imgeSrc: new URL("@/assets/img/home/investor_GSR.png", import.meta.url)
.href, .href,
}, },
{
imgeSrc: new URL("@/assets/img/home/investor_lmmutable.png", import.meta.url)
.href,
},
]); ]);
let timer = null; let timer = null;

View File

@ -6,9 +6,7 @@
<div class="content"> <div class="content">
<div class="top-left"> <div class="top-left">
<div class="top-left-img"> <div class="top-left-img">
<!-- <LazyLoadImg :src="detailData.nft.image" :src-placeholder="placeholderImg" alt="" /> -->
<ImgCard :nftData="detailData.nft" /> <ImgCard :nftData="detailData.nft" />
<!-- <img src="" alt=""> -->
</div> </div>
</div> </div>
<div class="top-right"> <div class="top-right">
@ -40,7 +38,6 @@
3购买 3购买
4 4
--> -->
<div v-if="myAddress != detailData.nft.owner_address"> <div v-if="myAddress != detailData.nft.owner_address">
<div v-if="detailData.event != null" class="buy" @click="localWalletStore.token == '' ? cardLogin() : buyNow()">Buy Now</div> <div v-if="detailData.event != null" class="buy" @click="localWalletStore.token == '' ? cardLogin() : buyNow()">Buy Now</div>
<div class="add" v-if="detailData.event != null && detailData.in_shopcart == 0" @click="localWalletStore.token == '' ? cardLogin() : addCart()"> <div class="add" v-if="detailData.event != null && detailData.in_shopcart == 0" @click="localWalletStore.token == '' ? cardLogin() : addCart()">
@ -140,15 +137,15 @@
<h2>Property</h2> <h2>Property</h2>
<div class="gold-content"> <div class="gold-content">
<div class="left"> <div class="left">
<h4>Gold coins</h4> <h4>Gold Amount</h4>
<p>1000</p> <p>{{ detailData.nft.detail.gold_coins }}</p>
</div> </div>
<div class="right"> <div class="right">
<div class="right-img"> <div class="right-img">
<img src="@/assets/img/marketplace/Icon_!.png" alt=""> <img src="@/assets/img/marketplace/Icon_!.png" alt="">
</div> </div>
<div class="right-tips"> <div class="right-tips">
It can be enabled on your home page and you will receive 100,000 gold coins in counter Fire. A Gold Card is equivalent to 100,000 Gold. Once redeemed, 100,000 Gold will be credited to your Counter Fire game account.
</div> </div>
</div> </div>
</div> </div>
@ -201,28 +198,15 @@ const cardLogin = async () => {
// //
const buyDataArr = ref([]) const buyDataArr = ref([])
const buyNow = async () => { const buyNow = async () => {
// console.log(toRaw(detailData.value))
// return
// debugger
buyDataArr.value = [] buyDataArr.value = []
buyDataArr.value.push(detailData.value) buyDataArr.value.push(detailData.value)
const buyResult = await createModal(BuyDialog, { const buyResult = await createModal(BuyDialog, {
buyDataArr: buyDataArr.value, buyDataArr: buyDataArr.value,
}).show() }).show()
if(buyResult.errcode) { if(buyResult.errcode) {
console.log('buy fail')
message.success('buy fail') message.success('buy fail')
return return
} }
return
// ------------------------
let tokenIds = [detailData.value.event.data.id]
try {
await new BlockChain().market.batchBuy(tokenIds)
console.log('buy success')
} catch (e) {
console.log('buy fail', e.message)
}
} }
// //
@ -238,7 +222,7 @@ const addCart = async () => {
} }
try { try {
const { errcode, errmsg } = await marketplaceList.addCartListState(data) const { errcode, errmsg } = await marketplaceList.addCartListState(data)
console.log(errcode, errmsg) // console.log(errcode, errmsg)
if(errcode == 0) { if(errcode == 0) {
message.success('success! Add from cart') message.success('success! Add from cart')
marketplaceList.getCartList = await marketplaceList.getCartListState() marketplaceList.getCartList = await marketplaceList.getCartListState()
@ -269,15 +253,16 @@ const clearCart = async () => {
getDetail() getDetail()
} }
} catch (e) { } catch (e) {
console.log(e) // console.log(e)
} }
} }
// 使
const lockToGame = async(type) => { const lockToGame = async(type) => {
if(type == 'redeem') { if(type == 'redeem') {
const confirmResult = await createModal(ConfirmDialog, { const confirmResult = await createModal(ConfirmDialog, {
title: '', title: '',
message: 'Once enabled, the gold coin card will be consumed, and you will receive corresponding gold coins in the game. Do you wish to continue with this?' message: `Redeem ${detailData.value.nft.detail.gold_coins} Gold to your game account. Do you wish to proceed?`
}).show() }).show()
if (confirmResult.errcode == 0) { if (confirmResult.errcode == 0) {
lockToGameConfirm() lockToGameConfirm()
@ -285,24 +270,20 @@ const lockToGame = async(type) => {
} else if(type == 'convert') { } else if(type == 'convert') {
const confirmResult = await createModal(ConfirmDialog, { const confirmResult = await createModal(ConfirmDialog, {
title: '', title: '',
message: 'After the hero links, you can use in the game, and can auto re-link after the game test ending, whether to continue the next link?' message: 'After converting, you will be able to use the hero in the game. At the end of Season 1, the hero will automatically be returned to your wallet or Immutable Passport. Do you want to proceed?'
}).show() }).show()
console.log('confirmResult',confirmResult) // console.log('confirmResult',confirmResult)
if (confirmResult.errcode == 0) { if (confirmResult.errcode == 0) {
lockToGameConfirm() lockToGameConfirm()
} }
} }
} }
const lockToGameConfirm = async () => { const lockToGameConfirm = async () => {
try { try {
await new BlockChain().locker.lock(detailData.value.nft.contract_address, [detailData.value.nft.token_id]) await new BlockChain().locker.lock(detailData.value.nft.contract_address, [detailData.value.nft.token_id])
// console.log('lockToGame success')
message.success('lockToGame success') message.success('lockToGame success')
router.go(-1) router.go(-1)
} catch (e) { } catch (e) {
// console.log('lockToGame fail', e.message)
message.error('lockToGame fail.') message.error('lockToGame fail.')
} }
} }
@ -315,28 +296,12 @@ const beginSell = async() => {
if (detailData.value.event) return if (detailData.value.event) return
floorPrice.value = await getFloorPrice() floorPrice.value = await getFloorPrice()
sellDialogVisible.value = true sellDialogVisible.value = true
return
try {
//TODO::
const sellData = {
contractAddress: detailData.contract_address,
tokenId: detailData.token_id,
currencyAddress: import.meta.env.VUE_APP_MARKET_CURRENCY,
currencyAmount: '1000000000000000000',
orderExpiry: null
}
await new BlockChain().market.beginSellERC721(sellData)
console.log('beginSell success')
} catch (e) {
console.log('beginSell fail', e.message)
}
} }
// //
const cancelSell = async() => { const cancelSell = async() => {
console.log('cancelSell', detailData.value.event) // console.log('cancelSell', detailData.value.event)
if (!detailData.value.event) return if (!detailData.value.event) return
try { try {
@ -347,7 +312,7 @@ const cancelSell = async() => {
clearTimeout(timer) clearTimeout(timer)
}, 2000); }, 2000);
} }
console.log('cancelSell success') // console.log('cancelSell success')
} catch (e) { } catch (e) {
try { try {
let res = await new BlockChain().market.cancelOrdersOnChain([detailData.value.event.data.id]) let res = await new BlockChain().market.cancelOrdersOnChain([detailData.value.event.data.id])
@ -358,9 +323,9 @@ const cancelSell = async() => {
}, 2000); }, 2000);
} }
} catch (e2) { } catch (e2) {
console.log('cancelSell fail', e.message) // console.log('cancelSell fail', e.message)
} }
console.log('cancelSell fail', e.message) // console.log('cancelSell fail', e.message)
} }
} }
@ -407,7 +372,7 @@ const getDetail = async () => {
let { errcode, errmsg, data} = await nftDetail(props.address, props.tokenid) let { errcode, errmsg, data} = await nftDetail(props.address, props.tokenid)
contractBlankUrl.value = `${import.meta.env.VUE_APP_EXPLORER_URL}${data.nft.contract_address}` contractBlankUrl.value = `${import.meta.env.VUE_APP_EXPLORER_URL}${data.nft.contract_address}`
if (errcode) { if (errcode) {
console.log(errmsg) // console.log(errmsg)
//TODO:: //TODO::
return return
} }
@ -422,7 +387,7 @@ const getDetail = async () => {
price.value = _data.tokenAmount price.value = _data.tokenAmount
} }
console.log(data,contractBlankUrl.value,import.meta.env.VUE_APP_NET_ID,import.meta.env.VUE_APP_GPAL_API,`${import.meta.env.VUE_APP_EXPLORER_URL}${data.nft.contract_address}`,'----') // console.log(data,contractBlankUrl.value,import.meta.env.VUE_APP_NET_ID,import.meta.env.VUE_APP_GPAL_API,`${import.meta.env.VUE_APP_EXPLORER_URL}${data.nft.contract_address}`,'----')
} }
onMounted(() => { onMounted(() => {