From e0668cea7c6785184b54723d274fc00c417a412e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Fri, 21 Jun 2019 01:03:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=AF=95=E8=AE=BE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/courses/Resource/Fileslistitem.js | 46 +-- .../src/modules/courses/Resource/index.js | 4 +- .../courses/coursesHome/coursesHomeCard.js | 272 +++++++++--------- .../graduation/tasks/GraduateTaskItem.js | 5 +- .../tasks/GraduationTasksSubmitedit.js | 2 +- .../tasks/GraduationTasksSubmitnew.js | 2 +- .../tasks/GraduationTasksappraise.js | 10 +- .../tasks/GraduationTasksappraiseReply.js | 4 +- .../graduation/tasks/GraduationTasksedit.js | 13 +- .../tasks/GraduationTaskssetting.js | 52 ++-- .../tasks/GraduationTaskssettinglist.js | 64 +++-- .../tasks/GraduationTaskssettingquestions.js | 4 +- public/react/src/modules/forums/PostItem.js | 208 +++++++------- 13 files changed, 360 insertions(+), 326 deletions(-) diff --git a/public/react/src/modules/courses/Resource/Fileslistitem.js b/public/react/src/modules/courses/Resource/Fileslistitem.js index cc6304481..dd37c441c 100644 --- a/public/react/src/modules/courses/Resource/Fileslistitem.js +++ b/public/react/src/modules/courses/Resource/Fileslistitem.js @@ -248,20 +248,7 @@ class Fileslistitem extends Component{ } - {this.props.isAdmin ||this.props.current_user.username===discussMessage.author.name? - - - this.settingList()}>设置 - - - - this.onDelete(discussMessage.id)}>删除 - - - :""} {discussMessage.course_groups.length===0?"": -

+

{discussMessage.course_groups.map((item,key)=>{ return(

{item.course_group_name} - 发布于 { moment(item.course_group_publish_time).format('YYYY-MM-DD hh:mm')} + 将发布于 { moment(item.course_group_publish_time).format('YYYY-MM-DD hh:mm')}
) })}

} -

+

- {discussMessage.author.name} + {discussMessage.author.login} 大小 {discussMessage.filesize} 下载 {discussMessage.downloads_count} 引用 {discussMessage.quotes} @@ -299,15 +289,31 @@ class Fileslistitem extends Component{ { discussMessage.publish_time===null?"":discussMessage.is_publish===true?moment(discussMessage.publish_time).fromNow():moment(discussMessage.publish_time).format('YYYY-MM-DD hh:mm')} + {this.props.isAdmin ||this.props.current_user.login===discussMessage.author.login? + + + + this.settingList()}>设置 + + + + this.onDelete(discussMessage.id)}>删除 + + + :""}

- 资源描述 : - {discussMessage.description} - {this.props.isAdmin ?this.settingList()}>:""} + {/**/} + +

资源描述 :{discussMessage.description===null?"暂无描述":discussMessage.description}
+ + {/*{this.props.isAdmin ?this.settingList()}>:""}*/}

diff --git a/public/react/src/modules/courses/Resource/index.js b/public/react/src/modules/courses/Resource/index.js index 5ad4b81d3..2cc5dbafb 100644 --- a/public/react/src/modules/courses/Resource/index.js +++ b/public/react/src/modules/courses/Resource/index.js @@ -655,8 +655,8 @@ class Fileslists extends Component{ secondRowLeft={
共 {total_count} 个资源 - 公共资源:{public_count}个 - {this.props.isAdmin()||this.props.isStudent()?私有资源:{private_count}个:""} + 已发布:{public_count}个 + {this.props.isAdmin()||this.props.isStudent()?未发布:{private_count}个:""}
} onPressEnter={this.onPressEnter} diff --git a/public/react/src/modules/courses/coursesHome/coursesHomeCard.js b/public/react/src/modules/courses/coursesHome/coursesHomeCard.js index 3f6d565cf..c5f6aeca7 100644 --- a/public/react/src/modules/courses/coursesHome/coursesHomeCard.js +++ b/public/react/src/modules/courses/coursesHome/coursesHomeCard.js @@ -1,136 +1,136 @@ -import React, { Component } from 'react'; -import {getImageUrl} from 'educoder'; -import { BrowserRouter as Router, Route, Link } from "react-router-dom"; -import {Tooltip,Spin,Alert} from 'antd'; -import ShowSpin from '../../../common/ShowSpin'; - -class coursesHomeCard extends Component{ - constructor(props) { - super(props) - } - render(){ - let {coursesHomelist}=this.props; - - return( -
- -
- - {/**/} - - { - coursesHomelist===undefined?"":coursesHomelist.courses.map((item,key)=>{ - - - return( -
- -
- -

非成员不能访问

-
- - { - item.is_public===1&&item.id===1309? -
-
- - 公开 -
- :"" - } - { - item.is_public===1&&item.id!=1309? -
-
- - 公开 -
- :"" - } - {item.is_end===true?

- -

已结束
-

:""} -
- -

- {/*{item.name.length>32?*/} - {/**/} - {/**/} - {/*: {item.name}}*/} - 23?item.name:""}>{item.name} -

- - - 用户 - - -

{item.creator} {item.technical_title}

-

- - - {item.school} - - -

-
- -
-
- {item.visits===0?"": - - {item.visits} - - - } - - {item.course_members_count===0?"": - - {item.course_members_count} - - } - - {item.tasks_count===0?"": - - {item.tasks_count} - - } - - {/**/} - - {/**/} - {/*{item.attachment_count}*/} - {/**/} - - {/**/} - -
-
- -
- ) - }) - } - - - - -
-
- ) - } - } -export default coursesHomeCard; - +import React, { Component } from 'react'; +import {getImageUrl} from 'educoder'; +import { BrowserRouter as Router, Route, Link } from "react-router-dom"; +import {Tooltip,Spin,Alert} from 'antd'; +import ShowSpin from '../../../common/ShowSpin'; + +class coursesHomeCard extends Component{ + constructor(props) { + super(props) + } + render(){ + let {coursesHomelist}=this.props; + + return( +
+ +
+ + {/**/} + + { + coursesHomelist===undefined?"":coursesHomelist.courses.map((item,key)=>{ + + + return( +
+ +
+ +

非成员不能访问

+
+ + { + item.is_public===1&&item.id===1309? +
+
+ + 公开 +
+ :"" + } + { + item.is_public===1&&item.id!=1309? +
+
+ + 公开 +
+ :"" + } + {item.is_end===true?

+ +

已结束
+

:""} +
+ +

+ {/*{item.name.length>32?*/} + {/**/} + {/**/} + {/*: {item.name}}*/} + 23?item.name:""}>{item.name} +

+ + + 用户 + + +

{item.creator} {item.technical_title}

+

+ + + {item.school} + + +

+
+ +
+
+ {item.visits===0?"": + + {item.visits} + + + } + + {item.course_members_count===0?"": + + {item.course_members_count} + + } + + {item.tasks_count===0?"": + + {item.tasks_count} + + } + + {/**/} + + {/**/} + {/*{item.attachment_count}*/} + {/**/} + + {/**/} + +
+
+
+
+ ) + }) + } + + + + +
+
+ ) + } + } +export default coursesHomeCard; + diff --git a/public/react/src/modules/courses/graduation/tasks/GraduateTaskItem.js b/public/react/src/modules/courses/graduation/tasks/GraduateTaskItem.js index ef23674fe..942fa96ca 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduateTaskItem.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduateTaskItem.js @@ -185,18 +185,21 @@ class GraduateTaskItem extends Component{ { this.props.isAdmin?{discussMessage.name}:"" } { this.props.isStudent? {discussMessage.name}:"" } { this.props.isNotMember?this.props.discussMessage.private_icon===true? - {discussMessage.name} + {discussMessage.name} : {discussMessage.name}:"" } diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitedit.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitedit.js index a708939ba..ec1cf4e48 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitedit.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitedit.js @@ -473,7 +473,7 @@ class GraduationTasksSubmitedit extends Component{ {/*{workslist&&workslist.task_name}*/} {/*>*/} {/**/} - {this.props.user.username} 提交作品 + {this.props.user&&this.props.user.username} 提交作品

diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js index 2a0ffa8fb..e1284832c 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js @@ -459,7 +459,7 @@ render(){ {/*{workslist&&workslist.task_name}*/} {/*>*/} {/**/} - {this.props.user.username} 提交作品 + {this.props.user&&this.props.user.username} 提交作品

diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraise.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraise.js index a76354481..374318af1 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraise.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraise.js @@ -234,11 +234,11 @@ class GraduationTasksappraise extends Component{
- 更新 - {datalist&&datalist.update_user_name} - - {moment(datalist&&datalist.update_time).format('YYYY-MM-DD HH:mm:ss')==="Invalid date"?"":moment(datalist&&datalist.update_time).format('YYYY-MM-DD HH:mm:ss')} - + {/*更新*/} + {/*{datalist&&datalist.update_user_name}*/} + {/**/} + {/*{moment(datalist&&datalist.update_time).format('YYYY-MM-DD HH:mm:ss')==="Invalid date"?"":moment(datalist&&datalist.update_time).format('YYYY-MM-DD HH:mm:ss')}*/} + {/**/} 提交 {datalist&&datalist.author_name} diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraiseReply.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraiseReply.js index 69ab8ba79..1c733868e 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraiseReply.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraiseReply.js @@ -124,8 +124,9 @@ class GraduationTasksappraiseReply extends Component{ saveModulationModal=(value,num)=>{ console.log(value,num) let {operationId}=this.state; + let category_id= this.props.match.params.category_id; // console.log(value,num) - let url ="/graduation_works/"+operationId+"/adjust_score.json"; + let url ="/graduation_works/"+category_id+"/adjust_score.json"; axios.post(url,{ score:num, comment:value @@ -138,6 +139,7 @@ class GraduationTasksappraiseReply extends Component{ Modalstopval:result.data.message, ModalSave:this.cancelmodel, }) + this.fetchAllComments() } }).catch((error)=>{ diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksedit.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksedit.js index 8bd55dea9..36c2f9d3f 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksedit.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksedit.js @@ -18,7 +18,7 @@ class GraduationTasksedit extends Component{ this.state={ coursename:"", coursesearch:"", - title_num:20, + title_num:60, title_value:"", fileList: [], contents: [{val:"",id:1}], @@ -138,8 +138,11 @@ class GraduationTasksedit extends Component{ } goback=()=>{ - let courseId=this.props.match.params.coursesId; - window.location.href="/courses/"+courseId+"/graduation_tasks/"+this.state.data.graduation_id; + // let courseId=this.props.match.params.coursesId; + // window.location.href="/courses/"+courseId+"/graduation_tasks/"+this.state.data.graduation_id; + // goback = () => { + window.history.go(-1) + } @@ -147,7 +150,7 @@ class GraduationTasksedit extends Component{ changeTitle=(e)=>{ this.setState({ - title_num:20-parseInt(e.target.value.length), + title_num:60-parseInt(e.target.value.length), title_value:e.target.value }) @@ -315,7 +318,7 @@ class GraduationTasksedit extends Component{ {getFieldDecorator('name', { rules: [{ required: true, message: "请输入标题" }], - })()} + })()}
diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js index 9ef3d7091..9d0b33e80 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js @@ -111,11 +111,11 @@ class GraduationTaskssettingapp extends Component{ max_nums: result.data.max_num, task_type: result.data.task_type, baseonproject: result.data.base_on_project, - publish_time: result.data.publish_time, - end_time: result.data.end_time, + publish_time:moment(moment(handleDateString(result.data.publish_time))).format("YYYY-MM-DD HH:mm"), + end_time:moment(moment(handleDateString(result.data.end_time))).format("YYYY-MM-DD HH:mm"), allowlate: result.data.allow_late, latepenalty: result.data.late_penalty, - latetime: result.data.late_time, + latetime:moment(moment(handleDateString(result.data.late_time))).format("YYYY-MM-DD HH:mm"), crosscomment: result.data.cross_comment, taskid: result.data.id, taskname: result.data.task_name, @@ -128,7 +128,7 @@ class GraduationTaskssettingapp extends Component{ hasproject: result.data.has_project, hascommit: result.data.has_commit, assigngroups: assigngroups, - commenttime: result.data.comment_time, + commenttime:moment(moment(handleDateString(result.data.comment_time))).format("YYYY-MM-DD HH:mm"), task_status: result.data.task_status }) } @@ -142,7 +142,9 @@ class GraduationTaskssettingapp extends Component{ componentDidMount(){ this.getsettings(); - + if(this.props.isAdmin()===true){ + this.editSetting() + } } @@ -210,17 +212,18 @@ class GraduationTaskssettingapp extends Component{ latetime:null }) }else{ - endtime=moment(handleDateString(dateString)).add(1, 'months') + + endtime= moment(moment(handleDateString(dateString))).add(1, 'months').format("YYYY-MM-DD HH:mm") let {allowlate}=this.state; if(allowlate===true||allowlate===1){ this.setState({ - publish_time:handleDateString(dateString), + publish_time:moment(moment(handleDateString(dateString))).format("YYYY-MM-DD HH:mm"), end_time:endtime, - latetime:moment(endtime).add(1, 'months'), + latetime:moment(moment(handleDateString(endtime))).add(1, 'months').format("YYYY-MM-DD HH:mm"), }) }else{ this.setState({ - publish_time:handleDateString(dateString), + publish_time:moment(moment(handleDateString(dateString))).format("YYYY-MM-DD HH:mm"), end_time:endtime }) } @@ -240,12 +243,12 @@ class GraduationTaskssettingapp extends Component{ let {allowlate}=this.state; if(allowlate===true||allowlate===1){ this.setState({ - end_time:handleDateString(dateString), - latetime:moment(handleDateString(dateString)).add(1, 'months'), + end_time:moment(moment(handleDateString(dateString))).format("YYYY-MM-DD HH:mm"), + latetime:moment(moment(handleDateString(dateString))).add(1, 'months').format("YYYY-MM-DD HH:mm"), }) }else{ this.setState({ - end_time:handleDateString(dateString) + end_time:moment(moment(handleDateString(dateString))).format("YYYY-MM-DD HH:mm"), }) } @@ -288,7 +291,7 @@ class GraduationTaskssettingapp extends Component{ this.setState({ latepenalty:5, allowlate:e.target.value, - latetime:end_time===null?"":moment(end_time).add(1, 'months'), + latetime:end_time===null?"":moment(moment(handleDateString(end_time))).add(1, 'months').format("YYYY-MM-DD HH:mm"), }) }else{ this.setState({ @@ -326,7 +329,7 @@ class GraduationTaskssettingapp extends Component{ this.setState({ crosscomment:e.target.checked, - commenttime:newtime + commenttime:moment(moment(newtime)).format("YYYY-MM-DD HH:mm"), }) }else{ @@ -410,7 +413,7 @@ class GraduationTaskssettingapp extends Component{ Topval:"发布设置均可修改", Botvalleft:"点击修改", Botval:"此设置将对所有分班生效", - starttime:moment(moment(handleDateString(this.props.getNowFormatDates(1))).add(1, 'months')).format("YYYY-MM-DD HH:mm"), + starttime:moment(moment(handleDateString(this.props.getNowFormatDates(1)))).format("YYYY-MM-DD HH:mm") , starttimes:this.props.getNowFormatDates(1), typs:"start", endtime:endtime, @@ -558,6 +561,7 @@ class GraduationTaskssettingapp extends Component{ commenttimetype:false }) } + debugger if(moment(this.state.commenttime) { - try { - if (this.state.settingdata.is_end === true) { + + if (this.state.settingdata&&this.state.settingdata.is_end === true) { // this.setState({ // modalsType: true, // modalsTopval: "课堂已结束不能再修改!", @@ -886,9 +892,7 @@ class GraduationTaskssettingapp extends Component{ flagPageEdit: true, }) } - } catch (e) { - } } @@ -1025,8 +1029,8 @@ class GraduationTaskssettingapp extends Component{
-
-
+
+
任务列表 任务问答 @@ -1113,7 +1117,7 @@ class GraduationTaskssettingapp extends Component{ -
+
发布时间: @@ -1150,7 +1154,7 @@ class GraduationTaskssettingapp extends Component{ {this.state.publishTimetypesval}
:""} -
+
截止时间: @@ -1166,7 +1170,7 @@ class GraduationTaskssettingapp extends Component{ value={end_time===null||end_time===""?"":moment(end_time, dateFormat)} onChange={this.onChangeTimeend} disabledTime={disabledDateTime} - disabled={this.props.isAdmin()===true?endtimetype===true?true:flagPageEdit===true?false:true:true} + disabled={this.props.isSuperAdmin()===true?flagPageEdit===true?false:true:this.props.isAdmin()===true?endtimetype===true?true:flagPageEdit===true?false:true:true} className={this.state.endTimetypes===true||end_timetype===true?"noticeTip":""} /> diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js index 4c5496ad5..d0b30db93 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js @@ -105,10 +105,12 @@ class GraduationTaskssettinglist extends Component{ teacherrating: worklists[i].teacher_comment_score, crossrating: worklists[i].cross_comment_score, finalscore: worklists[i].final_score.work_score === null ? "--" : worklists[i].final_score.work_score, - operation: this.props.isAdmin()?[{name: worklists[i].assign === true ? "分配" : "", id: worklists[i].id}, { + operation: this.props.isAdmin()?[{name: worklists[i].assign === true ? "分配" : "", id: worklists[i].id,status:worklists[i].status}, { name: "调分", - id: worklists[i].id - }, {name:"评阅", id: worklists[i].id}]:[{name:"", id: worklists[i].id}], + id: worklists[i].id, + status:worklists[i].status + }, {name:"评阅", id: worklists[i].id, status:worklists[i].status}]:[{name:"", id: worklists[i].id, + status:worklists[i].status}], }) } } @@ -723,8 +725,8 @@ class GraduationTaskssettinglist extends Component{
{this.props.isAdmin()?operation.map((tag,key) => { return( -
- 调整学生最终成绩
+
+ {tag.status===0?"--":调整学生最终成绩
其它历史评分将全部失效:""}> {tag.name==="评阅"?{tag.name} @@ -734,7 +736,7 @@ class GraduationTaskssettinglist extends Component{ >{tag.name} } -
+ }
) }):""} @@ -742,8 +744,10 @@ class GraduationTaskssettinglist extends Component{ this.props.isStudent()? operation.map((tag,key) => { return( -
+
+ {tag.status===0?"--": 查看 + }
)} ):"" @@ -853,8 +857,9 @@ class GraduationTaskssettinglist extends Component{
{this.props.isAdmin()?operation.map((tag,key) => { return( -
- 调整学生最终成绩
+
+ {tag.status===0?"--": + 调整学生最终成绩
其它历史评分将全部失效:""}> {tag.name==="评阅"?{tag.name} @@ -865,6 +870,7 @@ class GraduationTaskssettinglist extends Component{ }
+ }
) }):""} @@ -872,8 +878,10 @@ class GraduationTaskssettinglist extends Component{ this.props.isStudent()? operation.map((tag,key) => { return( -
+
+ {tag.status===0?"--": 查看 + }
)} ):"" @@ -997,16 +1005,18 @@ class GraduationTaskssettinglist extends Component{
{this.props.isAdmin()?operation.map((tag,key) => { return( -
- 调整学生最终成绩
- 其它历史评分将全部失效:""}> - {tag.name==="评阅"?{tag.name} - : - this.showModulationtype(tag.id):tag.name==="分配"?()=>this.showAllocationModal(tag.id):""} - >{tag.name} - } -
+
+ {tag.status===0?"--": + 调整学生最终成绩
+ 其它历史评分将全部失效:""}> + {tag.name==="评阅"?{tag.name} + : + this.showModulationtype(tag.id):tag.name==="分配"?()=>this.showAllocationModal(tag.id):""} + >{tag.name} + } +
+ }
) }):""} @@ -1015,8 +1025,10 @@ class GraduationTaskssettinglist extends Component{ this.props.isStudent()? operation.map((tag,key) => { return( -
+
+ {tag.status===0?"--": 查看 + }
)} ):"" @@ -1125,7 +1137,8 @@ class GraduationTaskssettinglist extends Component{
{this.props.isAdmin()?operation.map((tag,key) => { return( -
+
+ {tag.status===0?"--": 调整学生最终成绩
其它历史评分将全部失效:""}> {tag.name==="评阅"?{tag.name} @@ -1135,6 +1148,7 @@ class GraduationTaskssettinglist extends Component{ >{tag.name} }
+ }
) }):""} @@ -1143,8 +1157,10 @@ class GraduationTaskssettinglist extends Component{ this.props.isStudent()? operation.map((tag,key) => { return( -
- 查看 +
+ {tag.status===0?"--": + 查看 + }
)} ):"" diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettingquestions.js b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettingquestions.js index acf160c1f..f373af827 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettingquestions.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettingquestions.js @@ -1,7 +1,7 @@ import React,{Component} from "React"; import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal, Table, Divider, Tag} from "antd"; import {Link} from 'react-router-dom'; -import { WordsBtn } from 'educoder'; +import { WordsBtn,markdownToHTML} from 'educoder'; import axios from 'axios'; import Modals from '../../../modals/Modals'; import HomeworkModal from "../../coursesPublic/HomeworkModal"; @@ -332,7 +332,7 @@ class GraduationTasksquestions extends Component{ width: '100%', border: '1px solid transparent' }}> - {questionslist.description} +
:"" } diff --git a/public/react/src/modules/forums/PostItem.js b/public/react/src/modules/forums/PostItem.js index 2f79e6dc5..aa610184f 100644 --- a/public/react/src/modules/forums/PostItem.js +++ b/public/react/src/modules/forums/PostItem.js @@ -1,104 +1,104 @@ -import React, { Component } from 'react'; -import { Redirect } from 'react-router'; - -import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom"; - -import PropTypes from 'prop-types'; - -import classNames from 'classnames'; - -import { getImageUrl, toPath } from 'educoder'; - -import moment from 'moment'; - - -class PostItem extends Component { - _toTenThousand(num) { - if (num > 10000) { - return ( (num - 500)/ 10000 ).toFixed(1) + '万' - } - return num - } - - render() { - const { match, history, currentPage, memo, user, setTop, setDown } = this.props - return ( -
-
- - 用户头像 - -
-

- {/* target="_blank" */} - - {memo.subject} - - - { memo.sticky && 置顶 } - - { memo.reward && - - {memo.reward} - - } -

- -
- {memo.username} - {/*最后回复:todo{memo.username} - memo.language && memo.language != 'other' && {memo.language} - */} - {moment(memo.updated_at).fromNow()} - {memo.tag && memo.tag.length ? 来自 {memo.tag.join('/')} : ''} - - {/*C++*/} - -

- {/* data-tip-down="回复数" {memo.replies_count} - {memo.praise_count}*/} - {memo.replies_count ? - - {memo.replies_count} 回复 - :''} - - {memo.praise_count ? - - {memo.praise_count} 赞 - :''} - - {memo.viewed_count ? - - {this._toTenThousand(memo.viewed_count)} 浏览 - :''} - -

-
- { user && (user.admin === true || user.user_id === memo.author_id) && - - } -
-
-
- ); - } -} -export default PostItem +import React, { Component } from 'react'; +import { Redirect } from 'react-router'; + +import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom"; + +import PropTypes from 'prop-types'; + +import classNames from 'classnames'; + +import { getImageUrl, toPath } from 'educoder'; + +import moment from 'moment'; + + +class PostItem extends Component { + _toTenThousand(num) { + if (num > 10000) { + return ( (num - 500)/ 10000 ).toFixed(1) + '万' + } + return num + } + + render() { + const { match, history, currentPage, memo, user, setTop, setDown } = this.props + return ( +
+
+ + 用户头像 + +
+

+ {/* target="_blank" */} + + {memo.subject} + + + { memo.sticky && 置顶 } + + { memo.reward && + + {memo.reward} + + } +

+ +
+ {memo.username} + {/*最后回复:todo{memo.username} + memo.language && memo.language != 'other' && {memo.language} + */} + {moment(memo.updated_at).fromNow()} + {memo.tag && memo.tag.length ? 来自 {memo.tag.join('/')} : ''} + + {/*C++*/} + +

+ {/* data-tip-down="回复数" {memo.replies_count} + {memo.praise_count}*/} + {memo.replies_count ? + + {memo.replies_count} 回复 + :''} + + {memo.praise_count ? + + {memo.praise_count} 赞 + :''} + + {memo.viewed_count ? + + {this._toTenThousand(memo.viewed_count)} 浏览 + :''} + +

+
+ { user && (user.admin === true || user.user_id === memo.author_id) && + + } +
+
+
+ ); + } +} +export default PostItem