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
eb9f685e
Commit
eb9f685e
authored
Aug 12, 2022
by
wenglk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
ea6f8199
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
207 additions
and
95 deletions
+207
-95
address.ts
src/mixin/address.ts
+27
-44
api.ts
src/service/api.ts
+125
-0
index.vue
src/views/mobile/address/index.vue
+15
-40
votePackTable.vue
src/views/pc/address/components/votePackTable.vue
+40
-11
No files found.
src/mixin/address.ts
View file @
eb9f685e
...
@@ -320,7 +320,7 @@ export default Vue.extend({
...
@@ -320,7 +320,7 @@ export default Vue.extend({
},
},
pageChange2
(
page
:
number
)
{
pageChange2
(
page
:
number
)
{
this
.
pages2
.
currentPage
=
page
;
this
.
pages2
.
currentPage
=
page
;
console
.
log
(
'page2'
);
this
.
loadingVote
=
true
getVoterAddr
(
getVoterAddr
(
this
.
$route
.
query
.
address
as
string
,
this
.
$route
.
query
.
address
as
string
,
...
@@ -329,13 +329,20 @@ export default Vue.extend({
...
@@ -329,13 +329,20 @@ export default Vue.extend({
).
then
((
res
)
=>
{
).
then
((
res
)
=>
{
if
(
res
.
error
===
null
)
{
if
(
res
.
error
===
null
)
{
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
this
.
voteList
=
res
.
result
.
map
((
i
:
any
)
=>
({
let
obj
=
{}
as
any
...
i
,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
sender
:
i
.
from
,
res
.
result
.
forEach
((
i
:
any
)
=>
{
receiver
:
i
.
to
,
i
.
voter_addr
.
forEach
((
item
:
string
)
=>
{
time
:
i
.
block_time
,
// i.voter_detail[item]++
}));
if
(
!
obj
[
item
])
obj
[
item
]
=
1
const
txHashes
=
res
.
result
.
map
((
i
:
any
)
=>
i
.
hash
);
else
obj
[
item
]
++
})
i
.
voter_detail
=
obj
obj
=
{}
})
this
.
voteList
=
res
.
result
this
.
loadingVote
=
false
// const txHashes = res.result.map((i: any) => i.hash);
// this.setVoteReward(txHashes);
// this.setVoteReward(txHashes);
}
}
});
});
...
@@ -373,36 +380,6 @@ export default Vue.extend({
...
@@ -373,36 +380,6 @@ export default Vue.extend({
return
""
;
return
""
;
}
}
},
},
setVoteReward
(
txHashes
:
string
[])
{
getTxByHashes
(
"ycc"
,
yccApi
,
txHashes
).
then
((
txRes
)
=>
{
const
list
=
txRes
.
map
((
i
:
any
,
index
:
number
)
=>
{
return
{
txHash
:
txHashes
[
index
],
receipt
:
i
.
receipt
,
};
})
.
map
((
i
:
any
)
=>
{
const
res
=
getConsensusList
([
i
]);
return
{
txHash
:
i
.
txHash
,
reward
:
res
.
filter
((
m
)
=>
m
.
type
===
"vote"
)
.
reduce
((
p
,
c
)
=>
{
return
p
+
c
.
reward
;
},
0
),
};
});
list
.
forEach
((
item
:
{
txHash
:
string
;
reward
:
number
})
=>
{
const
the
=
this
.
voteList
.
find
((
i
)
=>
i
.
hash
===
item
.
txHash
);
if
(
the
)
{
the
.
reward
=
item
.
reward
;
}
});
this
.
voteList
=
[...
this
.
voteList
];
});
},
getVoter
()
{
getVoter
()
{
getVoterAddrCount
(
this
.
$route
.
query
.
address
as
string
).
then
((
res
)
=>
{
getVoterAddrCount
(
this
.
$route
.
query
.
address
as
string
).
then
((
res
)
=>
{
if
(
res
.
error
===
null
)
{
if
(
res
.
error
===
null
)
{
...
@@ -413,13 +390,19 @@ export default Vue.extend({
...
@@ -413,13 +390,19 @@ export default Vue.extend({
this
.
pages2
.
pageSize
this
.
pages2
.
pageSize
).
then
((
res
)
=>
{
).
then
((
res
)
=>
{
if
(
res
.
error
===
null
)
{
if
(
res
.
error
===
null
)
{
// console.log(res, 'vote');
let
obj
=
{}
as
any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
this
.
voteList
=
res
.
result
.
map
((
i
:
any
)
=>
({
res
.
result
.
forEach
((
i
:
any
)
=>
{
...
i
,
i
.
voter_addr
.
forEach
((
item
:
string
)
=>
{
sender
:
i
.
from
,
// i.voter_detail[item]++
receiver
:
i
.
to
,
if
(
!
obj
[
item
])
obj
[
item
]
=
1
time
:
i
.
block_time
,
else
obj
[
item
]
++
}));
})
i
.
voter_detail
=
obj
obj
=
{}
})
this
.
voteList
=
res
.
result
}
}
});
});
}
}
...
...
src/service/api.ts
View file @
eb9f685e
...
@@ -487,3 +487,127 @@ export function numOfOnChainTx(times: { start: number; end: number }[]) {
...
@@ -487,3 +487,127 @@ export function numOfOnChainTx(times: { start: number; end: number }[]) {
},
},
});
});
}
}
// 获取区块下非共识交易总数
export
function
getBlocksUnConsensusTxsCount
(
height
:
number
)
{
return
axios
(
expandApi
,
{
method
:
"post"
,
params
:
{
id
:
1
,
method
:
"Tx.TxCount"
,
params
:
[
{
"not"
:
[
{
"key"
:
"action_name"
,
"value"
:
"miner"
}
],
match
:
[
{
key
:
"height"
,
value
:
height
,
}
],
},
],
},
});
}
// 获取区块下非共识交易列表
export
function
getBlocksUnConsensusTxs
(
height
:
number
,
number
:
number
,
size
:
number
)
{
return
axios
(
expandApi
,
{
method
:
"post"
,
params
:
{
id
:
1
,
method
:
"Tx.TxList"
,
params
:
[
{
sort
:
[
{
key
:
"height"
,
ascending
:
false
,
},
],
"not"
:
[
{
"key"
:
"action_name"
,
"value"
:
"miner"
}
],
match
:
[
{
key
:
"height"
,
value
:
height
,
}
],
page
:
{
number
,
size
,
},
},
],
},
});
}
// 获取区块下共识交易总数
export
function
getBlocksConsensusTxsCount
(
height
:
number
)
{
return
axios
(
expandApi
,
{
method
:
"post"
,
params
:
{
id
:
1
,
method
:
"Tx.TxCount"
,
params
:
[
{
match
:
[
{
"key"
:
"action_name"
,
"value"
:
"miner"
},
{
key
:
"height"
,
value
:
height
,
}
],
},
],
},
});
}
// 获取区块下共识交易列表
export
function
getBlocksConsensusTxs
(
height
:
number
,
number
:
number
,
size
:
number
)
{
return
axios
(
expandApi
,
{
method
:
"post"
,
params
:
{
id
:
1
,
method
:
"Tx.TxList"
,
params
:
[
{
sort
:
[
{
key
:
"height"
,
ascending
:
false
,
},
],
match
:
[
{
"key"
:
"action_name"
,
"value"
:
"miner"
},
{
key
:
"height"
,
value
:
height
,
}
],
page
:
{
number
,
size
,
},
},
],
},
});
}
\ No newline at end of file
src/views/mobile/address/index.vue
View file @
eb9f685e
...
@@ -9,10 +9,7 @@
...
@@ -9,10 +9,7 @@
:handleSelectChange=
"(v) => (selectedExecer = v)"
:handleSelectChange=
"(v) => (selectedExecer = v)"
:frozen=
"frozen"
:frozen=
"frozen"
></m-address-overview>
></m-address-overview>
<div
<div
class=
"rounded-twoPx shadow-shadow1 bg-white"
style=
"margin-top: 15px"
>
class=
"rounded-twoPx shadow-shadow1 bg-white"
style=
"margin-top: 15px;"
>
<m-tabs
<m-tabs
:focusedTab=
"focusedTab"
:focusedTab=
"focusedTab"
:setFocusedTab=
"($event) => (focusedTab = $event)"
:setFocusedTab=
"($event) => (focusedTab = $event)"
...
@@ -49,8 +46,8 @@
...
@@ -49,8 +46,8 @@
:status="n.success"
:status="n.success"
>
</m-tx-item>
>
</m-tx-item>
</div>
</div>
<div
v-if=
"focusedTab === '
votingRecord
'"
>
<div
v-if=
"focusedTab === '
consensus
'"
>
<
vote-pack-table
<
MVotePack
v-for=
"(v, i) in voteList"
v-for=
"(v, i) in voteList"
:key=
"i"
:key=
"i"
:height=
"v.height"
:height=
"v.height"
...
@@ -59,19 +56,7 @@
...
@@ -59,19 +56,7 @@
:txHash=
"v.hash"
:txHash=
"v.hash"
:rewardAmount=
"v.reward"
:rewardAmount=
"v.reward"
type=
"vote"
type=
"vote"
></vote-pack-table>
></MVotePack>
</div>
<div
v-if=
"focusedTab === 'packingRecord'"
>
<m-vote-pack
v-for=
"(n, i) in packList"
:key=
"i"
:height=
"n.height"
:timeBlock=
"n.time"
:sender=
"n.sender"
:txHash=
"n.hash"
:rewardAmount=
"n.reward"
type=
"pack"
></m-vote-pack>
</div>
</div>
</div>
</div>
<m-page-container
<m-page-container
...
@@ -85,7 +70,7 @@
...
@@ -85,7 +70,7 @@
class=
"mt-5"
class=
"mt-5"
></m-page-container>
></m-page-container>
<m-page-container
<m-page-container
v-if=
"focusedTab === '
votingRecord
'"
v-if=
"focusedTab === '
consensus
'"
@
pageChange=
"pageChange2"
@
pageChange=
"pageChange2"
@
sizeChange=
"sizeChange2"
@
sizeChange=
"sizeChange2"
:simple=
"false"
:simple=
"false"
...
@@ -94,28 +79,18 @@
...
@@ -94,28 +79,18 @@
:total=
"pages2.total"
:total=
"pages2.total"
class=
"mt-5"
class=
"mt-5"
></m-page-container>
></m-page-container>
<m-page-container
v-if=
"focusedTab === 'packingRecord'"
@
pageChange=
"pageChange3"
@
sizeChange=
"sizeChange3"
:simple=
"false"
:currentPage=
"pages3.currentPage"
:pageSize=
"pages3.pageSize"
:total=
"pages3.total"
class=
"mt-5"
></m-page-container>
</div>
</div>
</
template
>
</
template
>
<
script
lang=
"ts"
>
<
script
lang=
"ts"
>
import
MChainSearch
from
'@/components/mobile/m-chainSearch.vue'
import
MChainSearch
from
"@/components/mobile/m-chainSearch.vue"
;
import
MTabs
from
'@/components/mobile/m-tabs.vue'
import
MTabs
from
"@/components/mobile/m-tabs.vue"
;
import
MPageContainer
from
'@/components/mobile/m-pageContainer.vue'
import
MPageContainer
from
"@/components/mobile/m-pageContainer.vue"
;
import
MVotePack
from
'@/components/mobile/m-vote-pack.vue'
import
MVotePack
from
"@/components/mobile/m-vote-pack.vue"
;
import
address
from
'@/mixin/address'
import
address
from
"@/mixin/address"
;
import
VueTypedMixins
from
'vue-typed-mixins'
import
VueTypedMixins
from
"vue-typed-mixins"
;
import
MAddressOverview
from
'./components/m-address-overview/index.vue'
import
MAddressOverview
from
"./components/m-address-overview/index.vue"
;
import
MTxItem
from
'@/components/mobile/m-txItem.vue'
import
MTxItem
from
"@/components/mobile/m-txItem.vue"
;
import
Select
from
'@/components/pc/Select.vue'
import
Select
from
"@/components/pc/Select.vue"
;
export
default
VueTypedMixins
(
address
).
extend
({
export
default
VueTypedMixins
(
address
).
extend
({
components
:
{
components
:
{
...
@@ -127,7 +102,7 @@ export default VueTypedMixins(address).extend({
...
@@ -127,7 +102,7 @@ export default VueTypedMixins(address).extend({
Select
,
Select
,
MTxItem
,
MTxItem
,
},
},
})
})
;
</
script
>
</
script
>
<
style
lang=
"scss"
scoped
>
<
style
lang=
"scss"
scoped
>
.c-address
{
.c-address
{
...
...
src/views/pc/address/components/votePackTable.vue
View file @
eb9f685e
<
template
>
<
template
>
<div
class=
"c-votePackTable"
>
<div
class=
"c-votePackTable"
>
<el-table
:data=
"list"
v-loading=
"loading"
stripe
>
<el-table
:data=
"list"
v-loading=
"loading"
element-loading-text=
"Loading..."
element-loading-spinner=
"el-icon-loading"
stripe
>
<!--
<TableColumn
label
width=
"40"
></TableColumn>
-->
<!--
<TableColumn
label
width=
"40"
></TableColumn>
-->
<TableColumn
type=
"expand"
>
<TableColumn
type=
"expand"
>
<template
slot-scope=
"props"
>
<template
slot-scope=
"props"
>
<div
<div
class=
"line"
class=
"line"
v-for=
"
item in props.row.voter_addr
"
v-for=
"
(item, index) in Object.keys(props.row.voter_detail)
"
:key=
"i
tem.hash
"
:key=
"i
ndex
"
>
>
<p
class=
"adr"
>
{{
item
|
filterHash
(
10
)
}}
</p>
<router-link
<span>
投票节点
</span>
class=
"adr"
<span>
YCC
</span>
:to=
"
{
path: '/address',
query: {
address: item,
},
}"
>
{{
item
|
filterHash
(
10
)
}}
</router-link>
<span
class=
"vote-node"
>
投票节点
</span>
<span
class=
"reward"
>
{{
Number
(
props
.
row
.
voter_detail
[
item
])
*
0.25
}}
YCC
</span
>
</div>
</div>
</
template
>
</
template
>
</TableColumn>
</TableColumn>
...
@@ -38,11 +56,11 @@
...
@@ -38,11 +56,11 @@
:to=
"
{
:to=
"
{
path: '/address',
path: '/address',
query: {
query: {
address: row.
sender
,
address: row.
maker_addr[0]
,
},
},
}"
}"
>
>
{{
row
.
sender
|
filterHash
(
10
)
}}
{{
row
.
maker_addr
[
0
]
|
filterHash
(
10
)
}}
</router-link>
</router-link>
</div>
</div>
</
template
>
</
template
>
...
@@ -64,7 +82,7 @@
...
@@ -64,7 +82,7 @@
<TableColumn
:label=
"$t('lang.trade.time')"
align=
"right"
width=
"220"
>
<TableColumn
:label=
"$t('lang.trade.time')"
align=
"right"
width=
"220"
>
<
template
slot-scope=
"{ row }"
>
<
template
slot-scope=
"{ row }"
>
<div
class=
"text-text-color"
>
<div
class=
"text-text-color"
>
{{
row
.
time
|
formatTime
}}
{{
row
.
block_
time
|
formatTime
}}
</div>
</div>
</
template
>
</
template
>
</TableColumn>
</TableColumn>
...
@@ -93,11 +111,22 @@ export default Vue.extend({
...
@@ -93,11 +111,22 @@ export default Vue.extend({
align-items
:
center
;
align-items
:
center
;
font-size
:
14px
;
font-size
:
14px
;
font-family
:
PingFangSC-Regular
,
PingFang
SC
;
font-family
:
PingFangSC-Regular
,
PingFang
SC
;
color
:
#1f3470
;
line-height
:
50px
;
line-height
:
40px
;
color
:
rgb
(
124
,
136
,
173
)
;
.adr
{
.adr
{
margin-left
:
355px
;
margin-left
:
355px
;
width
:
300px
;
width
:
300px
;
color
:
#2545cb
;
transition
:
0
.3s
;
}
.adr
:hover
{
color
:
#1890ff
;
}
.vote-node
{
margin-left
:
30px
;
}
.reward
{
margin-left
:
95px
;
}
}
}
}
</
style
>
</
style
>
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