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
a9627295
Commit
a9627295
authored
Dec 19, 2023
by
wenglk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
地址转小写
parent
bdbe3b53
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
612 additions
and
586 deletions
+612
-586
chartsInAddr.vue
src/components/chartsInAddr.vue
+144
-131
address.ts
src/mixin/address.ts
+382
-375
AddressOverview.ts
src/mixin/componentsMixin/AddressOverview.ts
+86
-80
No files found.
src/components/chartsInAddr.vue
View file @
a9627295
<
template
>
<
template
>
<div
class=
"charts"
ref=
"charts"
></div>
<div
class=
"charts"
ref=
"charts"
></div>
</
template
>
</
template
>
<
script
lang=
"ts"
>
<
script
lang=
"ts"
>
import
*
as
echarts
from
'echarts/core'
import
*
as
echarts
from
"echarts/core"
;
import
{
LineSeriesOption
,
LineChart
}
from
'echarts/charts'
import
{
LineSeriesOption
,
LineChart
}
from
"echarts/charts"
;
import
{
TooltipComponent
,
GridComponent
}
from
'echarts/components'
import
{
TooltipComponent
,
GridComponent
}
from
"echarts/components"
;
import
{
CanvasRenderer
}
from
'echarts/renderers'
import
{
CanvasRenderer
}
from
"echarts/renderers"
;
import
{
getAccountRecords
}
from
'@/service/api'
import
{
getAccountRecords
}
from
"@/service/api"
;
import
moment
from
'moment'
import
moment
from
"moment"
;
type
ECOption
=
echarts
.
ComposeOption
<
LineSeriesOption
>
type
ECOption
=
echarts
.
ComposeOption
<
LineSeriesOption
>
;
echarts
.
use
([
TooltipComponent
,
GridComponent
,
LineChart
,
CanvasRenderer
])
echarts
.
use
([
TooltipComponent
,
GridComponent
,
LineChart
,
CanvasRenderer
])
;
import
chartsMixin
from
'@/mixin/componentsMixin/charts'
import
chartsMixin
from
"@/mixin/componentsMixin/charts"
;
import
VueTypedMixins
from
'vue-typed-mixins'
import
VueTypedMixins
from
"vue-typed-mixins"
;
import
{
nFormatter
}
from
'@/utils/common'
import
{
nFormatter
}
from
"@/utils/common"
;
export
default
VueTypedMixins
(
chartsMixin
).
extend
({
export
default
VueTypedMixins
(
chartsMixin
).
extend
({
props
:
{
props
:
{
scale
:
String
,
scale
:
String
,
grid
:
Object
,
grid
:
Object
,
},
data
()
{
return
{
xData
:
[],
seriesData
:
[],
}
},
methods
:
{
generate
()
{
switch
(
this
.
scale
)
{
case
'D1'
:
return
this
.
generateD1
()
case
'W1'
:
return
this
.
generateW1
()
case
'M1'
:
return
this
.
generateM1
()
case
'M6'
:
return
this
.
generateM6
()
case
'Y1'
:
return
this
.
generateY1
()
}
},
},
draw
()
{
data
()
{
const
times
=
this
.
generate
()
return
{
times
&&
xData
:
[],
getAccountRecords
(
seriesData
:
[],
this
.
$route
.
query
.
address
as
string
,
};
times
,
'ycc'
,
).
then
((
ret
)
=>
{
if
(
ret
.
error
==
null
)
{
this
.
xData
=
ret
.
result
const
myChart
=
echarts
.
init
(
this
.
$refs
.
charts
as
HTMLElement
)
myChart
.
setOption
({
tooltip
:
{
trigger
:
'axis'
,
},
xAxis
:
{
type
:
'category'
,
axisLabel
:
{
textStyle
:
{
color
:
'#7c88ad'
,
},
},
axisTick
:
{
show
:
false
,
},
data
:
times
?.
map
((
i
)
=>
{
return
moment
.
unix
(
i
).
format
(
'YYYY.MM.DD'
)
})
.
reverse
(),
},
yAxis
:
{
type
:
'value'
,
axisLabel
:
{
formatter
:
(
item
:
number
)
=>
{
return
nFormatter
(
item
)
},
textStyle
:
{
color
:
'#7c88ad'
,
},
},
},
series
:
[
{
data
:
this
.
xData
// eslint-disable-next-line @typescript-eslint/no-explicit-any
.
map
((
i
:
any
)
=>
(
i
&&
i
[
0
]
&&
i
[
0
].
balance
)
||
0
)
.
map
((
i
)
=>
i
/
1
e8
)
.
reverse
(),
type
:
'line'
,
areaStyle
:
{
normal
:
{
// 颜色渐变函数 前四个参数分别表示四个位置依次为左、下、右、上
color
:
new
echarts
.
graphic
.
LinearGradient
(
0
,
0
,
0
,
1
,
[
{
offset
:
0
,
color
:
'#2545CB'
,
// 0% 处的颜色
},
{
offset
:
0.6
,
color
:
'#9FAEE9'
,
// 40% 处的颜色
},
{
offset
:
1
,
color
:
'white'
,
// 100% 处的颜色
},
]),
//背景渐变色
lineStyle
:
{
// 系列级个性化折线样式
type
:
'solid'
,
color
:
'#2545CB'
,
//折线的颜色
},
},
},
smooth
:
true
,
showSymbol
:
false
,
itemStyle
:
{},
},
],
grid
:
this
.
grid
,
}
as
ECOption
)
}
})
},
},
},
methods
:
{
mounted
()
{
generate
()
{
this
.
draw
()
switch
(
this
.
scale
)
{
},
case
"D1"
:
watch
:
{
return
this
.
generateD1
();
'$route.query.address'
()
{
case
"W1"
:
this
.
draw
()
return
this
.
generateW1
();
case
"M1"
:
return
this
.
generateM1
();
case
"M6"
:
return
this
.
generateM6
();
case
"Y1"
:
return
this
.
generateY1
();
}
},
draw
()
{
const
times
=
this
.
generate
();
times
&&
getAccountRecords
(
(
this
.
$route
.
query
.
address
as
string
).
toLowerCase
(),
times
,
"ycc"
).
then
((
ret
)
=>
{
if
(
ret
.
error
==
null
)
{
this
.
xData
=
ret
.
result
;
const
myChart
=
echarts
.
init
(
this
.
$refs
.
charts
as
HTMLElement
);
myChart
.
setOption
({
tooltip
:
{
trigger
:
"axis"
,
},
xAxis
:
{
type
:
"category"
,
axisLabel
:
{
textStyle
:
{
color
:
"#7c88ad"
,
},
},
axisTick
:
{
show
:
false
,
},
data
:
times
?.
map
((
i
)
=>
{
return
moment
.
unix
(
i
)
.
format
(
"YYYY.MM.DD"
);
})
.
reverse
(),
},
yAxis
:
{
type
:
"value"
,
axisLabel
:
{
formatter
:
(
item
:
number
)
=>
{
return
nFormatter
(
item
);
},
textStyle
:
{
color
:
"#7c88ad"
,
},
},
},
series
:
[
{
data
:
this
.
xData
// eslint-disable-next-line @typescript-eslint/no-explicit-any
.
map
(
(
i
:
any
)
=>
(
i
&&
i
[
0
]
&&
i
[
0
].
balance
)
||
0
)
.
map
((
i
)
=>
i
/
1
e8
)
.
reverse
(),
type
:
"line"
,
areaStyle
:
{
normal
:
{
// 颜色渐变函数 前四个参数分别表示四个位置依次为左、下、右、上
color
:
new
echarts
.
graphic
.
LinearGradient
(
0
,
0
,
0
,
1
,
[
{
offset
:
0
,
color
:
"#2545CB"
,
// 0% 处的颜色
},
{
offset
:
0.6
,
color
:
"#9FAEE9"
,
// 40% 处的颜色
},
{
offset
:
1
,
color
:
"white"
,
// 100% 处的颜色
},
]
),
//背景渐变色
lineStyle
:
{
// 系列级个性化折线样式
type
:
"solid"
,
color
:
"#2545CB"
,
//折线的颜色
},
},
},
smooth
:
true
,
showSymbol
:
false
,
itemStyle
:
{},
},
],
grid
:
this
.
grid
,
}
as
ECOption
);
}
});
},
},
},
scale
()
{
mounted
()
{
this
.
draw
()
this
.
draw
();
},
},
},
watch
:
{
})
"$route.query.address"
()
{
this
.
draw
();
},
scale
()
{
this
.
draw
();
},
},
});
</
script
>
</
script
>
<
style
lang=
"scss"
scoped
>
<
style
lang=
"scss"
scoped
>
.charts
{
.charts
{
width
:
100%
;
width
:
100%
;
}
}
</
style
>
</
style
>
src/mixin/address.ts
View file @
a9627295
import
{
import
{
getAddressTxCountOrigin
,
getAddressTxCountOrigin
,
getAddrTxList_another
,
getAddrTxList_another
,
getVoterAddr
,
getVoterAddr
,
getVoterAddrCount
,
getVoterAddrCount
,
yccApi
,
yccApi
,
}
from
"@/service/api"
;
}
from
"@/service/api"
;
import
{
iExecAccount
,
iPack
,
iVote
}
from
"@/types/address"
;
import
{
iExecAccount
,
iPack
,
iVote
}
from
"@/types/address"
;
import
{
icustomized2Tx
}
from
"@/types/trade"
;
import
{
icustomized2Tx
}
from
"@/types/trade"
;
...
@@ -13,400 +13,407 @@ import { getTxByHashes } from "ycc-api/dist/cmjs/service/blockDetail";
...
@@ -13,400 +13,407 @@ import { getTxByHashes } from "ycc-api/dist/cmjs/service/blockDetail";
import
{
getConsensusList
}
from
"@/utils/consensus"
;
import
{
getConsensusList
}
from
"@/utils/consensus"
;
export
default
Vue
.
extend
({
export
default
Vue
.
extend
({
data
()
{
data
()
{
return
{
return
{
value
:
""
,
value
:
""
,
focusedTab
:
"txRecord"
,
focusedTab
:
"txRecord"
,
total1
:
0
,
total1
:
0
,
pages
:
{
pages
:
{
currentPage
:
1
,
currentPage
:
1
,
pageSize
:
10
,
pageSize
:
10
,
total
:
0
,
total
:
0
,
},
},
pages3
:
{
pages3
:
{
currentPage
:
1
,
currentPage
:
1
,
pageSize
:
10
,
pageSize
:
10
,
total
:
0
,
total
:
0
,
},
},
pages2
:
{
pages2
:
{
currentPage
:
1
,
currentPage
:
1
,
pageSize
:
10
,
pageSize
:
10
,
total
:
0
,
total
:
0
,
},
},
selectedOption
:
"1"
,
selectedOption
:
"1"
,
loadingTxRecordTable
:
false
,
loadingTxRecordTable
:
false
,
txRecordList
:
[]
as
icustomized2Tx
[],
txRecordList
:
[]
as
icustomized2Tx
[],
voteList
:
[]
as
iVote
[],
voteList
:
[]
as
iVote
[],
selectedExecer
:
""
,
selectedExecer
:
""
,
execAccount
:
[]
as
iExecAccount
[],
execAccount
:
[]
as
iExecAccount
[],
packList
:
[]
as
iPack
[],
packList
:
[]
as
iPack
[],
loadingVote
:
false
,
loadingVote
:
false
,
loadingPack
:
false
,
loadingPack
:
false
,
selectedTxRecordFilterValue
:
"all"
,
selectedTxRecordFilterValue
:
"all"
,
};
};
},
watch
:
{
"$route.query.address"
()
{
this
.
getAllExecBalance
();
this
.
getTxList
();
this
.
getVoter
();
},
selectedTxRecordFilterValue
(
newValue
)
{
this
.
pages
.
currentPage
=
1
;
this
.
getTxList
();
},
},
},
watch
:
{
mounted
()
{
"$route.query.address"
()
{
this
.
getAllExecBalance
();
this
.
getAllExecBalance
();
this
.
getTxList
();
this
.
getTxList
();
this
.
getVoter
();
this
.
getVoter
();
},
computed
:
{
txRecordFilterOptionList
()
{
return
[
{
name
:
this
.
$t
(
"lang.trade.title"
),
value
:
"all"
,
},
{
name
:
this
.
$t
(
"lang.trade.filterSucceedTx"
),
value
:
"filterSucceedTx"
,
},
},
{
selectedTxRecordFilterValue
(
newValue
)
{
name
:
this
.
$t
(
"lang.trade.filterFailedTx"
),
this
.
pages
.
currentPage
=
1
;
value
:
"filterFailedTx"
,
this
.
getTxList
();
},
{
name
:
this
.
$t
(
"lang.trade.filterSentTx"
),
value
:
"filterSentTx"
,
},
{
name
:
this
.
$t
(
"lang.trade.filterReceivedTx"
),
value
:
"filterReceivedTx"
,
},
];
},
tabList
()
{
return
[
{
name
:
this
.
$t
(
"lang.trade.txRecord"
),
value
:
"txRecord"
,
},
},
{
name
:
this
.
$t
(
"lang.trade.consensusRecord"
),
value
:
"consensus"
,
}
];
},
},
optionList
()
{
mounted
()
{
return
[
this
.
getAllExecBalance
();
{
name
:
this
.
$t
(
"lang.trade.txRecord"
),
value
:
"1"
},
this
.
getTxList
();
{
name
:
this
.
$t
(
"lang.trade.consensusNode"
),
value
:
"2"
},
this
.
getVoter
();
];
},
},
execerOptionsList
():
{
name
:
string
;
value
:
string
}[]
{
computed
:
{
return
this
.
execAccount
.
map
((
i
)
=>
({
address
()
{
name
:
i
.
execer
,
return
(
this
.
$route
.
query
.
address
as
string
).
toLowerCase
();
value
:
i
.
execer
,
},
}));
txRecordFilterOptionList
()
{
},
return
[
balance
():
number
{
return
(
this
.
execAccount
.
find
((
i
)
=>
i
.
execer
===
this
.
selectedExecer
)
||
{
account
:
{
balance
:
0
,
},
}
)?.
account
?.
balance
;
},
frozen
():
number
{
return
(
this
.
execAccount
.
find
((
i
)
=>
i
.
execer
===
this
.
selectedExecer
)
||
{
account
:
{
frozen
:
0
,
},
}
)?.
account
?.
frozen
;
},
txRecordReqParams
():
any
{
switch
(
this
.
selectedTxRecordFilterValue
)
{
case
"all"
:
return
[
{
match_one
:
[
{
key
:
"from"
,
value
:
this
.
$route
.
query
.
address
as
string
,
},
{
key
:
"to"
,
value
:
this
.
$route
.
query
.
address
as
string
,
},
],
match
:
[],
"not"
:
[
{
"key"
:
"action_name"
,
"value"
:
"miner"
}
]
},
];
case
"filterSucceedTx"
:
return
[
{
match_one
:
[
{
{
key
:
"from"
,
name
:
this
.
$t
(
"lang.trade.title"
)
,
value
:
this
.
$route
.
query
.
address
as
string
,
value
:
"all"
,
},
},
{
{
key
:
"to"
,
name
:
this
.
$t
(
"lang.trade.filterSucceedTx"
)
,
value
:
this
.
$route
.
query
.
address
as
string
,
value
:
"filterSucceedTx"
,
},
},
],
match
:
[
{
{
query
:
{
name
:
this
.
$t
(
"lang.trade.filterFailedTx"
),
match_one
:
[
value
:
"filterFailedTx"
,
{
key
:
"is_para"
,
value
:
true
,
},
{
key
:
"success"
,
value
:
true
,
},
],
},
},
},
],
"not"
:
[
{
{
"key"
:
"action_name"
,
name
:
this
.
$t
(
"lang.trade.filterSentTx"
),
"value"
:
"miner"
value
:
"filterSentTx"
,
}
]
},
];
case
"filterFailedTx"
:
return
[
{
match_one
:
[
{
key
:
"from"
,
value
:
this
.
$route
.
query
.
address
as
string
,
},
},
{
{
key
:
"to"
,
name
:
this
.
$t
(
"lang.trade.filterReceivedTx"
)
,
value
:
this
.
$route
.
query
.
address
as
string
,
value
:
"filterReceivedTx"
,
},
},
],
];
match
:
[
},
tabList
()
{
return
[
{
{
key
:
"success"
,
name
:
this
.
$t
(
"lang.trade.txRecord"
)
,
value
:
false
,
value
:
"txRecord"
,
},
},
{
{
key
:
"is_para"
,
name
:
this
.
$t
(
"lang.trade.consensusRecord"
)
,
value
:
false
,
value
:
"consensus"
,
},
},
],
];
"not"
:
[
},
{
optionList
()
{
"key"
:
"action_name"
,
return
[
"value"
:
"miner"
{
name
:
this
.
$t
(
"lang.trade.txRecord"
),
value
:
"1"
},
}
{
name
:
this
.
$t
(
"lang.trade.consensusNode"
),
value
:
"2"
},
]
];
},
},
];
execerOptionsList
():
{
name
:
string
;
value
:
string
}[]
{
case
"filterSentTx"
:
return
this
.
execAccount
.
map
((
i
)
=>
({
return
[
name
:
i
.
execer
,
{
value
:
i
.
execer
,
match_one
:
[
}));
{
},
key
:
"from"
,
balance
():
number
{
value
:
this
.
$route
.
query
.
address
as
string
,
return
(
},
this
.
execAccount
.
find
(
],
(
i
)
=>
i
.
execer
===
this
.
selectedExecer
match
:
[],
)
||
{
"not"
:
[
account
:
{
{
balance
:
0
,
"key"
:
"action_name"
,
},
"value"
:
"miner"
}
}
]
)?.
account
?.
balance
;
},
},
];
frozen
():
number
{
case
"filterReceivedTx"
:
return
(
return
[
this
.
execAccount
.
find
(
{
(
i
)
=>
i
.
execer
===
this
.
selectedExecer
match_one
:
[
)
||
{
{
account
:
{
key
:
"to"
,
frozen
:
0
,
value
:
this
.
$route
.
query
.
address
as
string
,
},
},
],
match
:
[],
"not"
:
[
{
"key"
:
"action_name"
,
"value"
:
"miner"
}
}
]
)?.
account
?.
frozen
;
},
},
];
txRecordReqParams
():
any
{
default
:
switch
(
this
.
selectedTxRecordFilterValue
)
{
return
[];
case
"all"
:
}
return
[
},
{
},
match_one
:
[
methods
:
{
{
getAllExecBalance
()
{
key
:
"from"
,
Rpc
.
getAllExecBalance
(
this
.
$route
.
query
.
address
as
string
).
then
((
res
)
=>
{
value
:
this
.
address
as
string
,
if
(
res
.
error
===
null
)
{
},
this
.
execAccount
=
res
.
result
.
execAccount
;
{
this
.
selectedExecer
=
res
.
result
.
execAccount
[
0
].
execer
;
key
:
"to"
,
}
value
:
this
.
address
as
string
,
});
},
},
],
checkGroup
(
arr
:
icustomized2Tx
[])
{
match
:
[],
arr
.
map
((
current
,
index
)
=>
{
not
:
[
if
(
current
.
group_count
>
1
)
{
{
current
.
tradeG
=
1
;
//0-非交易组,1-交易组,3-交易组末条, 2-交易组首条
key
:
"action_name"
,
// current.tradeG = (current.tx.fee === 0 && arr[index-1].tx.fee!==0)? 2 : 1
value
:
"miner"
,
if
(
current
.
fee
!==
0
)
{
},
current
.
tradeG
=
2
;
],
}
else
{
},
if
(
index
<
arr
.
length
)
{
];
console
.
log
(
index
);
case
"filterSucceedTx"
:
current
.
tradeG
=
arr
[
index
].
next
===
""
?
3
:
1
;
return
[
}
else
{
{
current
.
tradeG
=
3
;
match_one
:
[
}
{
}
key
:
"from"
,
}
else
{
value
:
this
.
address
as
string
,
current
.
tradeG
=
0
;
},
}
{
});
key
:
"to"
,
return
arr
;
value
:
this
.
address
as
string
,
},
},
getTxList
()
{
],
this
.
loadingTxRecordTable
=
true
;
match
:
[
getAddressTxCountOrigin
(
this
.
txRecordReqParams
).
then
((
res
)
=>
{
{
if
(
res
.
error
===
null
)
{
query
:
{
this
.
total1
=
res
.
result
;
match_one
:
[
this
.
pages
.
total
=
res
.
result
;
{
// this.pages.total = res.result > 10000 ? 10000 : res.result;
key
:
"is_para"
,
getAddrTxList_another
(
value
:
true
,
this
.
pages
.
currentPage
,
},
this
.
pages
.
pageSize
,
{
this
.
txRecordReqParams
[
0
]
key
:
"success"
,
).
then
((
res
)
=>
{
value
:
true
,
if
(
res
.
error
===
null
)
{
},
this
.
txRecordList
=
this
.
checkGroup
(
res
.
result
);
],
this
.
loadingTxRecordTable
=
false
;
},
},
],
not
:
[
{
key
:
"action_name"
,
value
:
"miner"
,
},
],
},
];
case
"filterFailedTx"
:
return
[
{
match_one
:
[
{
key
:
"from"
,
value
:
this
.
address
as
string
,
},
{
key
:
"to"
,
value
:
this
.
address
as
string
,
},
],
match
:
[
{
key
:
"success"
,
value
:
false
,
},
{
key
:
"is_para"
,
value
:
false
,
},
],
not
:
[
{
key
:
"action_name"
,
value
:
"miner"
,
},
],
},
];
case
"filterSentTx"
:
return
[
{
match_one
:
[
{
key
:
"from"
,
value
:
this
.
address
as
string
,
},
],
match
:
[],
not
:
[
{
key
:
"action_name"
,
value
:
"miner"
,
},
],
},
];
case
"filterReceivedTx"
:
return
[
{
match_one
:
[
{
key
:
"to"
,
value
:
this
.
address
as
string
,
},
],
match
:
[],
not
:
[
{
key
:
"action_name"
,
value
:
"miner"
,
},
],
},
];
default
:
return
[];
}
}
});
},
}
});
},
setValue
(
v
:
string
)
{
this
.
value
=
v
;
},
sizeChange2
(
size
:
number
)
{
this
.
pages2
.
pageSize
=
size
;
this
.
pageChange2
(
1
);
},
},
pageChange2
(
page
:
number
)
{
methods
:
{
this
.
pages2
.
currentPage
=
page
;
getAllExecBalance
()
{
this
.
loadingVote
=
true
Rpc
.
getAllExecBalance
(
this
.
address
as
string
).
then
((
res
)
=>
{
if
(
res
.
error
===
null
)
{
this
.
execAccount
=
res
.
result
.
execAccount
;
this
.
selectedExecer
=
res
.
result
.
execAccount
[
0
].
execer
;
}
});
},
checkGroup
(
arr
:
icustomized2Tx
[])
{
arr
.
map
((
current
,
index
)
=>
{
if
(
current
.
group_count
>
1
)
{
current
.
tradeG
=
1
;
//0-非交易组,1-交易组,3-交易组末条, 2-交易组首条
// current.tradeG = (current.tx.fee === 0 && arr[index-1].tx.fee!==0)? 2 : 1
if
(
current
.
fee
!==
0
)
{
current
.
tradeG
=
2
;
}
else
{
if
(
index
<
arr
.
length
)
{
console
.
log
(
index
);
current
.
tradeG
=
arr
[
index
].
next
===
""
?
3
:
1
;
}
else
{
current
.
tradeG
=
3
;
}
}
}
else
{
current
.
tradeG
=
0
;
}
});
return
arr
;
},
getTxList
()
{
this
.
loadingTxRecordTable
=
true
;
getAddressTxCountOrigin
(
this
.
txRecordReqParams
).
then
((
res
)
=>
{
if
(
res
.
error
===
null
)
{
this
.
total1
=
res
.
result
;
this
.
pages
.
total
=
res
.
result
;
// this.pages.total = res.result > 10000 ? 10000 : res.result;
getAddrTxList_another
(
this
.
pages
.
currentPage
,
this
.
pages
.
pageSize
,
this
.
txRecordReqParams
[
0
]
).
then
((
res
)
=>
{
if
(
res
.
error
===
null
)
{
this
.
txRecordList
=
this
.
checkGroup
(
res
.
result
);
this
.
loadingTxRecordTable
=
false
;
}
});
}
});
},
setValue
(
v
:
string
)
{
this
.
value
=
v
;
},
sizeChange2
(
size
:
number
)
{
this
.
pages2
.
pageSize
=
size
;
this
.
pageChange2
(
1
);
},
pageChange2
(
page
:
number
)
{
this
.
pages2
.
currentPage
=
page
;
this
.
loadingVote
=
true
;
getVoterAddr
(
getVoterAddr
(
this
.
$route
.
query
.
address
as
string
,
this
.
address
as
string
,
this
.
pages2
.
currentPage
,
this
.
pages2
.
currentPage
,
this
.
pages2
.
pageSize
this
.
pages2
.
pageSize
).
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
let
obj
=
{}
as
any
let
obj
=
{}
as
any
;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
res
.
result
.
forEach
((
i
:
any
)
=>
{
res
.
result
.
forEach
((
i
:
any
)
=>
{
i
.
voter_addr
.
forEach
((
item
:
string
)
=>
{
i
.
voter_addr
.
forEach
((
item
:
string
)
=>
{
// i.voter_detail[item]++
// i.voter_detail[item]++
if
(
!
obj
[
item
])
obj
[
item
]
=
1
if
(
!
obj
[
item
])
obj
[
item
]
=
1
;
else
obj
[
item
]
++
else
obj
[
item
]
++
;
})
});
i
.
voter_detail
=
obj
i
.
voter_detail
=
obj
;
obj
=
{}
obj
=
{};
})
});
this
.
voteList
=
res
.
result
this
.
voteList
=
res
.
result
;
this
.
loadingVote
=
false
this
.
loadingVote
=
false
;
// const txHashes = res.result.map((i: any) => i.hash);
// const txHashes = res.result.map((i: any) => i.hash);
// this.setVoteReward(txHashes);
// this.setVoteReward(txHashes);
}
}
});
});
},
},
sizeChange
(
size
:
number
)
{
sizeChange
(
size
:
number
)
{
this
.
pages
.
pageSize
=
size
;
this
.
pages
.
pageSize
=
size
;
this
.
pageChange
(
1
);
this
.
pageChange
(
1
);
},
},
pageChange
(
page
:
number
)
{
pageChange
(
page
:
number
)
{
this
.
pages
.
currentPage
=
page
;
this
.
pages
.
currentPage
=
page
;
this
.
loadingTxRecordTable
=
true
;
this
.
loadingTxRecordTable
=
true
;
getAddrTxList_another
(
getAddrTxList_another
(
this
.
pages
.
currentPage
,
this
.
pages
.
currentPage
,
this
.
pages
.
pageSize
,
this
.
pages
.
pageSize
,
this
.
txRecordReqParams
[
0
]
this
.
txRecordReqParams
[
0
]
).
then
((
res
)
=>
{
).
then
((
res
)
=>
{
if
(
res
.
error
===
null
)
{
if
(
res
.
error
===
null
)
{
this
.
txRecordList
=
this
.
checkGroup
(
res
.
result
);
this
.
txRecordList
=
this
.
checkGroup
(
res
.
result
);
this
.
loadingTxRecordTable
=
false
;
this
.
loadingTxRecordTable
=
false
;
}
}
});
});
},
},
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
groupCellName
(
val
:
any
)
{
groupCellName
(
val
:
any
)
{
switch
(
val
.
row
.
tradeG
)
{
switch
(
val
.
row
.
tradeG
)
{
case
0
:
case
0
:
return
""
;
return
""
;
case
1
:
case
1
:
return
"tx-middle"
;
return
"tx-middle"
;
case
2
:
case
2
:
return
"tx-start"
;
return
"tx-start"
;
case
3
:
case
3
:
return
"tx-end"
;
return
"tx-end"
;
default
:
default
:
return
""
;
return
""
;
}
},
getVoter
()
{
getVoterAddrCount
(
this
.
$route
.
query
.
address
as
string
).
then
((
res
)
=>
{
if
(
res
.
error
===
null
)
{
this
.
pages2
.
total
=
res
.
result
;
getVoterAddr
(
this
.
$route
.
query
.
address
as
string
,
this
.
pages2
.
currentPage
,
this
.
pages2
.
pageSize
).
then
((
res
)
=>
{
if
(
res
.
error
===
null
)
{
// console.log(res, 'vote');
let
obj
=
{}
as
any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
res
.
result
.
forEach
((
i
:
any
)
=>
{
i
.
voter_addr
.
forEach
((
item
:
string
)
=>
{
// i.voter_detail[item]++
if
(
!
obj
[
item
])
obj
[
item
]
=
1
else
obj
[
item
]
++
})
i
.
voter_detail
=
obj
obj
=
{}
})
this
.
voteList
=
res
.
result
}
}
});
},
}
getVoter
()
{
});
getVoterAddrCount
(
this
.
address
as
string
).
then
((
res
)
=>
{
if
(
res
.
error
===
null
)
{
this
.
pages2
.
total
=
res
.
result
;
getVoterAddr
(
this
.
address
as
string
,
this
.
pages2
.
currentPage
,
this
.
pages2
.
pageSize
).
then
((
res
)
=>
{
if
(
res
.
error
===
null
)
{
// console.log(res, 'vote');
let
obj
=
{}
as
any
;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
res
.
result
.
forEach
((
i
:
any
)
=>
{
i
.
voter_addr
.
forEach
((
item
:
string
)
=>
{
// i.voter_detail[item]++
if
(
!
obj
[
item
])
obj
[
item
]
=
1
;
else
obj
[
item
]
++
;
});
i
.
voter_detail
=
obj
;
obj
=
{};
});
this
.
voteList
=
res
.
result
;
}
});
}
});
},
},
},
},
});
});
src/mixin/componentsMixin/AddressOverview.ts
View file @
a9627295
...
@@ -3,92 +3,98 @@ import QRCode from "qrcode";
...
@@ -3,92 +3,98 @@ import QRCode from "qrcode";
import
{
getAddressTxCount
}
from
"@/service/api"
;
import
{
getAddressTxCount
}
from
"@/service/api"
;
import
Rpc
from
"@/utils/Rpc"
;
import
Rpc
from
"@/utils/Rpc"
;
export
default
Vue
.
extend
({
export
default
Vue
.
extend
({
data
()
{
data
()
{
return
{
return
{
txCount
:
0
,
txCount
:
0
,
receive
:
0
,
receive
:
0
,
send
:
0
,
send
:
0
,
value
:
0
,
value
:
0
,
};
};
},
watch
:
{
"$route.query.address"
()
{
this
.
getAddrOverview
();
this
.
init
();
getAddressTxCount
(
this
.
$route
.
query
.
address
as
string
).
then
((
ret
)
=>
{
if
(
ret
.
error
===
null
)
{
this
.
txCount
=
ret
.
result
;
}
});
},
},
},
watch
:
{
mounted
()
{
"$route.query.address"
()
{
this
.
getAddrOverview
();
this
.
getAddrOverview
();
this
.
init
();
this
.
init
();
getAddressTxCount
(
this
.
$route
.
query
.
address
as
string
).
then
((
ret
)
=>
{
getAddressTxCount
(
if
(
ret
.
error
===
null
)
{
(
this
.
$route
.
query
.
address
as
string
).
toLowerCase
()
this
.
txCount
=
ret
.
result
;
).
then
((
ret
)
=>
{
}
if
(
ret
.
error
===
null
)
{
});
this
.
txCount
=
ret
.
result
;
},
}
computed
:
{
});
tradeInTotalList
():
{
name
:
string
;
value
:
number
}[]
{
return
[
// {
// name: this.$t("lang.address.totalReception") as string,
// value: this.receive,
// },
// {
// name: this.$t("lang.address.totalSent") as string,
// value: this.send,
// },
{
name
:
this
.
$t
(
"lang.address.totalValue"
)
as
string
,
value
:
this
.
value
,
},
},
{
},
name
:
this
.
$t
(
"lang.block.txCount"
)
as
string
,
mounted
()
{
value
:
this
.
txCount
,
this
.
getAddrOverview
();
this
.
init
();
getAddressTxCount
(
(
this
.
$route
.
query
.
address
as
string
).
toLowerCase
()
).
then
((
ret
)
=>
{
if
(
ret
.
error
===
null
)
{
this
.
txCount
=
ret
.
result
;
}
});
},
computed
:
{
tradeInTotalList
():
{
name
:
string
;
value
:
number
}[]
{
return
[
// {
// name: this.$t("lang.address.totalReception") as string,
// value: this.receive,
// },
// {
// name: this.$t("lang.address.totalSent") as string,
// value: this.send,
// },
{
name
:
this
.
$t
(
"lang.address.totalValue"
)
as
string
,
value
:
this
.
value
,
},
{
name
:
this
.
$t
(
"lang.block.txCount"
)
as
string
,
value
:
this
.
txCount
,
},
];
},
},
];
},
},
},
methods
:
{
methods
:
{
getAddrOverview
()
{
getAddrOverview
()
{
Rpc
.
getAddrOverview
(
Rpc
.
getAddrOverview
(
this
.
$route
.
query
.
address
as
string
).
then
((
res
)
=>
{
(
this
.
$route
.
query
.
address
as
string
).
toLowerCase
()
if
(
res
.
error
===
null
)
{
).
then
((
res
)
=>
{
const
balance
=
res
.
result
.
balance
;
if
(
res
.
error
===
null
)
{
const
receiver
=
res
.
result
.
reciver
;
const
balance
=
res
.
result
.
balance
;
this
.
receive
=
receiver
;
const
receiver
=
res
.
result
.
reciver
;
this
.
send
=
receiver
-
balance
;
this
.
receive
=
receiver
;
this
.
send
=
receiver
-
balance
;
fetch
(
"/market"
)
fetch
(
"/market"
)
.
then
((
ret
)
=>
ret
.
json
())
.
then
((
ret
)
=>
ret
.
json
())
.
then
((
ret
)
=>
{
.
then
((
ret
)
=>
{
if
(
ret
.
msg
===
"succeed"
)
{
if
(
ret
.
msg
===
"succeed"
)
{
const
data
=
ret
.
data
.
data
.
USDT
.
YCC
;
const
data
=
ret
.
data
.
data
.
USDT
.
YCC
;
this
.
value
=
data
.
last
*
balance
;
this
.
value
=
data
.
last
*
balance
;
}
}
});
}
});
});
}
});
},
init
()
{
QRCode
.
toCanvas
(
document
.
getElementById
(
"qrcode"
),
this
.
$route
.
query
.
address
as
string
,
{
color
:
{
dark
:
"#1F3470"
,
light
:
"#0000"
,
},
width
:
130
,
margin
:
0
,
},
},
function
(
error
)
{
init
()
{
if
(
error
)
console
.
error
(
error
);
QRCode
.
toCanvas
(
}
document
.
getElementById
(
"qrcode"
),
);
(
this
.
$route
.
query
.
address
as
string
).
toLowerCase
(),
{
color
:
{
dark
:
"#1F3470"
,
light
:
"#0000"
,
},
width
:
130
,
margin
:
0
,
},
function
(
error
)
{
if
(
error
)
console
.
error
(
error
);
}
);
},
},
},
},
});
});
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