From 30434866cb99aff570f927641a57804dcf89e310 Mon Sep 17 00:00:00 2001 From: dingyongkang <837816638@qq.com> Date: Wed, 26 Feb 2020 09:39:33 +0800 Subject: [PATCH] =?UTF-8?q?pr=E9=83=A8=E5=88=86=E4=B8=8E=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8F=91=E5=B8=83=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/AppConfig.js | 4 +- public/react/src/forge/Main/Detail.js | 71 ++- public/react/src/forge/Merge/MergeDetail.js | 322 ++++++++++++ public/react/src/forge/Merge/MergeItem.js | 11 +- public/react/src/forge/Merge/MergeSubmit.js | 204 ++++++++ public/react/src/forge/Merge/MessageCount.js | 472 ++++++++++++++++++ public/react/src/forge/Merge/NewMerge.js | 353 +++++++++++++ public/react/src/forge/Merge/UpdateMerge.js | 355 +++++++++++++ public/react/src/forge/Merge/merge.css | 13 + public/react/src/forge/Merge/merge.js | 26 +- public/react/src/forge/Version/NewVersion.js | 199 ++++++++ .../react/src/forge/Version/UpdateVersion.js | 218 ++++++++ public/react/src/forge/Version/version.css | 24 + public/react/src/forge/Version/version.js | 2 +- 14 files changed, 2252 insertions(+), 22 deletions(-) create mode 100644 public/react/src/forge/Merge/MergeDetail.js create mode 100644 public/react/src/forge/Merge/MergeSubmit.js create mode 100644 public/react/src/forge/Merge/MessageCount.js create mode 100644 public/react/src/forge/Merge/NewMerge.js create mode 100644 public/react/src/forge/Merge/UpdateMerge.js create mode 100644 public/react/src/forge/Version/NewVersion.js create mode 100644 public/react/src/forge/Version/UpdateVersion.js create mode 100644 public/react/src/forge/Version/version.css diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index c518026e2..5949c2fb5 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -45,7 +45,7 @@ export function initAxiosInterceptors(props) { // https://github.com/axios/axios/issues/1497 // TODO 读取到package.json中的配置? - var proxy = "http://localhost:3000" + var //proxy = "http://localhost:3000" //proxy = "http://testbdweb.trustie.net" //proxy = "http://testbdweb.educoder.net" // proxy = "https://testeduplus2.educoder.net" @@ -54,7 +54,7 @@ export function initAxiosInterceptors(props) { // proxy="https://test-newweb.educoder.net" //proxy="https://test-jupyterweb.educoder.net" //proxy="http://192.168.2.63:3001" - // proxy="http://123.59.135.93:56666" + proxy="http://123.59.135.93:56666" // 在这里使用requestMap控制,避免用户通过双击等操作发出重复的请求; // 如果需要支持重复的请求,考虑config里面自定义一个allowRepeat参考来控制 diff --git a/public/react/src/forge/Main/Detail.js b/public/react/src/forge/Main/Detail.js index a8a1d61e4..9e007c18a 100644 --- a/public/react/src/forge/Main/Detail.js +++ b/public/react/src/forge/Main/Detail.js @@ -66,6 +66,38 @@ const MergeIndexDetail = Loadable({ loader: () => import('../Merge/merge'), loading: Loading, }) + +const CreateMerge = Loadable({ + loader: () => import('../Merge/NewMerge'), + loading: Loading, +}) + +const MessageCount = Loadable({ + loader: () => import('../Merge/MessageCount'), + loading: Loading, +}) + +const MergeSubmit = Loadable({ + loader: () => import('../Merge/MergeSubmit'), + loading: Loading, +}) + +const UpdateMerge = Loadable({ + loader: () => import('../Merge/UpdateMerge'), + loading: Loading, +}) +//版本发布 +const VersionIndex = Loadable({ + loader: () => import('../Version/version'), + loading: Loading, +}) +const NewVersionIndex = Loadable({ + loader: () => import('../Version/NewVersion'), + loading: Loading, +}) + + + const TrendsIndex = Loadable({ loader: () => import('../Activity/Activity'), loading: Loading, @@ -274,7 +306,7 @@ class Detail extends Component{
  • 0 || urlFlag)? "active" : ""}>代码
  • 0 ? "active" : ""}>工单{projectDetail&&projectDetail.issues_count===0?"":projectDetail&&projectDetail.issues_count===0?projectDetail.issues_count:""}
  • 0 ? "active" : ""}>合并请求{projectDetail&&projectDetail.pull_requests_count===0?"":projectDetail&&projectDetail.pull_requests_count===0?projectDetail.pull_requests_count:""}
  • -
  • 0 ? "active" : ""}>版本发布
  • +
  • 0 ? "active" : ""}>版本发布
  • 0 ? "active" : ""}>动态
  • { isManager && @@ -373,6 +405,43 @@ class Detail extends Component{ (props) => () } > + + () + } + > + + () + } + > + + () + } + > + + () + } + > + () + } + > + + + () + } + > + () diff --git a/public/react/src/forge/Merge/MergeDetail.js b/public/react/src/forge/Merge/MergeDetail.js new file mode 100644 index 000000000..7178deb71 --- /dev/null +++ b/public/react/src/forge/Merge/MergeDetail.js @@ -0,0 +1,322 @@ +import React , {Component} from 'react'; +import {Link} from 'react-router-dom'; + +import axios from 'axios'; +import Nav from '../Order/Nav'; +import UploadComponent from '../Upload/Index'; + +import{ Modal,Col,Form,Input,Tooltip,Popconfirm } from 'antd' +import NoneData from '../../modules/courses/coursesPublic/NoneData'; + + +const TextArea = Input.TextArea; + + +class MergeDetail extends Component{ + constructor(props){ + super(props); + this.state={ + data:undefined, + isShow:false, + imgsrc:'', + journalsdata:undefined, + //图片区域是否显示 none 隐藏 block 显示 + display:'none', + titledisplay:'none', + countvalue:'', + //是否需要编辑 + isedit:'block' + } + } + + componentDidMount=()=>{ + this.getDetail(); + } + + getDetail=()=>{ + const { projectsId , mergeid} = this.props.match.params; + const url = `/projects/${projectsId}/pull_requests/${mergeid}.json`; + axios.get(url).then((result)=>{ + if(result){ + this.setState({ + data:result.data, + }) + this.getjournalslist(); + } + }).catch((error)=>{ + console.log(error); + }) + } + + handleok=() => { + this.setState({ + isShow:false + }); + }; + handleCancel=()=>{ + this.setState({ + isShow:false + }); + } + + imgshow=()=>{ + this.setState({ + isShow:true + }); + }; + + //添加评论 + addjournals=()=>{ + this.props.form.validateFieldsAndScroll((err, values) => { + if(!err){ + const { data } = this.state; + const url = `/issues/${data.pull_request.id}/journals.json`; + axios.post(url,{ + ...values, + issue_id:data.id, + }).then(result=>{ + if(result){ + this.getjournalslist(); + } + }).catch(error=>{ + console.log(error); + }) + } + }) + } + //获取评论信息 + getjournalslist=()=>{ + const { data } = this.state; + const url = `/issues/${data.pull_request.id}/journals.json`; + let id=data.id; + axios.get(url,{ + params:{ + id + } + }).then(result=>{ + if(result){ + this.setState({ + journalsdata:result.data + }) + } + }).catch(error=>{ + console.log(error); + }) + } + + //关闭工单 + closedetail=(id)=>{ + const {projectsId,orderId} = this.props.match.params; + const url = `/projects/${projectsId}/issues/${orderId}/close_issue.json`; + axios.post(url,{ + project_id:projectsId, + id:orderId, + status_id:id, + }).then(result=>{ + if(result){ + this.getDetail(); + } + }).catch(error=>{ + console.log(error); + }) + } + + //修改评论 + updatedetail=(id)=>{ + const {mergeid} = this.props.match.params; + const url = `/issues/${mergeid}/journals/${id}.json`; + axios.put(url,{ + issue_id:mergeid, + id:id, + content:this.state.countvalue + }).then(result=>{ + if(result){ + this.setState({ + isedit:'block' + }) + this.getjournalslist(); + } + }).catch(error=>{ + console.log(error); + }) + } + + changmodelname=(e)=>{ + this.setState({ + countvalue:e.target.value + }) + } + editdetail=(count,status)=>{ + this.setState({ + countvalue:count, + isedit:status + }) + } + + + render(){ + const { projectsId,mergeid} = this.props.match.params; + const { data,journalsdata } = this.state; + const { getFieldDecorator } = this.props.form; + const url = this.props.history.location.pathname; + const renderList =()=>{ + if(journalsdata && journalsdata.issue_journals && journalsdata.issue_journals.length>0 ){ + return( +
    { + journalsdata.issue_journals.map((item,key)=>{ + return( +
  • +
    + +
    +
    +

    {item.user_name} + + 于{item.created_at} + + 评论

    +
    + this.editdetail(item.content,'none')}> +
    + this.deletedetail(item.id)}> + + +
    + +
    +
    +

    {item.content}

    +
    +