From 4c7632f605c0b8b6b8b6cae9646adf197f4668ec Mon Sep 17 00:00:00 2001 From: Zhiting Lin Date: Mon, 26 Aug 2019 15:32:01 +0800 Subject: [PATCH] complete vote function --- src/assets/language/cn.js | 5 ++ src/assets/language/en.js | 5 ++ src/assets/style.css | 4 + src/router.js | 16 ++++ src/store/actions.js | 5 +- src/store/constants.js | 2 + src/store/mutations.js | 5 +- src/store/store.js | 2 + src/utils/GenericTools.js | 2 +- src/views/home.vue | 37 ++++++-- src/views/vote/listCancel.vue | 191 ++++++++++++++++++++++++++++++++++++++++++ src/views/vote/listVote.vue | 31 ++++--- src/views/vote/veto.vue | 189 +++++++++++++++++++++++++++++++++++++++++ src/views/vote/vote.vue | 17 ++-- 14 files changed, 480 insertions(+), 31 deletions(-) create mode 100644 src/views/vote/listCancel.vue create mode 100644 src/views/vote/veto.vue diff --git a/src/assets/language/cn.js b/src/assets/language/cn.js index 9134a3f..265d611 100644 --- a/src/assets/language/cn.js +++ b/src/assets/language/cn.js @@ -66,6 +66,11 @@ const cn = { vote:'投票', votes:'票数' }, + listCancel:{ + voted:'已投票', + cancel:'可取消', + selectVote:'选择节点' + }, vote:{ selectNode:'选择节点' }, diff --git a/src/assets/language/en.js b/src/assets/language/en.js index 1ff233e..a070f53 100644 --- a/src/assets/language/en.js +++ b/src/assets/language/en.js @@ -66,6 +66,11 @@ const en = { vote:'Vote', votes:'Votes' }, + listCancel:{ + voted:'Voted', + cancel:'Cancel', + selectVote:'Choose to vote' + }, vote:{ selectNode:'Select Node' }, diff --git a/src/assets/style.css b/src/assets/style.css index 0cc3d6c..81b580d 100644 --- a/src/assets/style.css +++ b/src/assets/style.css @@ -89,6 +89,10 @@ a { float: right; } +.text-aglin-right { + text-aglin: right; +} + h1, h2 { font-weight: 500; diff --git a/src/router.js b/src/router.js index b93e25f..8dd7240 100644 --- a/src/router.js +++ b/src/router.js @@ -26,6 +26,14 @@ const routers = [ } }, { + path: '/listCancel', + name: 'listCancel', + meta: { title: '选择节点' }, + component: resolve => { + require(['@/views/vote/listCancel.vue'], resolve) + } + }, + { path: '/vote', name: 'vote', meta: { title: '投票' }, @@ -34,6 +42,14 @@ const routers = [ } }, { + path: '/veto', + name: 'veto', + meta: { title: '取消投票' }, + component: resolve => { + require(['@/views/vote/veto.vue'], resolve) + } + }, + { path: '/crossChain', name: 'cross-chain', meta: { title: '跨链' }, diff --git a/src/store/actions.js b/src/store/actions.js index 1a250cf..54a2237 100644 --- a/src/store/actions.js +++ b/src/store/actions.js @@ -6,8 +6,11 @@ import account from "../models/account"; export const actions = { [Actions.SET_BYTOM]:({commit}, bytom) => commit(Actions.SET_BYTOM, bytom), + [Actions.SET_LIST_VOTE]:({commit}, listVote) => commit(Actions.SET_LIST_VOTE, listVote), + [Actions.SET_SELECTED_VOTE]:({commit}, selectVote) => commit(Actions.SET_SELECTED_VOTE, selectVote), - [Actions.LOAD_BYTOM]:({dispatch}) => { + + [Actions.LOAD_BYTOM]:({dispatch}) => { return new Promise((resolve, reject) => { InternalMessage.signal(InternalMessageTypes.LOAD).send().then(_bytom => { dispatch(Actions.SET_BYTOM, Bytom.fromJson(_bytom)); diff --git a/src/store/constants.js b/src/store/constants.js index 1e1ea93..5d765d8 100644 --- a/src/store/constants.js +++ b/src/store/constants.js @@ -7,6 +7,8 @@ export const CREATE_NEW_BYTOM = 'createNewBytom'; export const CREATE_NEW_BYTOM_ACCOUNT = 'createNewAccount'; export const IMPORT_BYTOM = 'importBytom'; export const SET_AUTO_LOCK = 'setAutoLock'; +export const SET_LIST_VOTE = 'setListVote'; +export const SET_SELECTED_VOTE = 'setSelectVote'; export const LOCK = 'lock'; export const DESTROY = 'destroy'; diff --git a/src/store/mutations.js b/src/store/mutations.js index a1d28d8..f2365f7 100644 --- a/src/store/mutations.js +++ b/src/store/mutations.js @@ -8,6 +8,9 @@ export const mutations = { [Mutations.PUSH_ALERT_RESULT]:(state, alertResult) => state.alertResult = alertResult, [Mutations.CLEAR_ALERT_RESULT]:(state) => state.alertResult = null, [Mutations.PUSH_PROMPT]:(state, prompt) => state.prompt = prompt, - // [Mutations.SET_AUTO_LOCK]:(state, inactivityInterval) => + [Mutations.SET_LIST_VOTE]:(state, listVote) => state.listVote = listVote, + [Mutations.SET_SELECTED_VOTE]:(state, selectVote) => state.selectVote = selectVote, + + // [Mutations.SET_AUTO_LOCK]:(state, inactivityInterval) => // state.bytom.settings.inactivityInterval = TimingHelpers.minutes(inactivityInterval), }; diff --git a/src/store/store.js b/src/store/store.js index 249871f..a1d41fe 100644 --- a/src/store/store.js +++ b/src/store/store.js @@ -13,6 +13,8 @@ const state = { alertResult:null, prompt:null, + listVote:[], + selectVote: null, }; const getters = { diff --git a/src/utils/GenericTools.js b/src/utils/GenericTools.js index a56b67e..38eda48 100644 --- a/src/utils/GenericTools.js +++ b/src/utils/GenericTools.js @@ -6,4 +6,4 @@ export const strippedHost = () => { if(host.indexOf('www.') === 0) host = host.replace('www.', ''); return host; -}; \ No newline at end of file +}; diff --git a/src/views/home.vue b/src/views/home.vue index 476ee19..c6be665 100644 --- a/src/views/home.vue +++ b/src/views/home.vue @@ -8,7 +8,7 @@ display:flex; } .topbar .topbar-left { - width: 115px; + width: 85px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; @@ -79,6 +79,7 @@ height: 48px; line-height: 23px; font-size: 16px; + padding: 12px 10px; } .btn-received { @@ -125,10 +126,6 @@ width: 90%; } -.list-item .value { - float: right; - margin-top: 13px; -} .account-address { cursor: pointer; } @@ -175,8 +172,8 @@
@@ -229,7 +226,12 @@