This commit is contained in:
caishi 2020-08-14 10:08:38 +08:00
parent 6e7b6f3928
commit 1027156adb
2 changed files with 21 additions and 23 deletions

View File

@ -151,7 +151,9 @@ class Detail extends Component {
}
componentDidUpdate = (prevState) => {
if (prevState && this.props && (prevState.match.params.projectsId !== this.props.match.params.projectsId)) {
let prevParam = prevState.match.params;
let propsParam = this.props.match.params;
if (prevState && this.props && (prevParam.projectsId !== propsParam.projectsId || prevParam.owner !== propsParam.owner)) {
this.getProject();
}
}
@ -204,7 +206,6 @@ class Detail extends Component {
disconnected: () => { },
received: data => {
console.log(`###### ---received data--- ######`);
console.log(data);
if (data) {
this.getDetail();
cable.subscriptions.consumer.disconnect();
@ -247,8 +248,7 @@ class Detail extends Component {
target_type: "project",
id: project_id
}
})
.then(result => {
}).then(result => {
if (result && result.data.status === 0) {
this.setWatchersCount(result.data.watchers_count, result.data.watched);
}
@ -261,12 +261,10 @@ class Detail extends Component {
// 点赞和取消点赞
pariseFunc = (flag) => {
const { project_id } = this.state;
axios({
method: flag ? 'delete' : 'post',
url: `/projects/${project_id}/praise_tread/${flag ? 'unlike' : 'like'}.json`
})
.then(result => {
}).then(result => {
if (result && result.data.status === 0) {
this.setPraisesCount(result.data.praises_count, result.data.praised)
}
@ -292,11 +290,12 @@ class Detail extends Component {
// fork项目
forkFunc = () => {
const { current_user } = this.props
const { projectsId , owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/forks.json`;
axios.post(url).then(result => {
if (result && result.data.status === 0) {
this.props.history.push(`/projects/${owner}/${result.data.identifier}/coders`);
this.props.history.push(`/projects/${current_user && current_user.login}/${result.data.identifier}/coders`);
this.props.showNotification(result.data.message);
}
}).catch(error => {
@ -304,7 +303,6 @@ class Detail extends Component {
})
}
// 同步镜像
synchronismMirror = () => {
const { projectsId , owner } = this.props.match.params;

View File

@ -17,11 +17,11 @@ class order_form extends Component {
branch_name: "",
issue_tag_ids: "",
fixed_version_id: "",
tracker_id: "1",
tracker_id: "4",
issue_type: "1",
status_id: "1",
assigned_to_id: "",
priority_id: "1",
priority_id: "2",
done_ratio: "0%",
issue_chosen: undefined,
branches: undefined,