修复滚动加载,上架下架数据不刷新

This commit is contained in:
yuyongdong 2024-07-04 06:02:41 +08:00
parent e8fc2d9c88
commit 0077418819
14 changed files with 129 additions and 37 deletions

View File

@ -3,15 +3,15 @@ VUE_APP_BASE_API2='https://invitation.counterfire.games'
//VUE_APP_BASE_API2='http://192.168.100.83:3000/'
VUE_APP_GPAL_API='https://game2006api.cebggame.com/'
# VUE_APP_PASSPORT_PUBLISHABLE_KEY=pk_imapik-test-8c2FAlWxWAoRITk1v9rH
VUE_APP_PASSPORT_PUBLISHABLE_KEY=pk_imapik-test-eRr-kyOKaZ0jIdrvrPCn
VUE_APP_PASSPORT_REDIRECT_URI=http://localhost:4000/marketplace
VUE_APP_PASSPORT_LOGOUT_URI=http://localhost:4000/
VUE_APP_PASSPORT_CLIENT_ID=eTmUah69p7ZdRhRYzBta6lZRKXXeXDYj
VUE_APP_PASSPORT_PUBLISHABLE_KEY=pk_imapik-tU10buLqoyLZ0o54rcub
VUE_APP_PASSPORT_REDIRECT_URI=https://www.counterfire.games
VUE_APP_PASSPORT_LOGOUT_URI=https://www.counterfire.games
VUE_APP_PASSPORT_CLIENT_ID=tTB5eEedqDOHPHMI41sRDGmqAQwus9oE
# VUE_APP_PASSPORT_CLIENT_ID=0FNfXxQywm7wjdbyLTDzWt4txc53yRrT
VUE_APP_PASSPORT_MARKET_ADDRESS=0x7d117aA8BD6D31c4fa91722f246388f38ab1942c
VUE_APP_MKT_API='https://market-test.kingsome.cn'
VUE_APP_MKT_API='https://market-api.counterfire.games'
VUE_APP_NET_ID='13371'
VUE_APP_MARKET_CURRENCY='0xFd42bfb03212dA7e1A4608a44d7658641D99CF34'
VUE_APP_MARKET_CURRENCY='0x52A6c53869Ce09a731CD772f245b97A4401d3348'
VUE_APP_MAKEFEE_ADDRESS='0x50A8e60041A206AcaA5F844a1104896224be6F39'
VUE_APP_LOCKER_ADDRESS='0x2034e51e1a24f8b488610aBBDCc74F3e0cA833df'
VUE_APP_EXPLORER_URL='https://explorer.immutable.com/address/'

18
.env.test Normal file
View File

@ -0,0 +1,18 @@
VUE_APP_BASE_API='https://market.cebg.games'
VUE_APP_BASE_API2='https://invitation.counterfire.games'
//VUE_APP_BASE_API2='http://192.168.100.83:3000/'
VUE_APP_GPAL_API='https://game2006api.cebggame.com/'
# VUE_APP_PASSPORT_PUBLISHABLE_KEY=pk_imapik-test-8c2FAlWxWAoRITk1v9rH
VUE_APP_PASSPORT_PUBLISHABLE_KEY=pk_imapik-tU10buLqoyLZ0o54rcub
VUE_APP_PASSPORT_REDIRECT_URI=https://zrguoqth-wwwtest.counterfire.games
VUE_APP_PASSPORT_LOGOUT_URI=https://zrguoqth-wwwtest.counterfire.games
VUE_APP_PASSPORT_CLIENT_ID=tTB5eEedqDOHPHMI41sRDGmqAQwus9oE
# VUE_APP_PASSPORT_CLIENT_ID=0FNfXxQywm7wjdbyLTDzWt4txc53yRrT
VUE_APP_PASSPORT_MARKET_ADDRESS=0x7d117aA8BD6D31c4fa91722f246388f38ab1942c
VUE_APP_MKT_API='https://market-api.counterfire.games'
VUE_APP_NET_ID='13371'
VUE_APP_MARKET_CURRENCY='0x52A6c53869Ce09a731CD772f245b97A4401d3348'
VUE_APP_MAKEFEE_ADDRESS='0x50A8e60041A206AcaA5F844a1104896224be6F39'
VUE_APP_LOCKER_ADDRESS='0x2034e51e1a24f8b488610aBBDCc74F3e0cA833df'
VUE_APP_EXPLORER_URL='https://explorer.immutable.com/address/'
VUE_APP_PRODUCTION=production

View File

@ -1 +0,0 @@
//VITE_API_BASE_URL=http://localhost:5000

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

View File

