hookehuyr

fix 配置优化

......@@ -42,4 +42,4 @@ module.exports = {
parserOptions: {
parser: 'babel-eslint'
}
}
};
......
{
"bitwise": false,
"camelcase": true,
"curly": true,
"eqeqeq": true,
"esversion": 6,
"forin": true,
"freeze": true,
"funcscope": true,
"futurehostile": true,
"immed": true,
"indent": 4,
"latedef": true,
"maxdepth": 4,
"maxerr": 10000,
"maxlen": 200,
"maxparams": 4,
"maxstatements": 1000,
"newcap": true,
"noarg": true,
"nocomma": true,
"noempty": false,
"nonbsp": true,
"nonew": true,
"notypeof": false,
"quotmark": "single",
"shadow": "inner",
"singleGroups": true,
"strict": false,
"undef": true,
"unused": true,
"varstmt": false,
"asi": true,
"boss": true,
"debug": true,
"elision": true,
"eqnull": true,
"evil": true,
"expr": true,
"lastsemic": true,
"laxbreak": true,
"laxcomma": true,
"loopfunc": true,
"multistr": true,
"plusplus": false,
"proto": true,
"sub": true,
"browser": true,
"jquery": true,
"devel": true,
"globals": {
"define": true,
"module": true,
"export": true,
"console": true,
"THREE": true,
"TWEEN": true,
"Stats":true,
"_": true
}
}
import axios from 'axios'
import router from './router'
// 请求拦截器
axios.interceptors.request.use(
config => {
// 发送请求前
let hash = location.hash.split('?')[0];
config.headers['Step-Url'] = location.pathname + hash;
if (config.params) {
config.params = _.merge(config.params, { version: 'v.1.1.0 ' })
} else {
config.params = {
version: 'v.1.1.0'
}
}
return config;
},
error => {
// 请求错误处理
return Promise.reject(error);
})
// 响应拦截器
axios.interceptors.response.use(
response => {
return response;
},
error => {
if (error.response) {
switch (error.response.status) {
case 401:
if (window.location.hostname === 'localhost') {
window.location.href = '../login.html';
} else {
let h = window.location.origin + '/' + _.split(window.location.pathname, '/', 2)[1] + '/login.html';
window.location.href = error.response.data.hasOwnProperty('content') ? error.response.data.content : h;
}
break;
case 404:
router.replace({
path: '/'
})
break;
}
}
return Promise.reject(error.response.data);
})
export default axios;
......@@ -2,6 +2,7 @@ import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import axios from './http'
import MuseUI from 'muse-ui';
import 'muse-ui/dist/muse-ui.css';
import Toast from 'muse-ui-toast';
......@@ -20,5 +21,6 @@ Vue.use(NProgress);
new Vue({
router,
store,
axios,
render: h => h(App)
}).$mount('#app')
......
......@@ -148,9 +148,6 @@ export default {
position: relative;
}
// /deep/.mu-table th.is-sortable {
// color: rgba(0,0,0,.87);
// }
/deep/.mu-table th.is-sortable .mu-table-sort-icon {
opacity: .6;
}
......
......@@ -3,7 +3,7 @@ const path = require('path')
const webpack = require('webpack')
const CompressionWebpackPlugin = require('compression-webpack-plugin')
function resolve(dir) {
function resolve (dir) {
return path.join(__dirname, './', dir)
}
......@@ -119,16 +119,16 @@ module.exports = {
*/
config
.plugin('html-index')
.tap(args => {
if (process.env.NODE_ENV === 'production') {
args[0].cdn = cdn.build
}
if (process.env.NODE_ENV === 'development') {
args[0].cdn = cdn.dev
}
return args
})
.end()
.tap(args => {
if (process.env.NODE_ENV === 'production') {
args[0].cdn = cdn.build
}
if (process.env.NODE_ENV === 'development') {
args[0].cdn = cdn.dev
}
return args
})
.end()
},
// css相关配置
css: {
......