Commit 0e8bdb14 by 黑潮

update: 修改

parent ce0bc314
...@@ -16,35 +16,35 @@ import '../static/font/iconfont.css'; // iconfont ...@@ -16,35 +16,35 @@ import '../static/font/iconfont.css'; // iconfont
import '../theme/index.css'; // 新主题 import '../theme/index.css'; // 新主题
import './assets/common.css'; import './assets/common.css';
import filters from './filters/index.js'; import filters from './filters/index.js';
window.getLimit(router, 'haoban-devops').then(() => {
Vue.config.productionTip = false;
Vue.use(ElementUI); Vue.config.productionTip = false;
Vue.use(VueAxios, axios);
Vue.use(ElementUI);
Vue.use(VueAxios, axios);
// 注册一个全局自定义指令 `v-focus` // 注册一个全局自定义指令 `v-focus`
Vue.directive('focus', function (el) { Vue.directive('focus', function(el) {
el.querySelector('input').focus(); el.querySelector('input').focus();
}); });
// 全局注册过滤器 // 全局注册过滤器
Object.keys(filters).forEach(key => { Object.keys(filters).forEach(key => {
Vue.filter(key, filters[key]); Vue.filter(key, filters[key]);
}); });
Vue.prototype.axios.withCredentials = true; // 跨域cookie访问 Vue.prototype.axios.withCredentials = true; // 跨域cookie访问
window.$bus = new Vue(); // 全局事件 window.$bus = new Vue(); // 全局事件
// Vue.axios.defaults.baseURL = process.env['NODE_ENV'] === 'development' ? 'http://gicdev.demogic.com' : 'https://hope.demogic.com/'; // Vue.axios.defaults.baseURL = process.env['NODE_ENV'] === 'development' ? 'http://gicdev.demogic.com' : 'https://hope.demogic.com/';
Vue.axios.interceptors.request.use( Vue.axios.interceptors.request.use(
config => { config => {
return config; return config;
}, },
err => { err => {
return Promise.reject(err); return Promise.reject(err);
} }
); );
Vue.axios.interceptors.response.use( Vue.axios.interceptors.response.use(
response => { response => {
if (response.status == 200) { if (response.status == 200) {
if (response.data.errorCode == 4002 || response.data.errorCode == 4011) { if (response.data.errorCode == 4002 || response.data.errorCode == 4011) {
...@@ -67,7 +67,7 @@ window.getLimit(router, 'haoban-devops').then(() => { ...@@ -67,7 +67,7 @@ window.getLimit(router, 'haoban-devops').then(() => {
.then(_ => { .then(_ => {
window.location.href = window.location.origin + '/operation-platform/#/'; window.location.href = window.location.origin + '/operation-platform/#/';
}) })
.catch(() => { }); .catch(() => {});
} else { } else {
// 加上登录页 // 加上登录页
window.location.href = window.location.origin + '/operation-platform/#/'; window.location.href = window.location.origin + '/operation-platform/#/';
...@@ -82,9 +82,10 @@ window.getLimit(router, 'haoban-devops').then(() => { ...@@ -82,9 +82,10 @@ window.getLimit(router, 'haoban-devops').then(() => {
} }
return Promise.reject(error.response.status.toString()); return Promise.reject(error.response.status.toString());
} }
); );
/* eslint-disable no-new */ /* eslint-disable no-new */
window.getLimit(router, 'haoban-devops').then(() => {
new Vue({ new Vue({
el: '#app', el: '#app',
router, router,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment