parent
038f59d155
commit
53e4048944
@ -28,7 +28,8 @@ import {
|
|||||||
CloudUploadOutlined,
|
CloudUploadOutlined,
|
||||||
CopyOutlined,
|
CopyOutlined,
|
||||||
DeleteOutlined,
|
DeleteOutlined,
|
||||||
DesktopOutlined, ExpandOutlined,
|
DesktopOutlined,
|
||||||
|
ExpandOutlined,
|
||||||
FileZipOutlined,
|
FileZipOutlined,
|
||||||
FolderAddOutlined,
|
FolderAddOutlined,
|
||||||
LoadingOutlined,
|
LoadingOutlined,
|
||||||
@ -65,6 +66,7 @@ class Access extends Component {
|
|||||||
state = {
|
state = {
|
||||||
sessionId: '',
|
sessionId: '',
|
||||||
client: {},
|
client: {},
|
||||||
|
clientState: STATE_IDLE,
|
||||||
clipboardVisible: false,
|
clipboardVisible: false,
|
||||||
clipboardText: '',
|
clipboardText: '',
|
||||||
containerOverflow: 'hidden',
|
containerOverflow: 'hidden',
|
||||||
@ -107,16 +109,13 @@ class Access extends Component {
|
|||||||
this.renderDisplay(sessionId, protocol);
|
this.renderDisplay(sessionId, protocol);
|
||||||
|
|
||||||
window.addEventListener('resize', this.onWindowResize);
|
window.addEventListener('resize', this.onWindowResize);
|
||||||
window.addEventListener('onfocus', this.onWindowFocus);
|
window.onfocus = this.onWindowFocus;
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
if (this.state.client) {
|
if (this.state.client) {
|
||||||
this.state.client.disconnect();
|
this.state.client.disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
window.removeEventListener('resize', this.onWindowResize);
|
|
||||||
document.removeEventListener("onfocus", this.onWindowFocus);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sendClipboard(data) {
|
sendClipboard(data) {
|
||||||
@ -158,7 +157,7 @@ class Access extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onTunnelStateChange = (state) => {
|
onTunnelStateChange = (state) => {
|
||||||
console.log('onTunnelStateChange', state);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
updateSessionStatus = async (sessionId) => {
|
updateSessionStatus = async (sessionId) => {
|
||||||
@ -169,24 +168,23 @@ class Access extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onClientStateChange = (state) => {
|
onClientStateChange = (state) => {
|
||||||
|
this.setState({
|
||||||
|
clientState: state
|
||||||
|
});
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case STATE_IDLE:
|
case STATE_IDLE:
|
||||||
console.log('初始化');
|
|
||||||
message.destroy();
|
message.destroy();
|
||||||
message.loading('正在初始化中...', 0);
|
message.loading('正在初始化中...', 0);
|
||||||
break;
|
break;
|
||||||
case STATE_CONNECTING:
|
case STATE_CONNECTING:
|
||||||
console.log('正在连接...');
|
|
||||||
message.destroy();
|
message.destroy();
|
||||||
message.loading('正在努力连接中...', 0);
|
message.loading('正在努力连接中...', 0);
|
||||||
break;
|
break;
|
||||||
case STATE_WAITING:
|
case STATE_WAITING:
|
||||||
console.log('正在等待...');
|
|
||||||
message.destroy();
|
message.destroy();
|
||||||
message.loading('正在等待服务器响应...', 0);
|
message.loading('正在等待服务器响应...', 0);
|
||||||
break;
|
break;
|
||||||
case STATE_CONNECTED:
|
case STATE_CONNECTED:
|
||||||
console.log('连接成功。');
|
|
||||||
this.onWindowResize(null);
|
this.onWindowResize(null);
|
||||||
message.destroy();
|
message.destroy();
|
||||||
message.success('连接成功');
|
message.success('连接成功');
|
||||||
@ -195,12 +193,10 @@ class Access extends Component {
|
|||||||
})
|
})
|
||||||
break;
|
break;
|
||||||
case STATE_DISCONNECTING:
|
case STATE_DISCONNECTING:
|
||||||
console.log('连接正在关闭中...');
|
|
||||||
message.destroy();
|
message.destroy();
|
||||||
message.loading('正在关闭连接...', 0);
|
message.loading('正在关闭连接...', 0);
|
||||||
break;
|
break;
|
||||||
case STATE_DISCONNECTED:
|
case STATE_DISCONNECTED:
|
||||||
console.log('连接关闭。');
|
|
||||||
message.destroy();
|
message.destroy();
|
||||||
message.error('连接关闭');
|
message.error('连接关闭');
|
||||||
break;
|
break;
|
||||||
@ -346,9 +342,6 @@ class Access extends Component {
|
|||||||
if (true === this.state.clipboardVisible || true === this.state.confirmVisible) {
|
if (true === this.state.clipboardVisible || true === this.state.confirmVisible) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('--------------------')
|
|
||||||
console.log(keysym)
|
|
||||||
this.state.client.sendKeyEvent(1, keysym);
|
this.state.client.sendKeyEvent(1, keysym);
|
||||||
if (keysym === 65288) {
|
if (keysym === 65288) {
|
||||||
return false;
|
return false;
|
||||||
@ -375,13 +368,13 @@ class Access extends Component {
|
|||||||
|
|
||||||
fullScreen = () => {
|
fullScreen = () => {
|
||||||
let fs = this.state.fullScreen;
|
let fs = this.state.fullScreen;
|
||||||
if(fs){
|
if (fs) {
|
||||||
exitFull();
|
exitFull();
|
||||||
this.setState({
|
this.setState({
|
||||||
fullScreen: false,
|
fullScreen: false,
|
||||||
fullScreenBtnText: '进入全屏'
|
fullScreenBtnText: '进入全屏'
|
||||||
})
|
})
|
||||||
}else {
|
} else {
|
||||||
requestFullScreen(document.documentElement);
|
requestFullScreen(document.documentElement);
|
||||||
this.setState({
|
this.setState({
|
||||||
fullScreen: true,
|
fullScreen: true,
|
||||||
@ -399,7 +392,6 @@ class Access extends Component {
|
|||||||
if (element) {
|
if (element) {
|
||||||
element.value = this.state.clipboardText;
|
element.value = this.state.clipboardText;
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -567,7 +559,7 @@ class Access extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onWindowFocus = (e) => {
|
onWindowFocus = (e) => {
|
||||||
if (navigator.clipboard) {
|
if (navigator.clipboard && this.state.clientState === STATE_CONNECTED) {
|
||||||
navigator.clipboard.readText().then((text) => {
|
navigator.clipboard.readText().then((text) => {
|
||||||
this.sendClipboard({
|
this.sendClipboard({
|
||||||
'data': text,
|
'data': text,
|
||||||
@ -844,7 +836,7 @@ class Access extends Component {
|
|||||||
<Menu.Item key="2" icon={<FileZipOutlined/>} onClick={this.showFileSystem}>
|
<Menu.Item key="2" icon={<FileZipOutlined/>} onClick={this.showFileSystem}>
|
||||||
文件管理
|
文件管理
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Item key="3" icon={<ExpandOutlined />} onClick={this.fullScreen}>
|
<Menu.Item key="3" icon={<ExpandOutlined/>} onClick={this.fullScreen}>
|
||||||
{this.state.fullScreenBtnText}
|
{this.state.fullScreenBtnText}
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<SubMenu title="发送快捷键" icon={<DesktopOutlined/>}>
|
<SubMenu title="发送快捷键" icon={<DesktopOutlined/>}>
|
||||||
@ -852,8 +844,14 @@ class Access extends Component {
|
|||||||
onClick={() => this.sendCombinationKey(['65507', '65513', '65535'])}>Ctrl+Alt+Delete</Menu.Item>
|
onClick={() => this.sendCombinationKey(['65507', '65513', '65535'])}>Ctrl+Alt+Delete</Menu.Item>
|
||||||
<Menu.Item
|
<Menu.Item
|
||||||
onClick={() => this.sendCombinationKey(['65507', '65513', '65288'])}>Ctrl+Alt+Backspace</Menu.Item>
|
onClick={() => this.sendCombinationKey(['65507', '65513', '65288'])}>Ctrl+Alt+Backspace</Menu.Item>
|
||||||
|
<Menu.Item
|
||||||
|
onClick={() => this.sendCombinationKey(['65515', '100'])}>Windows+D</Menu.Item>
|
||||||
|
<Menu.Item
|
||||||
|
onClick={() => this.sendCombinationKey(['65515', '101'])}>Windows+E</Menu.Item>
|
||||||
<Menu.Item
|
<Menu.Item
|
||||||
onClick={() => this.sendCombinationKey(['65515', '114'])}>Windows+R</Menu.Item>
|
onClick={() => this.sendCombinationKey(['65515', '114'])}>Windows+R</Menu.Item>
|
||||||
|
<Menu.Item
|
||||||
|
onClick={() => this.sendCombinationKey(['65515', '120'])}>Windows+X</Menu.Item>
|
||||||
<Menu.Item
|
<Menu.Item
|
||||||
onClick={() => this.sendCombinationKey(['65515'])}>Windows</Menu.Item>
|
onClick={() => this.sendCombinationKey(['65515'])}>Windows</Menu.Item>
|
||||||
</SubMenu>
|
</SubMenu>
|
||||||
|
@ -43,18 +43,12 @@ class Access extends Component {
|
|||||||
rate: rate,
|
rate: rate,
|
||||||
})
|
})
|
||||||
this.renderDisplay(connectionId);
|
this.renderDisplay(connectionId);
|
||||||
|
|
||||||
window.addEventListener('resize', this.onWindowResize);
|
|
||||||
window.addEventListener('onfocus', this.onWindowFocus);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
if (this.state.client) {
|
if (this.state.client) {
|
||||||
this.state.client.disconnect();
|
this.state.client.disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
window.removeEventListener('resize', this.onWindowResize);
|
|
||||||
document.removeEventListener("onfocus", this.onWindowFocus);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onTunnelStateChange = (state) => {
|
onTunnelStateChange = (state) => {
|
||||||
|
@ -49,13 +49,21 @@ class UserShareSelectedAsset extends Component {
|
|||||||
userGroupId: this.props.userGroupId
|
userGroupId: this.props.userGroupId
|
||||||
})
|
})
|
||||||
|
|
||||||
|
this.init(this.props.sharer, this.props.userGroupId);
|
||||||
this.loadTableData();
|
this.loadTableData();
|
||||||
this.init(this.props.sharer, this.props.userGroupId)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async init(sharer, userGroupId) {
|
async init(sharer, userGroupId) {
|
||||||
|
|
||||||
|
let params = {
|
||||||
|
pageIndex: 1,
|
||||||
|
pageSize: 1000,
|
||||||
|
sharer: sharer,
|
||||||
|
userGroupId: userGroupId
|
||||||
|
}
|
||||||
|
let paramStr = qs.stringify(params);
|
||||||
let q1 = request.get('/tags');
|
let q1 = request.get('/tags');
|
||||||
let q2 = request.get(`/assets/paging?pageIndex=1&pageSize=1000&sharer=${sharer}&userGroupId=${userGroupId}`);
|
let q2 = request.get(`/assets/paging?${paramStr}`);
|
||||||
|
|
||||||
let r1 = await q1;
|
let r1 = await q1;
|
||||||
let r2 = await q2;
|
let r2 = await q2;
|
||||||
|
Loading…
Reference in New Issue
Block a user