From eae9d507f21928e3fce155bd20fbf0d1028baace Mon Sep 17 00:00:00 2001 From: Hera Zhao Date: Mon, 13 Apr 2026 13:17:25 +0000 Subject: [PATCH 1/5] =?UTF-8?q?fix:=20=E5=95=86=E4=B8=9A=E8=AE=A4=E8=AF=81?= =?UTF-8?q?=E5=9B=BE=E6=A0=87=E9=80=BB=E8=BE=91=E5=8F=8D=E8=BD=AC=20?= =?UTF-8?q?=E2=80=94=20=E8=AE=A4=E8=AF=81=E7=94=A8=E6=88=B7=E7=82=B9?= =?UTF-8?q?=E4=BA=AE=EF=BC=8C=E6=9C=AA=E8=AE=A4=E8=AF=81=E7=81=B0=E8=89=B2?= 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/views/UserManagement.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/views/UserManagement.vue b/frontend/src/views/UserManagement.vue index 520c7ab..72e127a 100644 --- a/frontend/src/views/UserManagement.vue +++ b/frontend/src/views/UserManagement.vue @@ -100,8 +100,8 @@ - - + + -- 2.49.1 From 36862a4dbef7fd53b73996fbf81589a520d1ead4 Mon Sep 17 00:00:00 2001 From: Hera Zhao Date: Mon, 13 Apr 2026 13:19:58 +0000 Subject: [PATCH 2/5] =?UTF-8?q?fix:=20=E7=94=A8=E6=88=B7=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E7=AD=9B=E9=80=89=E5=8E=BB=E6=8E=89=E7=AE=A1=E7=90=86=E5=91=98?= =?UTF-8?q?=E5=8A=A0=E4=BC=81=E4=B8=9A=E7=94=A8=E6=88=B7=EF=BC=8C=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=91=98=E4=B8=8D=E5=8F=AF=E6=8D=A2=E8=A7=92=E8=89=B2?= =?UTF-8?q?=E5=92=8C=E5=88=A0=E9=99=A4?= 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/views/UserManagement.vue | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/frontend/src/views/UserManagement.vue b/frontend/src/views/UserManagement.vue index 72e127a..0fc35c3 100644 --- a/frontend/src/views/UserManagement.vue +++ b/frontend/src/views/UserManagement.vue @@ -91,10 +91,10 @@
未找到用户
@@ -162,10 +162,10 @@ function formatDate(d) { } const roles = [ - { value: 'admin', label: '管理员' }, { value: 'senior_editor', label: '高级编辑' }, { value: 'editor', label: '编辑' }, { value: 'viewer', label: '查看者' }, + { value: 'business', label: '企业用户' }, ] const filteredUsers = computed(() => { @@ -178,7 +178,11 @@ const filteredUsers = computed(() => { ) } if (filterRole.value) { - list = list.filter(u => u.role === filterRole.value) + if (filterRole.value === 'business') { + list = list.filter(u => u.business_verified) + } else { + list = list.filter(u => u.role === filterRole.value) + } } return list }) -- 2.49.1 From 1790ab3b449ff0bbb7980072e821ed350a22ddfa Mon Sep 17 00:00:00 2001 From: Hera Zhao Date: Mon, 13 Apr 2026 13:36:09 +0000 Subject: [PATCH 3/5] =?UTF-8?q?fix:=20viewer=E5=8F=AA=E8=83=BD=E7=9C=8B?= =?UTF-8?q?=E5=88=B0=E5=92=8C=E7=AE=A1=E7=90=86=E8=87=AA=E5=B7=B1=E4=B8=AA?= =?UTF-8?q?=E4=BA=BA=E9=85=8D=E6=96=B9=E7=9A=84=E6=A0=87=E7=AD=BE=EF=BC=8C?= =?UTF-8?q?=E4=B8=8D=E6=98=BE=E7=A4=BA=E5=85=AC=E5=85=B1=E5=BA=93=E6=A0=87?= =?UTF-8?q?=E7=AD=BE?= 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/views/RecipeManager.vue | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/frontend/src/views/RecipeManager.vue b/frontend/src/views/RecipeManager.vue index 3ca66d8..1d5b230 100644 --- a/frontend/src/views/RecipeManager.vue +++ b/frontend/src/views/RecipeManager.vue @@ -83,7 +83,7 @@
{ - const tags = recipeStore.allTags - if (auth.canEdit) return tags - return tags.filter(t => !EDITOR_ONLY_TAGS.includes(t)) + if (auth.canEdit) return recipeStore.allTags + // Viewer: only show tags from their own diary recipes + const myTags = new Set() + for (const d of diaryStore.userDiary) { + for (const t of (d.tags || [])) myTags.add(t) + } + return [...myTags].sort((a, b) => a.localeCompare(b, 'zh')) }) const showBatchTagPicker = ref(false) const batchTagsSelected = ref([]) -- 2.49.1 From 6d1ae6e6823e22b2c5c27b88a73d3f2e351d6ba9 Mon Sep 17 00:00:00 2001 From: Hera Zhao Date: Mon, 13 Apr 2026 13:40:56 +0000 Subject: [PATCH 4/5] =?UTF-8?q?fix:=20=E8=A1=A5=E5=85=A888=E4=B8=AA?= =?UTF-8?q?=E7=B2=BE=E6=B2=B9=E5=90=8D=E6=8B=BC=E9=9F=B3=E6=98=A0=E5=B0=84?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E5=A4=8Dmlk=E6=97=A0=E6=B3=95=E5=8C=B9?= =?UTF-8?q?=E9=85=8D=E9=BA=A6=E5=8D=A2=E5=8D=A1=E7=AD=89=E9=97=AE=E9=A2=98?= 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 | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/frontend/src/composables/usePinyinMatch.js b/frontend/src/composables/usePinyinMatch.js index d8684ef..ba447e1 100644 --- a/frontend/src/composables/usePinyinMatch.js +++ b/frontend/src/composables/usePinyinMatch.js @@ -57,6 +57,25 @@ const PINYIN_MAP = { '触': 'c', '修': 'x', '养': 'y', '滋': 'z', '润': 'r', '呼': 'h', '吸': 'x', '消': 'x', '化': 'h', '排': 'p', '毒': 'd', '净': 'j', '纤': 'x', '体': 't', '塑': 's', + // Extended: all oil name chars + '麦': 'm', '卢': 'l', '卡': 'k', '檀': 't', '橘': 'j', + '茅': 'm', '茴': 'h', '芹': 'q', '菜': 'c', '蕾': 'l', + '蜂': 'f', '蓍': 's', '莱': 'l', '姆': 'm', '莎': 's', + '穗': 's', '醇': 'c', '郁': 'y', '没': 'm', '脂': 'z', + '巴': 'b', '样': 'y', '班': 'b', '牙': 'y', '鸡': 'j', + '苍': 'c', '卫': 'w', '畅': 'c', '顺': 's', '释': 's', + '悦': 'y', '柔': 'r', '压': 'y', '定': 'd', '情': 'q', + '绪': 'x', '神': 's', '气': 'q', '宽': 'k', '容': 'r', + '恬': 't', '家': 'j', '欢': 'h', '欣': 'x', '舞': 'w', + '鼓': 'g', '赋': 'f', '谧': 'm', '睡': 's', '烂': 'l', + '绚': 'x', '焕': 'h', '肤': 'f', '年': 'n', '华': 'h', + '完': 'w', '理': 'l', '注': 'z', '贯': 'g', '全': 'q', + '仕': 's', '女': 'nv', '伯': 'b', '斯': 's', '道': 'd', + '格': 'g', '拉': 'l', '元': 'y', '肌': 'j', '栀': 'z', + '鹅': 'e', '掌': 'z', '柴': 'c', '胶': 'j', '囊': 'n', + '空': 'k', '风': 'f', '文': 'w', '月': 'y', '云': 'y', + '五': 'w', '味': 'w', '愈': 'y', '创': 'c', '慰': 'w', + '扁': 'b', '广': 'g', '州': 'z', '热': 'r', } /** -- 2.49.1 From abc54f2d6a92096fb7885e9eb1e37141455c28f3 Mon Sep 17 00:00:00 2001 From: Hera Zhao Date: Mon, 13 Apr 2026 13:43:15 +0000 Subject: [PATCH 5/5] =?UTF-8?q?test:=20PR#29=E6=B5=8B=E8=AF=95=20=E2=80=94?= =?UTF-8?q?=20=E6=8B=BC=E9=9F=B3=E5=8C=B9=E9=85=8D=E6=89=A9=E5=B1=95?= =?UTF-8?q?=E3=80=81viewer=E6=A0=87=E7=AD=BE=E5=8F=AF=E8=A7=81=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 新增14个单元测试: - 拼音匹配: mlk→麦卢卡、tx→檀香等11个用例 - viewer标签可见性: 只看自己diary标签、不看公共标签 Co-Authored-By: Claude Opus 4.6 (1M context) --- frontend/src/__tests__/pr27Features.test.js | 93 +++++++++++++++++++++ 1 file changed, 93 insertions(+) diff --git a/frontend/src/__tests__/pr27Features.test.js b/frontend/src/__tests__/pr27Features.test.js index aa41519..4aa015e 100644 --- a/frontend/src/__tests__/pr27Features.test.js +++ b/frontend/src/__tests__/pr27Features.test.js @@ -1,5 +1,6 @@ import { describe, it, expect } from 'vitest' import { recipeNameEn, oilEn } from '../composables/useOilTranslation' +import { matchesPinyinInitials, getPinyinInitials } from '../composables/usePinyinMatch' // --------------------------------------------------------------------------- // EDITOR_ONLY_TAGS includes '已下架' @@ -283,3 +284,95 @@ describe('one-time username change guard', () => { expect(!!user.username_changed).toBe(false) }) }) + +// --------------------------------------------------------------------------- +// Pinyin matching — PR29 extended coverage +// --------------------------------------------------------------------------- +describe('pinyin matching — extended oil names', () => { + it('matches mlk → 麦卢卡', () => { + expect(matchesPinyinInitials('麦卢卡', 'mlk')).toBe(true) + }) + + it('matches tx → 檀香', () => { + expect(matchesPinyinInitials('檀香', 'tx')).toBe(true) + }) + + it('matches xm → 香茅', () => { + expect(matchesPinyinInitials('香茅', 'xm')).toBe(true) + }) + + it('matches gbxz → 古巴香脂', () => { + expect(matchesPinyinInitials('古巴香脂', 'gbxz')).toBe(true) + }) + + it('matches my → 没药', () => { + expect(matchesPinyinInitials('没药', 'my')).toBe(true) + }) + + it('matches xhx → 小茴香', () => { + expect(matchesPinyinInitials('小茴香', 'xhx')).toBe(true) + }) + + it('matches jybh → 椒样薄荷', () => { + expect(matchesPinyinInitials('椒样薄荷', 'jybh')).toBe(true) + }) + + it('matches xbynz → 西班牙牛至', () => { + expect(matchesPinyinInitials('西班牙牛至', 'xbynz')).toBe(true) + }) + + it('matches sc → 顺畅呼吸 prefix', () => { + expect(matchesPinyinInitials('顺畅呼吸', 'sc')).toBe(true) + }) + + it('does not match wrong initials', () => { + expect(matchesPinyinInitials('麦卢卡', 'abc')).toBe(false) + }) + + it('getPinyinInitials returns correct string', () => { + expect(getPinyinInitials('麦卢卡')).toBe('mlk') + expect(getPinyinInitials('檀香')).toBe('tx') + expect(getPinyinInitials('没药')).toBe('my') + }) +}) + +// --------------------------------------------------------------------------- +// Viewer tag visibility — PR29 +// --------------------------------------------------------------------------- +describe('viewer tag visibility logic', () => { + const EDITOR_ONLY_TAGS_VAL = ['已审核', '已下架'] + + it('editor sees all tags', () => { + const allTags = ['美容', '儿童', '已审核', '已下架'] + const canEdit = true + const visible = canEdit ? allTags : [] + expect(visible).toEqual(allTags) + }) + + it('viewer sees no public tags', () => { + const canEdit = false + const myDiary = [ + { tags: ['我的标签'] }, + { tags: ['我的标签', '另一个'] }, + ] + // Viewer: collect tags from own diary only + const myTags = new Set() + for (const d of myDiary) { + for (const t of (d.tags || [])) myTags.add(t) + } + const visible = canEdit ? ['美容', '已审核'] : [...myTags] + expect(visible).toContain('我的标签') + expect(visible).toContain('另一个') + expect(visible).not.toContain('美容') + expect(visible).not.toContain('已审核') + }) + + it('viewer with no diary tags sees empty', () => { + const myDiary = [] + const myTags = new Set() + for (const d of myDiary) { + for (const t of (d.tags || [])) myTags.add(t) + } + expect([...myTags]).toHaveLength(0) + }) +}) -- 2.49.1