Commit b83ac0f1 authored by chenqikuai's avatar chenqikuai

fix

parent 511e4d31
...@@ -20,7 +20,16 @@ ...@@ -20,7 +20,16 @@
<div class="flex-grow" style="margin-left: 10px;"> <div class="flex-grow" style="margin-left: 10px;">
<div class="flex justify-between" style="margin-bottom: 5px;"> <div class="flex justify-between" style="margin-bottom: 5px;">
<div class="text-darkBlue text-sm font-bold"> <div class="text-darkBlue text-sm font-bold">
102938 <router-link
:to="{
path: '/blockDetail',
query: {
height: height,
},
}"
>
102938
</router-link>
</div> </div>
<div class="text-text-color"> <div class="text-text-color">
{{ 2039480923 | formatTime }} {{ 2039480923 | formatTime }}
...@@ -31,7 +40,16 @@ ...@@ -31,7 +40,16 @@
{{ $t('lang.txDetail.txHash') }}: {{ $t('lang.txDetail.txHash') }}:
</span> </span>
<span class="text-footer-color text-xs font-bold"> <span class="text-footer-color text-xs font-bold">
asdlfkjadlsfk <router-link
:to="{
path: '/tradeHash',
query: {
hash: txHash,
},
}"
>
{{ 'alskdjflaksjdflkasdf' | filterHash(9) }}
</router-link>
</span> </span>
</div> </div>
<div> <div>
...@@ -39,7 +57,16 @@ ...@@ -39,7 +57,16 @@
{{ $t('lang.trade.sender') }}: {{ $t('lang.trade.sender') }}:
</span> </span>
<span class="text-footer-color text-xs font-bold"> <span class="text-footer-color text-xs font-bold">
asdlfkjadlsfk <router-link
:to="{
path: '/address',
query: {
address: sender,
},
}"
>
{{ 'lakjsdflkjaskdlfjasdf' | filterHash(9) }}
</router-link>
</span> </span>
</div> </div>
</div> </div>
......
...@@ -3,7 +3,7 @@ import Vue from "vue"; ...@@ -3,7 +3,7 @@ import Vue from "vue";
import { getBlockOverviewAndRelativeHeight } from "ycc-api/dist/cmjs/service/blockDetail"; import { getBlockOverviewAndRelativeHeight } from "ycc-api/dist/cmjs/service/blockDetail";
import { message } from "ant-design-vue"; import { message } from "ant-design-vue";
import { tradeAccuracy } from "@/utils/common"; import { tradeAccuracy } from "@/utils/common";
import { getConsensusList, getPackList, getVoteList } from "@/utils/consensus"; import { getConsensusList } from "@/utils/consensus";
const Rpc = getRpc("/yccApi"); const Rpc = getRpc("/yccApi");
export default Vue.extend({ export default Vue.extend({
data() { data() {
...@@ -13,22 +13,7 @@ export default Vue.extend({ ...@@ -13,22 +13,7 @@ export default Vue.extend({
txRecordFilterValue: "allTx", txRecordFilterValue: "allTx",
consensusNodeFilterValue: "allNode", consensusNodeFilterValue: "allNode",
consensusNodeTableList: [ consensusNodeTableList: [] as any[],
{
height: 111,
address: "aldjfasdf",
reward: 10 * 1e8,
time: 102938123,
type: "",
},
{
height: 111,
address: "aldjfasdf",
reward: 10 * 1e8,
time: 102938123,
type: "lakjsd",
},
] as any[],
loadingConsensusNodeTable: false, loadingConsensusNodeTable: false,
overview: { overview: {
txCount: 0, txCount: 0,
...@@ -42,7 +27,7 @@ export default Vue.extend({ ...@@ -42,7 +27,7 @@ export default Vue.extend({
loadingOverview: false, loadingOverview: false,
loadingRelativeNumber: false, loadingRelativeNumber: false,
loadingTable: false, loadingTable: false,
Trades: [] as any[], allTrades: [] as any[],
txHashes: [], txHashes: [],
pages: { pages: {
currentPage: 1, currentPage: 1,
...@@ -57,25 +42,51 @@ export default Vue.extend({ ...@@ -57,25 +42,51 @@ export default Vue.extend({
}, },
fetchTradeFromTxHashes() { fetchTradeFromTxHashes() {
this.loadingTable = true; this.loadingTable = true;
const searchArr: string[] = []; Rpc.getTxByHashes(this.txHashes).then((data) => {
const end =
this.pages.pageSize * this.pages.currentPage - 1 < this.pages.total
? this.pages.pageSize * this.pages.currentPage - 1
: this.pages.total - 1;
const start = this.pages.pageSize * (this.pages.currentPage - 1);
for (let i = start; i <= end; i++) {
searchArr.push(this.txHashes[i]);
}
Rpc.getTxByHashes(searchArr).then((data) => {
this.loadingTable = false; this.loadingTable = false;
if (data.error == null) { if (data.error == null) {
console.log(getConsensusList(data.result.txs)); // 共识节点 this.consensusNodeTableList = getConsensusList(data.result.txs).map(
(i) => {
return {
height: this.$route.query.height,
address: i.addr,
reward: i.reward,
time: data.result.txs[0].blockTime,
type: i.type,
};
}
);
// this.searchIcon(data.result.txs); // this.searchIcon(data.result.txs);
this.Trades = this.checkGroup(data.result.txs); this.allTrades = this.checkGroup(data.result.txs);
} else { } else {
message.warning(this.$t("components.tip") + data.error); message.warning(this.$t("components.tip") + data.error);
} }
}); });
// this.loadingTable = true;
// const searchArr: string[] = [];
// const end =
// this.pages.pageSize * this.pages.currentPage - 1 < this.pages.total
// ? this.pages.pageSize * this.pages.currentPage - 1
// : this.pages.total - 1;
// const start = this.pages.pageSize * (this.pages.currentPage - 1);
// for (let i = start; i <= end; i++) {
// searchArr.push(this.txHashes[i]);
// }
// Rpc.getTxByHashes(searchArr).then((data) => {
// this.loadingTable = false;
// if (data.error == null) {
// console.log(
// data.result.txs[0].blockTime,
// "show data.result.txs[0].blockTime"
// );
// console.log(getConsensusList(data.result.txs)); // 共识节点
// // this.searchIcon(data.result.txs);
// this.Trades = this.checkGroup(data.result.txs);
// } else {
// message.warning(this.$t("components.tip") + data.error);
// }
// });
}, },
checkGroup(arr: any[]) { checkGroup(arr: any[]) {
arr.map((current, index) => { arr.map((current, index) => {
...@@ -164,6 +175,23 @@ export default Vue.extend({ ...@@ -164,6 +175,23 @@ export default Vue.extend({
}, },
}, },
computed: { computed: {
consensusNodeTableListFiltered(): any[] {
if (this.consensusNodeFilterValue === "allNode")
return this.consensusNodeTableList;
return this.consensusNodeTableList.filter(
(i) =>
i.type ===
(this.consensusNodeFilterValue === "packingNode" ? "pack" : "vote")
);
},
Trades(): any[] {
const end =
this.pages.pageSize * this.pages.currentPage - 1 < this.pages.total
? this.pages.pageSize * this.pages.currentPage - 1
: this.pages.total - 1;
const start = this.pages.pageSize * (this.pages.currentPage - 1);
return this.allTrades.slice(start, end + 1);
},
tabList(): any[] { tabList(): any[] {
return [ return [
{ {
......
...@@ -26,7 +26,16 @@ ...@@ -26,7 +26,16 @@
' text-orange2': item.row.type === '', ' text-orange2': item.row.type === '',
}" }"
> >
{{ item.row.height }} <router-link
:to="{
path: '/blockDetail',
query: {
height: item.row.height,
},
}"
>
{{ item.row.height }}
</router-link>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
...@@ -46,16 +55,14 @@ ...@@ -46,16 +55,14 @@
}, },
}" }"
> >
{{ item.row.address }} {{ item.row.address | filterHash(10) }}
</router-link> </router-link>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="$t('lang.block.blockReward')"> <el-table-column :label="$t('lang.block.blockReward')">
<template slot-scope="{ row }"> <template slot-scope="{ row }">
<div class="text-darkBlue"> <div class="text-darkBlue">{{ row.reward | filterAmount }} YCC</div>
{{ row.reward | filterAmount }}
</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="$t('lang.txDetail.time')"> <el-table-column :label="$t('lang.txDetail.time')">
...@@ -68,7 +75,7 @@ ...@@ -68,7 +75,7 @@
<el-table-column :label="$t('lang.trade.type')" align="right" width="90"> <el-table-column :label="$t('lang.trade.type')" align="right" width="90">
<template slot-scope="{ row }"> <template slot-scope="{ row }">
<div class="text-darkBlue"> <div class="text-darkBlue">
{{ row.type }} {{ row.type === 'vote' ? '投票节点' : '打包节点' }}
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
...@@ -91,7 +98,7 @@ export default Vue.extend({ ...@@ -91,7 +98,7 @@ export default Vue.extend({
methods: { methods: {
cellStyle({ row }: any) { cellStyle({ row }: any) {
return { return {
backgroundColor: row.type === '' ? 'rgba(255, 164, 87, 0.06)' : '', backgroundColor: row.type === 'pack' ? 'rgba(255, 164, 87, 0.06)' : '',
} }
}, },
}, },
......
<template> <template>
<div class="block-detail min-w-1200 md:w-bodySet mx-auto flow-root"> <div
class="block-detail min-w-1200 md:w-bodySet mx-auto flow-root"
style="padding-bottom: 60px;"
>
<chain-search <chain-search
style="margin-top: 30px;" style="margin-top: 30px;"
:clickSearch="clickSearch" :clickSearch="clickSearch"
...@@ -13,12 +16,7 @@ ...@@ -13,12 +16,7 @@
:loading="loadingOverview" :loading="loadingOverview"
:loadingRelativeBlockHeight="loadingRelativeNumber" :loadingRelativeBlockHeight="loadingRelativeNumber"
></block-overview> ></block-overview>
<div <div class="shadow-shadow1">
style="
box-shadow: 0px 2px 15px 0px rgba(31, 52, 112, 0.06);
padding-bottom: 60px;
"
>
<TabList <TabList
:tabList="tabList" :tabList="tabList"
:setFocusedTab="(v) => (focusedTab = v)" :setFocusedTab="(v) => (focusedTab = v)"
...@@ -40,6 +38,7 @@ ...@@ -40,6 +38,7 @@
:Loading="loadingTable" :Loading="loadingTable"
:Trades="Trades" :Trades="Trades"
:pages="pages" :pages="pages"
:hidePageContainer="true"
:sizeChange="sizeChange" :sizeChange="sizeChange"
:pageChange="pageChange" :pageChange="pageChange"
></TradeTable> ></TradeTable>
...@@ -57,10 +56,23 @@ ...@@ -57,10 +56,23 @@
</DataFilter> </DataFilter>
<consensus-node-table <consensus-node-table
v-if="focusedTab === 'consensusNodeTab'" v-if="focusedTab === 'consensusNodeTab'"
:list="consensusNodeTableList" :list="consensusNodeTableListFiltered"
:loading="loadingConsensusNodeTable" :loading="loadingTable"
></consensus-node-table> ></consensus-node-table>
</div> </div>
<div
class="flex justify-end"
style="margin-top: 30px;"
v-if="focusedTab === 'txRecordTab'"
>
<page-container
@pageChange="pageChange"
@sizeChange="sizeChange"
:currentPage="pages.currentPage"
:pageSize="pages.pageSize"
:total="pages.total"
></page-container>
</div>
</div> </div>
</template> </template>
...@@ -70,6 +82,7 @@ import BlockOverview from '@/components/pc/BlockChainBrowser/BlockOverview/index ...@@ -70,6 +82,7 @@ import BlockOverview from '@/components/pc/BlockChainBrowser/BlockOverview/index
import TabList from '@/components/pc/BlockChainBrowser/TabList/index.vue' import TabList from '@/components/pc/BlockChainBrowser/TabList/index.vue'
import DataFilter from '@/components/pc/BlockChainBrowser/DataFilter/index.vue' import DataFilter from '@/components/pc/BlockChainBrowser/DataFilter/index.vue'
import TradeTable from '@/components/pc/BlockChainBrowser/TradeTable/index.vue' import TradeTable from '@/components/pc/BlockChainBrowser/TradeTable/index.vue'
import PageContainer from '@/components/pc/BlockChainBrowser/PageContainer.vue'
import blockDetailMixin from '@/mixin/blockDetail' import blockDetailMixin from '@/mixin/blockDetail'
import VueTypedMixins from 'vue-typed-mixins' import VueTypedMixins from 'vue-typed-mixins'
import ConsensusNodeTable from './components/consensusNodeTable.vue' import ConsensusNodeTable from './components/consensusNodeTable.vue'
...@@ -78,6 +91,7 @@ export default VueTypedMixins(blockDetailMixin).extend({ ...@@ -78,6 +91,7 @@ export default VueTypedMixins(blockDetailMixin).extend({
components: { components: {
ChainSearch, ChainSearch,
BlockOverview, BlockOverview,
PageContainer,
TabList, TabList,
DataFilter, DataFilter,
TradeTable, TradeTable,
......
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