import React, { PureComponent, Fragment, useState, useEffect } from 'react'; import { Button, notification, Modal } from 'antd'; import config from '@/utils/config'; import { PageContainer } from '@ant-design/pro-layout'; import { Controlled as CodeMirror } from 'react-codemirror2'; import { request } from '@/utils/http'; const Crontab = () => { const [width, setWdith] = useState('100%'); const [marginLeft, setMarginLeft] = useState(0); const [marginTop, setMarginTop] = useState(-72); const [value, setValue] = useState(''); const [loading, setLoading] = useState(true); const getConfig = () => { setLoading(true); request .get(`${config.apiPrefix}config/shareCode`) .then((data) => { setValue(data.content); }) .finally(() => setLoading(false)); }; useEffect(() => { if (document.body.clientWidth < 768) { setWdith('auto'); setMarginLeft(0); setMarginTop(0); } else { setWdith('100%'); setMarginLeft(0); setMarginTop(-72); } getConfig(); }, []); return ( { setValue(value); }} onChange={(editor, data, value) => {}} /> ); }; export default Crontab;