Commit ce0bc314 by 黑潮

update: 权限埋点

parent a977ac86
...@@ -16,79 +16,80 @@ import '../static/font/iconfont.css'; // iconfont ...@@ -16,79 +16,80 @@ 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.config.productionTip = false; Vue.use(ElementUI);
Vue.use(VueAxios, axios);
Vue.use(ElementUI); // 注册一个全局自定义指令 `v-focus`
Vue.use(VueAxios, axios); Vue.directive('focus', function (el) {
el.querySelector('input').focus();
});
// 全局注册过滤器
Object.keys(filters).forEach(key => {
Vue.filter(key, filters[key]);
});
// 注册一个全局自定义指令 `v-focus` Vue.prototype.axios.withCredentials = true; // 跨域cookie访问
Vue.directive('focus', function(el) {
el.querySelector('input').focus();
});
// 全局注册过滤器
Object.keys(filters).forEach(key => {
Vue.filter(key, filters[key]);
});
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(
response => {
if (response.status == 200) {
if (response.data.errorCode == 4002 || response.data.errorCode == 4011) {
// 加上登录页
window.location.href = window.location.origin + '/operation-platform/#/';
}
} }
return response; );
}, Vue.axios.interceptors.response.use(
error => { response => {
if (error.response) { if (response.status == 200) {
switch (error.response.status) { if (response.data.errorCode == 4002 || response.data.errorCode == 4011) {
case 401: // 加上登录页
if (error.response.data.errorCode == 4011) { window.location.href = window.location.origin + '/operation-platform/#/';
ElementUI.MessageBox.confirm(error.response.data.message, '提示', { }
confirmButtonText: '知道了', }
showCancelButton: false, return response;
type: 'warning' },
}) error => {
.then(_ => { if (error.response) {
window.location.href = window.location.origin + '/operation-platform/#/'; switch (error.response.status) {
case 401:
if (error.response.data.errorCode == 4011) {
ElementUI.MessageBox.confirm(error.response.data.message, '提示', {
confirmButtonText: '知道了',
showCancelButton: false,
type: 'warning'
}) })
.catch(() => {}); .then(_ => {
} else { window.location.href = window.location.origin + '/operation-platform/#/';
// 加上登录页 })
window.location.href = window.location.origin + '/operation-platform/#/'; .catch(() => { });
} } else {
break; // 加上登录页
case 403: window.location.href = window.location.origin + '/operation-platform/#/';
if (error.response.data.errorCode == 4004) { }
ElementUI.Message.error(error.response.data.message); break;
} case 403:
break; if (error.response.data.errorCode == 4004) {
ElementUI.Message.error(error.response.data.message);
}
break;
}
} }
return Promise.reject(error.response.status.toString());
} }
return Promise.reject(error.response.status.toString()); );
}
);
/* eslint-disable no-new */ /* eslint-disable no-new */
new Vue({ new Vue({
el: '#app', el: '#app',
router, router,
store, store,
components: { App }, components: { App },
template: '<App/>' template: '<App/>'
});
}); });
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
width="90" width="90"
fixed="right"> fixed="right">
<template slot-scope="{row}"> <template slot-scope="{row}">
<el-button type="text" @click.prevent.native="retry(row.id)">重试</el-button> <el-button v-if="$getButtonLimit($buttonCode.interfaceRetry)" :limit-code="$buttonCode.interfaceRetry" type="text" @click.prevent.native="retry(row.id)">重试</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -281,4 +281,4 @@ export default { ...@@ -281,4 +281,4 @@ export default {
text-align: right; text-align: right;
} }
} }
</style> </style>
\ No newline at end of file
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
width="200"> width="200">
<template slot-scope="{row}"> <template slot-scope="{row}">
<el-button <el-button
v-if="$getButtonLimit($buttonCode.customerInformation)" :limit-code="$buttonCode.customerInformation"
@click.native.prevent="$router.push({ path: '/business-log?name=平台运维&icon=icon-03&code=platform_operation&tabCode=platform_business_list', query: { enterpriseId: row.enterpriseId } })" @click.native.prevent="$router.push({ path: '/business-log?name=平台运维&icon=icon-03&code=platform_operation&tabCode=platform_business_list', query: { enterpriseId: row.enterpriseId } })"
type="text"> type="text">
客户资料 客户资料
...@@ -182,4 +183,4 @@ export default { ...@@ -182,4 +183,4 @@ export default {
text-align: right; text-align: right;
margin-top: 20px; margin-top: 20px;
} }
</style> </style>
\ No newline at end of file
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