From 9152a08b87efbba63fa5903e467533a66d89680a Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Mon, 8 Jul 2019 14:10:56 +0800 Subject: [PATCH] function comp react 16.8 --- public/react/package.json | 4 +- .../courses/busyWork/CommonWorkAppraise.js | 42 ++------------- .../CommonWorkAppraiseReviseAttachments.js | 52 +++++++++++++++++++ .../src/modules/courses/busyWork/TestHooks.js | 26 ++++++++++ 4 files changed, 85 insertions(+), 39 deletions(-) create mode 100644 public/react/src/modules/courses/busyWork/CommonWorkAppraiseReviseAttachments.js create mode 100644 public/react/src/modules/courses/busyWork/TestHooks.js diff --git a/public/react/package.json b/public/react/package.json index 21f37b76e..5cb94e404 100644 --- a/public/react/package.json +++ b/public/react/package.json @@ -63,13 +63,13 @@ "rc-select": "^8.0.12", "rc-tree": "^1.7.11", "rc-upload": "^2.5.1", - "react": "^16.3.0", + "react": "^16.8.0", "react-beautiful-dnd": "^10.0.4", "react-codemirror": "^1.0.0", "react-codemirror2": "^6.0.0", "react-content-loader": "^3.1.1", "react-dev-utils": "^5.0.0", - "react-dom": "^16.3.0-alpha.2", + "react-dom": "^16.8.0", "react-hot-loader": "^4.0.0", "react-infinite-scroller": "^1.2.4", "react-loadable": "^5.3.1", diff --git a/public/react/src/modules/courses/busyWork/CommonWorkAppraise.js b/public/react/src/modules/courses/busyWork/CommonWorkAppraise.js index 4e7d72a30..3a7e25fcd 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkAppraise.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkAppraise.js @@ -13,6 +13,9 @@ import CheckCodeModal from '../coursesPublic/modal/CheckCodeModal' import '../css/Courses.css' import WorkDetailPageHeader from './common/WorkDetailPageHeader' import CommonWorkAppraiseReply from './reply/CommonWorkAppraiseReply' +import Example from './TestHooks' +import CommonWorkAppraiseReviseAttachments from './CommonWorkAppraiseReviseAttachments' + const { Option} = Select; const CheckboxGroup = Checkbox.Group; const confirm = Modal.confirm; @@ -174,12 +177,12 @@ class CommonWorkAppraise extends Component{ modalSave={ModalSave} loadtype={loadtype} /> - {/* 内容区 */} {/*
*/}
+ -
- 补交附件 -
- -
- {revise_reason} -
- {revise_attachments.map((item,key)=>{ - return( -
- - - - - {item.title} - - {item.filesize} - {item.delete===true?:""} -
- ) - })} -
- 更新 - {atta_update_user} - - {moment(atta_update_time).format('YYYY-MM-DD HH:mm')==="Invalid date"?"":moment(atta_update_time).format('YYYY-MM-DD HH:mm')} - -
-
} + {is_evaluation != true && project_info && project_info.name &&
diff --git a/public/react/src/modules/courses/busyWork/CommonWorkAppraiseReviseAttachments.js b/public/react/src/modules/courses/busyWork/CommonWorkAppraiseReviseAttachments.js new file mode 100644 index 000000000..d12099d38 --- /dev/null +++ b/public/react/src/modules/courses/busyWork/CommonWorkAppraiseReviseAttachments.js @@ -0,0 +1,52 @@ +import React, { useState } from 'react' +import moment from 'moment' +// import Example from './TestHooks' +function CommonWorkAppraiseReviseAttachments(props) { + const { revise_attachments, revise_reason, atta_update_time, atta_update_user} = props + if (!revise_attachments) return '' + return ( + + {/* {Example()} */} + {revise_attachments.length===0?"":
+ +
+ 补交附件 +
+ + {/* {age} */} + +
+ {revise_reason} +
+ {revise_attachments.map((item,key)=>{ + return( +
+ + + + + {item.title} + + {item.filesize} + {item.delete===true?:""} +
+ ) + })} +
+ 更新 + {atta_update_user} + + {moment(atta_update_time).format('YYYY-MM-DD HH:mm')==="Invalid date"?"":moment(atta_update_time).format('YYYY-MM-DD HH:mm')} + +
+
} +
+ ) + +} +export default CommonWorkAppraiseReviseAttachments; \ No newline at end of file diff --git a/public/react/src/modules/courses/busyWork/TestHooks.js b/public/react/src/modules/courses/busyWork/TestHooks.js new file mode 100644 index 000000000..53a03bd49 --- /dev/null +++ b/public/react/src/modules/courses/busyWork/TestHooks.js @@ -0,0 +1,26 @@ +// import React, { useState, useEffect } from 'react' + + +// function Example() { +// const [state, setState] = useState({counter: 0}) +// useEffect(() => { +// console.log(' cdm') + +// return () => { +// console.log(' cwum') +// }; +// }) +// const add1ToCounter = () => { +// const newCounterValue = state.counter + 1 +// setState({ counter: newCounterValue }) +// } +// return ( +//
+//

{state.counter}

+// +//
+// ) +// } +// export default Example \ No newline at end of file