diff --git a/web/src/App.js b/web/src/App.js index 0795536..275c78f 100644 --- a/web/src/App.js +++ b/web/src/App.js @@ -36,7 +36,7 @@ import request from "./common/request"; import {message} from "antd/es"; import Setting from "./components/setting/Setting"; 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 UserGroup from "./components/user/UserGroup"; import LoginLog from "./components/session/LoginLog"; @@ -64,16 +64,17 @@ class App extends Component { }; 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() { - if ('/login' === window.location.pathname) { - return; - } - let result = await request.get('/info'); if (result['code'] === 1) { this.setState({ @@ -151,7 +152,7 @@ class App extends Component { 资产列表 - }> + }> 授权凭证 diff --git a/web/src/common/constants.js b/web/src/common/constants.js index 7c151b5..2d8289f 100644 --- a/web/src/common/constants.js +++ b/web/src/common/constants.js @@ -1,19 +1,19 @@ // prod -// let wsPrefix; -// if (window.location.protocol === 'https:') { -// wsPrefix = 'wss:' -// } else { -// wsPrefix = 'ws:' -// } -// -// export const server = ''; -// export const wsServer = wsPrefix + window.location.host; -// export const prefix = window.location.protocol + '//' + window.location.host; +let wsPrefix; +if (window.location.protocol === 'https:') { + wsPrefix = 'wss:' +} else { + wsPrefix = 'ws:' +} + +export const server = ''; +export const wsServer = wsPrefix + window.location.host; +export const prefix = window.location.protocol + '//' + window.location.host; // dev -export const server = '//127.0.0.1:8088'; -export const wsServer = 'ws://127.0.0.1:8088'; -export const prefix = ''; +// export const server = '//127.0.0.1:8088'; +// export const wsServer = 'ws://127.0.0.1:8088'; +// export const prefix = ''; export const PROTOCOL_COLORS = { 'rdp': 'red', diff --git a/web/src/components/user/Logout.js b/web/src/components/user/Logout.js index 82c8a3c..164de7f 100644 --- a/web/src/components/user/Logout.js +++ b/web/src/components/user/Logout.js @@ -1,6 +1,7 @@ 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 {getCurrentUser} from "../../service/permission"; class Logout extends Component { @@ -14,22 +15,36 @@ class Logout extends Component { } } + render() { + + const menu = ( + + + + + + 退出登录 + + + + + ); + return (
- + - - +
); }