From 4bed888e9d1669c2b00dfc7fbd50c4cfac52eeee Mon Sep 17 00:00:00 2001 From: Pan Date: Tue, 16 May 2017 11:08:17 +0800 Subject: [PATCH] refine --- README.md | 7 +++++-- package.json | 4 +--- src/router/index.js | 8 ++++---- src/store/modules/user.js | 4 ++-- src/styles/mixin.scss | 11 +++++++---- src/utils/fetch.js | 4 +--- src/utils/index.js | 5 ----- src/views/example/table.vue | 4 ++-- 8 files changed, 22 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index d60e7b07..3a292193 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,8 @@ [English Document](https://github.com/PanJiaChen/vue-element-admin/blob/master/README-en.md) +[wiki](https://github.com/PanJiaChen/vue-element-admin/wiki) + ## 前言 > 这半年来一直在用vue写管理后台,目前后台已经有七十多个页面,十几种权限,但维护成本依然很低,所以准备开源分享一下后台开发的经验和成果。目前的技术栈主要的采用vue+element+axios.由于是个人项目,所以数据请求都是用了mockjs代替。注意:在次项目基础上改造开发时请移除mock文件,不然所有请求都将会被代理掉!注意! @@ -10,10 +12,11 @@ 相应需求,开了一个qq群 591724180 方便大家交流 + - [wiki](https://github.com/PanJiaChen/vue-element-admin/wiki) - [手摸手,带你用 vue 撸后台 系列一](https://juejin.im/post/59097cd7a22b9d0065fb61d2) - [ 手摸手,带你封装一个vue component](https://segmentfault.com/a/1190000009090836) - - [wiki](https://github.com/PanJiaChen/vue-element-admin/wiki) - + + **如有问题请先看上述问题和Wiki,不能满足,欢迎issue和pr~** ## 功能 diff --git a/package.json b/package.json index 6d06022f..9069d749 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,6 @@ "mockjs": "1.0.1-beta3", "normalize.css": "3.0.2", "nprogress": "0.2.0", - "showdown": "1.6.4", "simplemde": "1.11.2", "sortablejs": "1.5.1", "vue": "2.2.6", @@ -38,7 +37,6 @@ }, "devDependencies": { "autoprefixer": "6.7.2", - "axios-mock-adapter": "1.8.1", "babel-core": "6.22.1", "babel-eslint": "7.1.1", "babel-loader": "6.2.10", @@ -79,7 +77,7 @@ "vue-loader": "12.0.4", "vue-style-loader": "2.0.5", "vue-template-compiler": "2.2.6", - "webpack": "2.2.3", + "webpack": "2.5.1", "webpack-bundle-analyzer": "2.2.1", "webpack-dashboard": "0.2.1", "webpack-dev-middleware": "1.10.0", diff --git a/src/router/index.js b/src/router/index.js index 86caba70..76204649 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -64,11 +64,11 @@ const Permission = resolve => require(['../views/permission/index'], resolve); Vue.use(Router); /** - * icon :the icon show in the sidebar - * hidden: if hiddenLtrue will not show in the sidebar - * redirect :if redirect:noredirect will not redirct in the levelbar + * icon : the icon show in the sidebar + * hidden : if hidden:true will not show in the sidebar + * redirect : if redirect:noredirect will not redirct in the levelbar * noDropdown : if noDropdown:true will not has submenu - * meta: { role: ['admin'] } will control the page role + * meta : { role: ['admin'] } will control the page role */ export default new Router({ // mode: 'history', //后端支持可开 diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 12836172..869d0256 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -79,7 +79,7 @@ const user = { }, - // 获取用户信息 + // 获取用户信息 GetInfo({ commit, state }) { return new Promise((resolve, reject) => { getInfo(state.token).then(response => { @@ -125,7 +125,7 @@ const user = { }); }, - // 前端 登出 + // 前端 登出 FedLogOut({ commit }) { return new Promise(resolve => { commit('SET_TOKEN', ''); diff --git a/src/styles/mixin.scss b/src/styles/mixin.scss index 4368917e..822ab92a 100644 --- a/src/styles/mixin.scss +++ b/src/styles/mixin.scss @@ -37,19 +37,22 @@ $transparent-border-style: $width solid transparent; height: 0; width: 0; - @if $direction == up { + @if $direction==up { border-bottom: $color-border-style; border-left: $transparent-border-style; border-right: $transparent-border-style; - } @else if $direction == right { + } + @else if $direction==right { border-left: $color-border-style; border-top: $transparent-border-style; border-bottom: $transparent-border-style; - } @else if $direction == down { + } + @else if $direction==down { border-top: $color-border-style; border-left: $transparent-border-style; border-right: $transparent-border-style; - } @else if $direction == left { + } + @else if $direction==left { border-right: $color-border-style; border-top: $transparent-border-style; border-bottom: $transparent-border-style; diff --git a/src/utils/fetch.js b/src/utils/fetch.js index ab220140..8e589a8b 100644 --- a/src/utils/fetch.js +++ b/src/utils/fetch.js @@ -12,7 +12,6 @@ const service = axios.create({ // request拦截器 service.interceptors.request.use(config => { // Do something before request is sent - console.log(store.getters.token) if (store.getters.token) { config.headers['X-Token'] = store.getters.token; // 让每个请求携带token--['X-Token']为自定义key 请根据实际情况自行修改 } @@ -28,9 +27,8 @@ service.interceptors.response.use( response => response /** * 下面的注释为通过response自定义code来标示请求状态,当code返回如下情况为权限有问题,登出并返回到登录页 - * 如通过htmlrequest 状态码标示 逻辑可写在下面error中 + * 如通过xmlhttprequest 状态码标识 逻辑可写在下面error中 */ - // const code = response.data.code; // // 50014:Token 过期了 50012:其他客户端登录了 50008:非法的token // if (code === 50008 || code === 50014 || code === 50012) { diff --git a/src/utils/index.js b/src/utils/index.js index 3f4c88bb..a011f17e 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -1,8 +1,6 @@ /** * Created by jiachenpan on 16/11/18. */ - import showdown from 'showdown' // markdown转化 - const converter = new showdown.Converter(); export function parseTime(time, cFormat) { if (arguments.length === 0) { @@ -214,6 +212,3 @@ } } - export function showdownMD(md) { - return converter.makeHtml(md) - } diff --git a/src/views/example/table.vue b/src/views/example/table.vue index 5d597e08..0664293e 100644 --- a/src/views/example/table.vue +++ b/src/views/example/table.vue @@ -321,8 +321,8 @@ }, handleFetchPv(pv) { fetchPv(pv).then(response => { - this.pvData = response.pvData - this.dialogPvVisible = true + this.pvData = response.data.pvData; + this.dialogPvVisible = true; }) }, handleDownload() {