|
@@ -1,7 +1,39 @@
|
|
-import React from "react"
|
|
|
|
|
|
+import React from 'react';
|
|
|
|
+import Flow, { FLOW_TYPE } from '@/components/Flow';
|
|
|
|
+import { connect } from 'dva';
|
|
|
|
+import { UnityAction } from '@/utils/utils';
|
|
|
|
|
|
-function Craft(props) {
|
|
|
|
-
|
|
|
|
|
|
+const graphData = JSON.parse(localStorage.graphData || null);
|
|
|
|
+
|
|
|
|
+// @connect(({ xflow }) => ({ flowDetail: xflow.flowDetail }))
|
|
|
|
+class Craft extends React.PureComponent {
|
|
|
|
+ state = {
|
|
|
|
+ flowDetail: graphData || { nodes: [], edges: [] },
|
|
|
|
+ };
|
|
|
|
+ componentDidMount() {
|
|
|
|
+ const {
|
|
|
|
+ dispatch,
|
|
|
|
+ match: {
|
|
|
|
+ params: { flowId },
|
|
|
|
+ },
|
|
|
|
+ } = this.props;
|
|
|
|
+
|
|
|
|
+ UnityAction.on('NODE_SAVE', nodeConfig => {
|
|
|
|
+ console.log(nodeConfig);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ componentWillUnmount() {
|
|
|
|
+ UnityAction.off('NODE_SAVE');
|
|
|
|
+ }
|
|
|
|
+ render() {
|
|
|
|
+ const { flowDetail } = this.state;
|
|
|
|
+
|
|
|
|
+ return (
|
|
|
|
+ <div>
|
|
|
|
+ <Flow meta={{ type: 'edit', flowId: 1 }} flowDetail={flowDetail} />
|
|
|
|
+ </div>
|
|
|
|
+ );
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
-export default Craft
|
|
|
|
|
|
+export default Craft;
|