fix: 操作后列表为空时自动返回上一页(和旧版一致)
首次加载为空→显示"暂无任务",操作后列表为空→自动popBackStack Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -52,6 +52,9 @@ class TaskListFragment : BaseFragment<FragmentTaskListBinding>() {
|
|||||||
private var currentStatus = 2
|
private var currentStatus = 2
|
||||||
|
|
||||||
|
|
||||||
|
/** 是否执行过操作(操作后列表为空时自动返回) */
|
||||||
|
private var hasActioned = false
|
||||||
|
|
||||||
/** 提示弹窗 */
|
/** 提示弹窗 */
|
||||||
private lateinit var tipDialog: QuTipDialog
|
private lateinit var tipDialog: QuTipDialog
|
||||||
|
|
||||||
@@ -126,6 +129,9 @@ class TaskListFragment : BaseFragment<FragmentTaskListBinding>() {
|
|||||||
// 确保 taskIndex 在范围内
|
// 确保 taskIndex 在范围内
|
||||||
if (taskIndex >= taskList.size) taskIndex = taskList.size - 1
|
if (taskIndex >= taskList.size) taskIndex = taskList.size - 1
|
||||||
fetchCurrentDetail()
|
fetchCurrentDetail()
|
||||||
|
} else if (hasActioned) {
|
||||||
|
// 操作后列表为空 → 自动返回上一页
|
||||||
|
findNavController().popBackStack()
|
||||||
} else {
|
} else {
|
||||||
showEmpty()
|
showEmpty()
|
||||||
}
|
}
|
||||||
@@ -369,6 +375,7 @@ class TaskListFragment : BaseFragment<FragmentTaskListBinding>() {
|
|||||||
when (result) {
|
when (result) {
|
||||||
is ApiResult.Success -> {
|
is ApiResult.Success -> {
|
||||||
Timber.d("任务操作: $successMsg")
|
Timber.d("任务操作: $successMsg")
|
||||||
|
hasActioned = true // 标记已操作,列表为空时自动返回
|
||||||
tipDialog.show(
|
tipDialog.show(
|
||||||
status = QuTipDialog.Status.SUCCESS,
|
status = QuTipDialog.Status.SUCCESS,
|
||||||
title = successMsg,
|
title = successMsg,
|
||||||
|
|||||||
Reference in New Issue
Block a user