添加提示语
This commit is contained in:
parent
3a60f9111b
commit
e584bbf712
2
components.d.ts
vendored
2
components.d.ts
vendored
@ -37,7 +37,6 @@ declare module 'vue' {
|
||||
Gold: typeof import('./src/components/common/searchView/gold.vue')['default']
|
||||
Hanging: typeof import('./src/components/assets/hanging.vue')['default']
|
||||
HangingCard: typeof import('./src/components/common/hangingCard.vue')['default']
|
||||
'HangingCard copy': typeof import('./src/components/common/hangingCard copy.vue')['default']
|
||||
Hero: typeof import('./src/components/common/searchView/hero.vue')['default']
|
||||
HeroCard: typeof import('./src/components/home/HeroCard.vue')['default']
|
||||
HeroWeaponChipSelector: typeof import('./src/components/home/HeroWeaponChipSelector.vue')['default']
|
||||
@ -48,6 +47,7 @@ declare module 'vue' {
|
||||
LatestNew: typeof import('./src/components/about/LatestNew.vue')['default']
|
||||
Layout: typeof import('./src/components/layout/index.vue')['default']
|
||||
LoadingDialog: typeof import('./src/components/Dialogs/loadingDialog.vue')['default']
|
||||
MessageDialog: typeof import('./src/components/Dialogs/messageDialog.vue')['default']
|
||||
MktContent: typeof import('./src/components/marketplace/mktContent.vue')['default']
|
||||
MktHeader: typeof import('./src/components/marketplace/mktHeader.vue')['default']
|
||||
NavBar: typeof import('./src/components/layout/NavBar.vue')['default']
|
||||
|
@ -59,10 +59,11 @@
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import {ref, toRaw, defineEmits, computed} from "vue";
|
||||
import {ref, toRaw, defineEmits, computed, getCurrentInstance, inject } from "vue";
|
||||
const message = inject('$message')
|
||||
|
||||
import { priceCalculated } from "@/configs/priceCalculate"
|
||||
import { BlockChain } from "@/components/chain/BlockChain"
|
||||
|
||||
const props = defineProps({
|
||||
buyDataArr: {
|
||||
type: Array,
|
||||
@ -91,16 +92,18 @@ const buyConfirm = async () => {
|
||||
const bc = new BlockChain()
|
||||
try {
|
||||
let res = await bc.market.batchBuy(ids)
|
||||
|
||||
if(res.result) {
|
||||
message.success('Success! Buy.')
|
||||
console.log('buy success ',res,ids)
|
||||
hideModal({errcode: 0});
|
||||
}
|
||||
} catch (err) {
|
||||
console.log("buy fail", err.message);
|
||||
message.error(err.message)
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
const handleCancel = (e) => {
|
||||
hideModal({errcode: 1});
|
||||
};
|
||||
|
@ -126,7 +126,8 @@
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import {ref, toRaw, defineEmits, onMounted, watch} from "vue";
|
||||
import {ref, toRaw, defineEmits, onMounted, inject} from "vue";
|
||||
const message = inject('$message')
|
||||
import {DownOutlined, UpOutlined} from "@ant-design/icons-vue";
|
||||
import {priceCalculated, timeFormat, royaltiesPrice, feePrice, totalPrice} from "@/configs/priceCalculate.js";
|
||||
import { BlockChain } from "@/components/chain/BlockChain"
|
||||
@ -185,12 +186,13 @@ const sellConfirm = async () => {
|
||||
let res = await bc.market.beginSellERC721(data)
|
||||
if(res.result) {
|
||||
let timer = setTimeout(() => {
|
||||
message.success('Success! Your item has been listed for sale.')
|
||||
emit("handleClose", true)
|
||||
clearTimeout(timer)
|
||||
}, 2000);
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
message.error('Your product failed to be listed')
|
||||
}
|
||||
} else {
|
||||
alert("价格不能为空");
|
||||
|
@ -39,7 +39,8 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, toRaw, onMounted, getCurrentInstance, defineEmits } from "vue"
|
||||
import { ref, toRaw, onMounted, getCurrentInstance, defineEmits,inject } from "vue"
|
||||
const message = inject('$message')
|
||||
import SellDialog from "@/components/Dialogs/sellDialog.vue"
|
||||
import { useDetailStore } from "@/store/detail"
|
||||
import { apiGetPrice, nftDetail } from "@/utils/marketplace"
|
||||
@ -96,40 +97,11 @@ const getNftData = async (val) => {
|
||||
|
||||
const sellDialogVisible = ref(false)
|
||||
const sellDataArr = ref([])
|
||||
const currency = import.meta.env.VUE_APP_MARKET_CURRENCY
|
||||
// 出售NFT
|
||||
const sellNft = async (val) => {
|
||||
sellDataArr.value = val
|
||||
floorPrice.value = await getFloorPrice(val)
|
||||
let curDate = new Date()
|
||||
let orderData = new Date(curDate.getTime() + 24*60*60*1000)
|
||||
sellDialogVisible.value = true
|
||||
console.log(floorPrice.value,await getFloorPrice(val))
|
||||
return
|
||||
const data = {
|
||||
// import.meta.env.VUE_APP_PASSPORT_MARKET_ADDRESS
|
||||
contractAddress: val.contract_address,
|
||||
tokenId: val.token_id,
|
||||
currencyAddress: currency,
|
||||
currencyAmount: '1000000000000000000',
|
||||
orderExpiry: orderData,
|
||||
}
|
||||
// sellDataArr.value.push(val)
|
||||
// buyDialogVisible.value = true
|
||||
const bc = new BlockChain()
|
||||
try {
|
||||
let res = await bc.market.beginSellERC721(data)
|
||||
console.log('售NFT', res)
|
||||
if(res.result) {
|
||||
let timer = setTimeout(() => {
|
||||
emit('renewMyNft')
|
||||
clearTimeout(timer);
|
||||
}, 2000);
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 取消出售
|
||||
@ -140,12 +112,13 @@ const cancelNft = async (val) => {
|
||||
let res = await bc.market.cancelOrder([orderIds.event.data.id])
|
||||
if(res.result) {
|
||||
let timer = setTimeout(() => {
|
||||
message.success('Your item has been unlisted.')
|
||||
emit('renewMyNft')
|
||||
clearTimeout(timer);
|
||||
}, 2000);
|
||||
}
|
||||
} catch (e) {
|
||||
// console.log(e)
|
||||
message.error('Your item has failed to be unlisted.')
|
||||
}
|
||||
}
|
||||
|
||||
@ -164,11 +137,7 @@ const cardPrice = async (val) => {
|
||||
|
||||
// 去详情页面
|
||||
const toDetail = () => {
|
||||
// detailData.nftData = toRaw(props.nftData)
|
||||
// router.push('/detail');
|
||||
router.push(`/detail/${props.nftData.contract_address}/${props.nftData.token_id}`)
|
||||
// const nftData = toRaw(props.nftData)
|
||||
// router.push({name: 'Detail', state: { nftData }});
|
||||
}
|
||||
|
||||
// 关闭弹窗
|
||||
|
@ -53,7 +53,8 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, defineEmits, onMounted, watch } from "vue"
|
||||
import { ref, defineEmits, onMounted, inject } from "vue"
|
||||
const message = inject('$message')
|
||||
import ImgCard from "@/components/common/imgCard.vue"
|
||||
import ConfirmDialog from "@/components/Dialogs/confirmDialog.vue";
|
||||
import BuyDialog from "@/components/Dialogs/buyDialog.vue"
|
||||
@ -154,8 +155,8 @@ const deleteNft = async (val) => {
|
||||
try {
|
||||
const { errcode, errmsg } = await marketplaceList.delCartListState(data)
|
||||
if(errcode == 0) {
|
||||
message.success('success! Remove from cart')
|
||||
getCartList()
|
||||
alert('success')
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
@ -180,6 +181,7 @@ const clearCart = async () => {
|
||||
if (res.errcode) {
|
||||
throw new Error(res.errmsg)
|
||||
}
|
||||
message.success('success! Remove from cart')
|
||||
await getCartList()
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
@ -191,16 +193,15 @@ const buyAll = async () => {
|
||||
const confirmResult = await createModal(BuyDialog, {
|
||||
buyDataArr: cartList.value,
|
||||
}).show()
|
||||
|
||||
if(confirmResult.errcode) {
|
||||
console.log('buy fail')
|
||||
message.error('buy fail')
|
||||
return
|
||||
}
|
||||
getCartList()
|
||||
alert('success')
|
||||
|
||||
message.success('success! Buy')
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
message.error(e)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -156,6 +156,7 @@ export class ImtblMarket {
|
||||
* @param { string[] } listingIds: listingId列表
|
||||
*/
|
||||
async batchBuy(listingIds) {
|
||||
// debugger
|
||||
await this.bc.checkAndChangeChain();
|
||||
const fulfiller = await this.signer.getAddress();
|
||||
// console.log(listingIds, marketAddress,'---')
|
||||
@ -190,6 +191,8 @@ export class ImtblMarket {
|
||||
console.log(
|
||||
`Fulfilling listings ${fulfillableOrders}, transaction expiry ${expiration}`
|
||||
);
|
||||
} else {
|
||||
console.log('余额不足')
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(`Fulfill bulk orders request failed with ${e}`);
|
||||
|
@ -34,7 +34,8 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, toRaw, onMounted, getCurrentInstance, defineEmits } from "vue"
|
||||
import { ref, toRaw, onMounted, getCurrentInstance, defineEmits,inject } from "vue"
|
||||
const message = inject('$message')
|
||||
import BuyDialog from "@/components/Dialogs/buyDialog.vue"
|
||||
import ImgCard from "@/components/common/imgCard.vue"
|
||||
import {priceCalculated} from "@/configs/priceCalculate.js"
|
||||
@ -72,6 +73,7 @@ const buyNft = async (val) => {
|
||||
}).show()
|
||||
if(buyResult.errcode) {
|
||||
console.log('buy fail')
|
||||
message.success('buy fail')
|
||||
return
|
||||
}
|
||||
}
|
||||
@ -83,10 +85,12 @@ const cancelNft = async (val) => {
|
||||
let res = await bc.market.cancelOrder([val.event.data.id])
|
||||
console.log(res,[val.event.data.id])
|
||||
if(res.result) {
|
||||
message.success('Your item has been unlisted.')
|
||||
emit('renewNft')
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
message.error('Your item has failed to be unlisted.')
|
||||
}
|
||||
}
|
||||
|
||||
@ -112,11 +116,11 @@ const addCart = async (val) => {
|
||||
const { errcode, errmsg } = await marketplaceList.addCartListState(data)
|
||||
console.log(errcode, errmsg)
|
||||
if(errcode == 0) {
|
||||
alert('Added successfully')
|
||||
message.success('success! Add from cart')
|
||||
marketplaceList.getCartList = await marketplaceList.getCartListState()
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
message.error('fail! Add from cart')
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,9 +4,8 @@ import "./style/rest.css";
|
||||
import "normalize.css";
|
||||
import "@/assets/text/text.css";
|
||||
import "./index.css"; // 导入 Tailwind CSS 样式
|
||||
import Antd from "ant-design-vue";
|
||||
import Antd, {message} from "ant-design-vue";
|
||||
// import "ant-design-vue/dist/antd.css";
|
||||
// import pinia from "@/store";
|
||||
import router from "./router/index";
|
||||
import VueAnimXyz from "@animxyz/vue3";
|
||||
import "@animxyz/core"; // Import css here if you haven't elsewhere
|
||||
@ -28,10 +27,10 @@ notification.config({
|
||||
});
|
||||
const app = createApp(App);
|
||||
app.config.globalProperties.$log = console.log.bind(console);
|
||||
app.provide('$message', message)
|
||||
|
||||
app
|
||||
.use(pinia)
|
||||
// .use(piniaL)
|
||||
.use(VueClipboard)
|
||||
.use(VueAnimXyz)
|
||||
.use(vue3dLoader)
|
||||
|
Loading…
x
Reference in New Issue
Block a user