Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
ycc-website
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Website
ycc-website
Commits
c74b88bc
Commit
c74b88bc
authored
Feb 14, 2022
by
chenqikuai
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
blockDetail txhashes display
parent
2ff6a249
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
166 additions
and
23 deletions
+166
-23
m-block-desc-card.vue
src/components/mobile/m-block-desc-card.vue
+1
-1
m-tabs.vue
src/components/mobile/m-tabs.vue
+44
-0
m-txItem.vue
src/components/mobile/m-txItem.vue
+39
-6
blockDetail.ts
src/mixin/blockDetail.ts
+48
-15
index.ts
src/router/index.ts
+1
-1
index.vue
src/views/mobile/blockDetail/index.vue
+33
-0
index.vue
src/views/pc/blockDetail/index.vue
+0
-0
No files found.
src/components/mobile/m-block-desc-card.vue
View file @
c74b88bc
...
...
@@ -17,7 +17,7 @@
</span>
</div>
</div>
<div
class=
"flex justify-between"
>
<div
class=
"flex justify-between
mt-1
"
>
<div
class=
"text-text-color text-xs"
>
{{
$t
(
'lang.txDetail.height'
)
}}
</div>
...
...
src/components/mobile/m-tabs.vue
0 → 100644
View file @
c74b88bc
<
template
>
<div
class=
"c-title flex items-center pl-3.5 bg-white text-darkBlue font-bold text-sm"
>
<div
class=
"text-sm font-bold relative mr-7"
:class=
"[
tab.value === focusedTab ? ' text-footer-color' : ' text-text-color',
]"
@
click=
"setFocusedTab(tab.value)"
v-for=
"(tab, i) in tabList"
:key=
"i"
>
{{
tab
.
name
}}
<div
v-if=
"tab.value === focusedTab"
class=
"absolute -bottom-1 left-1/2 -translate-x-1/2 transform bg-footer-color"
style=
"width: 14px; height: 2px;"
></div>
</div>
</div>
</
template
>
<
script
lang=
"ts"
>
import
Vue
,
{
PropType
}
from
'vue'
export
default
Vue
.
extend
({
props
:
{
title
:
String
,
focusedTab
:
String
,
setFocusedTab
:
Function
,
tabList
:
Array
as
PropType
<
{
name
:
string
value
:
string
}[]
>
,
},
})
</
script
>
<
style
lang=
"scss"
scoped
>
.c-title
{
height
:
50px
;
}
</
style
>
src/components/mobile/m-txItem.vue
View file @
c74b88bc
...
...
@@ -16,11 +16,11 @@
{{
$t
(
'lang.trade.txAmount'
)
}}
:
</div>
<div
class=
"text-darkBlue text-sm font-bold"
>
12.00
YCC
{{
amount
|
filterAmount
}}
YCC
</div>
</div>
<div
class=
"text-xs text-text-color"
>
20394029348
{{
blockTime
|
formatTime
}}
</div>
</div>
<div
class=
"flex items-center justify-between"
>
...
...
@@ -32,10 +32,19 @@
class=
"text-xs"
:class=
"[txGroup ? ' text-lightBlue' : 'text-footer-color']"
>
{{
'1092380912'
|
filterHash
}}
<router-link
:to=
"
{
path: '/tradeHash',
query: {
hash: txHash,
},
}"
>
{{
txHash
|
filterHash
}}
</router-link>
</div>
</div>
<TxStatus
size=
"small"
:status=
"
true
"
/>
<TxStatus
size=
"small"
:status=
"
status
"
/>
</div>
<div
class=
"flex items-center justify-between"
>
<div>
...
...
@@ -46,7 +55,16 @@
class=
"text-xs"
:class=
"[txGroup ? ' text-lightBlue' : 'text-footer-color']"
>
{{
'1092380912'
|
filterHash
}}
<router-link
:to=
"
{
path: '/address',
query: {
address: from,
},
}"
>
{{
from
|
filterHash
}}
</router-link>
</span>
</div>
<div>
...
...
@@ -57,7 +75,16 @@
class=
"text-xs"
:class=
"[txGroup ? ' text-lightBlue' : 'text-footer-color']"
>
{{
'1092380912'
|
filterHash
}}
<router-link
:to=
"
{
path: '/address',
query: {
address: to,
},
}"
>
{{
to
|
filterHash
}}
</router-link>
</span>
</div>
</div>
...
...
@@ -72,7 +99,13 @@ export default Vue.extend({
TxStatus
,
},
props
:
{
blockTime
:
Number
,
txGroup
:
String
as
PropType
<
'isGroupItem'
|
'isGroupItemEnd'
>
,
amount
:
Number
,
txHash
:
String
,
from
:
String
,
to
:
String
,
status
:
Boolean
,
},
data
()
{
return
{
...
...
src/mixin/blockDetail.ts
View file @
c74b88bc
...
...
@@ -2,6 +2,8 @@ import { getRpc } from "ycc-api/src/service/Rpc";
import
{
getBlockDetail
}
from
"ycc-api/src/service/blockDetail/index"
;
import
Vue
from
"vue"
;
import
{
getBlockOverviewAndRelativeHeight
}
from
"ycc-api/dist/cmjs/service/blockDetail"
;
import
{
message
}
from
"ant-design-vue"
;
import
{
tradeAccuracy
}
from
"@/utils/common"
;
const
Rpc
=
getRpc
(
"/yccApi"
);
export
default
Vue
.
extend
({
data
()
{
...
...
@@ -22,7 +24,7 @@ export default Vue.extend({
loadingOverview
:
false
,
loadingRelativeNumber
:
false
,
loadingTable
:
false
,
Trades
:
[],
Trades
:
[]
as
any
[]
,
txHashes
:
[],
pages
:
{
currentPage
:
1
,
...
...
@@ -32,6 +34,48 @@ export default Vue.extend({
};
},
methods
:
{
isSuccess
(
execer
:
any
,
ty
:
any
)
{
return
!
tradeAccuracy
(
execer
,
ty
);
},
fetchTradeFromTxHashes
()
{
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
)
=>
{
if
(
data
.
error
==
null
)
{
// this.searchIcon(data.result.txs);
this
.
Trades
=
this
.
checkGroup
(
data
.
result
.
txs
);
console
.
log
(
this
.
Trades
,
"show Trades"
);
}
else
{
message
.
warning
(
this
.
$t
(
"components.tip"
)
+
data
.
error
);
}
});
},
checkGroup
(
arr
:
any
[])
{
arr
.
map
((
current
,
index
)
=>
{
if
(
current
.
tx
.
groupCount
>
1
)
{
current
.
tradeG
=
1
;
//0-非交易组,1-交易组,3-交易组末条, 2-交易组首条
if
(
current
.
tx
.
fee
!==
0
)
{
current
.
tradeG
=
2
;
}
else
{
if
(
index
<
arr
.
length
)
{
current
.
tradeG
=
arr
[
index
].
tx
.
next
?
1
:
3
;
}
else
{
current
.
tradeG
=
3
;
}
}
}
else
{
current
.
tradeG
=
0
;
}
});
return
arr
;
},
selectOption
(
v
:
string
)
{
this
.
selectedOption
=
v
;
},
...
...
@@ -62,6 +106,9 @@ export default Vue.extend({
stateHash
:
o
.
stateHash
,
txHash
:
o
.
txHash
,
};
this
.
txHashes
=
o
.
txHashes
;
this
.
pages
.
total
=
this
.
txHashes
.
length
;
this
.
fetchTradeFromTxHashes
();
});
relativeBlockHeight
.
then
((
r
:
any
)
=>
{
this
.
loadingRelativeNumber
=
false
;
...
...
@@ -75,20 +122,6 @@ export default Vue.extend({
});
},
async
init
()
{
// this.loadingOverview = true;
// this.loadingTable = true;
// const { overview, txs } =
// (await getBlockDetail("ycc", "/yccApi", {
// height: Number(this.$route.query.height),
// })) || {};
// if (overview) {
// this.overview = overview;
// this.pages.total = overview.txCount;
// this.Trades = txs;
// }
// this.loadingOverview = false;
// this.loadingTable = false;
this
.
fetchBlockOverviewAndRelativeBlockHeightData
();
},
// 交易组模块
...
...
src/router/index.ts
View file @
c74b88bc
...
...
@@ -42,7 +42,7 @@ const routes: Array<RouteConfig> = [
{
path
:
"/blockDetail"
,
name
:
"区块详情"
,
component
:
()
=>
import
(
`@/views/
${
file
}
/blockDetail.vue`
),
component
:
()
=>
import
(
`@/views/
${
file
}
/blockDetail
/index
.vue`
),
},
{
path
:
"/tradeHash"
,
...
...
src/views/mobile/blockDetail.vue
→
src/views/mobile/blockDetail
/index
.vue
View file @
c74b88bc
...
...
@@ -13,6 +13,33 @@
:nextBlockHeight=
"overview.nextBlockHeight"
:loading=
"loadingOverview"
></m-block-desc-card>
<m-tabs
class=
"mt-3.5"
:tabList=
"tabList"
:focusedTab=
"focusedTab"
:setFocusedTab=
"setFocusedTab"
></m-tabs>
<div
v-if=
"focusedTab === '1'"
class=
" flow-root"
>
<m-tx-item
v-for=
"(trade, i) in Trades"
:key=
"i"
:amount=
"trade.amount"
:txHash=
"trade.tx.hash"
:from=
"trade.tx.from"
:blockTime=
"trade.blockTime"
:to=
"trade.tx.to"
:status=
"isSuccess(trade.tx.execer, trade.receipt.ty)"
></m-tx-item>
<m-page-container
class=
"mt-3.5"
:simple=
"false"
@
pageChange=
"pageChange"
@
sizeChange=
"sizeChange"
:currentPage=
"pages.currentPage"
:pageSize=
"pages.pageSize"
:total=
"pages.total"
></m-page-container>
</div>
</div>
</
template
>
<
script
lang=
"ts"
>
...
...
@@ -20,10 +47,16 @@ import VueTypedMixins from 'vue-typed-mixins'
import
blockDetailMixin
from
'@/mixin/blockDetail'
import
MChainSearch
from
'@/components/mobile/m-chainSearch.vue'
import
MBlockDescCard
from
'@/components/mobile/m-block-desc-card.vue'
import
MTabs
from
'@/components/mobile/m-tabs.vue'
import
MTxItem
from
'@/components/mobile/m-txItem.vue'
import
MPageContainer
from
'@/components/mobile/m-pageContainer.vue'
export
default
VueTypedMixins
(
blockDetailMixin
).
extend
({
components
:
{
MChainSearch
,
MBlockDescCard
,
MTabs
,
MTxItem
,
MPageContainer
,
},
})
</
script
>
...
...
src/views/pc/blockDetail.vue
→
src/views/pc/blockDetail
/index
.vue
View file @
c74b88bc
File moved
chenqikuai
@chenqikuai
mentioned in commit
748f7ae1
·
Mar 03, 2022
mentioned in commit
748f7ae1
mentioned in commit 748f7ae18ac2f8eb14ee7c2865eaea786342a520
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment