Commit 4cf9927b authored by chenqikuai's avatar chenqikuai

refactor: recode the reward display

parent 5b063011
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
{{ $t('lang.block.blockReward') }} {{ $t('lang.block.blockReward') }}
</span> </span>
<span class="text-footer-color text-sm font-bold"> <span class="text-footer-color text-sm font-bold">
15 YCC {{ height | filterBlockReward }}
</span> </span>
</div> </div>
</div> </div>
...@@ -22,9 +22,7 @@ ...@@ -22,9 +22,7 @@
{{ $t('lang.txDetail.height') }} {{ $t('lang.txDetail.height') }}
</div> </div>
<div class="text-text-color text-xs"> <div class="text-text-color text-xs">
{{ $t('lang.block.votingNode') }}5+{{ {{ height | filterVotePackReward }}
$t('lang.block.packingNode')
}}10
</div> </div>
</div> </div>
<div class="flex justify-between items-end mb-6" style="margin-top: 3px;"> <div class="flex justify-between items-end mb-6" style="margin-top: 3px;">
......
...@@ -51,12 +51,10 @@ ...@@ -51,12 +51,10 @@
{{ $t('lang.block.blockReward') }} {{ $t('lang.block.blockReward') }}
</span> </span>
<span class="text-black text-xs"> <span class="text-black text-xs">
15 YCC {{ height | filterBlockReward }}
</span> </span>
<span class="text-text-color text-xs"> <span class="text-text-color text-xs">
{{ $t('lang.block.votingNode') }}5+{{ {{ height | filterVotePackReward }}
$t('lang.block.packingNode')
}}10
</span> </span>
</div> </div>
</div> </div>
......
...@@ -27,12 +27,10 @@ ...@@ -27,12 +27,10 @@
{{ $t('lang.block.blockRevenue') }} {{ $t('lang.block.blockRevenue') }}
</div> </div>
<div class="my-benifit"> <div class="my-benifit">
15YCC {{ $route.query.height | filterBlockReward }}
</div> </div>
<div class="my-title"> <div class="my-title">
{{ $t('lang.block.votingNode') }}5+{{ {{ $route.query.height | filterVotePackReward }}
$t('lang.block.packingNode')
}}10
</div> </div>
</div> </div>
<div class="right flex-shrink-0"> <div class="right flex-shrink-0">
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
<div> <div>
<span class="graytxt">{{ $t('lang.block.blockReward') }}:</span> <span class="graytxt">{{ $t('lang.block.blockReward') }}:</span>
<span> <span>
15 ycc {{item.height | filterBlockReward}}
</span> </span>
</div> </div>
</div> </div>
...@@ -57,9 +57,7 @@ ...@@ -57,9 +57,7 @@
</router-link> </router-link>
</div> </div>
<div class="graytxt"> <div class="graytxt">
{{ $t('lang.block.votingNode') }}5+{{ {{item.height | filterVotePackReward}}
$t('lang.block.packingNode')
}}10
</div> </div>
</div> </div>
</div> </div>
......
/**
* 初始发行是 100 亿 ycc
区块奖励是每个区块 15 个 ycc
所以当前发行数量= 100 亿+15*区块高度
*注: 高度 725000 之前每个区块的奖励时 30ycc,所以更准确的发行数量为:
100 亿+30*725000 + 15*(当前高度-725000)
*/
export const yccDifferenceBlockRewardHeight = 725000;
...@@ -5,6 +5,10 @@ export default Vue.extend({ ...@@ -5,6 +5,10 @@ export default Vue.extend({
return { return {
value: "", value: "",
focusedTab: "1", focusedTab: "1",
pages: {
total: 0,
},
selectedOption: "1",
}; };
}, },
computed: { computed: {
...@@ -24,10 +28,30 @@ export default Vue.extend({ ...@@ -24,10 +28,30 @@ export default Vue.extend({
}, },
]; ];
}, },
optionList() {
return [
{ name: this.$t("lang.trade.txRecord"), value: "1" },
{ name: this.$t("lang.trade.consensusNode"), value: "2" },
];
},
}, },
methods: { methods: {
setValue(v: string) { setValue(v: string) {
this.value = v; this.value = v;
}, },
groupCellName(val: any) {
switch (val.row.tradeG) {
case 0:
return "";
case 1:
return "tx-middle";
case 2:
return "tx-start";
case 3:
return "tx-end";
default:
return "";
}
},
}, },
}); });
...@@ -2,6 +2,7 @@ import { i18n } from "@/assets/lang"; ...@@ -2,6 +2,7 @@ import { i18n } from "@/assets/lang";
import { iAsset } from "@/types/trade"; import { iAsset } from "@/types/trade";
import { deCode } from "./prototype"; import { deCode } from "./prototype";
import { parseTransferNote } from "@33cn/chain33-transaction-parser"; import { parseTransferNote } from "@33cn/chain33-transaction-parser";
import { yccDifferenceBlockRewardHeight } from "@/constant";
/** /**
* 格式化时间 * 格式化时间
...@@ -170,15 +171,17 @@ export default { ...@@ -170,15 +171,17 @@ export default {
return result; return result;
} }
}, },
branchIncome: (num: string, token: string) => { filterBlockReward(num: string): string {
const differHeight = 725000 return Number(num) > yccDifferenceBlockRewardHeight ? `15 YCC` : `30 YCC`;
return Number(num) > differHeight },
? `15 YCC(${i18n.t("lang.block.votingNode")} 5 + ${i18n.t( filterVotePackReward(num: string):string {
return Number(num) > yccDifferenceBlockRewardHeight
? `${i18n.t("lang.block.votingNode")} 5 + ${i18n.t(
"lang.block.packingNode" "lang.block.packingNode"
)} 3` )} 3`
: `30 YCC(${i18n.t("lang.block.votingNode")} 5 + ${i18n.t( : `${i18n.t("lang.block.votingNode")} 5 + ${i18n.t(
"lang.block.packingNode" "lang.block.packingNode"
)} 3`; )} 3`;
}, },
TradeValue: (tradeInfo: any) => { TradeValue: (tradeInfo: any) => {
if (!tradeInfo.amount && !tradeInfo.assets) if (!tradeInfo.amount && !tradeInfo.assets)
......
...@@ -3,11 +3,32 @@ ...@@ -3,11 +3,32 @@
style="margin-top: 70px;" style="margin-top: 70px;"
class="min-w-1200 md:w-bodySet mx-auto flow-root" class="min-w-1200 md:w-bodySet mx-auto flow-root"
> >
<chain-search <chain-search :value="value" :setValue="setValue"></chain-search>
:value="value"
:setValue="setValue"
></chain-search>
<address-overview class="mt-7"></address-overview> <address-overview class="mt-7"></address-overview>
<TabList
:setFocusedTab="(v) => (focusedTab = v)"
:tabList="tabList"
:focusedTab="focusedTab"
></TabList>
<DataFilter
v-if="focusedTab === '1'"
:optionList="optionList"
:setValue="(v) => (selectedOption = v)"
:value="selectedOption"
>
<template #left>
{{ $t('lang.trade.txTotal', [pages.total]) }}
</template>
</DataFilter>
<TradeTable
v-if="focusedTab === '1'"
:groupCellName="groupCellName"
:Loading="loadingTable"
:Trades="Trades"
:pages="pages"
:sizeChange="sizeChange"
:pageChange="pageChange"
></TradeTable>
</div> </div>
</template> </template>
...@@ -16,12 +37,11 @@ import ChainSearch from '@/components/pc/BlockChainBrowser/ChainSearch.vue' ...@@ -16,12 +37,11 @@ import ChainSearch from '@/components/pc/BlockChainBrowser/ChainSearch.vue'
import AddressOverview from '@/components/pc/BlockChainBrowser/AddressOverview/index.vue' import AddressOverview from '@/components/pc/BlockChainBrowser/AddressOverview/index.vue'
import VueTypedMixins from 'vue-typed-mixins' import VueTypedMixins from 'vue-typed-mixins'
import address from '@/mixin/address' import address from '@/mixin/address'
import TabList from '@/components/pc/BlockChainBrowser/TabList/index.vue'
import DataFilter from '@/components/pc/BlockChainBrowser/DataFilter/index.vue'
export default VueTypedMixins(address).extend({ export default VueTypedMixins(address).extend({
components: { ChainSearch, AddressOverview }, components: { ChainSearch, AddressOverview, TabList, DataFilter },
computed: { computed: {},
},
}) })
</script> </script>
......
...@@ -69,7 +69,8 @@ ...@@ -69,7 +69,8 @@
<el-table-column :label="$t('lang.block.blockReward')"> <el-table-column :label="$t('lang.block.blockReward')">
<template slot-scope="block"> <template slot-scope="block">
<div class="light2"> <div class="light2">
{{ block.row.height | branchIncome('BTY') }} {{ block.row.height | filterBlockReward }}
({{ block.row.height | filterVotePackReward }})
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment