diff --git a/public/react/src/Loading.js b/public/react/src/Loading.js index e05a36a54..f341959c2 100644 --- a/public/react/src/Loading.js +++ b/public/react/src/Loading.js @@ -1,15 +1,12 @@ import React, { Component } from 'react'; - -import { BrowserRouter as Router, Route, Link } from "react-router-dom"; - import { Spin } from 'antd'; class Loading extends Component { componentDidUpdate(prevProps, prevState) { - if (!prevProps.error && this.props.error) { - console.log(this.props.error) - window.location.reload() - } + if (!prevProps.error && this.props.error) { + console.log(this.props.error) + window.location.reload() + } } render() { diff --git a/public/react/src/forge/Order/Detail.js b/public/react/src/forge/Order/Detail.js index 5d13b9e62..cdc7293bb 100644 --- a/public/react/src/forge/Order/Detail.js +++ b/public/react/src/forge/Order/Detail.js @@ -7,11 +7,19 @@ import UploadComponent from '../Upload/Index'; import { getImageUrl } from 'educoder'; import {Modal, Col, Form, Input, Tooltip, Popconfirm, Pagination , Spin} from 'antd' import NoneData from '../../modules/courses/coursesPublic/NoneData'; -import Attachments from '../Upload/attachment' +import Attachments from '../Upload/attachment'; +import QuillForEditor from '../quillForEditor'; +import { QuillDeltaToHtmlConverter } from 'quill-delta-to-html' const TextArea = Input.TextArea; - +const options = [ + ['bold', 'italic', 'underline'], + [{header: [1,2,3,false]}], + ['blockquote', 'code-block'], + ['link', 'image'], + ['formula'] +]; class Detail extends Component{ constructor(props){ @@ -32,7 +40,9 @@ class Detail extends Component{ page:1, search_count:undefined, isSpin:false, - showFiles: true + showFiles: true, + quillValue:'', + quillFlag:false } } @@ -74,12 +84,26 @@ class Detail extends Component{ //添加评论 addjournals=()=>{ + const { quillValue } = this.state; + if(!quillValue){ + this.setState({ + quillFlag:true + }) + return; + } + let _html = ''; + try { + _html = new QuillDeltaToHtmlConverter(quillValue.ops, {}).convert(); + } catch (error) { + console.log(error); + } this.props.form.validateFieldsAndScroll((err, values) => { if(!err){ const { data, page, limit, fileList } = this.state; const url = `/issues/${data.id}/journals.json`; axios.post(url,{ ...values, + content:_html, issue_id:data.id, attachment_ids:fileList }).then(result=>{ @@ -88,7 +112,8 @@ class Detail extends Component{ content: "" }); this.setState({ - showFiles: false + showFiles: false, + quillValue:'' }) this.getjournalslist(page, limit); this.props.showNotification("评论成功!"); @@ -215,7 +240,7 @@ class Detail extends Component{ } renderJournalList=(list)=>{ - console.log(list); + // console.log(list); if(list && list.length >0){ return( list.map((item,key)=>{ @@ -280,10 +305,16 @@ class Detail extends Component{ showFiles:flag }) } + onContentChange=(value)=>{ + + this.setState({ + quillValue:value + }) + } render(){ const { projectsId,orderId} = 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 , quillValue , quillFlag } = this.state; const { getFieldDecorator } = this.props.form; const { current_user } = this.props; const Paginations = ( @@ -325,7 +356,10 @@ class Detail extends Component{
{ item.content ? -
{item.content}
+ :
{this.renderJournalList(item.journal_details)} @@ -370,6 +404,8 @@ class Detail extends Component{ } } + + return(
@@ -435,15 +471,26 @@ class Detail extends Component{
- - {getFieldDecorator('content', { - rules: [{ - required: true, message: '请输入内容' - }], - })( -