From 874ee23c0f31bd9fa6ee0c829d92a15757ee5a76 Mon Sep 17 00:00:00 2001 From: caicai8 <1149225589@qq.com> Date: Wed, 26 Feb 2020 16:33:39 +0800 Subject: [PATCH] =?UTF-8?q?issue=E8=AF=84=E8=AE=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 2 +- public/react/src/AppConfig.js | 11 ++------- public/react/src/forge/Order/Detail.js | 17 ++++++++------ public/react/src/forge/Upload/Index.js | 27 +++++++++++------------ 4 files changed, 26 insertions(+), 31 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index fe77a99f7..cb39a24f7 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -329,7 +329,7 @@ class ApplicationController < ActionController::Base def current_user # User.current if Rails.env.development? - user_id = 36390 + user_id = 50207 else user_id = 130328 end diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index b6efca5b3..1f57d0ff0 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -47,15 +47,8 @@ export function initAxiosInterceptors(props) { // 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="http://192.168.2.63:3001" - proxy="http://123.59.135.93:56666" + // proxy="http://123.59.135.93:56666" + proxy="http://localhost:3000" // 在这里使用requestMap控制,避免用户通过双击等操作发出重复的请求; // 如果需要支持重复的请求,考虑config里面自定义一个allowRepeat参考来控制 diff --git a/public/react/src/forge/Order/Detail.js b/public/react/src/forge/Order/Detail.js index 330c90442..0c3ffd85f 100644 --- a/public/react/src/forge/Order/Detail.js +++ b/public/react/src/forge/Order/Detail.js @@ -85,8 +85,7 @@ class Detail extends Component{ }).then(result=>{ if(result){ this.props.form.setFieldsValue({ - content: "", - attachments_ids: undefined + content: "" }); this.setState({ showFiles: false @@ -117,7 +116,6 @@ class Detail extends Component{ search_count:result.data.journals_count, isSpin:false, fileList:undefined, - showFiles: true }) } }).catch(error=>{ @@ -161,7 +159,6 @@ class Detail extends Component{ //修改评论 updatedetail=(id)=>{ - console.log("updtedetail", this.state) const {page, limit } = this.state; const {orderId} = this.props.match.params; const url = `/issues/${orderId}/journals/${id}.json`; @@ -276,6 +273,13 @@ class Detail extends Component{ this.getjournalslist(page,limit); } + // 判断是否重新上传文件 + changeIsComplete=(flag)=>{ + this.setState({ + showFiles:flag + }) + } + render(){ const { projectsId,orderId} = this.props.match.params; const { data,journalsdata, page, limit, search_count, isSpin, isedit, showFiles } = this.state; @@ -423,8 +427,7 @@ class Detail extends Component{ { Paginations }
评论
{
+
const url = `/attachments/${file.response ? file.response.id : file.uid}.json`
axios.delete(url, {
}).then((response) => {
@@ -54,6 +55,8 @@ class Index extends Component{
handleChange = (info) => {
+ const { changeIsComplete } = this.props;
+ changeIsComplete && changeIsComplete(true);
if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
let fileList = info.fileList;
@@ -71,30 +74,26 @@ class Index extends Component{
}
render(){
-
+ //判断是否已经提交,如已提交评论则上一条评论数据清除
+ const { isComplete } = this.props;
const { fileList } = this.state;
+
+ let list = isComplete === true ? fileList : undefined;
const upload = {
name: 'file',
- fileList,
+ fileList:list,
action: `${getUploadActionUrl()}`,
onChange:this.handleChange,
onRemove: this.onAttachmentRemove,
};
return(
-
拖动文件或者点击此处上传 拖动文件或者点击此处上传