
@@ -102,29 +102,6 @@ const sellNft = async (val) => {
sellDialogVisible.value = true
}
-// 取消出售
-// const cancelNft = async (val) => {
-// let orderIds = await getNftData(val)
-// try {
-// const bc = new BlockChain()
-// 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) {
-// if(e.message.indexOf('rejected') > -1) {
-// message.error('User rejected the request')
-// } else {
-// message.error('Your item has failed to be unlisted.')
-// }
-// }
-// }
-
-
const loadingDialogVisible = ref(false)
// 下链使用
const lockToGame = async(type) => {
@@ -150,17 +127,24 @@ const lockToGame = async(type) => {
}
// mint一个英雄
const mintHero = async () => {
- try {
- const res = await new BlockChain().locker.mintNft([toRaw(props.nftData).uniid])
- message.success('Mint success.')
- emit('renewMyNft')
- } catch (e) {
- if(e.message.indexOf('rejected') > -1) {
- message.error('User rejected the request')
- } else if (e.message.indexOf('select wallet') > -1) {
- message.error('user cancel select wallet')
- } else {
- message.error('Mint Failed.')
+ if(marketplaceStore.userGold < 0) {
+ const confirmResult = await createModal(ConfirmDialog, {
+ title: '',
+ message: 'Mint Failed - Negative in-game gold balance. Please adjust your balance to continue.'
+ }).show()
+ } else {
+ try {
+ const res = await new BlockChain().locker.mintNft([toRaw(props.nftData).uniid])
+ message.success('Mint success.')
+ emit('renewMyNft')
+ } catch (e) {
+ if(e.message.indexOf('rejected') > -1) {
+ message.error('User rejected the request')
+ } else if (e.message.indexOf('select wallet') > -1) {
+ message.error('user cancel select wallet')
+ } else {
+ message.error('Mint Failed.')
+ }
}
}
}
diff --git a/src/components/assets/centralization.vue b/src/components/assets/centralization.vue
index cfa3a5b..a4b9929 100644
--- a/src/components/assets/centralization.vue
+++ b/src/components/assets/centralization.vue
@@ -104,9 +104,8 @@ const getMyAssets = async () => {
if(bc.passportLogined) {
try {
let nftListBox
- const ptoken = await bc.passportToken()
- let res = await apiHeroList(data, ptoken)
- // console.log(res,'----------------------')
+ // const ptoken = await bc.passportToken()
+ let res = await apiHeroList(data)
// return
nftList.value = [...nftList.value, ...res.rows]
// nftListBox = nftList.value.reduce((acc, obj) => {
diff --git a/src/components/assets/collectibles.vue b/src/components/assets/collectibles.vue
index 02d0954..e294128 100644
--- a/src/components/assets/collectibles.vue
+++ b/src/components/assets/collectibles.vue
@@ -37,10 +37,10 @@ import NftId from "@/configs/item.json"
import { apiAssetsState } from "@/utils/marketplace"
import {useMarketplaceStore} from "@/store/marketplace";
import {walletStore} from "@/store/wallet";
+import { BlockChain } from "@/components/chain/BlockChain"
const marketplaceStore = useMarketplaceStore()
const localWalletStore = walletStore()
const nftList = ref([])
-// console.log('localWalletStore', localWalletStore.token)
const overviewValue = ref()
const statusValue = ref('0')
@@ -83,6 +83,9 @@ const getMyAssets = async () => {
cursor: next_cursor.value,
search_name: overviewValue.value
}
+ const bc = new BlockChain()
+ // const pstoken = await bc.token()
+ // const ptoken = await bc.passportToken()
if(myADdress) {
try {
let nftListBox
diff --git a/src/components/assets/founder.vue b/src/components/assets/founder.vue
index 68c5c3f..8444db0 100644
--- a/src/components/assets/founder.vue
+++ b/src/components/assets/founder.vue
@@ -35,7 +35,7 @@
+
+
diff --git a/src/components/layout/NavBar.vue b/src/components/layout/NavBar.vue
index e5891eb..ea3a95b 100644
--- a/src/components/layout/NavBar.vue
+++ b/src/components/layout/NavBar.vue
@@ -277,6 +277,7 @@ const immuTableLogout = async () => {
// immutableStore.accessToken = ''
// immutableStore.accounts = ''
// await new PassportWallet().logout()
+ location.reload()
} catch (e) {
console.log(e)
}
diff --git a/src/configs/priceCalculate.js b/src/configs/priceCalculate.js
index f66e4ff..1850146 100644
--- a/src/configs/priceCalculate.js
+++ b/src/configs/priceCalculate.js
@@ -51,4 +51,36 @@ export const totalPrice = (price) => {
export const showTime = (time) => {
let str = time.split('.')
return str[0]
+}
+
+// 处理贡献值
+export const contribution = (quality) => {
+ let str
+ if(quality == 1) {
+ str = 10
+ } else if(quality == 2) {
+ str = 20
+ } else if(quality == 3) {
+ str = 30
+ } else if(quality == 4) {
+ str = 40
+ } else if(quality == 5) {
+ str = 160
+ }
+ return str
+}
+
+// 质押时间
+export const timeStaking = (time) => {
+ let timeArr = []
+ let now = new Date().getTime()
+ let str = (now/1000) - time
+ let d = Math.floor(str / 60 / 60 / 24);
+ d = d < 10 ? "0" + d : d;
+ let h = Math.floor((str / 60 / 60) % 24);
+ h = h < 10 ? "0" + h : h;
+ let m = Math.floor((str / 60) % 60);
+ m = m < 10 ? "0" + m : m;
+ timeArr = [d, h, m]
+ return timeArr
}
\ No newline at end of file
diff --git a/src/store/marketplace.js b/src/store/marketplace.js
index fa10f1a..52f9714 100644
--- a/src/store/marketplace.js
+++ b/src/store/marketplace.js
@@ -41,6 +41,7 @@ export const useMarketplaceStore = defineStore('marketplace', () => {
}
})
const detailData = ref()
+ const userGold = ref(0)
const updateOverviewStatus = (_connected) => {
overview.value = _connected;
@@ -101,8 +102,8 @@ export const useMarketplaceStore = defineStore('marketplace', () => {
getCartList, getCartListState,
addCartListState,
delCartListState,
- currencyPrice,priceDatas,
- detailData,
+ currencyPrice, priceDatas,
+ detailData, userGold
}
},
{
diff --git a/src/utils/marketplace.js b/src/utils/marketplace.js
index 1dfeb20..ed0382c 100644
--- a/src/utils/marketplace.js
+++ b/src/utils/marketplace.js
@@ -134,4 +134,16 @@ export const apiUnlockOrMint = async (data, token) => {
export const apiMintNft = async (data, token) => {
const url = `${API_BASE}/api/ingame/asset/hero/mint`
return httpPost(url, data, token)
-}
\ No newline at end of file
+}
+
+// 取每日预期所得
+export const apiExpected = async (account_address) => {
+ const url = `${API_BASE}/api/activity/stacking/expected_daily/${account_address}`
+ return httpGet(url, {})
+}
+
+// 用户信息
+export const apiUserData = async (account_address) => {
+ const url = `${API_BASE}/api/user/${account_address}`
+ return httpGet(url, {})
+}
diff --git a/src/views/DetailView.vue b/src/views/DetailView.vue
index 5ac10e7..91c57de 100644
--- a/src/views/DetailView.vue
+++ b/src/views/DetailView.vue
@@ -10,7 +10,8 @@