Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
Community-Mining-Client
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
Mining
Community-Mining-Client
Commits
41e1d16c
Commit
41e1d16c
authored
Dec 09, 2021
by
xhx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:导入
parent
77738ecb
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
162 additions
and
48 deletions
+162
-48
InputPasswordDialog.vue
src/components/InputPasswordDialog.vue
+3
-2
LockStatusDialog.vue
src/components/LockStatusDialog.vue
+16
-17
WalletStatus.vue
src/components/WalletStatus.vue
+20
-20
index.vue
src/views/NodePage/Details/index.vue
+122
-8
index.vue
src/views/NodePage/List/index.vue
+1
-1
No files found.
src/components/InputPasswordDialog.vue
View file @
41e1d16c
...
@@ -13,11 +13,12 @@
...
@@ -13,11 +13,12 @@
import
Vue
from
'vue'
;
import
Vue
from
'vue'
;
import
Component
from
'vue-class-component'
;
import
Component
from
'vue-class-component'
;
import
{
Prop
,
PropSync
}
from
'vue-property-decorator'
;
import
{
Prop
,
PropSync
}
from
'vue-property-decorator'
;
import
{
Dialog
}
from
'vant'
;
import
{
Dialog
,
Field
}
from
'vant'
;
@
Component
({
@
Component
({
components
:
{
components
:
{
[
Dialog
.
Component
.
name
]:
Dialog
.
Component
[
Dialog
.
Component
.
name
]:
Dialog
.
Component
,
'van-field'
:
Field
}
}
})
})
export
default
class
InputPasswordDialog
extends
Vue
{
export
default
class
InputPasswordDialog
extends
Vue
{
...
...
src/components/LockStatusDialog.vue
View file @
41e1d16c
...
@@ -43,16 +43,6 @@
...
@@ -43,16 +43,6 @@
/>
/>
</van-radio>
</van-radio>
</van-cell>
</van-cell>
<!--
<van-cell
class=
"lockstatus_item"
title=
"全锁定"
label=
"不可转账,不可挖矿"
clickable
@
click=
"radio = '3'"
>
<img
slot=
"icon"
src=
"@/assets/all_lock@2x.png"
alt=
""
>
<van-radio
name=
"3"
slot=
"right-icon"
>
<img
class=
"radio_icon"
slot=
"icon"
slot-scope=
"props"
:src=
"props.checked ? activeIcon : inactiveIcon "
/>
</van-radio>
</van-cell>
-->
</van-cell-group>
</van-cell-group>
</van-radio-group>
</van-radio-group>
</van-dialog>
</van-dialog>
...
@@ -60,7 +50,7 @@
...
@@ -60,7 +50,7 @@
<
script
lang=
'ts'
>
<
script
lang=
'ts'
>
import
Vue
from
'vue'
;
import
Vue
from
'vue'
;
import
Component
from
'vue-class-component'
;
import
Component
from
'vue-class-component'
;
import
{
Dialog
}
from
'vant'
;
import
{
Dialog
,
RadioGroup
,
Radio
,
CellGroup
,
Cell
}
from
'vant'
;
import
{
Prop
,
PropSync
}
from
'vue-property-decorator'
;
import
{
Prop
,
PropSync
}
from
'vue-property-decorator'
;
// import getNodeStatus from '../mixins/getNodeStatus';
// import getNodeStatus from '../mixins/getNodeStatus';
let
activeIcon
=
require
(
'@/assets/image/activeIcon@2x.png'
);
let
activeIcon
=
require
(
'@/assets/image/activeIcon@2x.png'
);
...
@@ -68,7 +58,11 @@ let inactiveIcon = require('@/assets/image/inactiveIcon@2x.png');
...
@@ -68,7 +58,11 @@ let inactiveIcon = require('@/assets/image/inactiveIcon@2x.png');
@
Component
({
@
Component
({
components
:
{
components
:
{
[
Dialog
.
Component
.
name
]:
Dialog
.
Component
[
Dialog
.
Component
.
name
]:
Dialog
.
Component
,
'van-radio-group'
:
RadioGroup
,
'van-cell-group'
:
CellGroup
,
'van-cell'
:
Cell
,
'van-radio'
:
Radio
}
}
})
})
export
default
class
LockStatusDialog
extends
Vue
{
export
default
class
LockStatusDialog
extends
Vue
{
...
@@ -103,10 +97,10 @@ export default class LockStatusDialog extends Vue {
...
@@ -103,10 +97,10 @@ export default class LockStatusDialog extends Vue {
</
script
>
</
script
>
<
style
scoped
>
<
style
scoped
>
.van-radio
{
.van-radio
{
height
:
0.68rem
;
/* height: 0.68rem; */
}
}
</
style
>
</
style
>
<
style
lang=
"scss"
scoped
>
<
style
lang=
"scss"
scoped
>
.lockstatus_item
{
.lockstatus_item
{
align-items
:
center
;
align-items
:
center
;
.van-cell__title
{
.van-cell__title
{
...
@@ -114,12 +108,16 @@ export default class LockStatusDialog extends Vue {
...
@@ -114,12 +108,16 @@ export default class LockStatusDialog extends Vue {
text-align
:
left
;
text-align
:
left
;
}
}
img
{
img
{
width
:
0
.54rem
;
width
:
20px
;
height
:
0
.4rem
;
height
:
16px
;
margin-right
:
6px
;
}
}
img
.radio_icon
{
img
.radio_icon
{
width
:
0
.48rem
;
width
:
10px
;
height
:
auto
;
height
:
auto
;
}
}
}
}
/
deep
/
.van-nav-bar
{
color
:
#000
}
</
style
>
</
style
>
\ No newline at end of file
src/components/WalletStatus.vue
View file @
41e1d16c
...
@@ -6,15 +6,15 @@
...
@@ -6,15 +6,15 @@
</li>
</li>
<!-- showLockStatusDialog -->
<!-- showLockStatusDialog -->
<li
@
click=
"lockStatusHandler"
>
<li
@
click=
"lockStatusHandler"
>
<div
v-if=
"!walletStatus.isWalletLock"
>
<div
v-if=
"!walletStatus.isWalletLock"
class=
"block"
>
<img
:src=
"require(`@/assets/image/full_unlock$
{isIcon?'_icon':'_button'}@2x.png`)" alt />
<img
:src=
"require(`@/assets/image/full_unlock$
{isIcon?'_icon':'_button'}@2x.png`)" alt />
<div
class=
"desc active"
>
全解锁
</div>
<div
class=
"desc active"
>
全解锁
</div>
</div>
</div>
<div
v-else-if=
"walletStatus.isWalletLock && walletStatus.isTicketLock"
>
<div
v-else-if=
"walletStatus.isWalletLock && walletStatus.isTicketLock"
class=
"block"
>
<img
:src=
"require(`@/assets/image/all_lock$
{isIcon?'_icon':'_button'}@2x.png`)" alt />
<img
:src=
"require(`@/assets/image/all_lock$
{isIcon?'_icon':'_button'}@2x.png`)" alt />
<div
class=
"desc"
>
全锁定
</div>
<div
class=
"desc"
>
全锁定
</div>
</div>
</div>
<div
v-else
>
<div
v-else
class=
"block"
>
<img
:src=
"require(`@/assets/image/mine_unlock$
{isIcon?'_icon':'_button'}@2x.png`)" alt />
<img
:src=
"require(`@/assets/image/mine_unlock$
{isIcon?'_icon':'_button'}@2x.png`)" alt />
<div
class=
"desc active"
>
挖矿解锁
</div>
<div
class=
"desc active"
>
挖矿解锁
</div>
</div>
</div>
...
@@ -29,10 +29,7 @@
...
@@ -29,10 +29,7 @@
<div
class=
"desc"
:class=
"[blockSync?'active':'']"
>
<div
class=
"desc"
:class=
"[blockSync?'active':'']"
>
<!-- blockanmation -->
<!-- blockanmation -->
<div>
区块同步
</div>
<div>
区块同步
</div>
<!--
<div
v-if=
"!blockSync"
>
<div
v-if=
"!isIcon"
class=
"block-height"
:class=
"[blockSync?'active':'']"
>
{{
`(${peerHeight
}
)`
}}
<
/div
>
{{
`(${peerHeight
}
)`
}}
<
/div> --
>
<!--
{{
`(${Math.floor(peerHeight/allHeight * 100)
}
/100)`
}}
<
/div> --
>
<
/div
>
<
/div
>
<
/li
>
<
/li
>
<!--
autoMiningHandler
-->
<!--
autoMiningHandler
-->
...
@@ -41,7 +38,7 @@
...
@@ -41,7 +38,7 @@
<
img
:
src
=
"require(`@/assets/image/ticket${isButton
}
_normal@2x.png`)"
v
-
else
alt
/>
<
img
:
src
=
"require(`@/assets/image/ticket${isButton
}
_normal@2x.png`)"
v
-
else
alt
/>
<
div
class
=
"desc"
:
class
=
"[(walletStatus && !walletStatus.isAutoMining)?'':'active']"
>
自动购票
<
/div
>
<
div
class
=
"desc"
:
class
=
"[(walletStatus && !walletStatus.isAutoMining)?'':'active']"
>
自动购票
<
/div
>
<
/li
>
<
/li
>
<
div
v
-
if
=
"!isIcon"
class
=
"block-height"
:
class
=
"[blockSync?'active':'']"
>
{{
`(${peerHeight
}
)`
}}
<
/div
>
<
!--
<
div
v
-
if
=
"!isIcon"
class
=
"block-height"
:
class
=
"[blockSync?'active':'']"
>
{{
`(${peerHeight
}
)`
}}
<
/div> --
>
<
/ul
>
<
/ul
>
<
/template
>
<
/template
>
<
script
lang
=
"ts"
>
<
script
lang
=
"ts"
>
...
@@ -106,17 +103,9 @@ export default Vue.extend({
...
@@ -106,17 +103,9 @@ export default Vue.extend({
}
}
ul
.
wallet
-
status
-
component
{
ul
.
wallet
-
status
-
component
{
display
:
flex
;
display
:
flex
;
display
:
grid
;
align
-
items
:
flex
-
start
;
grid
-
template
-
columns
:
repeat
(
5
,
1
fr
);
justify
-
content
:
center
;
place
-
content
:
space
-
between
;
padding
:
6
px
0
;
padding
:
6
px
0
;
// justify-content: space-between;
.
block
-
height
{
grid
-
column
:
3
/
span
3
;
&
.
active
{
color
:
rgba
(
230
,
88
,
132
,
0.7
);
}
}
.
action
{
.
action
{
width
:
100
%
;
width
:
100
%
;
height
:
auto
;
height
:
auto
;
...
@@ -126,16 +115,27 @@ ul.wallet-status-component{
...
@@ -126,16 +115,27 @@ ul.wallet-status-component{
animation
:
hue
3
s
linear
infinite
;
animation
:
hue
3
s
linear
infinite
;
}
}
li
{
li
{
flex
:
1
;
display
:
flex
;
flex
-
direction
:
column
;
flex
-
direction
:
column
;
justify
-
content
:
center
;
justify
-
content
:
center
;
align
-
items
:
center
;
text
-
align
:
center
;
text
-
align
:
center
;
overflow
:
hidden
;
overflow
:
hidden
;
div
.
block
{
display
:
flex
;
flex
-
direction
:
column
;
align
-
items
:
center
;
justify
-
content
:
center
;
}
img
{
img
{
width
:
14
px
;
width
:
50
%
;
height
:
auto
;
height
:
auto
;
}
}
div
.
desc
{
div
.
desc
{
font
-
size
:
14
px
;
margin
-
top
:
6
px
;
font
-
size
:
12
px
;
text
-
align
:
center
;
&
.
active
{
&
.
active
{
color
:
rgba
(
230
,
88
,
132
,
0.7
);
color
:
rgba
(
230
,
88
,
132
,
0.7
);
}
}
...
...
src/views/NodePage/Details/index.vue
View file @
41e1d16c
...
@@ -32,8 +32,10 @@
...
@@ -32,8 +32,10 @@
import
Vue
from
'vue'
import
Vue
from
'vue'
import
LockStatusDialog
from
'@/components/LockStatusDialog.vue'
;
import
LockStatusDialog
from
'@/components/LockStatusDialog.vue'
;
import
InputPasswordDialog
from
'@/components/InputPasswordDialog.vue'
;
import
InputPasswordDialog
from
'@/components/InputPasswordDialog.vue'
;
import
MinerTips
from
'@/components/MinerTips.vue'
;
import
WalletStatus
from
'@/components/WalletStatus.vue'
;
import
WalletStatus
from
'@/components/WalletStatus.vue'
;
import
{
getNodeStatus
}
from
'@/utils/getDeviceInfo'
;
import
{
rpc
}
from
'@/service/rpc'
;
import
{
Toast
}
from
'vant'
;
export
default
Vue
.
extend
({
export
default
Vue
.
extend
({
components
:
{
components
:
{
...
@@ -44,25 +46,137 @@ export default Vue.extend({
...
@@ -44,25 +46,137 @@ export default Vue.extend({
data
()
{
data
()
{
return
{
return
{
walletStatus
:
{
}
as
any
,
walletStatus
:
{
}
as
any
,
blockSync
:
{
}
as
any
,
// blockSync: false
,
peerHeight
:
undefined
as
undefined
|
number
,
//
peerHeight: undefined as undefined|number,
allHeight
:
undefined
as
undefined
|
number
,
//
allHeight: undefined as undefined|number,
passwordDialogShow
:
false
,
passwordDialogShow
:
false
,
errMsg
:
{
}
as
any
,
errMsg
:
''
,
lockStatusDialogShow
:
false
,
lockStatusDialogShow
:
false
,
showAction
:
false
,
showAction
:
false
,
isSync
:
false
,
ticketCount
:
undefined
as
undefined
|
number
,
peersInfo
:
{
}
as
any
,
accounts
:
{
}
as
any
,
password
:
''
,
userSelectedStatus
:
''
,
timer
:
0
}
}
,
computed
:
{
ip
():
string
{
console
.
log
(
this
.
$route
.
params
.
ip
)
return
this
.
$route
.
params
.
ip
||
''
}
,
url
():
string
{
return
this
.
ip
?
`http://${this.ip
}
:8801`
:
''
;
}
,
peerInfo
():
any
{
return
(
(
this
.
peersInfo
&&
this
.
peersInfo
.
peers
&&
this
.
peersInfo
.
peers
.
find
((
peer
:
any
)
=>
{
return
peer
.
self
;
}
))
||
{
}
);
}
,
peerHeight
():
number
{
return
(
this
.
peerInfo
.
header
&&
this
.
peerInfo
.
header
.
height
)
||
0
;
}
,
allHeight
():
number
{
return
(
(
this
.
peersInfo
.
peers
&&
this
.
peersInfo
.
peers
.
reduce
(
(
acc
:
number
,
cur
:
any
)
=>
Math
.
max
(
acc
,
cur
.
header
.
height
),
0
))
||
0
);
}
,
blockSync
():
boolean
{
return
this
.
peerHeight
===
this
.
allHeight
;
}
,
paiWalletInfo
():
any
{
return
(
this
.
accounts
&&
this
.
accounts
.
wallets
&&
this
.
accounts
.
wallets
.
find
((
wallet
:
any
)
=>
{
return
wallet
.
label
===
'YUAN-miner节点'
}
)
||
{
}
)
}
,
walletLabel
():
string
{
return
this
.
paiWalletInfo
.
label
||
''
}
}
,
created
()
{
this
.
init
()
this
.
timer
=
setInterval
(()
=>
{
let
{
getTicketCount
,
getPeerInfo
}
=
rpc
;
const
{
url
}
=
this
;
let
promise
=
[
getTicketCount
.
call
(
rpc
,
url
),
getPeerInfo
.
call
(
rpc
,
url
)]
Promise
.
all
(
promise
).
then
(([
ticketCount
,
peersInfo
])
=>
{
this
.
ticketCount
=
ticketCount
;
this
.
peersInfo
=
peersInfo
;
}
)
}
,
2000
);
}
,
beforeDestroy
()
{
if
(
this
.
timer
)
{
clearInterval
(
this
.
timer
)
}
}
}
,
}
,
methods
:
{
methods
:
{
async
init
()
{
async
init
()
{
const
{
walletStatus
,
isSync
,
ticketCount
,
peersInfo
,
accounts
}
=
await
getNodeStatus
({
ip
:
this
.
ip
}
);
const
{
walletStatus
,
isSync
,
ticketCount
,
peersInfo
,
accounts
}
=
await
this
.
getNodeStatus
({
ip
:
this
.
ip
}
);
this
.
walletStatus
=
walletStatus
;
this
.
walletStatus
=
walletStatus
;
this
.
isSync
=
isSync
;
this
.
isSync
=
isSync
;
this
.
ticketCount
=
ticketCount
;
this
.
ticketCount
=
ticketCount
;
this
.
peersInfo
=
peersInfo
;
this
.
peersInfo
=
peersInfo
;
this
.
accounts
=
accounts
;
this
.
accounts
=
accounts
;
}
,
reCheckLockStatusHandler
()
{
this
.
passwordDialogShow
=
false
this
.
lockStatusDialogShow
=
true
}
,
async
confirmPasswordHandler
(
password
:
string
)
{
this
.
errMsg
=
''
;
this
.
password
=
password
;
if
(
this
.
password
===
''
)
{
this
.
errMsg
=
'请输入密码'
;
return
;
}
try
{
let
flag
=
true
;
// true : 解锁购票 ;false : 解锁整个钱包
if
(
this
.
userSelectedStatus
===
'1'
)
{
flag
=
false
;
}
const
{
msg
}
=
await
rpc
.
unlock
(
this
.
password
,
flag
,
0
,
this
.
url
);
if
(
msg
)
{
if
(
[
'ErrVerifyOldpasswdFail'
,
'ErrInputPassword'
].
includes
(
msg
)
)
{
this
.
errMsg
=
'请输入正确的密码'
;
return
;
}
else
{
throw
msg
;
}
}
await
rpc
.
lock
(
this
.
url
);
await
rpc
.
unlock
(
this
.
password
,
flag
,
0
,
this
.
url
);
}
catch
(
err
:
any
)
{
Toast
(
err
.
message
||
err
);
}
finally
{
this
.
init
();
}
}
,
showPasswordDialogHandler
(
status
:
string
)
{
console
.
log
(
'userSelected status:'
,
status
)
this
.
userSelectedStatus
=
status
this
.
passwordDialogShow
=
true
this
.
lockStatusDialogShow
=
false
// this.hideLockStatusDialog();
// this.showPasswordDialog();
}
}
}
}
}
)
}
)
...
...
src/views/NodePage/List/index.vue
View file @
41e1d16c
...
@@ -84,7 +84,7 @@ export default Vue.extend({
...
@@ -84,7 +84,7 @@ export default Vue.extend({
return
{
return
{
pageShow
:
false
,
pageShow
:
false
,
wifiName
:
''
,
wifiName
:
''
,
devices
:
[
{}
]
as
Array
<
any
>
,
devices
:
[]
as
Array
<
any
>
,
isfeedback
:
false
,
isfeedback
:
false
,
btyAddress
:
''
btyAddress
:
''
}
}
...
...
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