diff --git a/src/AppConfig.js b/src/AppConfig.js index c9346918..fcc74368 100644 --- a/src/AppConfig.js +++ b/src/AppConfig.js @@ -126,21 +126,10 @@ export function initAxiosInterceptors(props) { // https://github.com/axios/axios/issues/1497 // TODO 读取到package.json中的配置? - var proxy = "http://localhost:3000" - // proxy = "http://testbdweb.trustie.net" - // proxy = "http://testbdweb.educoder.net" - // proxy = "https://testeduplus2.educoder.net" - //proxy="http://47.96.87.25:48080" - // proxy="https://pre-newweb.educoder.net" - // proxy="https://test-newweb.educoder.net" - // proxy="https://test-jupyterweb.educoder.net" - // proxy="https://test-newweb.educoder.net" - // proxy="https://test-jupyterweb.educoder.net" - //proxy="http://192.168.2.63:3001" - + var //proxy = "http://localhost:3000" - // proxy="http://123.59.135.93:56666" - proxy="http://localhost:3000" + proxy="http://123.59.135.93:56666" + // proxy="http://localhost:3000" // 在这里使用requestMap控制,避免用户通过双击等操作发出重复的请求; // 如果需要支持重复的请求,考虑config里面自定义一个allowRepeat参考来控制 @@ -236,7 +225,7 @@ export function initAxiosInterceptors(props) { // let timestamp=railsgettimes(proxy); // console.log(timestamp) // `https://api.m.taobao.com/rest/api3.do?api=mtop.common.getTimestamp` - railsgettimes( `${proxy}/api/main/first_stamp.json`); + // railsgettimes( `${proxy}/api/main/first_stamp.json`); let newopens=md5(opens+timestamp) config.url = `${proxy}${url}`; if (config.url.indexOf('?') == -1) { @@ -248,7 +237,7 @@ export function initAxiosInterceptors(props) { // 加api前缀 // railsgettimes(`http://api.m.taobao.com/rest/api3.do?api=mtop.common.getTimestamp`); - railsgettimes( `/api/main/first_stamp.json`); + // railsgettimes( `/api/main/first_stamp.json`); let newopens=md5(opens+timestamp) config.url = url; if (config.url.indexOf('?') == -1) { diff --git a/src/common/UrlTool.js b/src/common/UrlTool.js index 30afcf8a..c33fe4a7 100644 --- a/src/common/UrlTool.js +++ b/src/common/UrlTool.js @@ -106,31 +106,31 @@ export function getmyUrl(geturl) { } export function getUploadActionUrl(path, goTest) { - Railsgettimes() + // Railsgettimes() let anewopens=md5(newopens+newtimestamp); return `${getUrl()}/api/attachments.json${isDev ? `?debug=${window._debugType || 'admin'}&randomcode=${newtimestamp}&client_key=${anewopens}` : `?randomcode=${newtimestamp}&client_key=${anewopens}`}`; } export function getUploadActionUrltwo(id) { - Railsgettimes() + // Railsgettimes() let anewopens=md5(newopens+newtimestamp); return `${getUrlmys()}/api/shixuns/${id}/upload_data_sets.json${isDev ? `?debug=${window._debugType || 'admin'}&randomcode=${newtimestamp}&client_key=${anewopens}` : `?randomcode=${newtimestamp}&client_key=${anewopens}`}` } export function getUploadActionUrlthree() { - Railsgettimes() + // Railsgettimes() let anewopens=md5(newopens+newtimestamp); return `${getUrlmys()}/api/jupyters/import_with_tpm.json${isDev ? `?debug=${window._debugType || 'admin'}&randomcode=${newtimestamp}&client_key=${anewopens}` : `?randomcode=${newtimestamp}&client_key=${anewopens}`}` } export function getUploadActionUrlOfAuth(id) { - Railsgettimes() + // Railsgettimes() let anewopens=md5(newopens+newtimestamp); return `${getUrl()}/api/users/accounts/${id}/auth_attachment.json${isDev ? `?debug=${window._debugType || 'admin'}&randomcode=${newtimestamp}&client_key=${anewopens}` : `?randomcode=${newtimestamp}&client_key=${anewopens}`}` } export function getRandomNumber(type) { - Railsgettimes() + // Railsgettimes() let anewopens=md5(newopens+newtimestamp); return type===true?`randomcode=${newtimestamp}&client_key=${anewopens}`:`?randomcode=${newtimestamp}&client_key=${anewopens}` } @@ -149,7 +149,7 @@ export function getTaskUrlById(id) { } export function getRandomcode(url) { - Railsgettimes() + // Railsgettimes() let anewopens=md5(newopens+newtimestamp); if (url.indexOf('?') == -1) { diff --git a/src/forge/Order/Detail.js b/src/forge/Order/Detail.js index 5d13b9e6..a8431dd5 100644 --- a/src/forge/Order/Detail.js +++ b/src/forge/Order/Detail.js @@ -5,13 +5,20 @@ import axios from 'axios'; import Nav from './Nav'; 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 {Modal , Form, Input, Tooltip, Popconfirm, Pagination , Spin} from 'antd' +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 +39,9 @@ class Detail extends Component{ page:1, search_count:undefined, isSpin:false, - showFiles: true + showFiles: true, + quillValue:'', + quillFlag:false } } @@ -74,12 +83,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,11 +111,12 @@ class Detail extends Component{ content: "" }); this.setState({ - showFiles: false + showFiles: false, + quillValue:'', + quillFlag:false }) this.getjournalslist(page, limit); this.props.showNotification("评论成功!"); - // this.UploadFunc(undefined) } }).catch(error=>{ console.log(error); @@ -215,7 +239,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 +304,18 @@ class Detail extends Component{ showFiles:flag }) } + onContentChange=(value)=>{ + if(value){ + this.setState({ + quillValue:value, + quillFlag:false + }) + } + } 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 +357,10 @@ class Detail extends Component{
+
{data&&data.issue_status==="关闭"?"关闭中":"开启中"}
由 { data && data.author_name} 于 { data && data.created_at }创建{ data && data.journals_count && data.journals_count > 0 ?` · ${data.journals_count} 条评论`:""}
@@ -411,7 +448,10 @@ class Detail extends Component{
+ { quillFlag && 请输入评论内容}
+
评论
@@ -458,7 +509,7 @@ class Detail extends Component{
分支
{
diff --git a/src/forge/Order/New.js b/src/forge/Order/New.js
index 63c8e8f0..568721f3 100644
--- a/src/forge/Order/New.js
+++ b/src/forge/Order/New.js
@@ -1,17 +1,25 @@
import React , { Component } from "react";
import { Form , Input , Select } from 'antd';
-import {Link} from 'react-router-dom';
import { getImageUrl } from 'educoder';
import Nav from './Nav';
import UploadComponent from '../Upload/Index';
+import QuillForEditor from '../quillForEditor';
+import { QuillDeltaToHtmlConverter } from 'quill-delta-to-html'
+
import './order.css';
import axios from 'axios';
const Option = Select.Option;
-const TextArea = Input.TextArea;
+const options = [
+ ['bold', 'italic', 'underline'],
+ [{header: [1,2,3,false]}],
+ ['blockquote', 'code-block'],
+ ['link', 'image'],
+ ['formula']
+];
class New extends Component{
constructor(props){
super(props);
@@ -27,7 +35,8 @@ class New extends Component{
done_ratio:"0%",
issue_chosen:undefined,
branches:undefined,
- fileList:undefined
+ fileList:undefined,
+ description:undefined
}
}
@@ -94,9 +103,16 @@ class New extends Component{
if(values.issue_tag_ids.length > 0){
values.issue_tag_ids = [values.issue_tag_ids]
}
-
+ const { description } = this.state;
+ let _html = '';
+ try {
+ _html = new QuillDeltaToHtmlConverter(description.ops, {}).convert();
+ } catch (error) {
+ console.log(error);
+ }
axios.post(url,{
...values,
+ description:_html,
attachment_ids:fileList
}).then(result=>{
if(result){
@@ -118,10 +134,16 @@ class New extends Component{
})
}
+ onContentChange=(value)=>{
+ this.setState({
+ description:value
+ })
+ }
+
render(){
const { getFieldDecorator } = this.props.form;
const { current_user } = this.props;
- const { issue_tag_ids , fixed_version_id , branch_name , status_id , tracker_id , issue_type ,assigned_to_id , priority_id , done_ratio,
+ const { issue_tag_ids , fixed_version_id , branch_name , status_id , tracker_id , description ,assigned_to_id , priority_id , done_ratio,
issue_chosen , branches } = this.state;
return(
@@ -132,7 +154,7 @@ class New extends Component{