113
113
</q-item >
114
114
<q-separator color =" vseparator" />
115
115
<q-item >
116
- <q-item-section disabled >
117
- <q-item-label >Uptime:</q-item-label >
118
- </q-item-section >
119
- <q-item-section avatar disabled >
120
- <q-item-label >{{ identity.uptime }} days</q-item-label >
116
+ <q-item-section >
117
+ <div align =" center" class =" text-subtitle2 text-vgreen text-uppercase" >
118
+ <div content-style =" font-size: 12px" > daily reward countdown </div >
119
+ <div content-style =" font-size: 24px" class =" text-weight-bolder" >
120
+ {{ daily_reward_calculation_countdown.hours }} : {{daily_reward_calculation_countdown.minutes}} : {{daily_reward_calculation_countdown.seconds}}
121
+ </div >
122
+ </div >
121
123
</q-item-section >
122
124
</q-item >
123
125
<q-separator color =" vseparator" />
165
167
<q-separator color =" vseparator" v-if =" parseFloat(status.cpu) == 0" />
166
168
<q-item align =" center" >
167
169
<q-item-section >
170
+ <div align =" center" class =" text-subtitle2 text-uppercase" >
171
+ <div content-style =" font-size: 12px" > available for retrieval </div >
172
+ <div content-style =" font-size: 24px" class =" text-weight-bolder" >
173
+ {{identity.availble_for_retrieval}}
174
+ </div >
175
+ </div >
168
176
<q-btn label =" Retreive reward" outline rounded color =" vgreen" class =" q-my-xs" @click =" retreiveReward()" />
169
177
</q-item-section >
170
178
</q-item >
@@ -605,7 +613,13 @@ export default {
605
613
sortBy: ' rank' ,
606
614
descending: false
607
615
},
608
- script: ' '
616
+ script: ' ' ,
617
+ now: ' ' ,
618
+ daily_reward_calculation_countdown: {
619
+ hours: ' ' ,
620
+ minutes: ' ' ,
621
+ seconds: ' '
622
+ }
609
623
}
610
624
},
611
625
computed: {
@@ -623,14 +637,21 @@ export default {
623
637
},
624
638
registered_nodes : function () {
625
639
return this .$store .getters .getRegisteredNodes
640
+ },
641
+ daily_reward_next_calculation : function () {
642
+ return this .$store .getters .getDailyRewardNextCalculation
626
643
}
627
644
},
628
645
mounted () {
646
+ // to load countdown faster call getRewardHistoryData firstly
647
+ this .$configManager .getRewardHistoryData ()
648
+ this .$configManager .getAvailbleForRetrieval (this .identity .accountName )
649
+ this .int1 = setInterval (() => this .updateNow (), 1000 )
650
+ this .int2 = setInterval (() => this .updateDailyRewardCountdown (), 1000 )
651
+ this .int3 = setInterval (() => this .$configManager .getAvailbleForRetrieval (this .identity .accountName ), 15000 )
629
652
this .version = this .$utils .getVersion ()
630
- this .$configManager .accountAdded (this .identity .accountName )
631
653
this .$configManager .accountRegistered (this .identity .accountName )
632
654
this .$configManager .accountRun (this .identity .accountName )
633
- this .$configManager .getUserUptime (this .identity .accountName )
634
655
// TODO: not implemented yet
635
656
this .$store .commit (' setEarned' , ' 0.0000' )
636
657
this .$store .state .status .time = this .$utils .getTime ()
@@ -665,8 +686,30 @@ export default {
665
686
// clearInterval(this.m4)
666
687
clearInterval (this .m5 )
667
688
clearInterval (this .m6 )
689
+ clearInterval (this .m7 )
690
+ clearInterval (this .int1 )
691
+ clearInterval (this .int2 )
692
+ clearInterval (this .int3 )
668
693
},
669
694
methods: {
695
+ updateNow () {
696
+ this .now = Math .round (new Date ().getTime () / 1000 )
697
+ },
698
+ updateDailyRewardCountdown () {
699
+ let timeDelta = this .daily_reward_next_calculation > this .now ? this .daily_reward_next_calculation - this .now : 0
700
+ let hours = Math .floor (timeDelta / (60 * 60 ))
701
+ let minutes = Math .floor ((timeDelta - hours * 60 * 60 ) / 60 )
702
+ let seconds = timeDelta - hours * 60 * 60 - minutes * 60
703
+
704
+ function timeUnitToStr (unit ) {
705
+ return unit < 10 ? ' 0' + unit : unit .toString ()
706
+ }
707
+ this .daily_reward_calculation_countdown = {
708
+ hours: timeUnitToStr (hours),
709
+ minutes: timeUnitToStr (minutes),
710
+ seconds: timeUnitToStr (seconds)
711
+ }
712
+ },
670
713
getInstallScript () {
671
714
this .script = require (' ../assets/install.sh' ).default // eslint-disable-line global-require
672
715
},
@@ -695,6 +738,7 @@ export default {
695
738
this .voting_list = []
696
739
this .getInfoRare ()
697
740
this .getInfoOften ()
741
+ this .$configManager .getRewardHistoryData ()
698
742
},
699
743
getInfoRare () {
700
744
this .getListOfNodes ()
@@ -759,7 +803,6 @@ export default {
759
803
.retreiveReward (this .identity .accountName )
760
804
.then (() => {
761
805
setTimeout (() => this .getInfoOften (), 3000 )
762
- setTimeout (() => this .$configManager .getUserUptime (this .identity .accountName ), 3000 )
763
806
})
764
807
.catch (error => {
765
808
throw new Error (error)
0 commit comments