合约调用
This commit is contained in:
parent
0b53a086b0
commit
a474382f31
10
components.d.ts
vendored
10
components.d.ts
vendored
@ -7,27 +7,22 @@ export {}
|
|||||||
/* prettier-ignore */
|
/* prettier-ignore */
|
||||||
declare module 'vue' {
|
declare module 'vue' {
|
||||||
export interface GlobalComponents {
|
export interface GlobalComponents {
|
||||||
AAutoComplete: typeof import('ant-design-vue/es')['AutoComplete']
|
|
||||||
AboutFooter: typeof import('./src/components/about/AboutFooter.vue')['default']
|
AboutFooter: typeof import('./src/components/about/AboutFooter.vue')['default']
|
||||||
AButton: typeof import('ant-design-vue/es')['Button']
|
AButton: typeof import('ant-design-vue/es')['Button']
|
||||||
ACheckbox: typeof import('ant-design-vue/es')['Checkbox']
|
|
||||||
ACheckboxGroup: typeof import('ant-design-vue/es')['CheckboxGroup']
|
ACheckboxGroup: typeof import('ant-design-vue/es')['CheckboxGroup']
|
||||||
ACollapse: typeof import('ant-design-vue/es')['Collapse']
|
ACollapse: typeof import('ant-design-vue/es')['Collapse']
|
||||||
ACollapsePanel: typeof import('ant-design-vue/es')['CollapsePanel']
|
ACollapsePanel: typeof import('ant-design-vue/es')['CollapsePanel']
|
||||||
AInput: typeof import('ant-design-vue/es')['Input']
|
AInput: typeof import('ant-design-vue/es')['Input']
|
||||||
AInputSearch: typeof import('ant-design-vue/es')['InputSearch']
|
|
||||||
AModal: typeof import('ant-design-vue/es')['Modal']
|
AModal: typeof import('ant-design-vue/es')['Modal']
|
||||||
ASelect: typeof import('ant-design-vue/es')['Select']
|
ASelect: typeof import('ant-design-vue/es')['Select']
|
||||||
ASelectOption: typeof import('ant-design-vue/es')['SelectOption']
|
|
||||||
ASpace: typeof import('ant-design-vue/es')['Space']
|
ASpace: typeof import('ant-design-vue/es')['Space']
|
||||||
AssetsContent: typeof import('./src/components/assets/assetsContent.vue')['default']
|
AssetsContent: typeof import('./src/components/assets/assetsContent.vue')['default']
|
||||||
AssetsHeader: typeof import('./src/components/assets/assetsHeader.vue')['default']
|
AssetsHeader: typeof import('./src/components/assets/assetsHeader.vue')['default']
|
||||||
ATable: typeof import('ant-design-vue/es')['Table']
|
ATable: typeof import('ant-design-vue/es')['Table']
|
||||||
ATableColumn: typeof import('ant-design-vue/es')['TableColumn']
|
ATableColumn: typeof import('ant-design-vue/es')['TableColumn']
|
||||||
ATooltip: typeof import('ant-design-vue/es')['Tooltip']
|
|
||||||
Banner: typeof import('./src/components/home/banner.vue')['default']
|
Banner: typeof import('./src/components/home/banner.vue')['default']
|
||||||
BuyDialog: typeof import('./src/components/Dialogs/buyDialog.vue')['default']
|
BuyDialog: typeof import('./src/components/Dialogs/buyDialog.vue')['default']
|
||||||
Card: typeof import('./src/components/common/card.vue')['default']
|
Card: typeof import('./src/components/assets/card.vue')['default']
|
||||||
Cart: typeof import('./src/components/cart/index.vue')['default']
|
Cart: typeof import('./src/components/cart/index.vue')['default']
|
||||||
ChainModel: typeof import('./src/components/home/ChainModel.vue')['default']
|
ChainModel: typeof import('./src/components/home/ChainModel.vue')['default']
|
||||||
ChipCard: typeof import('./src/components/home/ChipCard.vue')['default']
|
ChipCard: typeof import('./src/components/home/ChipCard.vue')['default']
|
||||||
@ -40,7 +35,6 @@ declare module 'vue' {
|
|||||||
HangingCard: typeof import('./src/components/common/hangingCard.vue')['default']
|
HangingCard: typeof import('./src/components/common/hangingCard.vue')['default']
|
||||||
Hero: typeof import('./src/components/common/searchView/hero.vue')['default']
|
Hero: typeof import('./src/components/common/searchView/hero.vue')['default']
|
||||||
HeroCard: typeof import('./src/components/home/HeroCard.vue')['default']
|
HeroCard: typeof import('./src/components/home/HeroCard.vue')['default']
|
||||||
HeroCheckBox: typeof import('./src/components/common/searchView/heroCheckBox.vue')['default']
|
|
||||||
HeroWeaponChipSelector: typeof import('./src/components/home/HeroWeaponChipSelector.vue')['default']
|
HeroWeaponChipSelector: typeof import('./src/components/home/HeroWeaponChipSelector.vue')['default']
|
||||||
HomeFooter: typeof import('./src/components/home/HomeFooter.vue')['default']
|
HomeFooter: typeof import('./src/components/home/HomeFooter.vue')['default']
|
||||||
ImageTextModal: typeof import('./src/components/global/ImageTextModal.vue')['default']
|
ImageTextModal: typeof import('./src/components/global/ImageTextModal.vue')['default']
|
||||||
@ -48,7 +42,6 @@ declare module 'vue' {
|
|||||||
LatestNew: typeof import('./src/components/about/LatestNew.vue')['default']
|
LatestNew: typeof import('./src/components/about/LatestNew.vue')['default']
|
||||||
Layout: typeof import('./src/components/layout/index.vue')['default']
|
Layout: typeof import('./src/components/layout/index.vue')['default']
|
||||||
LoadingDialog: typeof import('./src/components/Dialogs/loadingDialog.vue')['default']
|
LoadingDialog: typeof import('./src/components/Dialogs/loadingDialog.vue')['default']
|
||||||
LodingDialog: typeof import('./src/components/Dialogs/lodingDialog.vue')['default']
|
|
||||||
MktContent: typeof import('./src/components/marketplace/mktContent.vue')['default']
|
MktContent: typeof import('./src/components/marketplace/mktContent.vue')['default']
|
||||||
MktHeader: typeof import('./src/components/marketplace/mktHeader.vue')['default']
|
MktHeader: typeof import('./src/components/marketplace/mktHeader.vue')['default']
|
||||||
NavBar: typeof import('./src/components/layout/NavBar.vue')['default']
|
NavBar: typeof import('./src/components/layout/NavBar.vue')['default']
|
||||||
@ -65,7 +58,6 @@ declare module 'vue' {
|
|||||||
Sort: typeof import('./src/components/common/searchView/Sort.vue')['default']
|
Sort: typeof import('./src/components/common/searchView/Sort.vue')['default']
|
||||||
StarTimer: typeof import('./src/components/common/starTimer.vue')['default']
|
StarTimer: typeof import('./src/components/common/starTimer.vue')['default']
|
||||||
Status: typeof import('./src/components/common/searchView/status.vue')['default']
|
Status: typeof import('./src/components/common/searchView/status.vue')['default']
|
||||||
Stotus: typeof import('./src/components/common/searchView/stotus.vue')['default']
|
|
||||||
TeamMember: typeof import('./src/components/about/TeamMember.vue')['default']
|
TeamMember: typeof import('./src/components/about/TeamMember.vue')['default']
|
||||||
TeamVision: typeof import('./src/components/about/TeamVision.vue')['default']
|
TeamVision: typeof import('./src/components/about/TeamVision.vue')['default']
|
||||||
Trading: typeof import('./src/components/assets/trading.vue')['default']
|
Trading: typeof import('./src/components/assets/trading.vue')['default']
|
||||||
|
@ -24,7 +24,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="id">2516</div>
|
<div class="id">2516</div>
|
||||||
<div class="price">
|
<div class="price">
|
||||||
<div>0.018</div>
|
<!-- <div>{{ priceCalculated(buyDataArr[0].event.data.buy[0].amount) }}</div> -->
|
||||||
|
<div>0.08</div>
|
||||||
<div class="price-img"><img src="@/assets/img/marketplace/ETHicon.png" alt=""></div>
|
<div class="price-img"><img src="@/assets/img/marketplace/ETHicon.png" alt=""></div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
@ -35,7 +36,8 @@
|
|||||||
<li>Total : </li>
|
<li>Total : </li>
|
||||||
<li>
|
<li>
|
||||||
<div>
|
<div>
|
||||||
<span>0.36</span>
|
<!-- <span>{{ priceCalculated(buyDataArr[0].event.data.buy[0].amount) }}</span> -->
|
||||||
|
<span>0.08</span>
|
||||||
<img src="@/assets/img/marketplace/ETHicon.png" alt="">
|
<img src="@/assets/img/marketplace/ETHicon.png" alt="">
|
||||||
</div>
|
</div>
|
||||||
<div class="money">$ 400</div>
|
<div class="money">$ 400</div>
|
||||||
@ -47,6 +49,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, toRaw, defineEmits } from "vue";
|
import { ref, toRaw, defineEmits } from "vue";
|
||||||
|
import {priceCalculated} from "@/configs/priceCalculate.js"
|
||||||
import {PassportWallet} from "@/wallet/passPort.js"
|
import {PassportWallet} from "@/wallet/passPort.js"
|
||||||
// const passProd = ref(new PassportWallet())
|
// const passProd = ref(new PassportWallet())
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@ -77,6 +80,9 @@ const buyConfirm = async () => {
|
|||||||
let res = await pass.beginBuy(toRaw(props.buyDataArr)[0].nft.token_id)
|
let res = await pass.beginBuy(toRaw(props.buyDataArr)[0].nft.token_id)
|
||||||
console.log('购买', res)
|
console.log('购买', res)
|
||||||
}
|
}
|
||||||
|
// const priceAmount = () => {
|
||||||
|
// return priceCalculated(price)
|
||||||
|
// }
|
||||||
|
|
||||||
const handleCancel = (e) => {
|
const handleCancel = (e) => {
|
||||||
emit('handleClose')
|
emit('handleClose')
|
||||||
|
@ -50,9 +50,8 @@ const props = defineProps({
|
|||||||
const buyDialogVisible = ref(false)
|
const buyDialogVisible = ref(false)
|
||||||
const buyDataArr = ref([])
|
const buyDataArr = ref([])
|
||||||
|
|
||||||
// 确认购买弹窗
|
// 出售NFT
|
||||||
const sellNft = async (val) => {
|
const sellNft = async (val) => {
|
||||||
debugger
|
|
||||||
const data = {
|
const data = {
|
||||||
// import.meta.env.VUE_APP_PASSPORT_MARKET_ADDRESS
|
// import.meta.env.VUE_APP_PASSPORT_MARKET_ADDRESS
|
||||||
contractAddress: val.contract_address,
|
contractAddress: val.contract_address,
|
||||||
@ -64,7 +63,7 @@ const sellNft = async (val) => {
|
|||||||
// buyDialogVisible.value = true
|
// buyDialogVisible.value = true
|
||||||
const pass = new PassportWallet()
|
const pass = new PassportWallet()
|
||||||
let res = await pass.beginSellERC721(data)
|
let res = await pass.beginSellERC721(data)
|
||||||
console.log('购买', res)
|
console.log('售NFT', res)
|
||||||
}
|
}
|
||||||
|
|
||||||
const getImageUrl = (name) => {
|
const getImageUrl = (name) => {
|
||||||
|
@ -81,6 +81,7 @@ const getMyAssets = async () => {
|
|||||||
search_name: ''
|
search_name: ''
|
||||||
}
|
}
|
||||||
let res = await apiAssetsState(myADdress, data)
|
let res = await apiAssetsState(myADdress, data)
|
||||||
|
console.log(res)
|
||||||
nftList.value = res.rows
|
nftList.value = res.rows
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ const getCartList = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onMounted(()=> {
|
onMounted(()=> {
|
||||||
// getCartList()
|
getCartList()
|
||||||
})
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
<div class="card-price">
|
<div class="card-price">
|
||||||
<div>
|
<div>
|
||||||
<span>
|
<span>
|
||||||
0.085
|
{{ priceCalculated(nftData.event.data.buy[0].amount) }}
|
||||||
</span>
|
</span>
|
||||||
<img src="@/assets/img/marketplace/ETHicon.png" alt="图片">
|
<img src="@/assets/img/marketplace/ETHicon.png" alt="图片">
|
||||||
</div>
|
</div>
|
||||||
@ -31,6 +31,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref, toRaw, onMounted, getCurrentInstance } from "vue"
|
import { ref, toRaw, onMounted, getCurrentInstance } from "vue"
|
||||||
import BuyDialog from "@/components/Dialogs/buyDialog.vue"
|
import BuyDialog from "@/components/Dialogs/buyDialog.vue"
|
||||||
|
import {priceCalculated} from "@/configs/priceCalculate.js"
|
||||||
import { useDetailStore } from "@/store/detail"
|
import { useDetailStore } from "@/store/detail"
|
||||||
import {
|
import {
|
||||||
apiAddCartList
|
apiAddCartList
|
||||||
|
9
src/configs/priceCalculate.js
Normal file
9
src/configs/priceCalculate.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
// 计算价格精度
|
||||||
|
export const priceCalculated = (price) => {
|
||||||
|
console.log('----')
|
||||||
|
let priceNum = Number(price)/1e18
|
||||||
|
if(isNaN(priceNum)){return priceNum}
|
||||||
|
let str = ''+priceNum
|
||||||
|
if(!/e/i.test(str)){return priceNum}
|
||||||
|
return (priceNum).toFixed(18).replace(/\.?0+$/,"")
|
||||||
|
}
|
@ -17,10 +17,9 @@ import Vue3Autocounter from 'vue3-autocounter';
|
|||||||
import { notification } from 'ant-design-vue';
|
import { notification } from 'ant-design-vue';
|
||||||
import { createPinia } from 'pinia'
|
import { createPinia } from 'pinia'
|
||||||
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
|
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
|
||||||
|
|
||||||
import {PassportWallet} from '@/wallet/passPort';
|
import {PassportWallet} from '@/wallet/passPort';
|
||||||
const passPortCallback = new PassportWallet()
|
const passPortCallback = new PassportWallet()
|
||||||
|
console.log(passPortCallback,'---')
|
||||||
const pinia = createPinia()
|
const pinia = createPinia()
|
||||||
pinia.use(piniaPluginPersistedstate)
|
pinia.use(piniaPluginPersistedstate)
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ onMounted(() => {
|
|||||||
// 初始化时进行一次检测
|
// 初始化时进行一次检测
|
||||||
updateOrientation();
|
updateOrientation();
|
||||||
}
|
}
|
||||||
console.log(isLandscape.value, "-=-=-");
|
// console.log(isLandscape.value, "-=-=-");
|
||||||
});
|
});
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user