From 3f1adac990aab76f6a845d07649a5ce6f9b8e005 Mon Sep 17 00:00:00 2001 From: chenyuan Date: Sat, 17 Oct 2026 11:59:03 +0800 Subject: [PATCH] =?UTF-8?q?fix(task):=20=E4=BB=BB=E5=8A=A1=E5=88=86?= =?UTF-8?q?=E9=85=8D=E7=8F=AD=E7=BA=A7=E4=B8=8B=E6=8B=89=E5=8F=AA=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=BD=93=E5=89=8D=E6=95=99=E5=B8=88=E8=87=AA=E5=B7=B1?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E7=9A=84=E6=95=99=E5=AD=A6=E7=8F=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 与后端 requireOwnedTeachingClass 的属主校验对齐, 避免选中他人班级后保存被 403 - createdBy 比较统一走 sameValue(去空白) --- src/views/teacherEnd/task/index.vue | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/views/teacherEnd/task/index.vue b/src/views/teacherEnd/task/index.vue index 0359d83..2529cb7 100644 --- a/src/views/teacherEnd/task/index.vue +++ b/src/views/teacherEnd/task/index.vue @@ -106,10 +106,17 @@ const expandedProjects = ref(new Set()); // 追踪展开的项目 const referenceAnswerSaving = reactive({}); let activeLoadGeneration = 0; +function sameValue(left, right) { + return String(left ?? "").trim() === String(right ?? "").trim(); +} + const currentUserId = computed(() => userStore.userInfo.userId); -const teachingClassList = computed(() => classList.value.filter((item) => item.classType === "TEACHING" || !item.classType && item.createdBy)); +const teachingClassList = computed(() => classList.value.filter((item) => + (item.classType === "TEACHING" || (!item.classType && item.createdBy)) + && sameValue(item.createdBy, currentUserId.value) +)); const selectedClass = computed(() => teachingClassList.value.find((item) => item.schoolClassId === classId.value)); -const canOperateSelectedClass = computed(() => selectedClass.value?.createdBy === currentUserId.value); +const canOperateSelectedClass = computed(() => sameValue(selectedClass.value?.createdBy, currentUserId.value)); // 按项目分组任务 const groupedTasks = computed(() => {