From 4aa96f8a5b316b41e0aa541339d1fb569c75b60f Mon Sep 17 00:00:00 2001 From: Chong Guo Date: Fri, 26 Apr 2019 21:26:45 -0700 Subject: [PATCH] Feature(dashboard): add dashboard page for admin and editor --- mock/index.ts | 4 +- mock/remote-serach.ts | 51 ++ package.json | 1 + src/api/remote-search.ts | 17 + src/components/Charts/Keyboard.vue | 18 +- src/components/Charts/LineMarker.vue | 19 +- src/components/Charts/MixChart.vue | 21 +- src/components/GithubCorner/index.vue | 69 +++ src/components/PanThumb/index.vue | 134 +++++ src/components/TextHoverEffect/Mallki.vue | 112 ++++ src/shims-vue.d.ts | 5 + .../dashboard/admin/components/BarChart.vue | 88 +++ .../dashboard/admin/components/BoxCard.vue | 150 +++++ .../dashboard/admin/components/LineChart.vue | 116 ++++ .../dashboard/admin/components/PanelGroup.vue | 230 ++++++++ .../dashboard/admin/components/PieChart.vue | 65 +++ .../admin/components/RaddarChart.vue | 102 ++++ .../admin/components/TodoList/Todo.vue | 91 +++ .../admin/components/TodoList/index.vue | 531 ++++++++++++++++++ .../admin/components/TransactionTable.vue | 70 +++ src/views/dashboard/admin/index.vue | 150 +++++ src/views/dashboard/editor/index.vue | 93 +++ src/views/dashboard/index.vue | 40 +- src/views/tab/components/TabPane.vue | 2 +- yarn.lock | 5 + 25 files changed, 2119 insertions(+), 65 deletions(-) create mode 100644 mock/remote-serach.ts create mode 100644 src/api/remote-search.ts create mode 100644 src/components/GithubCorner/index.vue create mode 100644 src/components/PanThumb/index.vue create mode 100644 src/components/TextHoverEffect/Mallki.vue create mode 100644 src/views/dashboard/admin/components/BarChart.vue create mode 100644 src/views/dashboard/admin/components/BoxCard.vue create mode 100644 src/views/dashboard/admin/components/LineChart.vue create mode 100644 src/views/dashboard/admin/components/PanelGroup.vue create mode 100644 src/views/dashboard/admin/components/PieChart.vue create mode 100644 src/views/dashboard/admin/components/RaddarChart.vue create mode 100644 src/views/dashboard/admin/components/TodoList/Todo.vue create mode 100644 src/views/dashboard/admin/components/TodoList/index.vue create mode 100644 src/views/dashboard/admin/components/TransactionTable.vue create mode 100644 src/views/dashboard/admin/index.vue create mode 100644 src/views/dashboard/editor/index.vue diff --git a/mock/index.ts b/mock/index.ts index ebaf69566..85852ee22 100644 --- a/mock/index.ts +++ b/mock/index.ts @@ -4,11 +4,13 @@ import { param2Obj } from '@/utils' import user from './user' import role from './role' import article from './article' +import remoteSearch from './remote-serach' const mocks = [ ...user, ...role, - ...article + ...article, + ...remoteSearch ] // For frontend mock diff --git a/mock/remote-serach.ts b/mock/remote-serach.ts new file mode 100644 index 000000000..faba615b1 --- /dev/null +++ b/mock/remote-serach.ts @@ -0,0 +1,51 @@ +import Mock from 'mockjs' + +const NameList: { name: string }[] = [] +const count = 100 + +for (let i = 0; i < count; i++) { + NameList.push(Mock.mock({ + name: '@first' + })) +} +NameList.push({ name: 'mock-Pan' }) + +export default [ + // username search + { + url: '/search/user', + type: 'get', + response: (config: any) => { + const { name } = config.query + const mockNameList = NameList.filter(item => { + const lowerCaseName = item.name.toLowerCase() + return !(name && lowerCaseName.indexOf(name.toLowerCase()) < 0) + }) + return { + code: 20000, + data: { items: mockNameList } + } + } + }, + + // transaction list + { + url: '/transaction/list', + type: 'get', + response: (_: any) => { + return { + code: 20000, + data: { + total: 20, + 'items|20': [{ + order_no: '@guid()', + timestamp: +Mock.Random.date('T'), + username: '@name()', + price: '@float(1000, 15000, 0, 2)', + 'status|1': ['success', 'pending'] + }] + } + } + } + } +] diff --git a/package.json b/package.json index b5c823603..4152b25a5 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "screenfull": "^4.2.0", "vue": "^2.6.10", "vue-class-component": "^7.0.2", + "vue-count-to": "^1.0.13", "vue-i18n": "^8.11.1", "vue-property-decorator": "^8.1.0", "vue-router": "^3.0.6", diff --git a/src/api/remote-search.ts b/src/api/remote-search.ts new file mode 100644 index 000000000..7fd259dae --- /dev/null +++ b/src/api/remote-search.ts @@ -0,0 +1,17 @@ +import request from '@/utils/request' + +export const searchUser = (name: string) => { + return request({ + url: '/search/user', + method: 'get', + params: { name } + }) +} + +export const transactionList = (params: any) => { + return request({ + url: '/transaction/list', + method: 'get', + params + }) +} diff --git a/src/components/Charts/Keyboard.vue b/src/components/Charts/Keyboard.vue index 5f6e82784..2d461809d 100644 --- a/src/components/Charts/Keyboard.vue +++ b/src/components/Charts/Keyboard.vue @@ -7,9 +7,9 @@ diff --git a/src/components/Charts/LineMarker.vue b/src/components/Charts/LineMarker.vue index 2289343b7..b101cbf1a 100644 --- a/src/components/Charts/LineMarker.vue +++ b/src/components/Charts/LineMarker.vue @@ -7,9 +7,9 @@ diff --git a/src/components/GithubCorner/index.vue b/src/components/GithubCorner/index.vue new file mode 100644 index 000000000..ed71cd54e --- /dev/null +++ b/src/components/GithubCorner/index.vue @@ -0,0 +1,69 @@ + + + + + diff --git a/src/components/PanThumb/index.vue b/src/components/PanThumb/index.vue new file mode 100644 index 000000000..d57230aaf --- /dev/null +++ b/src/components/PanThumb/index.vue @@ -0,0 +1,134 @@ + + + + + diff --git a/src/components/TextHoverEffect/Mallki.vue b/src/components/TextHoverEffect/Mallki.vue new file mode 100644 index 000000000..261c57cee --- /dev/null +++ b/src/components/TextHoverEffect/Mallki.vue @@ -0,0 +1,112 @@ + + + + + diff --git a/src/shims-vue.d.ts b/src/shims-vue.d.ts index da276b1ec..f9bf53b8a 100644 --- a/src/shims-vue.d.ts +++ b/src/shims-vue.d.ts @@ -10,3 +10,8 @@ declare module 'element-ui/lib/locale/lang/*' { declare module '*.gif' { export const gif: any } + +// TODO: remove this part after vue-count-to has its typescript file +declare module 'vue-count-to' { + // Placeholder +} diff --git a/src/views/dashboard/admin/components/BarChart.vue b/src/views/dashboard/admin/components/BarChart.vue new file mode 100644 index 000000000..284ce4a00 --- /dev/null +++ b/src/views/dashboard/admin/components/BarChart.vue @@ -0,0 +1,88 @@ + + + diff --git a/src/views/dashboard/admin/components/BoxCard.vue b/src/views/dashboard/admin/components/BoxCard.vue new file mode 100644 index 000000000..896afe788 --- /dev/null +++ b/src/views/dashboard/admin/components/BoxCard.vue @@ -0,0 +1,150 @@ + + + + + + + diff --git a/src/views/dashboard/admin/components/LineChart.vue b/src/views/dashboard/admin/components/LineChart.vue new file mode 100644 index 000000000..ebbc5046f --- /dev/null +++ b/src/views/dashboard/admin/components/LineChart.vue @@ -0,0 +1,116 @@ + + + diff --git a/src/views/dashboard/admin/components/PanelGroup.vue b/src/views/dashboard/admin/components/PanelGroup.vue new file mode 100644 index 000000000..e426e3cd6 --- /dev/null +++ b/src/views/dashboard/admin/components/PanelGroup.vue @@ -0,0 +1,230 @@ + + + + + diff --git a/src/views/dashboard/admin/components/PieChart.vue b/src/views/dashboard/admin/components/PieChart.vue new file mode 100644 index 000000000..b7ec91f55 --- /dev/null +++ b/src/views/dashboard/admin/components/PieChart.vue @@ -0,0 +1,65 @@ + + + diff --git a/src/views/dashboard/admin/components/RaddarChart.vue b/src/views/dashboard/admin/components/RaddarChart.vue new file mode 100644 index 000000000..d0e64c25c --- /dev/null +++ b/src/views/dashboard/admin/components/RaddarChart.vue @@ -0,0 +1,102 @@ + + + diff --git a/src/views/dashboard/admin/components/TodoList/Todo.vue b/src/views/dashboard/admin/components/TodoList/Todo.vue new file mode 100644 index 000000000..5237d5da6 --- /dev/null +++ b/src/views/dashboard/admin/components/TodoList/Todo.vue @@ -0,0 +1,91 @@ + + + diff --git a/src/views/dashboard/admin/components/TodoList/index.vue b/src/views/dashboard/admin/components/TodoList/index.vue new file mode 100644 index 000000000..540d0e2ea --- /dev/null +++ b/src/views/dashboard/admin/components/TodoList/index.vue @@ -0,0 +1,531 @@ + + + + + diff --git a/src/views/dashboard/admin/components/TransactionTable.vue b/src/views/dashboard/admin/components/TransactionTable.vue new file mode 100644 index 000000000..6a88b5bc2 --- /dev/null +++ b/src/views/dashboard/admin/components/TransactionTable.vue @@ -0,0 +1,70 @@ + + + diff --git a/src/views/dashboard/admin/index.vue b/src/views/dashboard/admin/index.vue new file mode 100644 index 000000000..31225857b --- /dev/null +++ b/src/views/dashboard/admin/index.vue @@ -0,0 +1,150 @@ + + + + + diff --git a/src/views/dashboard/editor/index.vue b/src/views/dashboard/editor/index.vue new file mode 100644 index 000000000..53edde9ac --- /dev/null +++ b/src/views/dashboard/editor/index.vue @@ -0,0 +1,93 @@ + + + + + diff --git a/src/views/dashboard/index.vue b/src/views/dashboard/index.vue index 9a51b125b..4c8e0f714 100644 --- a/src/views/dashboard/index.vue +++ b/src/views/dashboard/index.vue @@ -1,42 +1,32 @@ - + diff --git a/src/views/tab/components/TabPane.vue b/src/views/tab/components/TabPane.vue index 6cd32a47f..2b33322fa 100644 --- a/src/views/tab/components/TabPane.vue +++ b/src/views/tab/components/TabPane.vue @@ -72,7 +72,7 @@ diff --git a/yarn.lock b/yarn.lock index 5989d02c6..a10f7deb7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11510,6 +11510,11 @@ vue-cli-plugin-element@^1.0.1: resolved "https://registry.yarnpkg.com/vue-cli-plugin-element/-/vue-cli-plugin-element-1.0.1.tgz#34e58fb65b36cf59afaf14f503288e5e578b1554" integrity sha512-OJSOnJtn7f1v/8xX+MJae+RrE8WguhiiG9QTBx/MNOPXYsxqut6Ommo+ZD3raNc7eryhqdM2T/DlMfdvIKpCtw== +vue-count-to@^1.0.13: + version "1.0.13" + resolved "https://registry.yarnpkg.com/vue-count-to/-/vue-count-to-1.0.13.tgz#3e7573ea6e64c2b2972f64e0a2ab2e23c7590ff3" + integrity sha512-6R4OVBVNtQTlcbXu6SJ8ENR35M2/CdWt3Jmv57jOUM+1ojiFmjVGvZPH8DfHpMDSA+ITs+EW5V6qthADxeyYOQ== + vue-eslint-parser@^2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/vue-eslint-parser/-/vue-eslint-parser-2.0.3.tgz#c268c96c6d94cfe3d938a5f7593959b0ca3360d1"