From 9fd2621c596130bb99c02d6b8eae5dae7518ba50 Mon Sep 17 00:00:00 2001 From: "sylor_huang@126.com" Date: Fri, 5 Jun 2020 11:29:11 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9A=90=E8=97=8F=E4=B8=8A=E9=93=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Newfile/UserSubmitComponent.js | 41 ++++++++++++++++++------ src/forge/Order/Detail.js | 41 ++---------------------- src/forge/Order/order_form.js | 4 +-- src/modules/login/LoginDialog.js | 2 +- 4 files changed, 36 insertions(+), 52 deletions(-) diff --git a/src/forge/Newfile/UserSubmitComponent.js b/src/forge/Newfile/UserSubmitComponent.js index eccfe8361..05b8b34bf 100644 --- a/src/forge/Newfile/UserSubmitComponent.js +++ b/src/forge/Newfile/UserSubmitComponent.js @@ -1,6 +1,6 @@ import React, { Component } from "react"; import { getImageUrl } from "educoder"; -import { Form, Input, Button, Radio, Icon } from "antd"; +import { Form, Input, Button, Radio, Icon, Spin } from "antd"; import { Link } from "react-router-dom"; import "./index.css"; @@ -11,7 +11,8 @@ class UserSubmitComponent extends Component { super(props); this.state = { submitType: "0", - filename: "" + filename: "", + isSpin: false }; } @@ -26,7 +27,6 @@ class UserSubmitComponent extends Component { this.setState({ filename: e.target.value, }); - console.log("99999", e.target.value) }; // 提交变更 @@ -34,6 +34,7 @@ class UserSubmitComponent extends Component { const { filepath, content,editor_type } = this.props; const { branch, projectsId } = this.props.match.params; const { submitType, filename } = this.state; + this.setState({isSpin: true}) let path = editor_type === "upload" ? filepath : filepath.substr(1); this.props.form.validateFieldsAndScroll((err, values) => { if (!err) { @@ -47,22 +48,33 @@ class UserSubmitComponent extends Component { message: values.desc, }) .then((result) => { + this.setState({isSpin: false}) if (result && result.data.name) { - const url = values.branchname - ? `/projects/${projectsId}/coders?branch=${values.branchname}` - : `/projects/${projectsId}/coders`; + let url = values.branchname + ? `/projects/${projectsId}/coders?branch=${values.branchname}` + : `/projects/${projectsId}/coders`; + if(result.pr_id){ + url = `/projects/${projectsId}/merge/${result.pr_id}/Messagecount` + } + // const url = values.branchname + // ? `/projects/${projectsId}/coders?branch=${values.branchname}` + // : `/projects/${projectsId}/coders`; this.props.history.push(url); } }) .catch((error) => { + this.setState({isSpin: false}) console.log(error); }); + }else{ + this.setState({isSpin: false}) } }); }; // 确认修改文件 UpdateFile = () => { + this.setState({isSpin: true}) const { branch, detail, content, filepath } = this.props; const { projectsId } = this.props.match.params; const { submitType } = this.state; @@ -79,25 +91,31 @@ class UserSubmitComponent extends Component { message: values.desc, }) .then((result) => { + this.setState({isSpin: false}) if (result && result.data.status === 1) { - // const url = `/projects/${projectsId}/coders?url=${detail.path.split("/")[0]}`; - // this.props.history.push(url); - const url = values.branchname + let url = values.branchname ? `/projects/${projectsId}/coders?branch=${values.branchname}` : `/projects/${projectsId}/coders`; + if(result.pr_id){ + url = `/projects/${projectsId}/merge/${result.pr_id}/Messagecount` + } + this.props.history.push(url); this.props.showNotification("修改成功!"); } }) .catch((error) => { + this.setState({isSpin: false}) console.log(error); }); + }else{ + this.setState({isSpin: false}) } }); }; render() { - const { submitType,filename } = this.state; + const { submitType,filename, isSpin } = this.state; const { getFieldDecorator } = this.props.form; const { branch, projectsId } = this.props.match.params; @@ -150,6 +168,7 @@ class UserSubmitComponent extends Component { 提交变更 +
@@ -223,6 +242,8 @@ class UserSubmitComponent extends Component { 取消
+ +
); } diff --git a/src/forge/Order/Detail.js b/src/forge/Order/Detail.js index f0edd6ba9..7f6eed1c8 100644 --- a/src/forge/Order/Detail.js +++ b/src/forge/Order/Detail.js @@ -123,43 +123,6 @@ class Detail extends Component { }); }; - // renderJournalList = (list) => { - // if (list && list.length > 0) { - // return list.map((item, key) => { - // return ( - //
- // {item.detail}: - // - // {item.old_value && item.old_value.length > 0 ? "更新为" : "新增"} - // - // - // {item.value && item.value.length > 0 ? ( - // item.detail === "标签" ? ( - // - // {item.value[0].name} - // - // ) : ( - // item.value - // ) - // ) : ( - // "无" - // )} - // - //
- // ); - // }); - // } else { - // return ( - //
- // 没有评论~ - //
- // ); - // } - // }; - //复制 copydetail = () => { const { projectsId, orderId } = this.props.match.params; @@ -346,7 +309,7 @@ class Detail extends Component { 分支: {data && data.branch_name ? data.branch_name : "--"}

-

+ {/*

是否上链: {data && data.issue_type==="2" ? '是' : "--"}

@@ -356,7 +319,7 @@ class Detail extends Component { token值: {data && data.token ? data.token : "--"}

- } + } */}

标签: diff --git a/src/forge/Order/order_form.js b/src/forge/Order/order_form.js index ae4816dd1..8b47a75ce 100644 --- a/src/forge/Order/order_form.js +++ b/src/forge/Order/order_form.js @@ -571,7 +571,7 @@ class order_form extends Component { onChange={this.changeEndTime} /> - + {/* )} - )} + )} */} diff --git a/src/modules/login/LoginDialog.js b/src/modules/login/LoginDialog.js index 80fb085a0..f8a00701a 100644 --- a/src/modules/login/LoginDialog.js +++ b/src/modules/login/LoginDialog.js @@ -412,7 +412,7 @@ class LoginDialog extends Component { }) this.props.Modifyloginvalue(); console.log("login_url",this.props.location.pathname) - if(!this.props.location.pathname || this.props.location.pathname === ""){ + if(!this.props.location.pathname || this.props.location.pathname === "/"){ this.props.history.push(`/users/${response.data && response.data.login}`) }else{ window.location.reload();