Browse Source

退出应用按钮

simplify_dependencies
巴林闲侠 2 years ago
parent
commit
152fd7058f
  1. 12
      console/client/src/sections/console/actions/index.js
  2. 68
      console/client/src/sections/console/containers/index.js
  3. 1
      console/client/src/utils/webapi.js

12
console/client/src/sections/console/actions/index.js

@ -38,9 +38,21 @@ export function getVideo (params) {
});
}
export function logoutApp (params) {
return dispatch => basicAction({
type: 'get',
query: params,
dispatch: dispatch,
actionType: 'LOGOUT_APP',
url: ApiTable.logoutApp,
msg: { error: '退出应用失败' },
});
}
export default {
editCrane,
getCrane,
getVideo,
logoutApp,
}

68
console/client/src/sections/console/containers/index.js

@ -2,11 +2,11 @@ import React, { useEffect, useState, useRef } from 'react'
import { push } from 'react-router-redux';
import { connect } from 'react-redux';
import request from 'superagent';
import { getCrane } from '../actions'
import { getCrane, logoutApp } from '../actions'
import { ApiTable } from '$utils'
import { Colors } from '@peace/utils'
import {
SettingOutlined, VideoCameraOutlined
SettingOutlined, VideoCameraOutlined, LogoutOutlined
} from '@ant-design/icons';
import VideoModal from '../components/videoModal'
import { Col, Row, Button, Modal, Input, Space } from 'antd';
@ -57,6 +57,7 @@ function Index (props) {
})
const [isModalOpen, setIsModalOpen] = useState(false);
const [videoVis, setVideoVis] = useState(false)
const [isOutModalOpen, setIsOutModalOpen] = useState(false)
const draw = (type, params = {}) => {
const canvasArea = document.getElementById('canvasArea')
@ -475,8 +476,13 @@ function Index (props) {
color: darkModde ? darkColor.textColor : 'auto',
background: darkModde ? darkColor.background : 'auto'
}}>
<div style={{ padding: '0 8px 8px', textAlign: 'right' }}>
<div style={{ padding: '0 8px 8px', }}>
<Space>
<Button type="danger" size={'large'} style={{}} icon={<LogoutOutlined />} onClick={() => { setIsOutModalOpen(true) }}>
退出
</Button>
</Space>
<Space style={{ float: 'right' }}>
<Button type="primary" size={'large'} style={{}} icon={<VideoCameraOutlined />} onClick={() => { setVideoVis(true) }}>
监控视频
</Button>
@ -508,29 +514,11 @@ function Index (props) {
<Row style={{ height: '100%' }}>
{
[{
k: '高度',
v: 'tower_height',
s: '-',
unit: 'm'
}, {
k: '幅度',
v: 'max_amp',
s: '-',
}, {
k: '回转角',
v: 'rotation',
s: '-',
unit: '°',
dataFrom: 'live',
}, {
k: '重量',
v: 'x',
s: '-',
}, {
k: '力矩',
v: 'max_torque',
s: '-',
unit: 'KN*m'
}, {
k: '俯仰角',
v: 'pitch',
@ -538,11 +526,29 @@ function Index (props) {
unit: '°',
dataFrom: 'live',
}, {
k: '倾斜角',
v: 'inclination',
s: '-',
unit: '°',
dataFrom: 'live',
// k: '高度',
// v: 'tower_height',
// s: '-',
// unit: 'm'
}, {
// k: '幅度',
// v: 'max_amp',
// s: '-',
}, {
// k: '重量',
// v: 'x',
// s: '-',
}, {
// k: '力矩',
// v: 'max_torque',
// s: '-',
// unit: 'KN*m'
}, {
// k: '倾斜角',
// v: 'inclination',
// s: '-',
// unit: '°',
// dataFrom: 'live',
}, {
k: '',
v: '',
@ -609,6 +615,16 @@ function Index (props) {
>
<Input.Password size="large" placeholder="请输入密码" />
</Modal>
<Modal title="退出应用" open={isOutModalOpen}
onOk={() => {
dispatch(logoutApp());
}}
onCancel={() => {
setIsOutModalOpen(false)
}}
>
<span style={{ fontSize: 'large', fontWeight: 'bolder' }}>确定退出应用吗</span>
</Modal>
{
videoVis ?
<VideoModal onCancel={() => { setVideoVis(false) }} /> : ''

1
console/client/src/utils/webapi.js

@ -11,6 +11,7 @@ export const ApiTable = {
craneSetting: 'v1/settings',
dataLive: 'v1/data/live',
videoGet: 'v1/video/get',
logoutApp: 'v1/',
};
export const RouteTable = {

Loading…
Cancel
Save