import React, { useState, useEffect, useMemo } from 'react'; import { Slider, Result, Tabs, Alert } from 'antd'; import { PieChartOutlined, ExpandOutlined, PlayCircleOutlined, HighlightOutlined, } from '@ant-design/icons'; import TextLoop from 'react-text-loop'; import { connect } from 'dva'; import HeaderComponent from './components/Header'; import SourceBox from './SourceBox'; import TargetBox from './TargetBox'; import Calibration from 'components/Calibration'; import DynamicEngine from 'components/DynamicEngine'; import FormEditor from 'components/PanelComponents/FormEditor'; import template from 'components/DynamicEngine/template'; import mediaTpl from 'components/DynamicEngine/mediaTpl'; import graphTpl from 'components/DynamicEngine/graphTpl'; import schema from 'components/DynamicEngine/schema'; import { ActionCreators } from 'redux-undo'; import styles from './index.less'; const { TabPane } = Tabs; const Container = props => { const [scaleNum, setScale] = useState(1); const { pstate, dispatch } = props; const pointData = pstate ? pstate.pointData : {}; const curPoint = pstate ? pstate.curPoint : {}; // 指定画布的id let canvasId = 'js_canvas'; const backSize = () => { setScale(1); }; const CpIcon = { base: , media: , visible: , }; const generateHeader = (type, text) => { return (
{CpIcon[type]} {text}
); }; const handleSliderChange = v => { setScale(prev => (v >= 150 ? 1.5 : v / 100)); }; const handleSlider = type => { if (type) { setScale(prev => (prev >= 1.5 ? 1.5 : prev + 0.1)); } else { setScale(prev => (prev <= 0.5 ? 0.5 : prev - 0.1)); } }; const handleFormSave = data => { dispatch({ type: 'editorModal/modPointData', payload: { ...curPoint, item: { ...curPoint.item, config: data } }, }); }; const clearData = () => { dispatch({ type: 'editorModal/clearAll' }); }; const handleDel = id => { dispatch({ type: 'editorModal/delPointData', payload: { id }, }); }; const redohandler = () => { dispatch(ActionCreators.redo()); }; const undohandler = () => { dispatch(ActionCreators.undo()); }; useEffect(() => { if (window.innerWidth < 1024) { props.history.push('/mobileTip'); } // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const allType = useMemo(() => { let arr = []; template.forEach(v => { arr.push(v.type); }); mediaTpl.forEach(v => { arr.push(v.type); }); graphTpl.forEach(v => { arr.push(v.type); }); return arr; }, []); return (
Dooring升级啦!
Dooring添加自动保存功能
已有500+人使用
持续迭代中...
} />
{template.map((value, i) => ( ))} {mediaTpl.map((value, i) => ( ))} {graphTpl.map((value, i) => ( ))}
+ -
{pointData.length && curPoint ? ( <>
属性设置
) : (
)}
); }; export default connect(state => { return { pstate: state.present.editorModal }; })(Container);