整组同评 item删除

dev_oauth
hjm 6 years ago
parent 3521ba92e7
commit 3ddd1dc07f

@ -112,8 +112,13 @@ class CommonWorkAppraiseReply extends Component{
cancelText: '取消', cancelText: '取消',
onOk: () => { onOk: () => {
let category_id= this.props.match.params.category_id; let category_id= this.props.match.params.category_id;
const url = `/graduation_works/${category_id}/delete_score.json?comment_id=${item.id}` const task_id = this.props.task_id
axios.delete(url).then((result)=>{ // 作业是使用 task_id
const url = `/student_works/${task_id}/destroy_score.json`
axios.delete(url, { data: {
score_id: item.id
}
}).then((result)=>{
if(result.data.status == 0){ if(result.data.status == 0){
this.props.showNotification('删除成功') this.props.showNotification('删除成功')
this.fetchAllComments() this.fetchAllComments()

@ -258,6 +258,7 @@ class CCommentItem extends Component{
const isAnonymous = homework_status && homework_status.indexOf('匿评中') != -1 const isAnonymous = homework_status && homework_status.indexOf('匿评中') != -1
const isAppealing = homework_status && homework_status.indexOf('申诉中') != -1 const isAppealing = homework_status && homework_status.indexOf('申诉中') != -1
const attachments = item.attachments; const attachments = item.attachments;
const isAdmin = this.props.isAdmin()
return( return(
<div className="ccomment comment_item_cont df clearfix" key={item.id}> <div className="ccomment comment_item_cont df clearfix" key={item.id}>
@ -302,23 +303,29 @@ class CCommentItem extends Component{
{item.score !== null && <span className="score_area fl">{item.score}</span>} {item.score !== null && <span className="score_area fl">{item.score}</span>}
{/* !item.is_invalid && */} {/* item.is_invalid && */}
{/* { item.delete && <Tooltip title={ "" } > {/* { item.delete && isAdmin && <Tooltip title={ "" } >
<i className="iconfont icon-shanchu mr5 fr" style={{marginLeft: '6px'}} <i className="iconfont icon-shanchu mr5 fr" style={{marginLeft: '6px'}}
onClick={() => this.props.onDelete(item)}> onClick={() => this.props.onDelete(item)}>
</i> </i>
</Tooltip>} */} </Tooltip>} */}
{/* fr */} {/* fr */}
{/* <WordsBtn style="blue" className="fr">回复</WordsBtn> */} {/* <WordsBtn style="blue" className="fr">回复</WordsBtn> */}
{ item.is_invalid ? <span className="validate_area fr">失效</span> : { item.is_invalid ? <span className="validate_area fr">失效</span> :
<React.Fragment> <React.Fragment>
<WordsBtn style="blue" className="fr" onClick={this.state.show_reply ? this.cancelReply : this.showReply}>回复</WordsBtn> <WordsBtn style="blue" className="fr" onClick={this.state.show_reply ? this.cancelReply : this.showReply}>回复</WordsBtn>
{(isAppealing || isAnonymous) && item.can_appeal && item.appeal_status == 0 && <WordsBtn style="blue" className="fr mr20" onClick={this.state.show_appeal ? this.cancelAppeal : this.showAppeal}>申诉</WordsBtn>} {(isAppealing || isAnonymous) && item.can_appeal && item.appeal_status == 0 &&
<WordsBtn style="blue" className="fr mr20" onClick={this.state.show_appeal ? this.cancelAppeal : this.showAppeal}>申诉</WordsBtn>}
</React.Fragment> </React.Fragment>
} }
{item.delete && isAdmin
&& <WordsBtn style="blue" className="fr mr12"
onClick={() => this.props.onDelete(item)}>删除</WordsBtn>}
</div> </div>
</div> </div>

@ -151,8 +151,8 @@ class GraduationTasksappraiseMainEditor extends Component{
} }
this.setState({ score: val }) this.setState({ score: val })
} }
same_score_change = (val) => { same_score_change = (e) => {
this.setState({ same_score: !this.state.same_score }) this.setState({ same_score: e.target.checked }) //!this.state.same_score
} }
render(){ render(){
let { total_count, comments, pageCount, fileList, score, same_score, errorMessage, numberErrorMessage } = this.state let { total_count, comments, pageCount, fileList, score, same_score, errorMessage, numberErrorMessage } = this.state
@ -209,7 +209,7 @@ class GraduationTasksappraiseMainEditor extends Component{
<TPMMDEditor ref={this.mdRef} mdID={'appraiseEditor'} placeholder={placeholder || "请在此输入对本作品的评语最大限制2000个字符"} <TPMMDEditor ref={this.mdRef} mdID={'appraiseEditor'} placeholder={placeholder || "请在此输入对本作品的评语最大限制2000个字符"}
watch={false} height={160} className={errorMessage ? 'editorInputError' : ''}></TPMMDEditor> watch={false} height={160} className={errorMessage ? 'editorInputError' : ''}></TPMMDEditor>
{ showSameScore == true && <div> { showSameScore == true && <div>
<Checkbox value={same_score} onChange={this.same_score_change}>整组同评</Checkbox> <Checkbox checked={same_score} onChange={this.same_score_change}>整组同评</Checkbox>
<span className={"font-14 color-grey-9"}>(选中则本次评阅对象指小组全部成员否则仅评阅此成员1人 )</span> <span className={"font-14 color-grey-9"}>(选中则本次评阅对象指小组全部成员否则仅评阅此成员1人 )</span>
</div> } </div> }
<Upload {...commentUploadProp} className="upload_mainEditor upload_1 newuploads"> <Upload {...commentUploadProp} className="upload_mainEditor upload_1 newuploads">

Loading…
Cancel
Save