隐藏上链

This commit is contained in:
sylor_huang@126.com 2020-06-05 11:29:11 +08:00
parent 76c5e7e8de
commit 9fd2621c59
4 changed files with 36 additions and 52 deletions

View File

@ -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 {
<span className="color-grey-8">提交变更</span>
</span>
<Spin spinning={isSpin}>
<div className="userScrew">
<div className="screwPanel">
<Form>
@ -223,6 +242,8 @@ class UserSubmitComponent extends Component {
取消
</Button>
</div>
</Spin>
</div>
);
}

View File

@ -123,43 +123,6 @@ class Detail extends Component {
});
};
// renderJournalList = (list) => {
// if (list && list.length > 0) {
// return list.map((item, key) => {
// return (
// <div key={key + 1} className="journal-list-item">
// <span className="font-weight-bold mr3">{item.detail}</span>
// <span className="mr5 color-grey-9">
// {item.old_value && item.old_value.length > 0 ? "更新为" : "新增"}
// </span>
// <span>
// {item.value && item.value.length > 0 ? (
// item.detail === "标签" ? (
// <span
// className="issue-tag-show"
// style={{ background: item.value[0].color }}
// >
// {item.value[0].name}
// </span>
// ) : (
// item.value
// )
// ) : (
// "无"
// )}
// </span>
// </div>
// );
// });
// } else {
// return (
// <div>
// <span>没有评论~</span>
// </div>
// );
// }
// };
//复制
copydetail = () => {
const { projectsId, orderId } = this.props.match.params;
@ -346,7 +309,7 @@ class Detail extends Component {
<span className="issue_detail_info">分支:</span>
<span>{data && data.branch_name ? data.branch_name : "--"}</span>
</p>
<p className="grid-item pb15">
{/* <p className="grid-item pb15">
<span className="issue_detail_info">是否上链:</span>
<span>{data && data.issue_type==="2" ? '是' : "--"}</span>
</p>
@ -356,7 +319,7 @@ class Detail extends Component {
<span className="issue_detail_info">token值:</span>
<span>{data && data.token ? data.token : "--"}</span>
</p>
}
} */}
<p className="grid-item pb15">
<span className="issue_detail_info">标签:</span>

View File

@ -571,7 +571,7 @@ class order_form extends Component {
onChange={this.changeEndTime}
/>
</Form.Item>
<Form.Item label="是否上链">
{/* <Form.Item label="">
<Switch
checkedChildren="是"
unCheckedChildren="否"
@ -592,7 +592,7 @@ class order_form extends Component {
initialValue: token,
})(<Input placeholder="请填写token值" />)}
</Form.Item>
)}
)} */}
</div>
</div>
</Form>

View File

@ -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();