Compare commits

...

4 Commits

Author SHA1 Message Date
174f5ac79e ?? 2020-06-30 16:05:26 +08:00
0cc623c98b ?? 2020-06-30 16:04:42 +08:00
647be6fd8f 去掉console 2020-06-30 16:02:31 +08:00
d7fb3356e8 为每个ajax请求添加一个进度条 2020-06-30 15:26:12 +08:00
6 changed files with 111 additions and 7 deletions

View File

@ -1,5 +1,7 @@
module.exports = { module.exports = {
presets: [ presets: [
'@vue/cli-plugin-babel/preset' '@vue/cli-plugin-babel/preset'
] ],
plugins: ['transform-remove-console']
} }

View File

@ -13,6 +13,7 @@
"echarts": "^4.8.0", "echarts": "^4.8.0",
"element-ui": "^2.13.2", "element-ui": "^2.13.2",
"lodash": "^4.17.15", "lodash": "^4.17.15",
"nprogress": "^0.2.0",
"vue": "^2.6.11", "vue": "^2.6.11",
"vue-quill-editor": "^3.0.6", "vue-quill-editor": "^3.0.6",
"vue-router": "^3.2.0", "vue-router": "^3.2.0",
@ -25,6 +26,7 @@
"@vue/cli-service": "~4.4.0", "@vue/cli-service": "~4.4.0",
"@vue/eslint-config-standard": "^5.1.2", "@vue/eslint-config-standard": "^5.1.2",
"babel-eslint": "^10.1.0", "babel-eslint": "^10.1.0",
"babel-plugin-transform-remove-console": "^6.9.4",
"eslint": "^6.7.2", "eslint": "^6.7.2",
"eslint-plugin-import": "^2.20.2", "eslint-plugin-import": "^2.20.2",
"eslint-plugin-node": "^11.1.0", "eslint-plugin-node": "^11.1.0",

File diff suppressed because one or more lines are too long

View File

@ -17,8 +17,7 @@ import echarts from 'echarts'
import _ from 'lodash' import _ from 'lodash'
export default { export default {
props: { props: {},
},
data () { data () {
return { return {
options: { options: {
@ -58,9 +57,7 @@ export default {
const chart = echarts.init(document.querySelector('#main')) const chart = echarts.init(document.querySelector('#main'))
this.$http.get('reports/type/1').then(response => { this.$http.get('reports/type/1').then(response => {
const res = response.data const res = response.data
console.log(res.data, this.options)
const r = _.merge(res.data, this.options) const r = _.merge(res.data, this.options)
console.log(r)
chart.setOption(r) chart.setOption(r)
}) })
} }

View File

@ -14,17 +14,25 @@ import 'quill/dist/quill.snow.css' // for snow theme
import 'quill/dist/quill.bubble.css' // for bubble theme import 'quill/dist/quill.bubble.css' // for bubble theme
import timeline from 'element-ui/lib/timeline' import timeline from 'element-ui/lib/timeline'
import timelineItem from 'element-ui/lib/timeline-item' import timelineItem from 'element-ui/lib/timeline-item'
// 进度条
import NProgres from 'nprogress'
import 'nprogress/nprogress.css'
Vue.use(timeline) Vue.use(timeline)
Vue.use(timelineItem) Vue.use(timelineItem)
Vue.use(vueQuillEditor) Vue.use(vueQuillEditor)
Vue.component('table-tree', tableTree) Vue.component('table-tree', tableTree)
axios.defaults.baseURL = 'http://127.0.0.1:8888/api/private/v1/' axios.defaults.baseURL = 'http://127.0.0.1:8888/api/private/v1/'
// 为每个请求头挂一个 token // 为每个ajax请求头挂一个 token 并加载进度条
axios.interceptors.request.use(config => { axios.interceptors.request.use(config => {
NProgres.start()
config.headers.Authorization = sessionStorage.getItem('token') config.headers.Authorization = sessionStorage.getItem('token')
return config return config
}) })
axios.interceptors.response.use(response => {
NProgres.done()
return response
})
Vue.filter('dataFormat', (time) => { Vue.filter('dataFormat', (time) => {
const dt = (new Date(time)) const dt = (new Date(time))

View File

@ -1695,6 +1695,11 @@ babel-plugin-dynamic-import-node@^2.3.3:
dependencies: dependencies:
object.assign "^4.1.0" object.assign "^4.1.0"
babel-plugin-transform-remove-console@^6.9.4:
version "6.9.4"
resolved "https://registry.npm.taobao.org/babel-plugin-transform-remove-console/download/babel-plugin-transform-remove-console-6.9.4.tgz#b980360c067384e24b357a588d807d3c83527780"
integrity sha1-uYA2DAZzhOJLNXpYjYB9PINSd4A=
babel-runtime@6.x: babel-runtime@6.x:
version "6.26.0" version "6.26.0"
resolved "https://registry.npm.taobao.org/babel-runtime/download/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe" resolved "https://registry.npm.taobao.org/babel-runtime/download/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe"
@ -5738,6 +5743,11 @@ npm-run-path@^4.0.0:
dependencies: dependencies:
path-key "^3.0.0" path-key "^3.0.0"
nprogress@^0.2.0:
version "0.2.0"
resolved "https://registry.npm.taobao.org/nprogress/download/nprogress-0.2.0.tgz#cb8f34c53213d895723fcbab907e9422adbcafb1"
integrity sha1-y480xTIT2JVyP8urkH6UIq28r7E=
nth-check@^1.0.2, nth-check@~1.0.1: nth-check@^1.0.2, nth-check@~1.0.1:
version "1.0.2" version "1.0.2"
resolved "https://registry.yarnpkg.com/nth-check/-/nth-check-1.0.2.tgz#b2bd295c37e3dd58a3bf0700376663ba4d9cf05c" resolved "https://registry.yarnpkg.com/nth-check/-/nth-check-1.0.2.tgz#b2bd295c37e3dd58a3bf0700376663ba4d9cf05c"