fix(mobile): align practice position label

This commit is contained in:
2026-07-14 20:35:28 +08:00
parent e497c5d698
commit 857092c2c6
3 changed files with 14 additions and 2 deletions
+4 -2
View File
@@ -18,7 +18,7 @@
<view v-if="loggedIn" class="panel scenario-card employee-card">
<view class="scenario-headline">
<text class="scenario-title">{{ activeScenarioName }}</text>
<text class="scenario-desc">生活顾问 · 业主服务场景</text>
<text class="scenario-desc">{{ positionLabel }} · 业主服务场景</text>
</view>
<view class="scenario-persona">
<view class="persona-avatar">业</view>
@@ -263,7 +263,7 @@ import type {
PracticeRecord
} from '@/types/api';
import { answerDailyDrill, finishPractice, getPracticeAssignments, getPracticeHistory, getPracticePrepCard, startPractice, submitPracticeSatisfaction, submitPracticeTurn } from '@/services/practice';
import { isLoggedIn, rememberLoginRedirect } from '@/services/auth';
import { getSelectedPosition, isLoggedIn, rememberLoginRedirect } from '@/services/auth';
import { searchKnowledge } from '@/services/knowledge';
import { resetPageScroll } from '@/services/navigation';
import { ensureEmployeePosition } from '@/services/position';
@@ -299,6 +299,7 @@ const selectedScenarioId = ref(defaultScenarioId);
const prepCard = ref<PracticePrepCard | null>(null);
const prepLoading = ref(false);
const activeScenarioName = ref(defaultScenarioName);
const positionLabel = ref(getSelectedPosition() || '生活顾问');
const helpLoading = ref(false);
const helpAnswer = ref('');
const helpRefs = ref<string[]>([]);
@@ -918,6 +919,7 @@ const handleShow = async () => {
if (loggedIn.value && !(await ensureEmployeePosition('/pages/user/practice/index'))) {
return;
}
positionLabel.value = getSelectedPosition() || '生活顾问';
void loadAssignments();
void loadPrepCard();
};
@@ -153,6 +153,15 @@ test('训练页保留任务卡、对话区、回复区和结果区', async () =>
assert.match(source, /result-card/);
});
test('员工练习页显示当前岗位而不是固定生活顾问', async () => {
const source = await pageSource('../src/pages/user/practice/index.vue');
assert.match(source, /getSelectedPosition/);
assert.match(source, /const positionLabel = ref\(getSelectedPosition\(\) \|\| '生活顾问'\)/);
assert.match(source, /\{\{ positionLabel \}\} · 业主服务场景/);
assert.doesNotMatch(source, /scenario-desc">生活顾问 · 业主服务场景/);
});
test('训练页最近练过保留派发任务来源', async () => {
const source = await pageSource('../src/pages/user/practice/index.vue');