mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-11 18:42:54 +00:00
perf: 优化置顶后数据请求
This commit is contained in:
parent
57567ebb1b
commit
2aa687a40b
@ -485,6 +485,9 @@ class DialogController extends AbstractController
|
||||
}
|
||||
$dialogUser->top_at = $dialogUser->top_at ? null : Carbon::now();
|
||||
$dialogUser->save();
|
||||
return Base::retSuccess("success", $dialogId);
|
||||
return Base::retSuccess("success", [
|
||||
'id' => $dialogUser->dialog_id,
|
||||
'top_at' => $dialogUser->top_at?->toDateTimeString(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1906,6 +1906,9 @@ class ProjectController extends AbstractController
|
||||
}
|
||||
$projectUser->top_at = $projectUser->top_at ? null : Carbon::now();
|
||||
$projectUser->save();
|
||||
return Base::retSuccess("success", $projectId);
|
||||
return Base::retSuccess("success", [
|
||||
'id' => $projectUser->project_id,
|
||||
'top_at' => $projectUser->top_at?->toDateTimeString(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -888,16 +888,17 @@ export default {
|
||||
data: {
|
||||
project_id: this.topOperateItem.id,
|
||||
},
|
||||
}).then(() => {
|
||||
this.$store.dispatch("getProjects").then(() => {
|
||||
}).then(({data}) => {
|
||||
this.$store.dispatch("saveProject", data);
|
||||
this.$nextTick(() => {
|
||||
let active = this.$refs.projectWrapper.querySelector(".active")
|
||||
if (active) {
|
||||
$A.scrollToView(active, {
|
||||
behavior: 'smooth',
|
||||
behavior: 'instant',
|
||||
scrollMode: 'if-needed',
|
||||
});
|
||||
}
|
||||
}).catch(() => {});
|
||||
});
|
||||
}).catch(({msg}) => {
|
||||
$A.modalError(msg);
|
||||
});
|
||||
|
||||
@ -469,9 +469,10 @@ export default {
|
||||
data: {
|
||||
dialog_id: this.topOperateItem.id,
|
||||
},
|
||||
}).then(() => {
|
||||
this.$store.dispatch("getDialogs").then(() => {
|
||||
this.scrollIntoActive(true)
|
||||
}).then(({data}) => {
|
||||
this.$store.dispatch("saveDialog", data);
|
||||
this.$nextTick(() => {
|
||||
this.scrollIntoActive(false)
|
||||
});
|
||||
}).catch(({msg}) => {
|
||||
$A.modalError(msg);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user