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
73c01c10
Commit
73c01c10
authored
Feb 11, 2022
by
chenqikuai
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
全部区块查询页面
parent
46a75702
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
250 additions
and
141 deletions
+250
-141
zh.ts
src/assets/lang/zh.ts
+3
-3
m-blockItem.vue
src/components/mobile/m-blockItem.vue
+2
-2
m-latestBlocks.vue
src/components/mobile/m-latestBlocks.vue
+1
-3
m-pageContainer.vue
src/components/mobile/m-pageContainer.vue
+59
-18
m-title.vue
src/components/mobile/m-title.vue
+19
-0
block.ts
src/mixin/block.ts
+111
-0
block.vue
src/views/mobile/block.vue
+48
-0
blockChainBrowser.vue
src/views/mobile/blockChainBrowser.vue
+3
-0
block.vue
src/views/pc/block.vue
+4
-115
No files found.
src/assets/lang/zh.ts
View file @
73c01c10
...
@@ -4,8 +4,8 @@ export const lang = {
...
@@ -4,8 +4,8 @@ export const lang = {
news
:
"新闻公告"
,
news
:
"新闻公告"
,
blockChainBrowser
:
"区块链浏览器"
,
blockChainBrowser
:
"区块链浏览器"
,
page
:
{
page
:
{
first
:
"首
页
"
,
first
:
"首"
,
last
:
"尾
页
"
,
last
:
"尾"
,
confirm
:
"确定"
,
confirm
:
"确定"
,
nodata
:
"暂无数据"
,
nodata
:
"暂无数据"
,
},
},
...
@@ -101,7 +101,7 @@ export const lang = {
...
@@ -101,7 +101,7 @@ export const lang = {
txRecord
:
"交易记录"
,
txRecord
:
"交易记录"
,
consensusNode
:
"共识节点"
,
consensusNode
:
"共识节点"
,
txTotal
:
"共找到{0}笔交易"
,
txTotal
:
"共找到{0}笔交易"
,
receiveStatus
:
'接受状态'
receiveStatus
:
"接受状态"
,
},
},
components
:
{
components
:
{
hour
:
"小时"
,
hour
:
"小时"
,
...
...
src/components/mobile/m-blockItem.vue
View file @
73c01c10
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
class=
"text-footer-color text-base font-bold"
class=
"text-footer-color text-base font-bold"
style=
"margin-top: 7px;"
style=
"margin-top: 7px;"
>
>
{{
(
item
&&
item
.
txs
&&
item
.
txs
.
length
)
||
''
}}
{{
item
&&
item
.
txCount
}}
</div>
</div>
<div
class=
"text-xs font-bold text-footer-color-light"
>
<div
class=
"text-xs font-bold text-footer-color-light"
>
{{
$t
(
'lang.block.txCount'
)
}}
{{
$t
(
'lang.block.txCount'
)
}}
...
@@ -42,7 +42,7 @@
...
@@ -42,7 +42,7 @@
},
},
}"
}"
>
>
{{
item
.
minerHash
|
filterHash
}}
{{
item
.
hash
|
filterHash
(
12
)
}}
</router-link>
</router-link>
</span>
</span>
</div>
</div>
...
...
src/components/mobile/m-latestBlocks.vue
View file @
73c01c10
...
@@ -14,17 +14,15 @@
...
@@ -14,17 +14,15 @@
:key=
"i"
:key=
"i"
:item=
"item"
:item=
"item"
></m-block-item>
></m-block-item>
<m-latest-tx></m-latest-tx>
</div>
</div>
</
template
>
</
template
>
<
script
lang=
"ts"
>
<
script
lang=
"ts"
>
import
Vue
,
{
PropType
}
from
'vue'
import
Vue
,
{
PropType
}
from
'vue'
import
mBlockItem
from
'./m-blockItem.vue'
import
mBlockItem
from
'./m-blockItem.vue'
import
{
iBlockMsg
}
from
'ycc-api/dist/cmjs/service/home/types'
import
{
iBlockMsg
}
from
'ycc-api/dist/cmjs/service/home/types'
import
MLatestTx
from
'./m-latestTx.vue'
export
default
Vue
.
extend
({
export
default
Vue
.
extend
({
components
:
{
mBlockItem
,
MLatestTx
},
components
:
{
mBlockItem
,
},
props
:
{
props
:
{
latestBlocks
:
Array
as
PropType
<
iBlockMsg
[]
>
,
latestBlocks
:
Array
as
PropType
<
iBlockMsg
[]
>
,
},
},
...
...
src/components/mobile/m-pageContainer.vue
View file @
73c01c10
<
template
>
<
template
>
<div
class=
"m-page-container"
>
<div
class=
"m-page-container"
>
<div
class=
"
detail flex-left"
v-if=
"!simple
"
>
<div
class=
"
simple flex justify-end
"
>
<el-pagination
<el-pagination
background
background
small
small
@
current-change=
"handleCurrentChange"
@
current-change=
"handleCurrentChange"
@
size-change=
"handleSizeChange"
:current-page=
"currentPageNum"
:current-page=
"currentPageNum"
:page-size=
"pageSize"
:page-size=
"pageSize"
:page-sizes=
"[10, 20, 30]"
:page-sizes=
"[10, 20, 30]"
layout=
"
total,sizes,jumper
"
layout=
"
prev,pager,next
"
:total=
"total"
:total=
"total"
:pager-count=
"5"
:pager-count=
"5"
></el-pagination>
></el-pagination>
<div
class=
"confirm"
>
{{
$t
(
'lang.page.confirm'
)
}}
</div>
</div>
</div>
<div
class=
"simple"
>
<div
class=
"
detail flex mt-3.5 items-center justify-end"
v-if=
"!
simple"
>
<el-pagination
<el-pagination
background
background
small
small
@
current-change=
"handleCurrentChange"
@
current-change=
"handleCurrentChange"
:current-page=
"currentPageNum"
:current-page=
"currentPageNum"
:page-size=
"pageSize"
:page-size=
"pageSize"
:page-sizes=
"[10, 20, 30]"
layout=
"total,jumper"
layout=
"prev,pager,next"
:total=
"total"
:total=
"total"
:pager-count=
"5"
:pager-count=
"5"
></el-pagination>
></el-pagination>
<div
class=
"confirm"
>
{{
$t
(
'lang.page.confirm'
)
}}
</div>
</div>
</div>
</div>
</div>
</
template
>
</
template
>
...
@@ -87,30 +85,57 @@ export default Vue.extend({
...
@@ -87,30 +85,57 @@ export default Vue.extend({
})
})
</
script
>
</
script
>
<
style
lang=
"scss"
>
<
style
lang=
"scss"
>
$blue
:
#dee1e6
;
$white
:
#6368de
;
.m-page-container
{
.m-page-container
{
.btn-prev
,
.btn-next
{
margin
:
0
!
important
;
height
:
30px
!
important
;
min-width
:
30px
!
important
;
background
:
white
!
important
;
border
:
1px
solid
#dee1e6
;
}
.btn-prev
{
border-right
:
none
;
}
.el-pagination
{
.el-pagination
{
.el-pager
li
:not
(
.disabled
)
.active
{
.el-pager
li
:not
(
.disabled
)
.active
{
background-color
:
$blue
;
background-color
:
$blue
;
color
:
#6368de
;
}
}
.el-pager
li
{
.el-pager
li
{
background
:
white
;
line-height
:
30px
;
text-align
:
center
;
min-width
:
30px
!
important
;
height
:
30px
;
margin
:
0
!
important
;
font-weight
:
500
;
font-weight
:
500
;
font-size
:
12px
;
font-size
:
12px
;
border
:
1px
solid
#dee1e6
;
border-right
:
none
;
}
.el-pager
li
{
}
}
}
}
.confirm
{
.confirm
{
width
:
58px
;
height
:
30px
;
line-height
:
30px
;
background
:
#2545cb
;
border-radius
:
15px
;
padding
:
0
5px
;
padding
:
0
5px
;
flex-shrink
:
1
;
flex-shrink
:
1
;
margin-left
:
10px
;
margin-left
:
10px
;
display
:
inline-block
;
display
:
inline-block
;
width
:
fit-content
;
font-size
:
14px
;
height
:
22px
;
font-family
:
PingFangSC-Regular
,
PingFang
SC
;
line-height
:
22px
;
font-weight
:
400
;
background
:
$blue
;
color
:
#ffffff
;
border-radius
:
15px
;
text-align
:
center
;
text-align
:
center
;
color
:
$white
;
font-size
:
12px
;
font-family
:
PingFangSC-Regular
;
cursor
:
pointer
;
cursor
:
pointer
;
}
}
.el-pagination
{
.el-pagination
{
...
@@ -133,14 +158,30 @@ export default Vue.extend({
...
@@ -133,14 +158,30 @@ export default Vue.extend({
}
}
}
}
}
}
.el-pagination__total
{
.el-pagination__total
,
.el-pagination__jump
{
margin
:
0
;
margin
:
0
;
margin-left
:
4px
;
font-size
:
12px
;
font-size
:
12px
;
font-family
:
PingFangSC
;
font-family
:
PingFangSC
;
font-weight
:
400
;
font-weight
:
400
;
color
:
rgba
(
128
,
147
,
167
,
1
);
line-height
:
30px
!
important
;
line-height
:
17px
;
font-size
:
14px
;
font-family
:
PingFangSC-Regular
,
PingFang
SC
;
font-weight
:
400
;
color
:
#8093a7
;
height
:
30px
!
important
;
}
.el-pagination__editor.el-input
{
width
:
65px
;
height
:
30px
;
input
{
width
:
100%
;
height
:
100%
!
important
;
}
}
}
.detail
{
.detail
{
margin-bottom
:
12px
;
margin-bottom
:
12px
;
}
}
...
...
src/components/mobile/m-title.vue
0 → 100644
View file @
73c01c10
<
template
>
<div
class=
"c-title flex items-center pl-3.5 bg-white text-darkBlue font-bold text-sm"
>
{{
title
}}
</div>
</
template
>
<
script
lang=
"ts"
>
import
Vue
from
'vue'
export
default
Vue
.
extend
({
props
:
{
title
:
String
,
},
})
</
script
>
<
style
lang=
"scss"
scoped
>
.c-title
{
height
:
50px
;
}
</
style
>
src/mixin/block.ts
0 → 100644
View file @
73c01c10
import
Vue
from
"vue"
;
import
{
message
}
from
"ant-design-vue"
;
import
{
getRpc
}
from
"ycc-api/dist/cmjs/service/Rpc"
;
const
Rpc
=
getRpc
(
"/yccApi"
);
export
default
Vue
.
extend
({
data
()
{
return
{
maxHeight
:
0
,
startHeight
:
0
,
endHeight
:
0
,
Loading
:
false
,
Timer
:
0
,
pages
:
{
currentPage
:
1
,
pageSize
:
20
,
total
:
10
,
},
Blocks
:
[]
as
any
[],
};
},
computed
:
{
ParallelChain
():
any
{
return
this
.
$store
.
getters
.
isParallelChain
;
},
},
activated
()
{
this
.
getLastBlock
();
},
mounted
()
{
this
.
getLastBlock
();
},
methods
:
{
getLastBlock
()
{
if
(
this
.
Loading
)
return
;
this
.
Loading
=
true
;
Rpc
.
getLastHeader
().
then
((
data
)
=>
{
if
(
data
.
error
===
null
)
{
if
(
data
.
result
.
height
!==
this
.
endHeight
)
{
this
.
maxHeight
=
data
.
result
.
height
;
this
.
pages
.
total
=
this
.
maxHeight
;
this
.
getBlocks
(
this
.
maxHeight
);
return
;
}
this
.
Loading
=
false
;
}
else
{
this
.
Loading
=
false
;
message
.
warning
({
// title: this.$t('components.tip'),
// message: data.error,
content
:
data
.
error
as
string
,
});
}
});
},
pageChange
(
page
:
number
)
{
clearTimeout
(
this
.
Timer
);
this
.
pages
.
currentPage
=
page
;
const
newHeight
=
this
.
maxHeight
-
(
this
.
pages
.
currentPage
-
1
)
*
this
.
pages
.
pageSize
;
this
.
endHeight
=
0
;
this
.
Blocks
=
[];
this
.
getBlocks
(
newHeight
);
},
sizeChange
(
size
:
number
)
{
this
.
pages
.
pageSize
=
size
;
this
.
pageChange
(
1
);
},
getBlocks
(
endHeight
:
number
)
{
this
.
Loading
=
true
;
// 首次更新
if
(
this
.
endHeight
===
0
)
{
this
.
endHeight
=
endHeight
;
this
.
startHeight
=
this
.
endHeight
-
this
.
pages
.
pageSize
+
1
>
0
?
this
.
endHeight
-
this
.
pages
.
pageSize
+
1
:
0
;
// 尾页判断
}
else
{
// 非首次请求获取更新的区块
this
.
startHeight
=
this
.
endHeight
+
1
;
this
.
endHeight
=
this
.
maxHeight
;
}
Rpc
.
getHeaders
(
this
.
startHeight
,
this
.
endHeight
,
false
).
then
((
data
)
=>
{
if
(
data
.
error
===
null
)
{
const
info
=
data
.
result
.
items
.
reverse
();
if
(
this
.
pages
.
currentPage
===
1
)
{
this
.
Blocks
=
[...
info
,
...
this
.
Blocks
];
this
.
Blocks
.
length
=
this
.
pages
.
pageSize
;
}
else
{
this
.
Blocks
=
info
;
}
this
.
Loading
=
false
;
}
else
{
this
.
Loading
=
false
;
message
.
warning
({
content
:
data
.
error
,
});
// this.$notify.warning({
// title: this.$t('components.tip'),
// message: data.error,
// })
}
});
},
},
beforeDestroy
()
{
//清除定时器
clearTimeout
(
this
.
Timer
);
},
});
src/views/mobile/block.vue
0 → 100644
View file @
73c01c10
<
template
>
<div
class=
"c-block mx-4"
>
<m-chain-search
class=
"mt-3.5"
></m-chain-search>
<m-page-container
@
pageChange=
"pageChange"
@
sizeChange=
"sizeChange"
:currentPage=
"pages.currentPage"
:pageSize=
"pages.pageSize"
:total=
"pages.total"
class=
"mt-5"
></m-page-container>
<m-title
class=
"mt-3.5"
:title=
"`$
{$t('lang.block.title')}(${234234}${$t('lang.block.count')})`"
>
</m-title>
<m-block-item
v-for=
"(item, i) in Blocks"
:item=
"item"
:key=
"i"
></m-block-item>
<m-page-container
:simple=
"false"
@
pageChange=
"pageChange"
@
sizeChange=
"sizeChange"
:currentPage=
"pages.currentPage"
:pageSize=
"pages.pageSize"
:total=
"pages.total"
class=
"mt-5"
></m-page-container>
</div>
</
template
>
<
script
lang=
"ts"
>
import
MBlockItem
from
'@/components/mobile/m-blockItem.vue'
import
mChainSearch
from
'@/components/mobile/m-chainSearch.vue'
import
MPageContainer
from
'@/components/mobile/m-pageContainer.vue'
import
MTitle
from
'@/components/mobile/m-title.vue'
import
VueTypedMixins
from
'vue-typed-mixins'
import
blockMixin
from
'@/mixin/block'
export
default
VueTypedMixins
(
blockMixin
).
extend
({
components
:
{
mChainSearch
,
MPageContainer
,
MTitle
,
MBlockItem
},
})
</
script
>
<
style
lang=
"scss"
scoped
>
.c-block
{
padding-top
:
44px
;
border-radius
:
2px
;
}
</
style
>
src/views/mobile/blockChainBrowser.vue
View file @
73c01c10
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
class=
"mx-4 mt-3.5"
class=
"mx-4 mt-3.5"
:latestBlocks=
"latestBlocks"
:latestBlocks=
"latestBlocks"
></m-latest-blocks>
></m-latest-blocks>
<m-latest-tx
class=
"mx-4"
></m-latest-tx>
</div>
</div>
</
template
>
</
template
>
...
@@ -34,6 +35,7 @@ import MNumOfOnChainTx from '@/components/mobile/map/m-numOfOnChainTx.vue'
...
@@ -34,6 +35,7 @@ import MNumOfOnChainTx from '@/components/mobile/map/m-numOfOnChainTx.vue'
import
MChainPrice
from
'@/components/mobile/m-chain-price.vue'
import
MChainPrice
from
'@/components/mobile/m-chain-price.vue'
import
MChainPerf
from
'@/components/mobile/m-chain-perf.vue'
import
MChainPerf
from
'@/components/mobile/m-chain-perf.vue'
import
MLatestBlocks
from
'@/components/mobile/m-latestBlocks.vue'
import
MLatestBlocks
from
'@/components/mobile/m-latestBlocks.vue'
import
MLatestTx
from
'@/components/mobile/m-latestTx.vue'
export
default
VueTypedMixins
(
blockChainBrowserMixin
).
extend
({
export
default
VueTypedMixins
(
blockChainBrowserMixin
).
extend
({
components
:
{
components
:
{
...
@@ -44,6 +46,7 @@ export default VueTypedMixins(blockChainBrowserMixin).extend({
...
@@ -44,6 +46,7 @@ export default VueTypedMixins(blockChainBrowserMixin).extend({
MChainPrice
,
MChainPrice
,
MChainPerf
,
MChainPerf
,
MLatestBlocks
,
MLatestBlocks
,
MLatestTx
,
},
},
})
})
</
script
>
</
script
>
...
...
src/views/pc/block.vue
View file @
73c01c10
<
template
>
<
template
>
<div
class=
"the-block min-w-1200 md:w-bodySet mx-auto mb-16 flow-root"
>
<div
class=
"the-block min-w-1200 md:w-bodySet mx-auto mb-16 flow-root"
>
<chain-search
<chain-search
class=
"mt-7"
></chain-search>
class=
"mt-7"
></chain-search>
<div
class=
"pc-block inner-box"
>
<div
class=
"pc-block inner-box"
>
<div
class=
"title flex items-center justify-between"
>
<div
class=
"title flex items-center justify-between"
>
<span
class=
"total-block"
>
<span
class=
"total-block"
>
...
@@ -100,122 +98,13 @@
...
@@ -100,122 +98,13 @@
</template>
</template>
<
script
lang=
"ts"
>
<
script
lang=
"ts"
>
import
Vue
from
'vue
'
import
Vue
TypedMixins
from
'vue-typed-mixins
'
import
ChainSearch
from
'@/components/pc/BlockChainBrowser/ChainSearch.vue'
import
ChainSearch
from
'@/components/pc/BlockChainBrowser/ChainSearch.vue'
import
PageContainer
from
'@/components/pc/BlockChainBrowser/PageContainer.vue'
import
PageContainer
from
'@/components/pc/BlockChainBrowser/PageContainer.vue'
import
Count
from
'@/components/pc/BlockChainBrowser/Count.vue'
import
Count
from
'@/components/pc/BlockChainBrowser/Count.vue'
import
{
getRpc
}
from
'ycc-api/dist/cmjs/service/Rpc'
import
blockMixin
from
'@/mixin/block'
import
{
message
}
from
'ant-design-vue'
export
default
VueTypedMixins
(
blockMixin
).
extend
({
const
Rpc
=
getRpc
(
'/yccApi'
)
export
default
Vue
.
extend
({
components
:
{
ChainSearch
,
PageContainer
,
Count
},
components
:
{
ChainSearch
,
PageContainer
,
Count
},
data
()
{
return
{
maxHeight
:
0
,
startHeight
:
0
,
endHeight
:
0
,
Loading
:
false
,
Timer
:
0
,
pages
:
{
currentPage
:
1
,
pageSize
:
20
,
total
:
10
,
},
Blocks
:
[]
as
any
[],
}
},
computed
:
{
ParallelChain
():
any
{
return
this
.
$store
.
getters
.
isParallelChain
},
},
activated
()
{
this
.
getLastBlock
()
},
mounted
()
{
this
.
getLastBlock
()
},
methods
:
{
getLastBlock
()
{
console
.
log
(
this
.
Loading
,
'show loading'
)
if
(
this
.
Loading
)
return
this
.
Loading
=
true
Rpc
.
getLastHeader
().
then
((
data
)
=>
{
if
(
data
.
error
===
null
)
{
if
(
data
.
result
.
height
!==
this
.
endHeight
)
{
this
.
maxHeight
=
data
.
result
.
height
this
.
pages
.
total
=
this
.
maxHeight
this
.
getBlocks
(
this
.
maxHeight
)
return
}
this
.
Loading
=
false
}
else
{
this
.
Loading
=
false
message
.
warning
({
// title: this.$t('components.tip'),
// message: data.error,
content
:
data
.
error
as
string
,
})
}
})
},
pageChange
(
page
:
number
)
{
clearTimeout
(
this
.
Timer
)
this
.
pages
.
currentPage
=
page
let
newHeight
=
this
.
maxHeight
-
(
this
.
pages
.
currentPage
-
1
)
*
this
.
pages
.
pageSize
this
.
endHeight
=
0
this
.
Blocks
=
[]
this
.
getBlocks
(
newHeight
)
},
sizeChange
(
size
:
number
)
{
this
.
pages
.
pageSize
=
size
this
.
pageChange
(
1
)
},
getBlocks
(
endHeight
:
number
)
{
this
.
Loading
=
true
// 首次更新
if
(
this
.
endHeight
===
0
)
{
this
.
endHeight
=
endHeight
this
.
startHeight
=
this
.
endHeight
-
this
.
pages
.
pageSize
+
1
>
0
?
this
.
endHeight
-
this
.
pages
.
pageSize
+
1
:
0
// 尾页判断
}
else
{
// 非首次请求获取更新的区块
this
.
startHeight
=
this
.
endHeight
+
1
this
.
endHeight
=
this
.
maxHeight
}
Rpc
.
getHeaders
(
this
.
startHeight
,
this
.
endHeight
,
false
).
then
((
data
)
=>
{
if
(
data
.
error
===
null
)
{
let
info
=
data
.
result
.
items
.
reverse
()
if
(
this
.
pages
.
currentPage
===
1
)
{
this
.
Blocks
=
[...
info
,
...
this
.
Blocks
]
this
.
Blocks
.
length
=
this
.
pages
.
pageSize
}
else
{
this
.
Blocks
=
info
}
this
.
Loading
=
false
}
else
{
this
.
Loading
=
false
message
.
warning
({
content
:
data
.
error
,
})
// this.$notify.warning({
// title: this.$t('components.tip'),
// message: data.error,
// })
}
})
},
},
beforeDestroy
()
{
//清除定时器
clearTimeout
(
this
.
Timer
)
},
})
})
</
script
>
</
script
>
...
...
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