| | |
| | | import React, { useState, useRef, useEffect } from 'react'; |
| | | import { Drawer } from 'antd'; |
| | | import { Drawer, Space, Button } from 'antd'; |
| | | import { FormattedMessage, useIntl, useModel } from '@umijs/max'; |
| | | import { createStyles } from 'antd-style'; |
| | | import * as Utils from '../utils' |
| | |
| | | const intl = useIntl(); |
| | | const { styles } = useStyles(); |
| | | |
| | | const handleCancel = () => { |
| | | props.onCancel(); |
| | | }; |
| | | |
| | | const handleOk = () => { |
| | | } |
| | | |
| | | return ( |
| | | <> |
| | | <Drawer |
| | | |
| | | open={props.open} |
| | | onClose={handleCancel} |
| | | getContainer={props.refCurr} |
| | | rootStyle={{ position: "absolute" }} |
| | | mask={false} |
| | | width={600} |
| | | extra={ |
| | | <Space> |
| | | <Button onClick={handleCancel}> |
| | | <FormattedMessage id='common.cancel' defaultMessage='取消' /> |
| | | </Button> |
| | | <Button onClick={handleOk} type="primary"> |
| | | <FormattedMessage id='common.submit' defaultMessage='保存' /> |
| | | </Button> |
| | | </Space> |
| | | } |
| | | /> |
| | | </> |
| | | ) |
| | |
| | | const mapRef = React.useRef(); |
| | | const contentRef = React.useRef(); |
| | | |
| | | const [curSprite, setCurSPrite] = React.useState(null); |
| | | const [model, setModel] = React.useState(() => MapModel.OBSERVER_MODEL); |
| | | const [deviceVisible, setDeviceVisible] = React.useState(false); |
| | | const [settingsVisible, setSettingsVisible] = React.useState(false); |
| | |
| | | const [didClickSprite, setDidClickSprite] = React.useState(false); |
| | | const [spriteBySettings, setSpriteBySettings] = React.useState(null); |
| | | const prevSpriteBySettingsRef = React.useRef(); |
| | | const [curSprite, setCurSPrite] = React.useState(null); |
| | | const [drawerVisible, setDrawerVisible] = React.useState(false); |
| | | |
| | | // init func |
| | | React.useEffect(() => { |
| | |
| | | } |
| | | |
| | | React.useEffect(() => { |
| | | console.log(curSprite); |
| | | if (curSprite) { |
| | | setDrawerVisible(true) |
| | | } |
| | | }, [curSprite]); |
| | | |
| | | return ( |
| | |
| | | </Content> |
| | | </Layout > |
| | | |
| | | <MapDrawer |
| | | open={drawerVisible} |
| | | refCurr={mapRef.current} |
| | | onCancel={() => { |
| | | setDrawerVisible(false); |
| | | }} |
| | | /> |
| | | |
| | | <Edit |
| | | open={deviceVisible} |
| | | onCancel={() => { |