Skip to content

Commit

Permalink
Merge pull request #9 from boscore/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
icelanDesert authored Jun 14, 2019
2 parents 28bc8cd + 5ee2d04 commit 5c135c9
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 9 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"dependencies": {
"axios": "^0.18.0",
"echarts": "^4.2.1",
"element-ui": "^2.4.5",
"element-ui": "^2.9.1",
"eosjs": "^16.0.9",
"http2": "^3.3.7",
"marked": "^0.6.2",
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/element.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
Main,
Menu,
MenuItem,
Pagination,
Progress,
Option,
Radio,
Expand Down Expand Up @@ -50,6 +51,7 @@ Vue.use(DropdownMenu)
Vue.use(DropdownItem)

Vue.use(Progress)
Vue.use(Pagination)

Vue.use(Menu)
Vue.use(MenuItem)
Expand Down
60 changes: 55 additions & 5 deletions src/views/PollDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
<br v-if="!$store.state.isPC"/>
<!-- <span style="margin: 0 5px">{{$util.dateConvert(proposal.proposal.expires_at)}} </span> -->
<span >{{proposal.proposal.proposal_json.type || 'unknown'}} </span>
<br v-if="!$store.state.isPC"/>
<span style="font-weight:600">Budget: {{incentives}}</span>
</p>
<div v-if="$store.state.isPC" style="margin-bottom:30px">
<div
Expand Down Expand Up @@ -162,7 +164,10 @@
</div>
<hr style="border: none; border-bottom:2px solid #D8D8D8;" />
<div>
<h3 v-if="(this.proposal.meet_conditions_days > 0)">Meet the conditions {{this.proposal.meet_conditions_days}} {{this.proposal.meet_conditions_days > 1 ? 'days' : 'day'}}</h3>
<div v-if="(this.proposal.meet_conditions_days > 0)">
<h3> {{this.proposal.meet_conditions_days}} {{this.proposal.meet_conditions_days > 1 ? 'days' : 'day'}} satisfied</h3>
<el-progress :format="satisfiedText" :stroke-width="10" class="pass-percent" :percentage="satisfiedPercent"></el-progress>
</div>
<p>{{this.proposal ? this.proposal.stats.votes.accounts : 0}} accounts</p>
<p>{{this.proposal ? this.calcDays(this.proposal.proposal.created_at, new Date().toString()) : 0}} days since poll started</p>
</div>
Expand Down Expand Up @@ -410,6 +415,30 @@ export default {
})
return comm
},
incentives () {
if (this.proposal) {
if (this.proposal.proposal.proposal_json.incentives !== undefined) {
let incentives = Number(this.proposal.proposal.proposal_json.incentives)
let integer = Number(incentives.toFixed(0))
let decimals = String(incentives * 10000 % 10000)
while (decimals.length < 4) {
decimals = '0' + decimals
}
return this.$util.toThousands(integer) + '.' + decimals + ' BOS'
} else {
if (this.budgetList[this.proposal.proposal.proposal_name] !== undefined) {
let incentives = Number(this.budgetList[this.proposalName])
let integer = Number(incentives.toFixed(0))
let decimals = String(incentives * 10000 % 10000)
while (decimals.length < 4) {
decimals = '0' + decimals
}
return this.$util.toThousands(integer) + '.' + decimals + ' BOS'
}
}
}
return 'Not declare'
},
otherComm () {
let comm = []
this.votes.forEach(vote => {
Expand Down Expand Up @@ -481,8 +510,15 @@ export default {
return 'no content'
}
},
abstainPercent () {
return Number((100 - this.agreePercent - this.rejectPercent).toFixed(1))
satisfiedPercent () {
if (this.proposal) {
if (this.proposal.meet_conditions_days > 20) {
return 100
}
return Number((100 * this.proposal.meet_conditions_days / 20).toFixed(1))
} else {
return 0
}
},
agreePercent () {
if (!this.proposal || this.proposal.stats.staked.total === 0 || !this.proposal.stats.staked[1]) {
Expand Down Expand Up @@ -583,7 +619,18 @@ export default {
propLoading: true,
writeComment: false,
showVotersNum: 30,
screenWidth: document.body.clientWidth
screenWidth: document.body.clientWidth,
budgetList: {
'historyindex': '250000.0000',
'eosiosg11111': '1000000.0000',
'bosnationwps': '515000.0000',
'constantstab': '350000.0000',
'hyperion.api': '995600.0000',
'chintaionbos': '1000000.0000',
'omegaautodex': '450000.0000',
'btconbos': '400000.0000',
'universal': '800000.0000'
}
}
},
created () {
Expand Down Expand Up @@ -820,6 +867,9 @@ export default {
if (this.showVotersNum > this.votes.length) {
this.showVotersNum = this.votes.length
}
},
satisfiedText (percentage) {
return `${this.proposal.meet_conditions_days}/20`
}
},
watch: {
Expand Down Expand Up @@ -860,7 +910,7 @@ export default {
color #F46666
.el-progress-bar__inner
background-image linear-gradient(269deg, #F06262 0%, #FF7171 100%)
.abstain-percent
.satisfied-percent
.el-progress__text
color #F4D03F
.el-progress-bar__inner
Expand Down
10 changes: 10 additions & 0 deletions src/views/Referendum.vue
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@
</el-select>
</div>
</div>
<p v-if="propList.length === 0">No relevant proposals</p>
<div class="prop-list" v-loading="!proposals">
<div
style="cursor: pointer"
Expand All @@ -188,6 +189,7 @@
@click="turnDetail(prop)"
>
<PropCard
v-if="index >= ((currentPage - 1) * 12) && index < currentPage * 12"
:type="prop.proposal.proposal_json.type || 'unknown'"
:title="prop.proposal.title"
:desc="prop.proposal.proposal_json.content || ''"
Expand All @@ -197,6 +199,13 @@
class="prop-card"></PropCard>
</div>
</div>
<el-pagination
background
layout="prev, pager, next"
:page-count="Math.ceil(propList.length / 12)"
:current-page.sync = "currentPage"
>
</el-pagination>
</el-main>
</el-container>
</div>
Expand All @@ -218,6 +227,7 @@ export default {
return {
actionLoading: false,
activeTab: 'proposals',
currentPage: 1,
extendTime: null,
extendPropName: '',
extendVisible: false,
Expand Down

1 comment on commit 5c135c9

@vercel
Copy link

@vercel vercel bot commented on 5c135c9 Jun 14, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.