From 9fa16f02fbcc4e77384e580fe3c76c526fdbe57a Mon Sep 17 00:00:00 2001 From: yuyongdong Date: Mon, 24 Jun 2024 13:26:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E7=BA=A6=E8=B0=83=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components.d.ts | 1 + src/components/Dialogs/buyDialog.vue | 9 +- src/components/Dialogs/sellDialog.vue | 253 ++++++++++++++++++ src/components/assets/card.vue | 27 +- src/components/assets/hanging.vue | 1 + src/components/assets/trading.vue | 7 +- src/components/cart/index.vue | 20 +- .../common/searchView/rank copy.vue | 124 +++++++++ src/store/collectibles.js | 6 +- src/store/detail.js | 6 +- src/store/hanging.js | 6 +- src/store/immutable.js | 6 +- src/store/marketplace.js | 9 +- src/store/trading.js | 6 +- src/utils/marketplace.js | 18 +- src/views/DetailView.vue | 19 +- 16 files changed, 453 insertions(+), 65 deletions(-) create mode 100644 src/components/Dialogs/sellDialog.vue create mode 100644 src/components/common/searchView/rank copy.vue diff --git a/components.d.ts b/components.d.ts index e0038a1..b616462 100644 --- a/components.d.ts +++ b/components.d.ts @@ -55,6 +55,7 @@ declare module 'vue' { Roadmap: typeof import('./src/components/about/Roadmap.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] RouterView: typeof import('vue-router')['RouterView'] + SellDialog: typeof import('./src/components/Dialogs/sellDialog.vue')['default'] Sort: typeof import('./src/components/common/searchView/Sort.vue')['default'] StarTimer: typeof import('./src/components/common/starTimer.vue')['default'] Status: typeof import('./src/components/common/searchView/status.vue')['default'] diff --git a/src/components/Dialogs/buyDialog.vue b/src/components/Dialogs/buyDialog.vue index c1d0126..f7cd4d6 100644 --- a/src/components/Dialogs/buyDialog.vue +++ b/src/components/Dialogs/buyDialog.vue @@ -89,10 +89,13 @@ const handleCancel = (e) => { } - \ No newline at end of file diff --git a/src/components/assets/card.vue b/src/components/assets/card.vue index ab6e220..7523980 100644 --- a/src/components/assets/card.vue +++ b/src/components/assets/card.vue @@ -1,6 +1,7 @@ + + diff --git a/src/store/collectibles.js b/src/store/collectibles.js index 321e5ca..35bf8db 100644 --- a/src/store/collectibles.js +++ b/src/store/collectibles.js @@ -22,7 +22,7 @@ export const useCollectiblesStore = defineStore('collectibles', () => { status, updateStatusStatus, } }, -{ - persist: true, -} + { + persist: true, + } ) diff --git a/src/store/detail.js b/src/store/detail.js index 16bd55b..d733b7b 100644 --- a/src/store/detail.js +++ b/src/store/detail.js @@ -17,7 +17,7 @@ export const useDetailStore = defineStore('detail', () => { nftData, updateDetailStatus, } }, -{ - persist: true, -} + { + persist: true, + } ) diff --git a/src/store/hanging.js b/src/store/hanging.js index dfa0be5..91852fb 100644 --- a/src/store/hanging.js +++ b/src/store/hanging.js @@ -22,7 +22,7 @@ export const useHangingStore = defineStore('hanging', () => { status, updateStatusStatus, } }, -{ - persist: true, -} + { + persist: true, + } ) diff --git a/src/store/immutable.js b/src/store/immutable.js index e7b5e44..1292af5 100644 --- a/src/store/immutable.js +++ b/src/store/immutable.js @@ -16,7 +16,7 @@ export const useImmutableStore = defineStore('immutable', () => { access, updateAccessStatus, } }, -{ - persist: true, -} + { + persist: true, + } ) \ No newline at end of file diff --git a/src/store/marketplace.js b/src/store/marketplace.js index b462a33..e10ebbb 100644 --- a/src/store/marketplace.js +++ b/src/store/marketplace.js @@ -1,6 +1,6 @@ import { defineStore } from 'pinia'; import { ref } from 'vue'; -// import { apiMarketplaceState } from "@/utils/marketplace" +import { apiGetCartList } from "@/utils/marketplace" export const useMarketplaceStore = defineStore('marketplace', () => { const overview = ref('') @@ -47,8 +47,11 @@ export const useMarketplaceStore = defineStore('marketplace', () => { // return '可以' // } // } - const getCartList = async () => { - cartList.value = '可以' + async function getCartList() { + // cartList.value = '可以' + let res = await apiGetCartList() + console.log(res) + return res } return { diff --git a/src/store/trading.js b/src/store/trading.js index 65ff55f..5c72f01 100644 --- a/src/store/trading.js +++ b/src/store/trading.js @@ -22,7 +22,7 @@ export const useTradingStore = defineStore('trading', () => { status, updateStatusStatus, } }, -{ - persist: true, -} + { + persist: true, + } ) diff --git a/src/utils/marketplace.js b/src/utils/marketplace.js index 2e7ace5..63cd547 100644 --- a/src/utils/marketplace.js +++ b/src/utils/marketplace.js @@ -43,25 +43,25 @@ export const apiMarketplaceState = async (data) => { // 获取我拥有得资产 export const apiAssetsState = async (account_address, data) => { - const url = `/api/asset/${net_id}/${account_address}` - return httpGet(url, {data}) + const url = `${API_BASE}/api/asset/${net_id}/${account_address}?type=${data.type}?ge_size=${data.page_size}?cursor=${data.cursor}?search_name=${data.search_name}` + return httpGet(url, {}) } // 获取上架出售得NFTS export const apiHangingState = async (account_address, data) => { - const url = `/api/asset/${net_id}/${account_address}` + const url = `${API_BASE}/api/asset/${net_id}/${account_address}` return httpGet(url, {data}) } // 账号交易历史 -export const apiHistoryState = async (account_address) => { - const url = `/api/market/transaction/history/${net_id}/${account_address}` +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, {}) } // 详情 export const apiDetail = async (account_address) => { - const url = `/api/market/transaction/history/${net_id}/${account_address}` + const url = `${API_BASE}/api/market/transaction/history/${net_id}/${account_address}` return httpGet(url, {}) } @@ -73,16 +73,16 @@ export const apiGetCartList = async () => { // 添加购物车 export const apiAddCartList = async (data) => { - const url = `/api/shopcart/add` + const url = `${API_BASE}/api/shopcart/add` return httpPost(url, {data}) } // 删除购物车 export const apiDelCartList = async () => { - const url = `/api/shopcart/del` + const url = `${API_BASE}/api/shopcart/del` } // 清空购物车 export const apiClearCartList = async () => { - const url = `/api/shopcart/clear` + const url = `${API_BASE}/api/shopcart/clear` } diff --git a/src/views/DetailView.vue b/src/views/DetailView.vue index f70cea5..4c0c387 100644 --- a/src/views/DetailView.vue +++ b/src/views/DetailView.vue @@ -141,7 +141,9 @@ import { ref, toRaw, onMounted } from "vue" import StarTimer from "@/components/common/starTimer.vue" import { apiDetail } from "@/utils/marketplace" +import {priceCalculated} from "@/configs/priceCalculate.js" import { useDetailStore } from "@/store/detail" + const detailData = useDetailStore() console.log(toRaw(detailData.nftData)) import { PassportWallet } from "@/wallet/passPort" @@ -198,29 +200,18 @@ const sliceAddress = (address) => { // 处理货币 const priceWei = (price) => { - let toPrice = parseInt(BigInt(price))/1e18 - return priceFixed(toPrice) -} -const priceFixed = (num) => { - if(isNaN(num)){return num}; - //处理不需要转换的数字 - var str = ''+num; - if(!/e/i.test(str)){return num;}; - //先获取到精确的小数位 - var fixed = (''+num).match(/\d+$/)[0]; - //拿到保留指定的小数 - return new Number(num).toFixed(fixed); + return priceCalculated(price) } const getDetail = async () => { - let address = localStorage.getItem('address') + let address = localStorage.getItem('assessAddress') let res = await apiDetail(address) console.log('getDetail',toRaw(res)) nftData.value = res.rows } onMounted(() => { - // getDetail() + getDetail() })