From fe74f45bca3e9d314a4d88768d5e78755aadf4fa Mon Sep 17 00:00:00 2001 From: Hera Zhao Date: Sun, 12 Apr 2026 21:59:11 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=80=81=E5=B8=88=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E7=B2=BE=E7=A1=AE=E8=BE=93=E5=85=A5=E5=8C=B9?= =?UTF-8?q?=E9=85=8D=EF=BC=8C=E4=B8=8D=E6=9A=B4=E9=9C=B2=E8=80=81=E5=B8=88?= =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 输入老师的 display_name 或 username 精确匹配才能发送请求。 Co-Authored-By: Claude Opus 4.6 (1M context) --- frontend/src/views/Inventory.vue | 37 +++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/frontend/src/views/Inventory.vue b/frontend/src/views/Inventory.vue index 4122023..3a3e363 100644 --- a/frontend/src/views/Inventory.vue +++ b/frontend/src/views/Inventory.vue @@ -56,15 +56,17 @@ - - + + +
+ 已匹配:{{ matchedTeacher.display_name }} +
+
+ 未找到该老师,请确认名字是否正确 +
@@ -311,7 +313,16 @@ async function toggleOil(name) { // Plan request const showPlanRequest = ref(false) const planHealthDesc = ref('') -const planTeacherId = ref('') +const planTeacherName = ref('') +const matchedTeacher = ref(null) + +function matchTeacher() { + const name = planTeacherName.value.trim() + if (!name) { matchedTeacher.value = null; return } + matchedTeacher.value = plansStore.teachers.find(t => + t.display_name === name || t.username === name + ) || null +} const shoppingTotal = computed(() => plansStore.shoppingList.filter(i => !i.in_inventory).reduce((s, i) => s + i.total_cost, 0).toFixed(2) @@ -319,10 +330,11 @@ const shoppingTotal = computed(() => async function submitPlanRequest() { try { - await plansStore.createPlan(planHealthDesc.value, planTeacherId.value) + await plansStore.createPlan(planHealthDesc.value, matchedTeacher.value.id) showPlanRequest.value = false planHealthDesc.value = '' - planTeacherId.value = '' + planTeacherName.value = '' + matchedTeacher.value = null ui.showToast('已发送方案请求') } catch { ui.showToast('发送失败') @@ -629,5 +641,6 @@ onMounted(async () => { .overlay-header h3 { margin: 0; font-size: 16px; } .form-label { display: block; font-size: 13px; color: #6b6375; margin-bottom: 4px; font-weight: 500; } .form-textarea { width: 100%; border: 1.5px solid #e5e4e7; border-radius: 8px; padding: 8px; font-size: 13px; font-family: inherit; resize: vertical; box-sizing: border-box; } -.form-select { width: 100%; border: 1.5px solid #e5e4e7; border-radius: 8px; padding: 8px; font-size: 13px; font-family: inherit; box-sizing: border-box; } +.teacher-matched { color: #2e7d5a; font-size: 13px; margin-top: 4px; font-weight: 500; } +.teacher-no-match { color: #c62828; font-size: 12px; margin-top: 4px; }