Merge branch 'new-CounterFire' of http://git.kingsome.cn/huangjinming/CounterFireGames into new-CounterFire

This commit is contained in:
yuyongdong 2024-06-24 14:31:02 +08:00
parent df47209118
commit 769f860524
7 changed files with 43 additions and 28 deletions

View File

@ -8,24 +8,24 @@
<img src="@/assets/img/marketplace/Close counter.png" alt="">
</div>
<div class="content">
<div class="content-title">Transaction confirmation ( 2 )</div>
<div class="content-title">Transaction confirmation ( {{ props.buyDataArr.length }} )</div>
<div class="content-table">
<div>NFT</div>
<div>Token ID</div>
<div>Price</div>
</div>
<div class="content-nfts">
<div class="content-nfts" v-for="(item, index) in props.buyDataArr" :key="index">
<li>
<div class="nft">
<div class="nft-img">
<img src="" alt="">
<img :src="item.nft.image" alt="">
</div>
<div class="nft-name">NFT Name</div>
<div class="nft-name">{{ item.nft.name }}</div>
</div>
<div class="id">2516</div>
<div class="id">{{ item.nft.token_id }}</div>
<div class="price">
<!-- <div>{{ priceCalculated(buyDataArr[0].event.data.buy[0].amount) }}</div> -->
<div>0.08</div>
<div>{{ priceCalculated(item.event.data.buy[0].amount) }}</div>
<div class="price-img"><img src="@/assets/img/marketplace/ETHicon.png" alt=""></div>
</div>
</li>
@ -40,7 +40,7 @@
<span>0.08</span>
<img src="@/assets/img/marketplace/ETHicon.png" alt="">
</div>
<div class="money">$ 400</div>
<!-- <div class="money">$ 400</div> -->
</li>
</div>
<div class="btm-right" @click="buyConfirm">Confirm</div>
@ -63,6 +63,8 @@ const props = defineProps({
},
});
console.log(toRaw(props.buyDataArr))
const emit = defineEmits(['handleClose'])
const handleOk = (e) => {
@ -80,9 +82,22 @@ const buyConfirm = async () => {
let res = await pass.beginBuy(toRaw(props.buyDataArr)[0].nft.token_id)
console.log('购买', res)
}
// const priceAmount = () => {
// return priceCalculated(price)
// }
//
const totalPrice = () => {
// toRaw(props.buyDataArr).reduce((arr, amount)) => {
// return arr +
// }
// return priceCalculated(price)
// countTotal(arr, amount) {
// let $total = 0
// $total = arr.reduce((total, currentValue, currentIndex, arr) => {
// return currentValue[keyName] ? total + currentValue[keyName] * currentValue[keyNameTwo] : total
// }, 0)
// return $total
// }
}
const handleCancel = (e) => {
emit('handleClose')

View File

@ -62,7 +62,7 @@ const clearCart = async () => {
}
const getCartList = async () => {
console.log(await useMarketplaceStore().getCartList(),'-------------------------------------------------------')
// console.log(await useMarketplaceStore().getCartListState(),'-------------------------------------------------------')
// let token = localStorage.getItem('assessToken')
// if(token) {
// try {

View File

@ -84,7 +84,6 @@ import Rank from "@/components/common/searchView/rank.vue"
import Gold from "@/components/common/searchView/gold.vue"
import LoadingDialog from "@/components/Dialogs/loadingDialog.vue"
import NftId from "@/configs/item.json"
import Axios from "axios"
import {apiMarketplaceState} from "@/utils/marketplace.js"
import { useMarketplaceStore } from "@/store/marketplace"
const marketplaceList = useMarketplaceStore()
@ -159,7 +158,7 @@ const searchName = (id) => {
const getHeroData = async () => {
let data = {
page_size: 0,
page_size: 20,
cursor: '',
search: {
name: '',
@ -181,11 +180,12 @@ const getHeroData = async () => {
}
loadingDialogVisible.value = false;
try {
let res = await apiMarketplaceState(data)
let res = await marketplaceList.getMarketplaceState(data)
nftList.value = res.rows
loadingDialogVisible.value = false;
console.log(res,'-----')
// loadingDialogVisible.value = false;
} catch(e) {
loadingDialogVisible.value = false;
// loadingDialogVisible.value = false;
}
}

View File

@ -1,6 +1,5 @@
// 计算价格精度
export const priceCalculated = (price) => {
console.log('----')
let priceNum = Number(price)/1e18
if(isNaN(priceNum)){return priceNum}
let str = ''+priceNum

View File

@ -19,7 +19,6 @@ import { createPinia } from 'pinia'
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
import {PassportWallet} from '@/wallet/passPort';
const passPortCallback = new PassportWallet()
console.log(passPortCallback,'---')
const pinia = createPinia()
pinia.use(piniaPluginPersistedstate)

View File

@ -1,6 +1,6 @@
import { defineStore } from 'pinia';
import { ref } from 'vue';
import { apiGetCartList } from "@/utils/marketplace"
import { apiMarketplaceState, apiGetCartList, } from "@/utils/marketplace"
export const useMarketplaceStore = defineStore('marketplace', () => {
const overview = ref('')
@ -37,20 +37,21 @@ export const useMarketplaceStore = defineStore('marketplace', () => {
status.value = _connected;
}
// async function getMarketPlaceData() {
// const result = async apiMarketplaceState(13473,'0x8c10Ae04BF525734eaC00d5F7c062567461c207F')
// console.log(result)
// }
async function getMarketplaceState(_connected) {
const res = await apiMarketplaceState(_connected)
console.log(_connected)
return res
}
// actions: {
// const getCartList = async () => {
// return '可以'
// }
// }
async function getCartList() {
async function getCartListState() {
// cartList.value = '可以'
let res = await apiGetCartList()
console.log(res)
// console.log(res)
return res
}
@ -63,7 +64,8 @@ export const useMarketplaceStore = defineStore('marketplace', () => {
rank, updateRankStatus,
gold, updateGoldStatus,
status, updateStatusStatus,
cartList, getCartList,
getMarketplaceState,
cartList, getCartListState,
}
},
{

View File

@ -56,8 +56,8 @@ export const apiHangingState = async (account_address, data) => {
// 账号交易历史
export const apiHistoryState = async (account_address,data) => {
const url = `${API_BASE}/api/market/transaction/history/${net_id}/${account_address}?type=${data.type}?ge_size=${data.page_size}?cursor=${data.cursor}`
return httpGet(url, {})
const url = `${API_BASE}/api/market/transaction/history/${net_id}/${account_address}`
return httpGet(url, data)
}
// 详情