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

View File

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