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
7bb75be5
Commit
7bb75be5
authored
Sep 26, 2021
by
xhx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
购买状态判断
parent
77d898da
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
7 deletions
+20
-7
App.vue
src/App.vue
+1
-0
const.ts
src/constance/const.ts
+2
-0
index.ts
src/store/global/index.ts
+5
-1
index.vue
src/views/Details/index.vue
+5
-5
InfoCard.vue
src/views/Home/InfoCard.vue
+7
-1
No files found.
src/App.vue
View file @
7bb75be5
...
...
@@ -25,6 +25,7 @@ export default Vue.extend({
const
response
=
await
service
.
getTicketAddress
(
addr
)
const
walletRes
=
await
service
.
getWalletAddress
(
addr
)
const
_result
=
response
.
data
.
result
?.
data
Toast
.
clear
()
if
(
walletRes
.
data
.
result
?.
datas
)
{
Toast
({
message
:
'该账户不具备进入条件,将于3秒后退出'
,
...
...
src/constance/const.ts
View file @
7bb75be5
// export const TICKET_COUNT = 10000
export
const
TICKET_COUNT
=
process
.
env
.
NODE_ENV
!==
'production'
?
10000
:
3000
export
const
INCOME
=
100
src/store/global/index.ts
View file @
7bb75be5
const
stateData
=
{
showModal
:
true
,
showModal
:
true
,
inputBalance
:
0
}
export
type
AppType
=
typeof
stateData
export
const
global
=
{
...
...
@@ -12,6 +13,9 @@ export const global = {
SET_SHOWMODAL
(
state
:
AppType
,
s
:
boolean
)
{
state
.
showModal
=
s
},
SET_BALANCE
(
state
:
AppType
,
c
:
number
)
{
state
.
inputBalance
=
c
}
},
actions
:
{
...
...
src/views/Details/index.vue
View file @
7bb75be5
...
...
@@ -35,6 +35,7 @@ export default Vue.extend({
info
:
{}
as
any
,
fee
:
0
,
profit
:
0
,
ticket
:
0
,
isBind
:
false
,
// 是否初次委托
ticketNum
:
TICKET_COUNT
,
// 每票BTY
min
:
undefined
as
any
...
...
@@ -51,6 +52,9 @@ export default Vue.extend({
service
.
getBalance
(
this
.
$store
.
state
.
app
.
address
,
'coins'
).
then
((
res
:
any
)
=>
{
this
.
profit
=
Math
.
floor
((
res
.
data
.
result
as
any
)[
0
].
balance
/
1
e8
)
})
service
.
getBalance
(
this
.
$store
.
state
.
app
.
address
,
'ticket'
).
then
((
res
:
any
)
=>
{
this
.
ticket
=
Math
.
floor
((
res
.
data
.
result
as
any
)[
0
].
balance
/
1
e8
)
})
},
getInfo
()
{
poolInfo
(
this
.
$route
.
query
.
id
as
string
).
then
((
res
:
any
)
=>
{
...
...
@@ -66,15 +70,11 @@ export default Vue.extend({
})
})
},
// checkBind() {
// },
signGroup
(
txs
:
Array
<
string
>
){
return
signTxGroup
(
txs
.
join
(),
'none'
,
-
1
);
},
async
buy
(
value
:
string
)
{
if
(
this
.
profit
/
this
.
ticketNum
<
+
this
.
info
.
minTicket
)
{
// if (this.profit/this.ticketNum
<
1
)
{
Toast
(
`您的票数余额为
${
Math
.
floor
(
this
.
profit
/
this
.
ticketNum
)}
票,不足
${
this
.
info
.
minTicket
}
票`
)
return
}
...
...
@@ -117,6 +117,7 @@ export default Vue.extend({
if
(
isBind
)
return
bindPool
(
this
.
info
.
id
,
value
,
isBind
).
then
(
async
(
r
:
any
)
=>
{
if
(
r
.
data
.
data
.
isSucc
)
{
this
.
$store
.
commit
(
'global/SET_BALANCE'
,
this
.
ticketNum
*
Number
(
value
)
+
this
.
ticket
)
this
.
$toast
(
'购买成功'
)
}
}).
catch
(
e
=>
{
...
...
@@ -128,7 +129,6 @@ export default Vue.extend({
}
},
created
()
{
console
.
log
(
this
.
ticketNum
)
this
.
getFee
()
this
.
getInfo
()
}
...
...
src/views/Home/InfoCard.vue
View file @
7bb75be5
...
...
@@ -44,6 +44,7 @@ export default Vue.extend({
// }
},
methods
:
{
// freezon 前重复请求
waitToPool
()
{
if
(
this
.
timer
)
clearInterval
(
this
.
timer
)
this
.
timer
=
setInterval
(()
=>
{
...
...
@@ -54,12 +55,17 @@ export default Vue.extend({
service
.
getBalance
(
this
.
$store
.
state
.
app
.
address
,
'ticket'
).
then
((
res
:
any
)
=>
{
this
.
profit
=
Math
.
floor
((
res
.
data
.
result
as
any
)[
0
].
balance
/
1
e8
)
this
.
ticketNum
=
Math
.
floor
((
res
.
data
.
result
as
any
)[
0
].
frozen
/
1
e8
/
TICKET_COUNT
)
if
(
this
.
profit
>
3000
)
{
console
.
log
(
this
.
$store
.
state
.
global
.
inputBalance
,
'income'
)
console
.
log
(
this
.
profit
,
'profit'
)
// 等待 freezon
if
(
this
.
$store
.
state
.
global
.
inputBalance
<=
this
.
profit
)
{
this
.
btnClick
=
true
this
.
btnText
=
'等待挖矿'
this
.
waitToPool
()
}
else
{
if
(
this
.
timer
)
clearInterval
(
this
.
timer
)
// 普通状态 重置 inputBalance
this
.
$store
.
commit
(
'global/SET_BALANCE'
,
0
)
this
.
btnText
=
'领取收益'
this
.
btnClick
=
false
}
...
...
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