fix: 拼音搜索补充字映射 + 结果按匹配度排序
Some checks failed
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 4s
Test / build-check (push) Successful in 3s
PR Preview / test (pull_request) Successful in 5s
PR Preview / deploy-preview (pull_request) Successful in 16s
Test / e2e-test (push) Failing after 55s
Some checks failed
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 4s
Test / build-check (push) Successful in 3s
PR Preview / test (pull_request) Successful in 5s
PR Preview / deploy-preview (pull_request) Successful in 16s
Test / e2e-test (push) Failing after 55s
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -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',
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user