控制台只展示有权限的菜单,登录和提示优化
This commit is contained in:
@@ -2,8 +2,9 @@
|
||||
ENV = 'development'
|
||||
|
||||
# base api
|
||||
# VUE_APP_BASE_API = 'http://local.zyplayer.com:8083/zyplayer-doc-manage'
|
||||
VUE_APP_BASE_API = 'http://doc.zyplayer.com/zyplayer-doc-manage'
|
||||
VUE_APP_BASE_API = 'http://local.zyplayer.com:8083/zyplayer-doc-manage'
|
||||
# VUE_APP_BASE_API = 'http://doc.zyplayer.com/zyplayer-doc-manage'
|
||||
|
||||
|
||||
VUE_CLI_BABEL_TRANSPILE_MODULES = true
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
<template>
|
||||
<div id="app">
|
||||
<template v-if="fullscreen">
|
||||
<router-view></router-view>
|
||||
<router-view @loginSuccess="getSelfUserInfo"></router-view>
|
||||
</template>
|
||||
<el-container v-else>
|
||||
<el-aside>
|
||||
<div style="padding: 10px;height: 100%;box-sizing: border-box;background: #fafafa;">
|
||||
<el-menu default-active="1-4-1" :router="true" class="el-menu-vertical" @open="handleOpen" @close="handleClose" :collapse="isCollapse">
|
||||
<el-menu-item index="/"><i class="el-icon-s-home"></i>控制台</el-menu-item>
|
||||
<el-submenu index="1">
|
||||
<el-submenu index="1" v-if="userAuth.userManage">
|
||||
<template slot="title">
|
||||
<i class="el-icon-s-platform"></i>
|
||||
<span slot="title">系统管理</span>
|
||||
@@ -72,6 +72,9 @@
|
||||
isCollapse: false,
|
||||
aboutDialogVisible: false,
|
||||
userSelfInfo: {},
|
||||
userAuth: {
|
||||
userManage: false
|
||||
},
|
||||
// 升级信息
|
||||
upgradeInfo: {},
|
||||
}
|
||||
@@ -114,8 +117,10 @@
|
||||
});
|
||||
},
|
||||
getSelfUserInfo() {
|
||||
consoleApi.getSelfUserInfo().then(json => {
|
||||
this.userSelfInfo = json.data;
|
||||
consoleApi.selfInfoWithAuth().then(json => {
|
||||
let infoVo = json.data || {};
|
||||
this.userSelfInfo = infoVo.userInfo || {};
|
||||
this.userAuth = infoVo.userAuth || {};
|
||||
}).catch(e => {
|
||||
console.log("获取用户信息失败", e);
|
||||
});
|
||||
|
||||
@@ -13,6 +13,9 @@ export default {
|
||||
},
|
||||
getSelfUserInfo: data => {
|
||||
return request({url: '/user/info/selfInfo', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
selfInfoWithAuth: data => {
|
||||
return request({url: '/user/info/selfInfoWithAuth', method: 'post', data: Qs.stringify(data)});
|
||||
},
|
||||
getUserInfoList: data => {
|
||||
return request({url: '/user/info/list', method: 'post', data: Qs.stringify(data)});
|
||||
|
||||
@@ -12,6 +12,7 @@ const noValidate = {
|
||||
"/zyplayer-doc-db/executor/execute": true,
|
||||
"/zyplayer-doc-db/datasource/test": true,
|
||||
};
|
||||
let lastToastLoginTime = 0;
|
||||
|
||||
service.interceptors.request.use(
|
||||
config => {
|
||||
@@ -36,7 +37,11 @@ service.interceptors.response.use(
|
||||
if (!response.config.needValidateResult || response.data.errCode == 200) {
|
||||
return response.data;
|
||||
} else if (response.data.errCode == 400) {
|
||||
vue.$message.error('请先登录');
|
||||
// 一秒钟只提示一次
|
||||
if (new Date().getTime() - lastToastLoginTime > 1000) {
|
||||
vue.$message.error('请先登录');
|
||||
lastToastLoginTime = new Date().getTime();
|
||||
}
|
||||
let redirectUrl = '';
|
||||
let locationHref = window.location.href;
|
||||
if (locationHref.indexOf("?") >= 0) {
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
if (!valid) return;
|
||||
this.loginLoading = true;
|
||||
consoleApi.userLogin(this.loginParam).then(() => {
|
||||
this.$emit('loginSuccess');
|
||||
this.loginLoading = false;
|
||||
if (!!this.redirect) {
|
||||
location.href = decodeURIComponent(this.redirect);
|
||||
|
||||
Reference in New Issue
Block a user