优化菜单和登录按钮
This commit is contained in:
parent
cdbb7b567a
commit
ba982dacd0
@ -36,7 +36,7 @@ import request from "./common/request";
|
|||||||
import {message} from "antd/es";
|
import {message} from "antd/es";
|
||||||
import Setting from "./components/setting/Setting";
|
import Setting from "./components/setting/Setting";
|
||||||
import BatchCommand from "./components/command/BatchCommand";
|
import BatchCommand from "./components/command/BatchCommand";
|
||||||
import {NT_PACKAGE} from "./utils/utils";
|
import {isEmpty, NT_PACKAGE} from "./utils/utils";
|
||||||
import {isAdmin} from "./service/permission";
|
import {isAdmin} from "./service/permission";
|
||||||
import UserGroup from "./components/user/UserGroup";
|
import UserGroup from "./components/user/UserGroup";
|
||||||
import LoginLog from "./components/session/LoginLog";
|
import LoginLog from "./components/session/LoginLog";
|
||||||
@ -64,16 +64,17 @@ class App extends Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.getInfo().then(r => {
|
let hash = window.location.hash;
|
||||||
});
|
let current = hash.replace('#/', '');
|
||||||
|
if(isEmpty(current)){
|
||||||
|
current = 'dashboard';
|
||||||
|
}
|
||||||
|
this.setCurrent(current);
|
||||||
|
this.getInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getInfo() {
|
async getInfo() {
|
||||||
|
|
||||||
if ('/login' === window.location.pathname) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let result = await request.get('/info');
|
let result = await request.get('/info');
|
||||||
if (result['code'] === 1) {
|
if (result['code'] === 1) {
|
||||||
this.setState({
|
this.setState({
|
||||||
@ -151,7 +152,7 @@ class App extends Component {
|
|||||||
资产列表
|
资产列表
|
||||||
</Link>
|
</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Item key="idcard" icon={<IdcardOutlined/>}>
|
<Menu.Item key="credential" icon={<IdcardOutlined/>}>
|
||||||
<Link to={'/credential'}>
|
<Link to={'/credential'}>
|
||||||
授权凭证
|
授权凭证
|
||||||
</Link>
|
</Link>
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
// prod
|
// prod
|
||||||
// let wsPrefix;
|
let wsPrefix;
|
||||||
// if (window.location.protocol === 'https:') {
|
if (window.location.protocol === 'https:') {
|
||||||
// wsPrefix = 'wss:'
|
wsPrefix = 'wss:'
|
||||||
// } else {
|
} else {
|
||||||
// wsPrefix = 'ws:'
|
wsPrefix = 'ws:'
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// export const server = '';
|
export const server = '';
|
||||||
// export const wsServer = wsPrefix + window.location.host;
|
export const wsServer = wsPrefix + window.location.host;
|
||||||
// export const prefix = window.location.protocol + '//' + window.location.host;
|
export const prefix = window.location.protocol + '//' + window.location.host;
|
||||||
|
|
||||||
// dev
|
// dev
|
||||||
export const server = '//127.0.0.1:8088';
|
// export const server = '//127.0.0.1:8088';
|
||||||
export const wsServer = 'ws://127.0.0.1:8088';
|
// export const wsServer = 'ws://127.0.0.1:8088';
|
||||||
export const prefix = '';
|
// export const prefix = '';
|
||||||
|
|
||||||
export const PROTOCOL_COLORS = {
|
export const PROTOCOL_COLORS = {
|
||||||
'rdp': 'red',
|
'rdp': 'red',
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import React, {Component} from 'react';
|
import React, {Component} from 'react';
|
||||||
import {Button, message, Popconfirm} from "antd";
|
import {Button, Dropdown, Menu, message, Popconfirm} from "antd";
|
||||||
import request from "../../common/request";
|
import request from "../../common/request";
|
||||||
|
import {getCurrentUser} from "../../service/permission";
|
||||||
|
|
||||||
class Logout extends Component {
|
class Logout extends Component {
|
||||||
|
|
||||||
@ -14,9 +15,14 @@ class Logout extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
|
||||||
<div>
|
const menu = (
|
||||||
|
<Menu>
|
||||||
|
|
||||||
|
<Menu.Item>
|
||||||
|
|
||||||
<Popconfirm
|
<Popconfirm
|
||||||
key='login-btn-pop'
|
key='login-btn-pop'
|
||||||
title="您确定要退出登录吗?"
|
title="您确定要退出登录吗?"
|
||||||
@ -25,11 +31,20 @@ class Logout extends Component {
|
|||||||
cancelText="取消"
|
cancelText="取消"
|
||||||
placement="left"
|
placement="left"
|
||||||
>
|
>
|
||||||
<Button key="login-btn" type="dashed">
|
|
||||||
退出登录
|
退出登录
|
||||||
</Button>
|
|
||||||
</Popconfirm>
|
</Popconfirm>
|
||||||
|
</Menu.Item>
|
||||||
|
|
||||||
|
</Menu>
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<Dropdown overlay={menu}>
|
||||||
|
<Button key="login-btn" type="dashed">
|
||||||
|
{getCurrentUser()['nickname']}
|
||||||
|
</Button>
|
||||||
|
</Dropdown>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user