fix: 完善任务导航与结束会话错误处理

- 结束会话 API 异常时显示错误,不导航(可重试)
- 结束会话硬跳转改为软导航 router.push
- TaskForm 创建/更新/取消后跳转任务列表页
- 移除 TaskForm 页面内大标题
This commit is contained in:
2026-05-23 22:55:03 +08:00
parent 43e8cd4965
commit fce4ba194b
2 changed files with 22 additions and 31 deletions
+3 -18
View File
@@ -22,12 +22,6 @@ const priority = ref({
});
const priorityOptions = [0, 1, 2, 3, 4, 5];
const pageTitle = computed(() => (route.name === "update-task" ? "更新学习任务" : "创建学习任务"));
const pageSubtitle = computed(() =>
route.name === "update-task"
? "修改任务信息后保存,后续学习会话将使用最新内容"
: "填写任务基本信息与优先级维度,帮助系统更好排序"
);
const createTask = () => {
request
@@ -40,7 +34,7 @@ const createTask = () => {
.then((result) => {
if (result.code === 200) {
ElMessage.success("创建任务成功");
router.back();
router.push({ name: "study" });
} else {
ElMessage.error("任务创建失败:" + result.message);
}
@@ -81,7 +75,7 @@ const updateTask = () => {
.then((result) => {
if (result.code === 200) {
ElMessage.success("更新任务成功");
router.back();
router.push({ name: "study" });
} else {
ElMessage.error("任务更新失败:" + result.message);
}
@@ -90,7 +84,7 @@ const updateTask = () => {
const cancelTask = () => {
ElMessage.info("已取消操作");
router.back();
router.push({ name: "study" });
};
const submitTask = () => {
@@ -126,11 +120,6 @@ const isMobile = computed(() => screenWidth.value <= 900);
<template>
<section class="task-form-page">
<header class="surface-card form-header">
<h1 class="page-title">{{ pageTitle }}</h1>
<p class="page-subtitle">{{ pageSubtitle }}</p>
</header>
<el-form label-position="top" class="surface-card form-shell">
<div class="group">
<h3>基础信息</h3>
@@ -195,10 +184,6 @@ const isMobile = computed(() => screenWidth.value <= 900);
gap: 14px;
}
.form-header {
padding: 20px 22px;
}
.form-shell {
padding: 22px;
}