lyc8503 hace 4 años
padre
commit
f773a08840

+ 1 - 1
frontend_refactor/src/containers/SubmitForm.js

@@ -69,7 +69,7 @@ class SubmitForm extends React.Component {
             <div>
                 <Card style={{height: "40%", width: "80%", margin: "0 auto", marginTop: 30}}>
                     <Select defaultValue={types[0]} style={{width: 200}} onChange={this.choiceChange}>
-                        {types.map(x => <Select.Option value={x[0]}>{x[1]}</Select.Option>)}
+                        {types.map(x => <Select.Option key={x[0]} value={x[0]}>{x[1]}</Select.Option>)}
                     </Select>
 
                     <Divider/>

+ 20 - 10
frontend_refactor/src/containers/TaskList.js

@@ -1,5 +1,5 @@
 import React from "react";
-import {Divider} from "antd";
+import {Collapse, Divider} from "antd";
 import axios from "axios";
 import {BACKEND_URL} from "../config";
 
@@ -28,15 +28,25 @@ class TaskList extends React.Component {
     render() {
         return (
             <div>
-                {
-                    this.props.tasks.map(x => (
-                        <>
-                            <h4>{x}</h4>
-                            <h4>结果: {JSON.stringify(this.state.details[x])}</h4>
-                            <Divider/>
-                        </>
-                    ))
-                }
+                <Collapse style={{height: "40%", width: "80%", margin: "0 auto", marginTop: 30}}>
+                    {
+                        this.props.tasks.map(x => {
+
+                            const details = this.state.details[x]
+
+                            if (details === undefined) {
+                                return <></>;
+                            }
+
+                            return (
+                                <Collapse.Panel header={"任务 ID: " + x} key={x}>
+                                    <p>状态: {details.status}</p>
+                                    <p>结果: {JSON.stringify(details.data)}</p>
+                                </Collapse.Panel>
+                            )
+                        })
+                    }
+                </Collapse>
             </div>
         );
     }