From 6fa8808a01cd47aa009c4001b86757b0f7cd60e5 Mon Sep 17 00:00:00 2001 From: harry Date: Wed, 4 Mar 2020 22:20:53 +0800 Subject: [PATCH] courses/2346/common_homeworks/39148/2883174/appraise --- public/react/src/index.js | 2 +- .../busyWork/reply/CommonWorkAppraiseReply.js | 29 +---- .../tasks/GraduationTasksappraiseReply.js | 15 +-- .../graduation/tasks/Graduationtaskitem.js | 122 ++++++++---------- 4 files changed, 58 insertions(+), 110 deletions(-) diff --git a/public/react/src/index.js b/public/react/src/index.js index 250d64642..18c11c03f 100644 --- a/public/react/src/index.js +++ b/public/react/src/index.js @@ -1,7 +1,7 @@ import React from 'react' import ReactDOM from 'react-dom' import './index.css' -import App from './components/test-panel' +import App from './App' import * as serviceWorker from './serviceWorker' window.__useKindEditor = false; diff --git a/public/react/src/modules/courses/busyWork/reply/CommonWorkAppraiseReply.js b/public/react/src/modules/courses/busyWork/reply/CommonWorkAppraiseReply.js index 6ba8806d6..6beb9418c 100644 --- a/public/react/src/modules/courses/busyWork/reply/CommonWorkAppraiseReply.js +++ b/public/react/src/modules/courses/busyWork/reply/CommonWorkAppraiseReply.js @@ -15,9 +15,6 @@ import './CommonWorkAppraiseReply.css'; import ModulationModal from "../../coursesPublic/ModulationModal"; import Modals from '../../../modals/Modals'; -/* - -*/ class CommonWorkAppraiseReply extends Component { constructor(props) { super(props); @@ -32,7 +29,6 @@ class CommonWorkAppraiseReply extends Component { fetchAllComments = () => { let category_id = this.props.match.params.category_id; - // const url = `/graduation_works/${category_id}/comment_list.json` const task_id = this.props.task_id const url = `/student_works/${task_id}/comment_list.json` axios.get(url).then((result) => { @@ -246,27 +242,10 @@ class CommonWorkAppraiseReply extends Component { destroyOnClose={true} centered={true} /> : ""} - - {/*
*/} - {/*

{datalist&&datalist.task_name}

*/} - {/*返回*/} - {/*{this.props.isStudent()?补交附件:""}*/} - {/*
*/} - - - - {/* { - (!!comment_scores.length && -
- 全部评阅 - ({comment_scores.length}) -
)} */}
{!!comment_scores.length &&
全部评阅{comment_scores.length === 0 ? "" : `(${comment_scores.length})`} - {/*
*/} - {/* true: 老师身份显示“调分”入口,false: 不显示调分入口 */} {isAdmin && !allow_score && this.showModulationtype(this.props.task_id)}>调分 @@ -281,15 +260,9 @@ class CommonWorkAppraiseReply extends Component { showSameScore={isGroup && isAdmin} >}
- {/* ${!!comment_scores.length ? 'bor-bottom-greyE' : ''} */}
- {/* - .course-message .panel-comment_item { - margin-top: ${needNiPingEditor ? 56 : 28}px; - } - */} {!!comment_scores.length &&
{comment_scores.map((item, index) => { - return + return })}
}
diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraiseReply.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraiseReply.js index d4b4e6b63..20ea1fb8e 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraiseReply.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraiseReply.js @@ -7,7 +7,6 @@ import '../../../forums/Post.css' import '../../../comment/Comment.css' import '../../common/courseMessage.css' import './GraduationTasksappraiseReply.css' - /* */ @@ -91,8 +90,6 @@ class GraduationTasksappraiseReply extends Component { } showModulationtype = (id) => { - // console.log(id) - this.setState({ Modulationtype: true, operationId: id @@ -178,14 +175,4 @@ class GraduationTasksappraiseReply extends Component { ) } } -export default ImageLayerOfCommentHOC()(GraduationTasksappraiseReply); -{/*
*/ } -{/*
*/ } -{/**/ } -{/**/ } -{/*

暂时还没有相关数据哦!

*/ } -{/*
*/ } -{/*
*/ } -{/*
*/ } \ No newline at end of file +export default ImageLayerOfCommentHOC()(GraduationTasksappraiseReply); \ No newline at end of file diff --git a/public/react/src/modules/courses/graduation/tasks/Graduationtaskitem.js b/public/react/src/modules/courses/graduation/tasks/Graduationtaskitem.js index 662369dd3..f6af7e0b9 100644 --- a/public/react/src/modules/courses/graduation/tasks/Graduationtaskitem.js +++ b/public/react/src/modules/courses/graduation/tasks/Graduationtaskitem.js @@ -1,83 +1,71 @@ -import React,{ Component } from "react"; -import { getImageUrl, markdownToHTML, WordsBtn } from 'educoder'; -import { Tooltip } from 'antd' +import React, { useMemo } from "react"; +import { getImageUrl, markdownToHTML } from 'educoder'; +import { Tooltip } from 'antd' + const _origin = '' -class Graduationtaskitem extends Component{ - constructor(props){ - super(props); +export default ({ item, onDelete, isChildCommentPagination, loadMoreChildComments }) => { + const { content, id, user_login, image_url, username, comment_role, score, is_invalid, time, children, isAllChildrenLoaded, } = item + const md = useMemo(() => { + return markdownToHTML(content) + }, [content]) + function onDeleteHandler() { + onDelete(item) } - parseCommentContent = (oldContent) => { - return markdownToHTML(oldContent); - } - renderChildenComments = () => { + function onLoadMoreComments() { + loadMoreChildComments(item) } - render(){ - let { item }=this.props; - const _content = item.content && this.parseCommentContent(item.content) - return( -
-
- - 用户头像 - -
-
-
-
+ console.log(md, '-----------') + return ( +
+
+ + 用户头像 + +
+
+
+
+
+
+ {username}({comment_role}) + {time} + {score != null && score >= 0 && {score}分} -
-
- - {item.username}({item.comment_role}) - - {item.time} - {/* 分数 */} - {item.score != null && item.score >= 0 && {item.score}分} - - { !item.is_invalid && item.delete && - this.props.onDelete(item)}> - - } - {/* 回复 */} - { item.is_invalid ? 失效 : ''} -
+ {!is_invalid && item.delete && + + + } + {is_invalid ? 失效 : ''}
+
- {!!_content &&
-
-
-
-
-
} - {!_content && {"暂未写评语"}} - -
- {(item && item.children && item.children.length) ?
: ''} - {this.renderChildenComments(item)} - { item.isAllChildrenLoaded != true && item.children && this.props.isChildCommentPagination == true && item.children.length >= 5? - -
{this.props.loadMoreChildComments && this.props.loadMoreChildComments(item)}}> - -
-
- : ''} + {!!md ?
+
+
+
- {/*mr10 */} -

- {/* 第二排右侧按钮区域 */} -

- +
: {"暂未写评语"}} +
+ {(children && children.length) ?
: ''} + {isAllChildrenLoaded != true && children && isChildCommentPagination == true && children.length >= 5 ? + +
+ +
+
+ : ''}
+

- ) - } -} -export default Graduationtaskitem; \ No newline at end of file +
+ + ) +} \ No newline at end of file