@ -181,9 +181,8 @@ onMounted(() => {
.buy-dialog-content {
margin-top: 40px;
.content {
max-height: 45vh;
max-height: 450px;
overflow-y: auto;
.content-nfts {
width: 1017px;
margin: 0 auto;
@ -233,8 +232,22 @@ onMounted(() => {
}
}
}
&::-webkit-scrollbar {
width: 5px;
}
&::-webkit-scrollbar-track {
background: #171220;
border-radius: 2px;
}
&::-webkit-scrollbar-corner {
display: block;
}
&::-webkit-scrollbar-thumb {
height: 15px;
background: #9950fd;
border-radius: 10px;
}
}
}
.btm {
display: flex;

View File

@ -14,7 +14,7 @@
<div class="content-right-content">
<div class="pages-horizontal" v-show="nftList !== undefined && nftList.length > 0">
<li v-for="(item, index) in nftList" :key="index">
<Card v-if="nftList != undefined || nftList.length > 0" :nftData="item" @renewMyNft="getMyAssets" />
<Card v-if="nftList != undefined || nftList.length > 0" :nftData="item" @renewMyNft="renewMyNft" />
</li>
</div>
<div class="pages-no" v-show="nftList == undefined || nftList.length <= 0">
@ -60,6 +60,15 @@ const statusChild = (val) => {
getMyAssets()
}
//
const renewMyNft = async() => {
let timer = setTimeout(() => {
// getMyAssets()
location.reload()
clearTimeout(timer);
}, 2000);
}
const next_cursor = ref()
const getMyAssets = async () => {
// nftList.value = []
@ -71,14 +80,11 @@ const getMyAssets = async () => {
search_name: overviewValue.value
}
if(myADdress) {
console.log(data)
try {
let res = await apiAssetsState(myADdress, data)
nftList.value = [...res.rows, ...nftList.value]
console.log(nftList.value)
nftList.value = Array.from(new Set([...res.rows, ...nftList.value].map(JSON.stringify))).map(JSON.parse);
marketplaceStore.cursorObj = res.page
next_cursor.value = res.page.next_cursor
console.log('next_cursor.value', next_cursor.value)
} catch(e) {
console.log(e)
}

View File

@ -15,18 +15,21 @@
</template>
<script setup>
import { ref, onMounted, toRaw, watch } from "vue";
import { ref, onMounted, onUnmounted, toRaw, watch } from "vue";
import OverView from "@/components/common/searchView/Overview.vue";
import StatusRadio from "@/components/common/searchView/statusRadio.vue";
import Card from "@/components/common/tradingCard.vue";
import { apiHistoryState, nftDetail } from "@/utils/marketplace"
import {walletStore} from "@/store/wallet";
import {useMarketplaceStore} from "@/store/marketplace";
import { parseTradeEvent } from "@/components/chain/utils"
const localWalletStore = walletStore()
const nftList = ref([])
const overviewValue = ref()
const statusValue = ref('0')
const cursorObj = ref()
const overviewChild = (val) => {
overviewValue.value = val
getHistoryList()
@ -37,6 +40,7 @@ const statusChild = (val) => {
getHistoryList()
}
const next_cursor = ref()
const getHistoryList = async () => {
const myADdress = localWalletStore.address
const data = {
@ -61,6 +65,32 @@ const getHistoryList = async () => {
}
}
// const handleScroll = () => {
// const myADdress = localWalletStore.address
// 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();
// // console.log('scrollTop + windowHeight == scrollHeight',toRaw(marketplaceStore.cursorObj), scrollTop, windowHeight, scrollHeight)
// if(myADdress) {
// // if(toRaw(marketplaceStore.cursorObj).remaining != 0) {
// getHistoryList()
// console.log('')
// // // } else {
// // // console.log('')
// // } else {
// // return false;
// // }
// // return false;
// }
// }
// }
watch(localWalletStore,() => {
if(!localWalletStore.token) {
nftList.value = []
@ -71,8 +101,12 @@ watch(localWalletStore,() => {
onMounted(() => {
getHistoryList()
// window.addEventListener("scroll", handleScroll, true);
})
// onUnmounted(() => {
// window.removeEventListener('scroll', handleScroll)
// })
</script>
<style lang="scss" scoped>

View File

@ -274,7 +274,7 @@ onMounted(()=> {
}
.cart-list {
max-height: 50vh;
overflow-y: auto;
overflow-y: scroll;
.cart-item {
display: flex;
justify-content: space-between;
@ -368,6 +368,21 @@ onMounted(()=> {
background: #27232d;
}
}
&::-webkit-scrollbar {
width: 5px;
}
&::-webkit-scrollbar-track {
background: #171220;
border-radius: 2px;
}
&::-webkit-scrollbar-corner {
display: block;
}
&::-webkit-scrollbar-thumb {
height: 15px;
background: #9950fd;
border-radius: 10px;
}
}
}
.cart-total-price {

View File

@ -32,10 +32,10 @@ export class BlockChain {
}
initWallet() {
console.log("init blockchain instance");
console.log(this.store.address);
// console.log("init blockchain instance");
// console.log(this.store.address);
if (!this.store.address) {
console.log("no wallet login");
// console.log("no wallet login");
return;
} else {
this.restoreWallet(this.store.walletType)

View File

@ -5,8 +5,8 @@ import { cfgChainId } from '@/components/chain/utils.js';
const environment = import.meta.env.VUE_APP_PRODUCTION
const publishableKey = import.meta.env.VUE_APP_PASSPORT_PUBLISHABLE_KEY
const clientId = import.meta.env.VUE_APP_PASSPORT_CLIENT_ID
const redirectUri = import.meta.env.VUE_APP_PASSPORT_REDIRECT_URI
const logoutRedirectUri = import.meta.env.VUE_APP_PASSPORT_LOGOUT_URI
const redirectUri = location.origin
const logoutRedirectUri = location.origin
export const baseConfig = { environment, publishableKey }

View File

@ -21,11 +21,11 @@ const maxPriceValue = ref()
const priceApply = () => {
marketplaceList.minPrice = minPriceValue.value
marketplaceList.maxPrice = maxPriceValue.value
emit('clickPriceChild',marketplaceList.minPrice,marketplaceList.maxPrice)
}
watch(marketplaceList, () => {
minPriceValue.value = marketplaceList.minPrice
maxPriceValue.value = marketplaceList.maxPrice
emit('clickPriceChild',marketplaceList.minPrice,marketplaceList.maxPrice)
});
</script>

View File

@ -147,7 +147,6 @@ function click(event) {
router.push(event.key);
}
console.log('marketplaceStore.getCartList',marketplaceStore.getCartList)
//const { copied, copyToClipboard } = useCopyToClipboard(AppModule.accountId);
const { copied, error, reset, copyToClipboard } = useCopyToClipboard();

View File

@ -11,7 +11,7 @@
<div class="mkt-content-right">
<div class="mkt-content-right-header">
<div class="bg-cor"></div>
<div class="results-total"><span v-if="nftList">{{ nftList.length }}</span><span v-else>0 </span> Results</div>
<div class="results-total"><span v-if="nftList">{{ totalCount }}</span><span v-else>0 </span> Results</div>
<div class="search-list">
<li v-if="marketplaceList.overview">
<span>Overview: </span>
@ -174,11 +174,11 @@ const clearPriceAll = () => {
const priceChild = (minPrice, maxPrice) => {
toRaw(marketplaceList.getParamsData).filter.price_min = minPrice
toRaw(marketplaceList.getParamsData).filter.price_max = maxPrice
reqData.value.filter.price_max = minPrice
reqData.value.filter.price_max = maxPrice
toRaw(reqData.value).filter.price_min = minPrice ? Number(minPrice) * 1e6 : ''
toRaw(reqData.value).filter.price_max = maxPrice ? Number(maxPrice) * 1e6 : ''
reqData.value.cursor = ''
// nftList.value = []
// getHeroData()
nftList.value = []
getHeroData()
}
const clearHeroAll = () => {
@ -236,7 +236,7 @@ const clearAll = () => {
marketplaceList.hero = []
marketplaceList.rank = []
marketplaceList.gold = []
nftList.value = {
reqData.value = {
page_size: 20,
cursor: '',
search: {
@ -273,24 +273,32 @@ const renewNft = async() => {
}, 2000);
}
//
const totalCount = ref(0)
const getHeroData = async () => {
// loadingDialogVisible.value = false;
console.log(reqData.value)
// // return
try {
const { errcode, errmsg, rows, page } = await marketplaceList.getMarketplaceState(reqData.value)
// const { errcode, errmsg, rows, page } = await apiMarketplaceState(reqData.value)
// const { errcode, errmsg, rows, page } = await marketplaceList.getMarketplaceState(reqData.value)
const { errcode, errmsg, rows, page } = await apiMarketplaceState(reqData.value)
// console.log((toRaw(marketplaceList.cursorObj))
if(!errmsg) {
nftList.value = [...rows, ...nftList.value]
nftList.value = Array.from(new Set(nftList.value.map(JSON.stringify))).map(JSON.parse);
// nftList.value = nftList.value.reduce((acc, obj) => {
// const existingObj = acc.find(item => item.nft.token_id == obj.nft.token_id)
// if(!existingObj) {
// acc.push(obj)
// }
// return acc
// },[])
totalCount.value = page.total_count
cursorObj.value = page
console.log(cursorObj.value)
marketplaceList.cursorObj = page
console.log(rows,'-----')
}
// loadingDialogVisible.value = false;
} catch(e) {
console.log(e)
// console.log(e)
// loadingDialogVisible.value = false;
}
}