diff --git a/src/forge/Main/CoderRootFileDetail.js b/src/forge/Main/CoderRootFileDetail.js index a871c771c..a3c03aab2 100644 --- a/src/forge/Main/CoderRootFileDetail.js +++ b/src/forge/Main/CoderRootFileDetail.js @@ -97,30 +97,35 @@ class CoderRootFileDetail extends Component{ } render(){ - const { detail } = this.props; + const { detail , current_user , isManager , isReporter , isDeveloper } = this.props; const { readOnly ,value } = this.state; + + const flag = current_user && current_user.login && (isManager || isReporter); return(

{bytesToSize(detail && detail.size)} - { - readOnly ? - - : - - - - - } + flag && + + { + readOnly ? + + : + + + + + } - - - - + + + + + }

diff --git a/src/forge/Merge/MessageCount.js b/src/forge/Merge/MessageCount.js index b03547f5e..bb840f777 100644 --- a/src/forge/Merge/MessageCount.js +++ b/src/forge/Merge/MessageCount.js @@ -5,15 +5,20 @@ import axios from 'axios'; import Nav from '../Order/Nav'; import UploadComponent from '../Upload/Index'; import { getImageUrl } from 'educoder'; -import {Modal, Col, Form, Input, Tooltip, Popconfirm, Pagination , Spin,Dropdown,Icon,Menu} from 'antd' -import NoneData from '../../modules/courses/coursesPublic/NoneData'; +import {Modal, Form, Input, Tooltip, Popconfirm, Pagination , Spin,Dropdown,Icon,Menu} from 'antd' import Attachments from '../Upload/attachment' import './merge.css'; - +import QuillForEditor from '../quillForEditor'; const TextArea = Input.TextArea; - +const options = [ + ['bold', 'italic', 'underline'], + [{header: [1,2,3,false]}], + ['blockquote', 'code-block'], + ['link', 'image'], + ['formula'] +]; class MessageCount extends Component{ constructor(props){ super(props); @@ -39,7 +44,9 @@ class MessageCount extends Component{ mergename:'合并请求', mergekey:'merge', title:'', - body:'' + body:'', + commentsContent:undefined, + quillFlag:false } } @@ -81,12 +88,19 @@ class MessageCount extends Component{ //添加评论 addjournals=()=>{ + const { data, page, limit, fileList , commentsContent } = this.state; + if(!commentsContent){ + this.setState({ + quillFlag:true + }) + return; + } this.props.form.validateFieldsAndScroll((err, values) => { if(!err){ - const { data, page, limit, fileList } = this.state; const url = `/issues/${data.issue.id}/journals.json`; axios.post(url,{ ...values, + content:JSON.stringify(commentsContent), issue_id:data.id, attachment_ids:fileList }).then(result=>{ @@ -96,7 +110,9 @@ class MessageCount extends Component{ attachments_ids: undefined }); this.setState({ - showFiles: false + showFiles: false, + quillFlag:false, + commentsContent:undefined }) this.getjournalslist(page, limit); this.props.showNotification("评论成功!"); @@ -160,7 +176,7 @@ class MessageCount extends Component{ project_id:projectsId, id:data.pull_request.id, do:mergekey, - body:body, + body:JSON.stringify(body), title:title, }).then(result=>{ if(result){ @@ -173,14 +189,14 @@ class MessageCount extends Component{ //修改评论 updatedetail=(id)=>{ - console.log("updtedetail", this.state) + // console.log("updtedetail", this.state) const {page, limit,data } = this.state; const {orderId} = this.props.match.params; const url = `/issues/${data.issue.id}/journals/${id}.json`; axios.put(url,{ issue_id:orderId, id:id, - content:this.state.countvalue + content:JSON.stringify(this.state.countvalue) }).then(result=>{ if(result){ this.setState({ @@ -217,9 +233,9 @@ class MessageCount extends Component{ }) } - changmodelname=(e)=>{ + changmodelname=(value)=>{ this.setState({ - countvalue:e.target.value + countvalue:value }) } changtitlepr=(e)=>{ @@ -228,9 +244,9 @@ class MessageCount extends Component{ }) } - changbodypr=(e)=>{ + changbodypr=(value)=>{ this.setState({ - body:e.target.value + body:value }) } editdetail=(count,status)=>{ @@ -314,9 +330,48 @@ class MessageCount extends Component{ }) } + changeComments=(value)=>{ + this.setState({ + commentsContent:value + }) + if(value){ + this.setState({ + quillFlag:false + }) + } + } + + stringJson=(value) =>{ + let _value = null; + + try { + _value = JSON.parse(value); + } catch (e) { + _value = value; + } + return _value + } + commentCtx = (ctx) => { + let _ctx = null; + + try { + _ctx = JSON.parse(ctx); + } catch (e) { + _ctx = ctx; + } + + return ( + + ) + }; + render(){ const { projectsId,mergeId } = this.props.match.params; - const { data,journalsdata, page, limit, search_count, isSpin, isedit, showFiles } = this.state; + const { data,journalsdata, page, limit, search_count, isSpin, isedit, showFiles , commentsContent , quillFlag } = this.state; const { getFieldDecorator } = this.props.form; const { current_user } = this.props; const url = this.props.history.location.pathname; @@ -370,7 +425,7 @@ class MessageCount extends Component{
{ item.content ? -
{item.content}
+ this.commentCtx(item.content) :
{this.renderJournalList(item.journal_details)} @@ -384,7 +439,20 @@ class MessageCount extends Component{ }
-