后台管理-仪表盘功能

This commit is contained in:
ronger 2020-08-11 14:42:45 +08:00
parent ce2ff27f8f
commit 45573d41a6
6 changed files with 380 additions and 534 deletions

View File

@ -1,6 +1,6 @@
import appConfig from './config/app.config'
import apiConfig from './config/api.config'
import {isProdMode, isDevMode} from './environment'
import {isDevMode} from './environment'
export default {
/*

548
package-lock.json generated
View File

@ -1618,21 +1618,6 @@
}
}
},
"@sindresorhus/is": {
"version": "0.14.0",
"resolved": "https://registry.npm.taobao.org/@sindresorhus/is/download/@sindresorhus/is-0.14.0.tgz",
"integrity": "sha1-n7OjzzEyMoFR81PeRjLgHlIQK+o=",
"dev": true
},
"@szmarczak/http-timer": {
"version": "1.1.2",
"resolved": "https://registry.npm.taobao.org/@szmarczak/http-timer/download/@szmarczak/http-timer-1.1.2.tgz",
"integrity": "sha1-sWZeLEYaLNkvTBu/UNVFTeDUtCE=",
"dev": true,
"requires": {
"defer-to-connect": "^1.0.1"
}
},
"@types/anymatch": {
"version": "1.3.1",
"resolved": "https://registry.npm.taobao.org/@types/anymatch/download/@types/anymatch-1.3.1.tgz",
@ -2988,35 +2973,6 @@
}
}
},
"cacheable-request": {
"version": "6.1.0",
"resolved": "https://registry.npm.taobao.org/cacheable-request/download/cacheable-request-6.1.0.tgz",
"integrity": "sha1-IP+4vRYrpL4R6VZ9gj22UQUsqRI=",
"dev": true,
"requires": {
"clone-response": "^1.0.2",
"get-stream": "^5.1.0",
"http-cache-semantics": "^4.0.0",
"keyv": "^3.0.0",
"lowercase-keys": "^2.0.0",
"normalize-url": "^4.1.0",
"responselike": "^1.0.2"
},
"dependencies": {
"lowercase-keys": {
"version": "2.0.0",
"resolved": "https://registry.npm.taobao.org/lowercase-keys/download/lowercase-keys-2.0.0.tgz",
"integrity": "sha1-JgPni3tLAAbLyi+8yKMgJVislHk=",
"dev": true
},
"normalize-url": {
"version": "4.5.0",
"resolved": "https://registry.npm.taobao.org/normalize-url/download/normalize-url-4.5.0.tgz?cache=0&sync_timestamp=1596371468579&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fnormalize-url%2Fdownload%2Fnormalize-url-4.5.0.tgz",
"integrity": "sha1-RTNUCH5sqWlXvY9br3U/WYIUISk=",
"dev": true
}
}
},
"caller-callsite": {
"version": "2.0.0",
"resolved": "https://registry.npm.taobao.org/caller-callsite/download/caller-callsite-2.0.0.tgz?cache=0&sync_timestamp=1562668933683&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcaller-callsite%2Fdownload%2Fcaller-callsite-2.0.0.tgz",
@ -3335,15 +3291,6 @@
}
}
},
"clone-response": {
"version": "1.0.2",
"resolved": "https://registry.npm.taobao.org/clone-response/download/clone-response-1.0.2.tgz",
"integrity": "sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=",
"dev": true,
"requires": {
"mimic-response": "^1.0.0"
}
},
"coa": {
"version": "2.0.2",
"resolved": "https://registry.npm.taobao.org/coa/download/coa-2.0.2.tgz",
@ -3543,49 +3490,6 @@
}
}
},
"configstore": {
"version": "5.0.1",
"resolved": "https://registry.npm.taobao.org/configstore/download/configstore-5.0.1.tgz",
"integrity": "sha1-02UCG130uYzdGH1qOw4/anzF7ZY=",
"dev": true,
"requires": {
"dot-prop": "^5.2.0",
"graceful-fs": "^4.1.2",
"make-dir": "^3.0.0",
"unique-string": "^2.0.0",
"write-file-atomic": "^3.0.0",
"xdg-basedir": "^4.0.0"
},
"dependencies": {
"make-dir": {
"version": "3.1.0",
"resolved": "https://registry.npm.taobao.org/make-dir/download/make-dir-3.1.0.tgz",
"integrity": "sha1-QV6WcEazp/HRhSd9hKpYIDcmoT8=",
"dev": true,
"requires": {
"semver": "^6.0.0"
}
},
"semver": {
"version": "6.3.0",
"resolved": "https://registry.npm.taobao.org/semver/download/semver-6.3.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsemver%2Fdownload%2Fsemver-6.3.0.tgz",
"integrity": "sha1-7gpkyK9ejO6mdoexM3YeG+y9HT0=",
"dev": true
},
"write-file-atomic": {
"version": "3.0.3",
"resolved": "https://registry.npm.taobao.org/write-file-atomic/download/write-file-atomic-3.0.3.tgz",
"integrity": "sha1-Vr1cWlxwSBzRnFcb05q5ZaXeVug=",
"dev": true,
"requires": {
"imurmurhash": "^0.1.4",
"is-typedarray": "^1.0.0",
"signal-exit": "^3.0.2",
"typedarray-to-buffer": "^3.1.5"
}
}
}
},
"connect": {
"version": "3.7.0",
"resolved": "https://registry.npm.taobao.org/connect/download/connect-3.7.0.tgz",
@ -3839,12 +3743,6 @@
"randomfill": "^1.0.3"
}
},
"crypto-random-string": {
"version": "2.0.0",
"resolved": "https://registry.npm.taobao.org/crypto-random-string/download/crypto-random-string-2.0.0.tgz",
"integrity": "sha1-7yp6lm7BEIM4g2m6oC6+rSKbMNU=",
"dev": true
},
"css-blank-pseudo": {
"version": "0.1.4",
"resolved": "https://registry.npm.taobao.org/css-blank-pseudo/download/css-blank-pseudo-0.1.4.tgz",
@ -4126,32 +4024,11 @@
"resolved": "https://registry.npm.taobao.org/decode-uri-component/download/decode-uri-component-0.2.0.tgz",
"integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU="
},
"decompress-response": {
"version": "3.3.0",
"resolved": "https://registry.npm.taobao.org/decompress-response/download/decompress-response-3.3.0.tgz",
"integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=",
"dev": true,
"requires": {
"mimic-response": "^1.0.0"
}
},
"deep-extend": {
"version": "0.6.0",
"resolved": "https://registry.npm.taobao.org/deep-extend/download/deep-extend-0.6.0.tgz",
"integrity": "sha1-xPp8lUBKF6nD6Mp+FTcxK3NjMKw=",
"dev": true
},
"deepmerge": {
"version": "1.5.2",
"resolved": "https://registry.npm.taobao.org/deepmerge/download/deepmerge-1.5.2.tgz?cache=0&sync_timestamp=1572279720382&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fdeepmerge%2Fdownload%2Fdeepmerge-1.5.2.tgz",
"integrity": "sha1-EEmdhohEza1P7ghC34x/bwyVp1M="
},
"defer-to-connect": {
"version": "1.1.3",
"resolved": "https://registry.npm.taobao.org/defer-to-connect/download/defer-to-connect-1.1.3.tgz",
"integrity": "sha1-MxrgUMCNz3ifjIOnuB8O2U9KxZE=",
"dev": true
},
"define-properties": {
"version": "1.1.3",
"resolved": "https://registry.npm.taobao.org/define-properties/download/define-properties-1.1.3.tgz",
@ -4364,12 +4241,6 @@
"resolved": "https://registry.npm.taobao.org/duplexer/download/duplexer-0.1.1.tgz",
"integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E="
},
"duplexer3": {
"version": "0.1.4",
"resolved": "https://registry.npm.taobao.org/duplexer3/download/duplexer3-0.1.4.tgz",
"integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=",
"dev": true
},
"duplexify": {
"version": "3.7.1",
"resolved": "https://registry.npm.taobao.org/duplexify/download/duplexify-3.7.1.tgz",
@ -4420,6 +4291,14 @@
"safer-buffer": "^2.1.0"
}
},
"echarts": {
"version": "4.8.0",
"resolved": "https://registry.npm.taobao.org/echarts/download/echarts-4.8.0.tgz?cache=0&sync_timestamp=1596214937248&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fecharts%2Fdownload%2Fecharts-4.8.0.tgz",
"integrity": "sha1-ssHPuSKbE9No7hBPyO6mALV01MQ=",
"requires": {
"zrender": "4.3.1"
}
},
"ee-first": {
"version": "1.1.1",
"resolved": "https://registry.npm.taobao.org/ee-first/download/ee-first-1.1.1.tgz",
@ -4672,12 +4551,6 @@
"resolved": "https://registry.npm.taobao.org/escalade/download/escalade-3.0.2.tgz?cache=0&sync_timestamp=1594745271228&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fescalade%2Fdownload%2Fescalade-3.0.2.tgz",
"integrity": "sha1-algNcO24eIDyK0yR0NVgeN9pYsQ="
},
"escape-goat": {
"version": "2.1.1",
"resolved": "https://registry.npm.taobao.org/escape-goat/download/escape-goat-2.1.1.tgz",
"integrity": "sha1-Gy3HcANnbEV+x2Cy3GjttkgYhnU=",
"dev": true
},
"escape-html": {
"version": "1.0.3",
"resolved": "https://registry.npm.taobao.org/escape-html/download/escape-html-1.0.3.tgz",
@ -5583,15 +5456,6 @@
"is-glob": "^4.0.1"
}
},
"global-dirs": {
"version": "2.0.1",
"resolved": "https://registry.npm.taobao.org/global-dirs/download/global-dirs-2.0.1.tgz",
"integrity": "sha1-rN87tmhbzVXLNeigUiZlaelGkgE=",
"dev": true,
"requires": {
"ini": "^1.3.5"
}
},
"globals": {
"version": "11.12.0",
"resolved": "https://registry.npm.taobao.org/globals/download/globals-11.12.0.tgz",
@ -5621,36 +5485,6 @@
"minimatch": "~3.0.2"
}
},
"got": {
"version": "9.6.0",
"resolved": "https://registry.npm.taobao.org/got/download/got-9.6.0.tgz?cache=0&sync_timestamp=1596795791808&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fgot%2Fdownload%2Fgot-9.6.0.tgz",
"integrity": "sha1-7fRefWf5lUVwXeH3u+7rEhdl7YU=",
"dev": true,
"requires": {
"@sindresorhus/is": "^0.14.0",
"@szmarczak/http-timer": "^1.1.2",
"cacheable-request": "^6.0.0",
"decompress-response": "^3.3.0",
"duplexer3": "^0.1.4",
"get-stream": "^4.1.0",
"lowercase-keys": "^1.0.1",
"mimic-response": "^1.0.1",
"p-cancelable": "^1.0.0",
"to-readable-stream": "^1.0.0",
"url-parse-lax": "^3.0.0"
},
"dependencies": {
"get-stream": {
"version": "4.1.0",
"resolved": "https://registry.npm.taobao.org/get-stream/download/get-stream-4.1.0.tgz",
"integrity": "sha1-wbJVV189wh1Zv8ec09K0axw6VLU=",
"dev": true,
"requires": {
"pump": "^3.0.0"
}
}
}
},
"graceful-fs": {
"version": "4.2.4",
"resolved": "https://registry.npm.taobao.org/graceful-fs/download/graceful-fs-4.2.4.tgz?cache=0&sync_timestamp=1588086876757&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fgraceful-fs%2Fdownload%2Fgraceful-fs-4.2.4.tgz",
@ -5811,12 +5645,6 @@
}
}
},
"has-yarn": {
"version": "2.1.0",
"resolved": "https://registry.npm.taobao.org/has-yarn/download/has-yarn-2.1.0.tgz",
"integrity": "sha1-E34RNUp7W/EapctknPDG8/8rLnc=",
"dev": true
},
"hash-base": {
"version": "3.1.0",
"resolved": "https://registry.npm.taobao.org/hash-base/download/hash-base-3.1.0.tgz",
@ -6009,12 +5837,6 @@
}
}
},
"http-cache-semantics": {
"version": "4.1.0",
"resolved": "https://registry.npm.taobao.org/http-cache-semantics/download/http-cache-semantics-4.1.0.tgz",
"integrity": "sha1-SekcXL82yblLz81xwj1SSex045A=",
"dev": true
},
"http-errors": {
"version": "1.7.2",
"resolved": "https://registry.npm.taobao.org/http-errors/download/http-errors-1.7.2.tgz?cache=0&sync_timestamp=1561418493658&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fhttp-errors%2Fdownload%2Fhttp-errors-1.7.2.tgz",
@ -6079,7 +5901,7 @@
},
"micromatch": {
"version": "4.0.2",
"resolved": "https://registry.npm.taobao.org/micromatch/download/micromatch-4.0.2.tgz?cache=0&sync_timestamp=1588851826089&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fmicromatch%2Fdownload%2Fmicromatch-4.0.2.tgz",
"resolved": "https://registry.npm.taobao.org/micromatch/download/micromatch-4.0.2.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fmicromatch%2Fdownload%2Fmicromatch-4.0.2.tgz",
"integrity": "sha1-T8sJmb+fvC/L3SEvbWKbmlbDklk=",
"requires": {
"braces": "^3.0.1",
@ -6148,12 +5970,6 @@
"resolved": "https://registry.npm.taobao.org/ignore/download/ignore-5.1.8.tgz",
"integrity": "sha1-8VCotQo0KJsz4i9YiavU2AFvDlc="
},
"ignore-by-default": {
"version": "1.0.1",
"resolved": "https://registry.npm.taobao.org/ignore-by-default/download/ignore-by-default-1.0.1.tgz",
"integrity": "sha1-SMptcvbGo68Aqa1K5odr44ieKwk=",
"dev": true
},
"import-cwd": {
"version": "2.1.0",
"resolved": "https://registry.npm.taobao.org/import-cwd/download/import-cwd-2.1.0.tgz",
@ -6179,12 +5995,6 @@
"resolve-from": "^3.0.0"
}
},
"import-lazy": {
"version": "2.1.0",
"resolved": "https://registry.npm.taobao.org/import-lazy/download/import-lazy-2.1.0.tgz",
"integrity": "sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM=",
"dev": true
},
"imurmurhash": {
"version": "0.1.4",
"resolved": "https://registry.npm.taobao.org/imurmurhash/download/imurmurhash-0.1.4.tgz",
@ -6403,23 +6213,6 @@
"resolved": "https://registry.npm.taobao.org/is-callable/download/is-callable-1.2.0.tgz",
"integrity": "sha1-gzNlYLVKOONeOi33r9BFTWkUaLs="
},
"is-ci": {
"version": "2.0.0",
"resolved": "https://registry.npm.taobao.org/is-ci/download/is-ci-2.0.0.tgz",
"integrity": "sha1-a8YzQYGBDgS1wis9WJ/cpVAmQEw=",
"dev": true,
"requires": {
"ci-info": "^2.0.0"
},
"dependencies": {
"ci-info": {
"version": "2.0.0",
"resolved": "https://registry.npm.taobao.org/ci-info/download/ci-info-2.0.0.tgz",
"integrity": "sha1-Z6npZL4xpR4V5QENWObxKDQAL0Y=",
"dev": true
}
}
},
"is-color-stop": {
"version": "1.1.0",
"resolved": "https://registry.npm.taobao.org/is-color-stop/download/is-color-stop-1.1.0.tgz",
@ -6517,16 +6310,6 @@
"is-extglob": "^2.1.1"
}
},
"is-installed-globally": {
"version": "0.3.2",
"resolved": "https://registry.npm.taobao.org/is-installed-globally/download/is-installed-globally-0.3.2.tgz",
"integrity": "sha1-/T76ee5nDRGHIzGC1bCh3QAxMUE=",
"dev": true,
"requires": {
"global-dirs": "^2.0.1",
"is-path-inside": "^3.0.1"
}
},
"is-nan": {
"version": "1.3.0",
"resolved": "https://registry.npm.taobao.org/is-nan/download/is-nan-1.3.0.tgz",
@ -6535,12 +6318,6 @@
"define-properties": "^1.1.3"
}
},
"is-npm": {
"version": "4.0.0",
"resolved": "https://registry.npm.taobao.org/is-npm/download/is-npm-4.0.0.tgz",
"integrity": "sha1-yQ3YOAaW34enptgjwg0LErvjyE0=",
"dev": true
},
"is-number": {
"version": "3.0.0",
"resolved": "https://registry.npm.taobao.org/is-number/download/is-number-3.0.0.tgz",
@ -6564,12 +6341,6 @@
"resolved": "https://registry.npm.taobao.org/is-obj/download/is-obj-2.0.0.tgz",
"integrity": "sha1-Rz+wXZc3BeP9liBUUBjKjiLvSYI="
},
"is-path-inside": {
"version": "3.0.2",
"resolved": "https://registry.npm.taobao.org/is-path-inside/download/is-path-inside-3.0.2.tgz",
"integrity": "sha1-9SIPyCo+IzdXKR3dycWHfyofMBc=",
"dev": true
},
"is-plain-obj": {
"version": "1.1.0",
"resolved": "https://registry.npm.taobao.org/is-plain-obj/download/is-plain-obj-1.1.0.tgz",
@ -6603,7 +6374,7 @@
},
"is-retry-allowed": {
"version": "1.2.0",
"resolved": "https://registry.npm.taobao.org/is-retry-allowed/download/is-retry-allowed-1.2.0.tgz",
"resolved": "https://registry.npm.taobao.org/is-retry-allowed/download/is-retry-allowed-1.2.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fis-retry-allowed%2Fdownload%2Fis-retry-allowed-1.2.0.tgz",
"integrity": "sha1-13hIi9CkZmo76KFIK58rqv7eqLQ="
},
"is-ssh": {
@ -6668,12 +6439,6 @@
"resolved": "https://registry.npm.taobao.org/is-wsl/download/is-wsl-1.1.0.tgz",
"integrity": "sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0="
},
"is-yarn-global": {
"version": "0.3.0",
"resolved": "https://registry.npm.taobao.org/is-yarn-global/download/is-yarn-global-0.3.0.tgz",
"integrity": "sha1-1QLTOCWQ6jAEiTdGdUyJE5lz4jI=",
"dev": true
},
"isarray": {
"version": "1.0.0",
"resolved": "https://registry.npm.taobao.org/isarray/download/isarray-1.0.0.tgz?cache=0&sync_timestamp=1562592096220&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fisarray%2Fdownload%2Fisarray-1.0.0.tgz",
@ -6760,12 +6525,6 @@
"resolved": "https://registry.npm.taobao.org/jsesc/download/jsesc-2.5.2.tgz",
"integrity": "sha1-gFZNLkg9rPbo7yCWUKZ98/DCg6Q="
},
"json-buffer": {
"version": "3.0.0",
"resolved": "https://registry.npm.taobao.org/json-buffer/download/json-buffer-3.0.0.tgz",
"integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=",
"dev": true
},
"json-parse-better-errors": {
"version": "1.0.2",
"resolved": "https://registry.npm.taobao.org/json-parse-better-errors/download/json-parse-better-errors-1.0.2.tgz",
@ -6816,15 +6575,6 @@
"verror": "1.10.0"
}
},
"keyv": {
"version": "3.1.0",
"resolved": "https://registry.npm.taobao.org/keyv/download/keyv-3.1.0.tgz",
"integrity": "sha1-7MIoSG9pmR5J6UdkhaW+Ho/FxNk=",
"dev": true,
"requires": {
"json-buffer": "3.0.0"
}
},
"kind-of": {
"version": "6.0.3",
"resolved": "https://registry.npm.taobao.org/kind-of/download/kind-of-6.0.3.tgz",
@ -6845,15 +6595,6 @@
"webpack-sources": "^1.1.0"
}
},
"latest-version": {
"version": "5.1.0",
"resolved": "https://registry.npm.taobao.org/latest-version/download/latest-version-5.1.0.tgz?cache=0&sync_timestamp=1593529716730&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Flatest-version%2Fdownload%2Flatest-version-5.1.0.tgz",
"integrity": "sha1-EZ3+kI/jjRXfpD7NE/oS7Igy+s4=",
"dev": true,
"requires": {
"package-json": "^6.3.0"
}
},
"launch-editor": {
"version": "2.2.1",
"resolved": "https://registry.npm.taobao.org/launch-editor/download/launch-editor-2.2.1.tgz",
@ -7033,12 +6774,6 @@
"tslib": "^1.10.0"
}
},
"lowercase-keys": {
"version": "1.0.1",
"resolved": "https://registry.npm.taobao.org/lowercase-keys/download/lowercase-keys-1.0.1.tgz",
"integrity": "sha1-b54wtHCE2XGnyCD/FabFFnt0wm8=",
"dev": true
},
"lru-cache": {
"version": "5.1.1",
"resolved": "https://registry.npm.taobao.org/lru-cache/download/lru-cache-5.1.1.tgz",
@ -7276,12 +7011,6 @@
"resolved": "https://registry.npm.taobao.org/mimic-fn/download/mimic-fn-3.1.0.tgz?cache=0&sync_timestamp=1596093969209&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fmimic-fn%2Fdownload%2Fmimic-fn-3.1.0.tgz",
"integrity": "sha1-ZXVRRbvz42lUuUnBZFBCdFHVynQ="
},
"mimic-response": {
"version": "1.0.1",
"resolved": "https://registry.npm.taobao.org/mimic-response/download/mimic-response-1.0.1.tgz",
"integrity": "sha1-SSNTiHju9CBjy4o+OweYeBSHqxs=",
"dev": true
},
"minimalistic-assert": {
"version": "1.0.1",
"resolved": "https://registry.npm.taobao.org/minimalistic-assert/download/minimalistic-assert-1.0.1.tgz",
@ -7747,41 +7476,6 @@
}
}
},
"nodemon": {
"version": "2.0.4",
"resolved": "https://registry.npm.taobao.org/nodemon/download/nodemon-2.0.4.tgz",
"integrity": "sha1-VbCTGetIjWOUqpgYFIwMLRwExBY=",
"dev": true,
"requires": {
"chokidar": "^3.2.2",
"debug": "^3.2.6",
"ignore-by-default": "^1.0.1",
"minimatch": "^3.0.4",
"pstree.remy": "^1.1.7",
"semver": "^5.7.1",
"supports-color": "^5.5.0",
"touch": "^3.1.0",
"undefsafe": "^2.0.2",
"update-notifier": "^4.0.0"
},
"dependencies": {
"debug": {
"version": "3.2.6",
"resolved": "https://registry.npm.taobao.org/debug/download/debug-3.2.6.tgz?cache=0&sync_timestamp=1593529720846&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fdebug%2Fdownload%2Fdebug-3.2.6.tgz",
"integrity": "sha1-6D0X3hbYp++3cX7b5fsQE17uYps=",
"dev": true,
"requires": {
"ms": "^2.1.1"
}
},
"semver": {
"version": "5.7.1",
"resolved": "https://registry.npm.taobao.org/semver/download/semver-5.7.1.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsemver%2Fdownload%2Fsemver-5.7.1.tgz",
"integrity": "sha1-qVT5Ma66UI0we78Gnv8MAclhFvc=",
"dev": true
}
}
},
"nopt": {
"version": "3.0.6",
"resolved": "https://registry.npm.taobao.org/nopt/download/nopt-3.0.6.tgz",
@ -8073,12 +7767,6 @@
"os-tmpdir": "^1.0.0"
}
},
"p-cancelable": {
"version": "1.1.0",
"resolved": "https://registry.npm.taobao.org/p-cancelable/download/p-cancelable-1.1.0.tgz",
"integrity": "sha1-0HjRWjr0CSIMiG8dmgyi5EGrJsw=",
"dev": true
},
"p-defer": {
"version": "1.0.0",
"resolved": "https://registry.npm.taobao.org/p-defer/download/p-defer-1.0.0.tgz",
@ -8118,26 +7806,6 @@
"resolved": "https://registry.npm.taobao.org/p-try/download/p-try-2.2.0.tgz",
"integrity": "sha1-yyhoVA4xPWHeWPr741zpAE1VQOY="
},
"package-json": {
"version": "6.5.0",
"resolved": "https://registry.npm.taobao.org/package-json/download/package-json-6.5.0.tgz",
"integrity": "sha1-b+7ayjXnVyWHbQsOZJdGl/7RRbA=",
"dev": true,
"requires": {
"got": "^9.6.0",
"registry-auth-token": "^4.0.0",
"registry-url": "^5.0.0",
"semver": "^6.2.0"
},
"dependencies": {
"semver": {
"version": "6.3.0",
"resolved": "https://registry.npm.taobao.org/semver/download/semver-6.3.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsemver%2Fdownload%2Fsemver-6.3.0.tgz",
"integrity": "sha1-7gpkyK9ejO6mdoexM3YeG+y9HT0=",
"dev": true
}
}
},
"pako": {
"version": "1.0.11",
"resolved": "https://registry.npm.taobao.org/pako/download/pako-1.0.11.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fpako%2Fdownload%2Fpako-1.0.11.tgz",
@ -9414,12 +9082,6 @@
"integrity": "sha1-kyb4vPsBOtzABf3/BWrM4CDlHCQ=",
"dev": true
},
"pstree.remy": {
"version": "1.1.8",
"resolved": "https://registry.npm.taobao.org/pstree.remy/download/pstree.remy-1.1.8.tgz",
"integrity": "sha1-wkIiT0pnwh9oaDm720rCgrg3PTo=",
"dev": true
},
"public-encrypt": {
"version": "4.0.3",
"resolved": "https://registry.npm.taobao.org/public-encrypt/download/public-encrypt-4.0.3.tgz",
@ -9475,15 +9137,6 @@
"resolved": "https://registry.npm.taobao.org/punycode/download/punycode-2.1.1.tgz",
"integrity": "sha1-tYsBCsQMIsVldhbI0sLALHv0eew="
},
"pupa": {
"version": "2.0.1",
"resolved": "https://registry.npm.taobao.org/pupa/download/pupa-2.0.1.tgz",
"integrity": "sha1-29yf9I/76komoGm2+fersFEAhyY=",
"dev": true,
"requires": {
"escape-goat": "^2.0.0"
}
},
"q": {
"version": "1.5.1",
"resolved": "https://registry.npm.taobao.org/q/download/q-1.5.1.tgz",
@ -9576,18 +9229,6 @@
"unpipe": "1.0.0"
}
},
"rc": {
"version": "1.2.8",
"resolved": "https://registry.npm.taobao.org/rc/download/rc-1.2.8.tgz?cache=0&sync_timestamp=1593529723659&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Frc%2Fdownload%2Frc-1.2.8.tgz",
"integrity": "sha1-zZJL9SAKB1uDwYjNa54hG3/A0+0=",
"dev": true,
"requires": {
"deep-extend": "^0.6.0",
"ini": "~1.3.0",
"minimist": "^1.2.0",
"strip-json-comments": "~2.0.1"
}
},
"rc9": {
"version": "1.0.0",
"resolved": "https://registry.npm.taobao.org/rc9/download/rc9-1.0.0.tgz",
@ -9761,24 +9402,6 @@
"unicode-match-property-value-ecmascript": "^1.2.0"
}
},
"registry-auth-token": {
"version": "4.2.0",
"resolved": "https://registry.npm.taobao.org/registry-auth-token/download/registry-auth-token-4.2.0.tgz?cache=0&sync_timestamp=1594638396805&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fregistry-auth-token%2Fdownload%2Fregistry-auth-token-4.2.0.tgz",
"integrity": "sha1-HTff/acrvs0PWB5HFVQCE6Zet9o=",
"dev": true,
"requires": {
"rc": "^1.2.8"
}
},
"registry-url": {
"version": "5.1.0",
"resolved": "https://registry.npm.taobao.org/registry-url/download/registry-url-5.1.0.tgz",
"integrity": "sha1-6YM0tQ1UNLgRNrROxjjZwgCcUAk=",
"dev": true,
"requires": {
"rc": "^1.2.8"
}
},
"regjsgen": {
"version": "0.5.2",
"resolved": "https://registry.npm.taobao.org/regjsgen/download/regjsgen-0.5.2.tgz",
@ -9955,15 +9578,6 @@
"resolved": "https://registry.npm.taobao.org/resolve-url/download/resolve-url-0.2.1.tgz?cache=0&sync_timestamp=1585438700247&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fresolve-url%2Fdownload%2Fresolve-url-0.2.1.tgz",
"integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo="
},
"responselike": {
"version": "1.0.2",
"resolved": "https://registry.npm.taobao.org/responselike/download/responselike-1.0.2.tgz",
"integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=",
"dev": true,
"requires": {
"lowercase-keys": "^1.0.0"
}
},
"restore-cursor": {
"version": "3.1.0",
"resolved": "https://registry.npm.taobao.org/restore-cursor/download/restore-cursor-3.1.0.tgz",
@ -10148,23 +9762,6 @@
"resolved": "https://registry.npm.taobao.org/semver/download/semver-7.3.2.tgz",
"integrity": "sha1-YElisFK4HtB4aq6EOJ/7pw/9OTg="
},
"semver-diff": {
"version": "3.1.1",
"resolved": "https://registry.npm.taobao.org/semver-diff/download/semver-diff-3.1.1.tgz",
"integrity": "sha1-Bfd85Z8yXgDicGr9Z7tQbdscoys=",
"dev": true,
"requires": {
"semver": "^6.3.0"
},
"dependencies": {
"semver": {
"version": "6.3.0",
"resolved": "https://registry.npm.taobao.org/semver/download/semver-6.3.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsemver%2Fdownload%2Fsemver-6.3.0.tgz",
"integrity": "sha1-7gpkyK9ejO6mdoexM3YeG+y9HT0=",
"dev": true
}
}
},
"send": {
"version": "0.17.1",
"resolved": "https://registry.npm.taobao.org/send/download/send-0.17.1.tgz",
@ -10921,12 +10518,6 @@
"get-stdin": "^4.0.1"
}
},
"strip-json-comments": {
"version": "2.0.1",
"resolved": "https://registry.npm.taobao.org/strip-json-comments/download/strip-json-comments-2.0.1.tgz?cache=0&sync_timestamp=1594567555399&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fstrip-json-comments%2Fdownload%2Fstrip-json-comments-2.0.1.tgz",
"integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=",
"dev": true
},
"style-resources-loader": {
"version": "1.3.3",
"resolved": "https://registry.npm.taobao.org/style-resources-loader/download/style-resources-loader-1.3.3.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fstyle-resources-loader%2Fdownload%2Fstyle-resources-loader-1.3.3.tgz",
@ -11262,12 +10853,6 @@
}
}
},
"to-readable-stream": {
"version": "1.0.0",
"resolved": "https://registry.npm.taobao.org/to-readable-stream/download/to-readable-stream-1.0.0.tgz",
"integrity": "sha1-zgqgwvPfat+FLvtASng+d8BHV3E=",
"dev": true
},
"to-regex": {
"version": "3.0.2",
"resolved": "https://registry.npm.taobao.org/to-regex/download/to-regex-3.0.2.tgz",
@ -11293,26 +10878,6 @@
"resolved": "https://registry.npm.taobao.org/toidentifier/download/toidentifier-1.0.0.tgz",
"integrity": "sha1-fhvjRw8ed5SLxD2Uo8j013UrpVM="
},
"touch": {
"version": "3.1.0",
"resolved": "https://registry.npm.taobao.org/touch/download/touch-3.1.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ftouch%2Fdownload%2Ftouch-3.1.0.tgz",
"integrity": "sha1-/jZfX3XsntTlaCXgu3bSSrdK+Ds=",
"dev": true,
"requires": {
"nopt": "~1.0.10"
},
"dependencies": {
"nopt": {
"version": "1.0.10",
"resolved": "https://registry.npm.taobao.org/nopt/download/nopt-1.0.10.tgz",
"integrity": "sha1-bd0hvSoxQXuScn3Vhfim83YI6+4=",
"dev": true,
"requires": {
"abbrev": "1"
}
}
}
},
"tough-cookie": {
"version": "2.5.0",
"resolved": "https://registry.npm.taobao.org/tough-cookie/download/tough-cookie-2.5.0.tgz?cache=0&sync_timestamp=1584646121003&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ftough-cookie%2Fdownload%2Ftough-cookie-2.5.0.tgz",
@ -11387,15 +10952,6 @@
"resolved": "https://registry.npm.taobao.org/typedarray/download/typedarray-0.0.6.tgz",
"integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c="
},
"typedarray-to-buffer": {
"version": "3.1.5",
"resolved": "https://registry.npm.taobao.org/typedarray-to-buffer/download/typedarray-to-buffer-3.1.5.tgz",
"integrity": "sha1-qX7nqf9CaRufeD/xvFES/j/KkIA=",
"dev": true,
"requires": {
"is-typedarray": "^1.0.0"
}
},
"ua-parser-js": {
"version": "0.7.21",
"resolved": "https://registry.npm.taobao.org/ua-parser-js/download/ua-parser-js-0.7.21.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fua-parser-js%2Fdownload%2Fua-parser-js-0.7.21.tgz",
@ -11406,32 +10962,6 @@
"resolved": "https://registry.npm.taobao.org/uglify-js/download/uglify-js-3.10.0.tgz?cache=0&sync_timestamp=1592744803278&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fuglify-js%2Fdownload%2Fuglify-js-3.10.0.tgz",
"integrity": "sha1-OXp+bjHOggv9HLVbgE7hQMWHqec="
},
"undefsafe": {
"version": "2.0.3",
"resolved": "https://registry.npm.taobao.org/undefsafe/download/undefsafe-2.0.3.tgz",
"integrity": "sha1-axZucJStRjE7IgLafsws18xueq4=",
"dev": true,
"requires": {
"debug": "^2.2.0"
},
"dependencies": {
"debug": {
"version": "2.6.9",
"resolved": "https://registry.npm.taobao.org/debug/download/debug-2.6.9.tgz?cache=0&sync_timestamp=1593529720846&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fdebug%2Fdownload%2Fdebug-2.6.9.tgz",
"integrity": "sha1-XRKFFd8TT/Mn6QpMk/Tgd6U2NB8=",
"dev": true,
"requires": {
"ms": "2.0.0"
}
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npm.taobao.org/ms/download/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
"dev": true
}
}
},
"unfetch": {
"version": "4.1.0",
"resolved": "https://registry.npm.taobao.org/unfetch/download/unfetch-4.1.0.tgz",
@ -11498,15 +11028,6 @@
"imurmurhash": "^0.1.4"
}
},
"unique-string": {
"version": "2.0.0",
"resolved": "https://registry.npm.taobao.org/unique-string/download/unique-string-2.0.0.tgz",
"integrity": "sha1-OcZFH4GvsnSd4rIz4/fF6IQ72J0=",
"dev": true,
"requires": {
"crypto-random-string": "^2.0.0"
}
},
"universalify": {
"version": "0.1.2",
"resolved": "https://registry.npm.taobao.org/universalify/download/universalify-0.1.2.tgz?cache=0&sync_timestamp=1583530825899&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Funiversalify%2Fdownload%2Funiversalify-0.1.2.tgz",
@ -11563,27 +11084,6 @@
"resolved": "https://registry.npm.taobao.org/upath/download/upath-1.2.0.tgz?cache=0&sync_timestamp=1567457281208&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fupath%2Fdownload%2Fupath-1.2.0.tgz",
"integrity": "sha1-j2bbzVWog6za5ECK+LA1pQRMGJQ="
},
"update-notifier": {
"version": "4.1.0",
"resolved": "https://registry.npm.taobao.org/update-notifier/download/update-notifier-4.1.0.tgz?cache=0&sync_timestamp=1593529725735&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fupdate-notifier%2Fdownload%2Fupdate-notifier-4.1.0.tgz",
"integrity": "sha1-SGa5jDvFtUc8AgsSUFg2KPmjKPM=",
"dev": true,
"requires": {
"boxen": "^4.2.0",
"chalk": "^3.0.0",
"configstore": "^5.0.1",
"has-yarn": "^2.1.0",
"import-lazy": "^2.1.0",
"is-ci": "^2.0.0",
"is-installed-globally": "^0.3.1",
"is-npm": "^4.0.0",
"is-yarn-global": "^0.3.0",
"latest-version": "^5.0.0",
"pupa": "^2.0.1",
"semver-diff": "^3.1.1",
"xdg-basedir": "^4.0.0"
}
},
"upper-case": {
"version": "1.1.3",
"resolved": "https://registry.npm.taobao.org/upper-case/download/upper-case-1.1.3.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fupper-case%2Fdownload%2Fupper-case-1.1.3.tgz",
@ -11628,23 +11128,6 @@
"schema-utils": "^2.5.0"
}
},
"url-parse-lax": {
"version": "3.0.0",
"resolved": "https://registry.npm.taobao.org/url-parse-lax/download/url-parse-lax-3.0.0.tgz",
"integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=",
"dev": true,
"requires": {
"prepend-http": "^2.0.0"
},
"dependencies": {
"prepend-http": {
"version": "2.0.0",
"resolved": "https://registry.npm.taobao.org/prepend-http/download/prepend-http-2.0.0.tgz",
"integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=",
"dev": true
}
}
},
"use": {
"version": "3.1.1",
"resolved": "https://registry.npm.taobao.org/use/download/use-3.1.1.tgz",
@ -12508,12 +11991,6 @@
"async-limiter": "~1.0.0"
}
},
"xdg-basedir": {
"version": "4.0.0",
"resolved": "https://registry.npm.taobao.org/xdg-basedir/download/xdg-basedir-4.0.0.tgz",
"integrity": "sha1-S8jZmEQDaWIl74OhVzy7y0552xM=",
"dev": true
},
"xmlhttprequest-ssl": {
"version": "1.5.5",
"resolved": "https://registry.npm.taobao.org/xmlhttprequest-ssl/download/xmlhttprequest-ssl-1.5.5.tgz",
@ -12640,6 +12117,11 @@
"version": "0.1.2",
"resolved": "https://registry.npm.taobao.org/yeast/download/yeast-0.1.2.tgz",
"integrity": "sha1-AI4G2AlDIMNy28L47XagymyKxBk="
},
"zrender": {
"version": "4.3.1",
"resolved": "https://registry.npm.taobao.org/zrender/download/zrender-4.3.1.tgz?cache=0&sync_timestamp=1596209783480&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fzrender%2Fdownload%2Fzrender-4.3.1.tgz",
"integrity": "sha1-uviqbcgYei+BlpLX1fm+36K5D6M="
}
}
}

View File

@ -12,6 +12,7 @@
"@chenfengyuan/vue-qrcode": "^1.0.2",
"@nuxtjs/axios": "^5.12.0",
"cookieparser": "^0.1.0",
"echarts": "^4.8.0",
"element-ui": "^2.13.2",
"express": "^4.17.1",
"js-cookie": "^2.2.1",

77
pages/admin.vue Normal file
View File

@ -0,0 +1,77 @@
<template>
<el-row type="flex" justify="center" :gutter="8">
<el-col v-if="hasPermissions" :span="20">
<el-col :span="4">
<el-menu
:default-active="getActiveMenu"
class="el-menu-vertical-demo"
@select="handleSelectMenu">
<el-menu-item index="admin-dashboard">
<i class="el-icon-s-data"></i>
<span slot="title">Dashboard</span>
</el-menu-item>
<el-menu-item index="admin-user">
<i class="el-icon-s-custom"></i>
<span slot="title">用户管理</span>
</el-menu-item>
<el-menu-item index="admin-role">
<i class="el-icon-s-check"></i>
<span slot="title">角色管理</span>
</el-menu-item>
<el-menu-item index="admin-topic">
<i class="el-icon-postcard"></i>
<span slot="title">专题管理</span>
</el-menu-item>
<el-menu-item index="admin-tag">
<i class="el-icon-postcard"></i>
<span slot="title">标签管理</span>
</el-menu-item>
</el-menu>
</el-col>
<el-col :span="20">
<nuxt :nuxt-child-key="$route.name" />
</el-col>
</el-col>
<el-col v-else class="text-center">
<el-alert
title="用户无权限"
type="warning"
center
show-icon
:closable="false">
</el-alert>
</el-col>
</el-row>
</template>
<script>
export default {
name: "Admin",
computed: {
getActiveMenu () {
return this.$store.state.activeMenu;
},
hasPermissions () {
return this.$store.getters.hasPermissions('blog_admin');
}
},
methods: {
handleSelectMenu(item) {
let _ts = this;
let activeMenu = _ts.$store.state.activeMenu;
if (activeMenu !== item) {
_ts.$store.commit('setActiveMenu', item);
_ts.$router.push(
{
name: item
}
)
}
}
}
}
</script>
<style scoped>
</style>

195
pages/admin/dashboard.vue Normal file
View File

@ -0,0 +1,195 @@
<template>
<el-row :gutter="8" class="text-center">
<el-col :span="4">
<el-card>
<el-col class="mt-2rem dashboard-number">{{ dashboard.countUserNum }}</el-col>
<el-col class="mt-2rem">总用户数</el-col>
</el-card>
</el-col>
<el-col :span="4">
<el-card>
<el-col class="mt-2rem dashboard-number">{{ dashboard.newUserNum }}</el-col>
<el-col class="mt-2rem">新增用户</el-col>
</el-card>
</el-col>
<el-col :span="4">
<el-card>
<el-col class="mt-2rem dashboard-number">{{ dashboard.countArticleNum }}</el-col>
<el-col class="mt-2rem">总文章数</el-col>
</el-card>
</el-col>
<el-col :span="4">
<el-card>
<el-col class="mt-2rem dashboard-number">{{ dashboard.newArticleNum }}</el-col>
<el-col class="mt-2rem">今日文章数</el-col>
</el-card>
</el-col>
<el-col :span="4">
<el-card>
<el-col class="mt-2rem dashboard-number">{{ dashboard.countViewNum }}</el-col>
<el-col class="mt-2rem">总浏览量</el-col>
</el-card>
</el-col>
<el-col :span="4">
<el-card>
<el-col class="mt-2rem dashboard-number">{{ dashboard.todayViewNum }}</el-col>
<el-col class="mt-2rem">今日浏览量</el-col>
</el-card>
</el-col>
<el-col class="mt-2rem">
<div id="lastThirtyDays" style="width: 100%;height: 500px;"></div>
</el-col>
<el-col class="mt-2rem">
<div id="history" style="width: 100%;height: 500px;"></div>
</el-col>
</el-row>
</template>
<script>
import Vue from 'vue';
import {mapState} from 'vuex';
import echarts from 'echarts';
Vue.prototype.$echarts = echarts;
export default {
name: "Dashboard",
fetch({store, params, error}) {
return Promise.all([
store
.dispatch('dashboard/fetchDashboard', params)
.catch(err => error({statusCode: 404})),
store.dispatch("dashboard/fetchLastThirtyDays"),
store.dispatch("dashboard/fetchHistory")
])
},
computed: {
...mapState({
dashboard: state => state.dashboard.data,
lastThirtyDays: state => state.dashboard.lastThirtyDays,
history: state => state.dashboard.history,
})
},
methods: {
initLastThirtyDaysCharts(data) {
let myChart = this.$echarts.init(document.getElementById('lastThirtyDays'));
//
let option = {
title: {
text: '最近 30 天'
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
label: {
backgroundColor: '#6a7985'
}
}
},
legend: {
data: ["文章", "用户", "浏览量"]
},
xAxis: {
type: 'category',
data: data.dates
},
yAxis: {
type: 'value'
},
series: [{
name: '文章',
data: data.articles,
type: 'line',
smooth: true,
areaStyle: {}
},
{
name: '用户',
data: data.users,
type: 'line',
smooth: true,
areaStyle: {}
},
{
name: '浏览量',
data: data.visits,
type: 'line',
smooth: true,
areaStyle: {}
}]
};
// 使
myChart.setOption(option);
},
initHistoryCharts(data) {
let myChart = this.$echarts.init(document.getElementById('history'));
//
let option = {
title: {
text: '历史'
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
label: {
backgroundColor: '#6a7985'
}
}
},
legend: {
data: ["文章", "用户", "浏览量"]
},
xAxis: {
type: 'category',
data: data.dates
},
yAxis: {
type: 'value'
},
series: [{
name: '文章',
data: data.articles,
type: 'line',
smooth: true,
areaStyle: {}
},
{
name: '用户',
data: data.users,
type: 'line',
smooth: true,
areaStyle: {}
},
{
name: '浏览量',
data: data.visits,
type: 'line',
smooth: true,
areaStyle: {}
}]
};
// 使
myChart.setOption(option);
}
},
mounted() {
this.$store.commit("setActiveMenu", "admin-dashboard");
this.initLastThirtyDaysCharts(this.lastThirtyDays)
this.initHistoryCharts(this.history)
}
}
</script>
<style scoped>
.mt-2rem {
margin: 2rem auto;
}
.dashboard-number {
font-weight: bold;
font-size: 2em;
}
</style>

91
store/dashboard.js Normal file
View File

@ -0,0 +1,91 @@
export const DASHBOARD_API_PATH = '/api/admin/dashboard'
const getDefaultDashboardData = () => {
return {
dashboard: {}
}
}
const getDefaultLastThirtyDaysData = () => {
return {
dates: [],
articles: [],
users: [],
visits: []
}
}
export const state = () => {
return {
fetching: false,
data: getDefaultDashboardData(),
lastThirtyDays: getDefaultLastThirtyDaysData(),
history: getDefaultLastThirtyDaysData()
}
}
export const mutations = {
updateDashboardFetching(state, action) {
state.fetching = action
},
updateDashboardData(state, action) {
state.data = action
},
updateLastThirtyDaysData(state, action) {
state.lastThirtyDays = action
},
updateHistoryData(state, action) {
state.history = action
}
}
export const actions = {
fetchDashboard({commit}, params = {}) {
// 清空已有数据
commit('updateDashboardData', getDefaultDashboardData())
commit('updateDashboardFetching', true)
return this.$axios
.$get(`${DASHBOARD_API_PATH}`)
.then(response => {
commit('updateDashboardFetching', false);
commit('updateDashboardData', response);
})
.catch(error => {
console.log(error);
commit('updateDashboardFetching', false);
});
},
fetchLastThirtyDays({commit}, params = {}) {
// 清空已有数据
commit('updateLastThirtyDaysData', getDefaultLastThirtyDaysData())
commit('updateDashboardFetching', true)
return this.$axios
.$get(`${DASHBOARD_API_PATH}/last-thirty-days`)
.then(response => {
commit('updateDashboardFetching', false);
commit('updateLastThirtyDaysData', response);
})
.catch(error => {
console.log(error);
commit('updateDashboardFetching', false);
});
},
fetchHistory({commit}, params = {}) {
// 清空已有数据
commit('updateHistoryData', getDefaultLastThirtyDaysData())
commit('updateDashboardFetching', true)
return this.$axios
.$get(`${DASHBOARD_API_PATH}/history`)
.then(response => {
commit('updateDashboardFetching', false);
commit('updateHistoryData', response);
})
.catch(error => {
console.log(error);
commit('updateDashboardFetching', false);
});
}
}