From c8822a2869fffac5d155aa040f7ebb567f112670 Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Thu, 5 Aug 2021 16:51:24 +0800 Subject: [PATCH] add home page --- src/libs/fetch.js | 1 + src/router/index.js | 1 + src/views/Governance.vue | 33 --------- src/views/Home.vue | 154 ++++++++++++++++++++++++++++++++++----- 4 files changed, 136 insertions(+), 53 deletions(-) diff --git a/src/libs/fetch.js b/src/libs/fetch.js index 13d6a08e..4cec7ac0 100644 --- a/src/libs/fetch.js +++ b/src/libs/fetch.js @@ -25,6 +25,7 @@ async function refetchVersion(chain) { const version = sdk.match(re) return version[0] }) + .catch(e => console.error(e)) } const chainAPI = class ChainFetch { diff --git a/src/router/index.js b/src/router/index.js index ab004bad..03729f1d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -17,6 +17,7 @@ const router = new VueRouter({ name: 'home', component: () => import('@/views/Home.vue'), meta: { + layout: 'full', pageTitle: 'Home', breadcrumb: [ { diff --git a/src/views/Governance.vue b/src/views/Governance.vue index 111f1deb..0ea76c92 100644 --- a/src/views/Governance.vue +++ b/src/views/Governance.vue @@ -200,7 +200,6 @@ export default { }, methods: { getList() { - // this.$http.setup(this.$route) this.$http.getGovernanceList().then(res => { const voting = res.filter(i => i.status === 2) if (voting.length > 0) { @@ -221,38 +220,6 @@ export default { }) }, }, - // asyncComputed: { - // proposals: { - // get() { - // const api = new ChainAPI(this.$route) - // api.setup(this.$route) - // return api.getGovernanceList().then(res => { - // const voting = res.filter(i => i.status === 2) - // if (voting.length > 0) { - // let i = 0 - // Promise.all(voting.reverse().map(p => api.getGovernanceTally(p.id, p.tally.total))).then(update => { - // this.proposals.map(x => { - // if (x.status === 2) { - // const xh = x - // xh.tally = update[i] - // i += 1 - // return xh - // } - // return x - // }) - // }) - // } - // return res.reverse() - // }) - // }, - // // default: 'loading...', - // }, - // }, - // watch: { - // proposals(val, newdata) { - // console.log('In watch', val, newdata) - // }, - // }, } diff --git a/src/views/Home.vue b/src/views/Home.vue index dc51c340..0de1f275 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -1,34 +1,148 @@ - -