This commit is contained in:
Pan 2017-05-16 10:44:18 +08:00
parent 88f2f7eadd
commit 0da4e5e5a7
2 changed files with 34 additions and 39 deletions

View file

@ -6,31 +6,27 @@ import router from './router';
import store from './store'; import store from './store';
import ElementUI from 'element-ui'; import ElementUI from 'element-ui';
import 'element-ui/lib/theme-default/index.css'; import 'element-ui/lib/theme-default/index.css';
import 'assets/custom-theme/index.css'; // https://github.com/PanJiaChen/custom-element-theme import 'assets/custom-theme/index.css'; // 换肤版本element-ui css https://github.com/PanJiaChen/custom-element-theme
import NProgress from 'nprogress'; import NProgress from 'nprogress'; // Progress 进度条
import 'nprogress/nprogress.css'; import 'nprogress/nprogress.css';// Progress 进度条 样式
import 'normalize.css/normalize.css'; import 'normalize.css/normalize.css';// normalize.css 样式格式化
import 'styles/index.scss'; import 'styles/index.scss'; // 全局自定义的css样式
import 'components/Icon-svg/index'; import 'components/Icon-svg/index'; // 封装的svg组件
import 'assets/iconfont/iconfont'; import 'assets/iconfont/iconfont'; // iconfont 具体图标见https://github.com/PanJiaChen/vue-element-admin/wiki
import * as filters from './filters'; import * as filters from './filters'; // 全局vue filter
import Multiselect from 'vue-multiselect'; import Multiselect from 'vue-multiselect';// 使用的一个多选框组件element-ui的select不能满足所有需求
import Sticky from 'components/Sticky'; import 'vue-multiselect/dist/vue-multiselect.min.css';// 多选框组件css
import 'vue-multiselect/dist/vue-multiselect.min.css'; import Sticky from 'components/Sticky'; // 粘性header组件
import vueWaves from './directive/waves'; import vueWaves from './directive/waves';// 水波纹指令
import vueSticky from './directive/sticky'; import errLog from 'store/errLog';// error log组件
import errLog from 'store/errLog'; import './mock/index.js'; // 该项目所有请求使用mockjs模拟
import './mock/index.js'; // 使用api请求时请将此行注释不然将被mock拦截!! import permission from 'store/permission'; // 权限控制
// import './styles/mixin.scss';
import permission from 'store/permission';
// register globally // register globally
Vue.component('multiselect', Multiselect); Vue.component('multiselect', Multiselect);
Vue.component('Sticky', Sticky); Vue.component('Sticky', Sticky);
Vue.use(ElementUI); Vue.use(ElementUI);
Vue.use(vueWaves); Vue.use(vueWaves);
Vue.use(vueSticky);
// register global utility filters. // register global utility filters.
Object.keys(filters).forEach(key => { Object.keys(filters).forEach(key => {

View file

@ -26,27 +26,26 @@ service.interceptors.request.use(config => {
// respone拦截器 // respone拦截器
service.interceptors.response.use( service.interceptors.response.use(
response => response response => response
/**
* 下面的注释为通过response自定义code来标示请求状态当code返回如下情况为权限有问题登出并返回到登录页
* 如通过htmlrequest 状态码标示 逻辑可写在下面error中
*/
/** // const code = response.data.code;
/** // // 50014:Token 过期了 50012:其他客户端登录了 50008:非法的token
* 下面的注释为通过response自定义code来标示请求状态当code返回如下情况为权限有问题登出并返回到登录页 // if (code === 50008 || code === 50014 || code === 50012) {
* 如通过htmlrequest 状态码标示 逻辑可写在下面error中 // Message({
*/ // message: res.message,
// const code = response.data.code; // type: 'error',
// // 50014:Token 过期了 50012:其他客户端登录了 50008:非法的token // duration: 5 * 1000
// if (code === 50008 || code === 50014 || code === 50012) { // });
// Message({ // // 登出
// message: res.message, // store.dispatch('FedLogOut').then(() => {
// type: 'error', // router.push({ path: '/login' })
// duration: 5 * 1000 // });
// }); // } else {
// // 登出 // return response
// store.dispatch('FedLogOut').then(() => { // }
// router.push({ path: '/login' })
// });
// } else {
// return response
// }
, ,
error => { error => {
console.log('err' + error);// for debug console.log('err' + error);// for debug