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
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
139 additions
and
113 deletions
+139
-113
chartsInAddr.vue
src/components/chartsInAddr.vue
+63
-50
address.ts
src/mixin/address.ts
+65
-58
AddressOverview.ts
src/mixin/componentsMixin/AddressOverview.ts
+11
-5
No files found.
src/components/chartsInAddr.vue
View file @
a9627295
...
@@ -3,19 +3,19 @@
...
@@ -3,19 +3,19 @@
</
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
:
{
...
@@ -26,43 +26,45 @@ export default VueTypedMixins(chartsMixin).extend({
...
@@ -26,43 +26,45 @@ export default VueTypedMixins(chartsMixin).extend({
return
{
return
{
xData
:
[],
xData
:
[],
seriesData
:
[],
seriesData
:
[],
}
};
},
},
methods
:
{
methods
:
{
generate
()
{
generate
()
{
switch
(
this
.
scale
)
{
switch
(
this
.
scale
)
{
case
'D1'
:
case
"D1"
:
return
this
.
generateD1
()
return
this
.
generateD1
();
case
'W1'
:
case
"W1"
:
return
this
.
generateW1
()
return
this
.
generateW1
();
case
'M1'
:
case
"M1"
:
return
this
.
generateM1
()
return
this
.
generateM1
();
case
'M6'
:
case
"M6"
:
return
this
.
generateM6
()
return
this
.
generateM6
();
case
'Y1'
:
case
"Y1"
:
return
this
.
generateY1
()
return
this
.
generateY1
();
}
}
},
},
draw
()
{
draw
()
{
const
times
=
this
.
generate
()
const
times
=
this
.
generate
();
times
&&
times
&&
getAccountRecords
(
getAccountRecords
(
this
.
$route
.
query
.
address
as
string
,
(
this
.
$route
.
query
.
address
as
string
).
toLowerCase
()
,
times
,
times
,
'ycc'
,
"ycc"
).
then
((
ret
)
=>
{
).
then
((
ret
)
=>
{
if
(
ret
.
error
==
null
)
{
if
(
ret
.
error
==
null
)
{
this
.
xData
=
ret
.
result
this
.
xData
=
ret
.
result
;
const
myChart
=
echarts
.
init
(
this
.
$refs
.
charts
as
HTMLElement
)
const
myChart
=
echarts
.
init
(
this
.
$refs
.
charts
as
HTMLElement
);
myChart
.
setOption
({
myChart
.
setOption
({
tooltip
:
{
tooltip
:
{
trigger
:
'axis'
,
trigger
:
"axis"
,
},
},
xAxis
:
{
xAxis
:
{
type
:
'category'
,
type
:
"category"
,
axisLabel
:
{
axisLabel
:
{
textStyle
:
{
textStyle
:
{
color
:
'#7c88ad'
,
color
:
"#7c88ad"
,
},
},
},
},
axisTick
:
{
axisTick
:
{
...
@@ -70,18 +72,20 @@ export default VueTypedMixins(chartsMixin).extend({
...
@@ -70,18 +72,20 @@ export default VueTypedMixins(chartsMixin).extend({
},
},
data
:
times
data
:
times
?.
map
((
i
)
=>
{
?.
map
((
i
)
=>
{
return
moment
.
unix
(
i
).
format
(
'YYYY.MM.DD'
)
return
moment
.
unix
(
i
)
.
format
(
"YYYY.MM.DD"
);
})
})
.
reverse
(),
.
reverse
(),
},
},
yAxis
:
{
yAxis
:
{
type
:
'value'
,
type
:
"value"
,
axisLabel
:
{
axisLabel
:
{
formatter
:
(
item
:
number
)
=>
{
formatter
:
(
item
:
number
)
=>
{
return
nFormatter
(
item
)
return
nFormatter
(
item
);
},
},
textStyle
:
{
textStyle
:
{
color
:
'#7c88ad'
,
color
:
"#7c88ad"
,
},
},
},
},
},
},
...
@@ -89,31 +93,40 @@ export default VueTypedMixins(chartsMixin).extend({
...
@@ -89,31 +93,40 @@ export default VueTypedMixins(chartsMixin).extend({
{
{
data
:
this
.
xData
data
:
this
.
xData
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
.
map
((
i
:
any
)
=>
(
i
&&
i
[
0
]
&&
i
[
0
].
balance
)
||
0
)
.
map
(
(
i
:
any
)
=>
(
i
&&
i
[
0
]
&&
i
[
0
].
balance
)
||
0
)
.
map
((
i
)
=>
i
/
1
e8
)
.
map
((
i
)
=>
i
/
1
e8
)
.
reverse
(),
.
reverse
(),
type
:
'line'
,
type
:
"line"
,
areaStyle
:
{
areaStyle
:
{
normal
:
{
normal
:
{
// 颜色渐变函数 前四个参数分别表示四个位置依次为左、下、右、上
// 颜色渐变函数 前四个参数分别表示四个位置依次为左、下、右、上
color
:
new
echarts
.
graphic
.
LinearGradient
(
0
,
0
,
0
,
1
,
[
color
:
new
echarts
.
graphic
.
LinearGradient
(
0
,
0
,
0
,
1
,
[
{
{
offset
:
0
,
offset
:
0
,
color
:
'#2545CB'
,
// 0% 处的颜色
color
:
"#2545CB"
,
// 0% 处的颜色
},
},
{
{
offset
:
0.6
,
offset
:
0.6
,
color
:
'#9FAEE9'
,
// 40% 处的颜色
color
:
"#9FAEE9"
,
// 40% 处的颜色
},
},
{
{
offset
:
1
,
offset
:
1
,
color
:
'white'
,
// 100% 处的颜色
color
:
"white"
,
// 100% 处的颜色
},
},
]),
//背景渐变色
]
),
//背景渐变色
lineStyle
:
{
lineStyle
:
{
// 系列级个性化折线样式
// 系列级个性化折线样式
type
:
'solid'
,
type
:
"solid"
,
color
:
'#2545CB'
,
//折线的颜色
color
:
"#2545CB"
,
//折线的颜色
},
},
},
},
},
},
...
@@ -123,23 +136,23 @@ export default VueTypedMixins(chartsMixin).extend({
...
@@ -123,23 +136,23 @@ export default VueTypedMixins(chartsMixin).extend({
},
},
],
],
grid
:
this
.
grid
,
grid
:
this
.
grid
,
}
as
ECOption
)
}
as
ECOption
);
}
}
})
});
},
},
},
},
mounted
()
{
mounted
()
{
this
.
draw
()
this
.
draw
();
},
},
watch
:
{
watch
:
{
'$route.query.address'
()
{
"$route.query.address"
()
{
this
.
draw
()
this
.
draw
();
},
},
scale
()
{
scale
()
{
this
.
draw
()
this
.
draw
();
},
},
},
},
})
})
;
</
script
>
</
script
>
<
style
lang=
"scss"
scoped
>
<
style
lang=
"scss"
scoped
>
.charts
{
.charts
{
...
...
src/mixin/address.ts
View file @
a9627295
This diff is collapsed.
Click to expand it.
src/mixin/componentsMixin/AddressOverview.ts
View file @
a9627295
...
@@ -15,7 +15,9 @@ export default Vue.extend({
...
@@ -15,7 +15,9 @@ export default Vue.extend({
"$route.query.address"
()
{
"$route.query.address"
()
{
this
.
getAddrOverview
();
this
.
getAddrOverview
();
this
.
init
();
this
.
init
();
getAddressTxCount
(
this
.
$route
.
query
.
address
as
string
).
then
((
ret
)
=>
{
getAddressTxCount
(
(
this
.
$route
.
query
.
address
as
string
).
toLowerCase
()
).
then
((
ret
)
=>
{
if
(
ret
.
error
===
null
)
{
if
(
ret
.
error
===
null
)
{
this
.
txCount
=
ret
.
result
;
this
.
txCount
=
ret
.
result
;
}
}
...
@@ -25,7 +27,9 @@ export default Vue.extend({
...
@@ -25,7 +27,9 @@ export default Vue.extend({
mounted
()
{
mounted
()
{
this
.
getAddrOverview
();
this
.
getAddrOverview
();
this
.
init
();
this
.
init
();
getAddressTxCount
(
this
.
$route
.
query
.
address
as
string
).
then
((
ret
)
=>
{
getAddressTxCount
(
(
this
.
$route
.
query
.
address
as
string
).
toLowerCase
()
).
then
((
ret
)
=>
{
if
(
ret
.
error
===
null
)
{
if
(
ret
.
error
===
null
)
{
this
.
txCount
=
ret
.
result
;
this
.
txCount
=
ret
.
result
;
}
}
...
@@ -55,7 +59,9 @@ export default Vue.extend({
...
@@ -55,7 +59,9 @@ export default Vue.extend({
},
},
methods
:
{
methods
:
{
getAddrOverview
()
{
getAddrOverview
()
{
Rpc
.
getAddrOverview
(
this
.
$route
.
query
.
address
as
string
).
then
((
res
)
=>
{
Rpc
.
getAddrOverview
(
(
this
.
$route
.
query
.
address
as
string
).
toLowerCase
()
).
then
((
res
)
=>
{
if
(
res
.
error
===
null
)
{
if
(
res
.
error
===
null
)
{
const
balance
=
res
.
result
.
balance
;
const
balance
=
res
.
result
.
balance
;
const
receiver
=
res
.
result
.
reciver
;
const
receiver
=
res
.
result
.
reciver
;
...
@@ -76,7 +82,7 @@ export default Vue.extend({
...
@@ -76,7 +82,7 @@ export default Vue.extend({
init
()
{
init
()
{
QRCode
.
toCanvas
(
QRCode
.
toCanvas
(
document
.
getElementById
(
"qrcode"
),
document
.
getElementById
(
"qrcode"
),
this
.
$route
.
query
.
address
as
string
,
(
this
.
$route
.
query
.
address
as
string
).
toLowerCase
()
,
{
{
color
:
{
color
:
{
dark
:
"#1F3470"
,
dark
:
"#1F3470"
,
...
@@ -85,7 +91,7 @@ export default Vue.extend({
...
@@ -85,7 +91,7 @@ export default Vue.extend({
width
:
130
,
width
:
130
,
margin
:
0
,
margin
:
0
,
},
},
function
(
error
)
{
function
(
error
)
{
if
(
error
)
console
.
error
(
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