From 413abf60ba8b2b15aa81bacf0408ea4a511be81f Mon Sep 17 00:00:00 2001 From: Hera Zhao Date: Fri, 10 Apr 2026 14:27:09 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=8B=BC=E9=9F=B3=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E8=A1=A5=E5=85=85=E5=AD=97=E6=98=A0=E5=B0=84=20+=20=E7=BB=93?= =?UTF-8?q?=E6=9E=9C=E6=8C=89=E5=8C=B9=E9=85=8D=E5=BA=A6=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.6 (1M context) --- frontend/src/composables/usePinyinMatch.js | 14 ++++++++++++++ frontend/src/views/RecipeManager.vue | 10 +++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/frontend/src/composables/usePinyinMatch.js b/frontend/src/composables/usePinyinMatch.js index 1b22404..d8684ef 100644 --- a/frontend/src/composables/usePinyinMatch.js +++ b/frontend/src/composables/usePinyinMatch.js @@ -43,6 +43,20 @@ const PINYIN_MAP = { '丽': 'l', '清': 'q', '新': 'x', '自': 'z', '然': 'r', '植': 'z', '物': 'w', '芳': 'f', '疗': 'l', '复': 'f', '方': 'f', '单': 'd', '配': 'p', '调': 'd', + '忍': 'r', '圆': 'y', '侧': 'c', '呵': 'h', '铠': 'k', + '浆': 'j', '萸': 'y', '瑞': 'r', '芙': 'f', '蓉': 'r', + '桃': 't', '梅': 'm', '兰': 'l', '竹': 'z', '荆': 'j', + '藏': 'z', '蒿': 'h', '艾': 'a', '牡': 'm', '丹': 'd', + '参': 's', '芝': 'z', '灵': 'l', '芍': 's', '药': 'y', + '枫': 'f', '桦': 'h', '柳': 'l', '榉': 'j', '楠': 'n', + '海': 'h', '滨': 'b', '泽': 'z', '湖': 'h', '溪': 'x', + '威': 'w', '夷': 'y', '亚': 'y', '欧': 'o', '非': 'f', + '印': 'y', '澳': 'a', '美': 'm', '德': 'd', '法': 'f', + '意': 'y', '英': 'y', '日': 'r', '韩': 'h', '泰': 't', + '醒': 'x', '提': 't', '振': 'z', '镇': 'z', '抚': 'f', + '触': 'c', '修': 'x', '养': 'y', '滋': 'z', '润': 'r', + '呼': 'h', '吸': 'x', '消': 'x', '化': 'h', '排': 'p', + '毒': 'd', '净': 'j', '纤': 'x', '体': 't', '塑': 's', } /** diff --git a/frontend/src/views/RecipeManager.vue b/frontend/src/views/RecipeManager.vue index bb5f281..231f0d3 100644 --- a/frontend/src/views/RecipeManager.vue +++ b/frontend/src/views/RecipeManager.vue @@ -677,9 +677,17 @@ function handleSmartPaste() { function filteredOilNames(search) { if (!search) return oils.oilNames const q = search.toLowerCase() - return oils.oilNames.filter(name => + const results = oils.oilNames.filter(name => name.toLowerCase().includes(q) || matchesPinyinInitials(name, q) ) + // Sort: pinyin prefix match first, then name contains, then rest + results.sort((a, b) => { + const aPin = matchesPinyinInitials(a, q) ? 0 : 1 + const bPin = matchesPinyinInitials(b, q) ? 0 : 1 + if (aPin !== bPin) return aPin - bPin + return a.localeCompare(b, 'zh') + }) + return results } function selectOil(ing, name) {