From 5d82ff7b216eccf076bb80215ccaabd3bd167092 Mon Sep 17 00:00:00 2001 From: let5sne Date: Fri, 17 Jul 2026 04:29:32 +0800 Subject: [PATCH] fix(mobile): complete SOP focus regression --- mobile-uni/src/pages/user/sop/index.vue | 2 +- mobile-uni/src/services/supervisor-view.ts | 7 ++++--- mobile-uni/src/types/api.ts | 6 +++--- mobile-uni/tests/mobile-user-pages.test.mjs | 1 + 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/mobile-uni/src/pages/user/sop/index.vue b/mobile-uni/src/pages/user/sop/index.vue index 636bac6e..989dbe26 100644 --- a/mobile-uni/src/pages/user/sop/index.vue +++ b/mobile-uni/src/pages/user/sop/index.vue @@ -237,7 +237,7 @@ import { submitAnswerFeedback } from '@/services/knowledge'; import { getSelectedPosition, getSelectedPositionProfile, isLoggedIn, rememberLoginRedirect } from '@/services/auth'; -import { scrollPageToSelector } from '@/services/navigation'; +import { resetPageScroll, scrollPageToSelector } from '@/services/navigation'; import { ensureEmployeePosition } from '@/services/position'; const positionProfile = ref(getSelectedPositionProfile()); diff --git a/mobile-uni/src/services/supervisor-view.ts b/mobile-uni/src/services/supervisor-view.ts index 7b781c15..c48a166b 100644 --- a/mobile-uni/src/services/supervisor-view.ts +++ b/mobile-uni/src/services/supervisor-view.ts @@ -327,8 +327,9 @@ function identitySuffix(value: string) { function trainingTrendLabel(value: string, index: number) { const parts = value.match(/\d+/g) || []; - if (parts.length >= 3 && parts[0].length === 4) return `${parts[1].padStart(2, '0')}-${parts[2].padStart(2, '0')}`; - if (parts.length >= 2) return `${parts[0].padStart(2, '0')}-${parts[1].padStart(2, '0')}`; + const [first = '', second = '', third = ''] = parts; + if (parts.length >= 3 && first.length === 4) return `${second.padStart(2, '0')}-${third.padStart(2, '0')}`; + if (parts.length >= 2) return `${first.padStart(2, '0')}-${second.padStart(2, '0')}`; return `第${index + 1}次`; } @@ -339,6 +340,6 @@ function practiceTimeValue(value: string) { } const normalized = parts.length >= 5 ? parts.slice(0, 6) : [0, ...parts.slice(0, 5)]; while (normalized.length < 6) normalized.push(0); - const [year, month, day, hour, minute, second] = normalized; + const [year = 0, month = 0, day = 0, hour = 0, minute = 0, second = 0] = normalized; return (((((year * 13 + month) * 32 + day) * 24 + hour) * 60 + minute) * 60) + second; } diff --git a/mobile-uni/src/types/api.ts b/mobile-uni/src/types/api.ts index e27bb126..2206a16e 100644 --- a/mobile-uni/src/types/api.ts +++ b/mobile-uni/src/types/api.ts @@ -185,9 +185,9 @@ export interface PracticeTurnResponse { } export interface PracticeDimensionScore { - name: string; - score: number; - comment?: string; + label: string; + value: number | string; + note?: string; } export interface PracticeFinishResponse { diff --git a/mobile-uni/tests/mobile-user-pages.test.mjs b/mobile-uni/tests/mobile-user-pages.test.mjs index b1e5b040..4ca50d9e 100644 --- a/mobile-uni/tests/mobile-user-pages.test.mjs +++ b/mobile-uni/tests/mobile-user-pages.test.mjs @@ -45,6 +45,7 @@ test('训练结果回到顶部,SOP 答案生成后定位到回答区', async ( ]); assert.match(practiceSource, /result\.value = await finishPractice\([\s\S]*?resetPageScroll\(\)/); + assert.match(sopSource, /import \{ resetPageScroll, scrollPageToSelector \} from '@\/services\/navigation';/); assert.match(sopSource, /result\.value = await searchKnowledge\(value\);\s*scrollPageToSelector\('\.answer-panel'/); assert.match(navigationSource, /export const scrollPageToSelector = \(selector: string/); });