From 4563a8d69078106d8b4905a718fea0d7f2eb2394 Mon Sep 17 00:00:00 2001 From: Zhou Date: Fri, 14 Jun 2019 16:26:14 +0800 Subject: [PATCH 1/3] add pagination, change some word --- src/plugins/element.js | 2 ++ src/views/PollDetail.vue | 36 ++++++++++++++++++++++++++++++++---- src/views/Referendum.vue | 10 ++++++++++ 3 files changed, 44 insertions(+), 4 deletions(-) diff --git a/src/plugins/element.js b/src/plugins/element.js index 4ac5343..a7dc428 100644 --- a/src/plugins/element.js +++ b/src/plugins/element.js @@ -20,6 +20,7 @@ import { Main, Menu, MenuItem, + Pagination, Progress, Option, Radio, @@ -50,6 +51,7 @@ Vue.use(DropdownMenu) Vue.use(DropdownItem) Vue.use(Progress) +Vue.use(Pagination) Vue.use(Menu) Vue.use(MenuItem) diff --git a/src/views/PollDetail.vue b/src/views/PollDetail.vue index a6b9d78..aef2726 100644 --- a/src/views/PollDetail.vue +++ b/src/views/PollDetail.vue @@ -14,6 +14,8 @@
{{proposal.proposal.proposal_json.type || 'unknown'}} +
+ Request tokens: {{incentives}}


-

Meet the conditions {{this.proposal.meet_conditions_days}} {{this.proposal.meet_conditions_days > 1 ? 'days' : 'day'}}

+
+

{{this.proposal.meet_conditions_days}} {{this.proposal.meet_conditions_days > 1 ? 'days' : 'day'}} satisfied

+ +

{{this.proposal ? this.proposal.stats.votes.accounts : 0}} accounts

{{this.proposal ? this.calcDays(this.proposal.proposal.created_at, new Date().toString()) : 0}} days since poll started

@@ -410,6 +415,19 @@ export default { }) return comm }, + incentives () { + 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 { + return 'Not declare' + } + }, otherComm () { let comm = [] this.votes.forEach(vote => { @@ -481,8 +499,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]) { @@ -820,6 +845,9 @@ export default { if (this.showVotersNum > this.votes.length) { this.showVotersNum = this.votes.length } + }, + satisfiedText (percentage) { + return `${this.proposal.meet_conditions_days}/20` } }, watch: { @@ -860,7 +888,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 diff --git a/src/views/Referendum.vue b/src/views/Referendum.vue index 9e90d7b..6f9a341 100644 --- a/src/views/Referendum.vue +++ b/src/views/Referendum.vue @@ -180,6 +180,7 @@
+

No relevant proposals

+ + @@ -218,6 +227,7 @@ export default { return { actionLoading: false, activeTab: 'proposals', + currentPage: 1, extendTime: null, extendPropName: '', extendVisible: false, From f5a3dd47274f6aafc246b915e387813b12f6ba57 Mon Sep 17 00:00:00 2001 From: Zhou Date: Fri, 14 Jun 2019 16:37:52 +0800 Subject: [PATCH 2/3] update element-ui --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 028f849..8fa23ed 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4218,9 +4218,9 @@ } }, "element-ui": { - "version": "2.7.2", - "resolved": "https://registry.npmjs.org/element-ui/-/element-ui-2.7.2.tgz", - "integrity": "sha512-Exh9QTkm9gwMMPzg1TyaTlBKyr3k4K9XcC5vl0A/mneDvJX//RsURGuOWsCNDVQMdhh5h9e+W5icosh+pKfbCg==", + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/element-ui/-/element-ui-2.9.1.tgz", + "integrity": "sha512-w8vrCW5Q+2gfDzs19MUrFdnCy5IjF98rs7DBsKnJQKFfZJZiZ2O+YAsSp/EuPrCm3P/2o/N3MtvZ34VANel13g==", "requires": { "async-validator": "~1.8.1", "babel-helper-vue-jsx-merge-props": "^2.0.0", diff --git a/package.json b/package.json index e0b7a17..603fe26 100644 --- a/package.json +++ b/package.json @@ -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", From 5ee2d0411c2c9c9c5c4b22b14c22585fff6f274b Mon Sep 17 00:00:00 2001 From: Zhou Date: Fri, 14 Jun 2019 17:44:56 +0800 Subject: [PATCH 3/3] add budget display --- src/views/PollDetail.vue | 44 ++++++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/src/views/PollDetail.vue b/src/views/PollDetail.vue index aef2726..14cdb40 100644 --- a/src/views/PollDetail.vue +++ b/src/views/PollDetail.vue @@ -15,7 +15,7 @@ {{proposal.proposal.proposal_json.type || 'unknown'}}
- Request tokens: {{incentives}} + Budget: {{incentives}}