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