fix(aihr): preserve assignment source labels
This commit is contained in:
@@ -50,8 +50,15 @@
|
||||
<view v-if="assignments.length" class="task-list">
|
||||
<view v-for="item in assignments" :key="item.id" class="task-row">
|
||||
<view class="task-copy">
|
||||
<text class="task-badge" :class="{ daily: item.source === 'daily' }">
|
||||
{{ item.source === 'daily' ? '每日三题' : '专项训练' }}
|
||||
<text
|
||||
class="task-badge"
|
||||
:class="{
|
||||
daily: item.source === 'daily',
|
||||
retry: item.source === 'retry',
|
||||
camp: item.source === 'camp'
|
||||
}"
|
||||
>
|
||||
{{ assignmentSourceLabel(item.source) }}
|
||||
</text>
|
||||
<text class="task-title">{{ item.question || item.scenarioName }}</text>
|
||||
<text v-if="assignmentDesc(item)" class="task-desc">{{ assignmentDesc(item) }}</text>
|
||||
@@ -276,6 +283,13 @@ const assignmentDesc = (item: PracticeAssignment) => {
|
||||
return item.reason || item.feedback;
|
||||
};
|
||||
|
||||
const assignmentSourceLabel = (source?: string) => {
|
||||
if (source === 'daily') return '每日三题';
|
||||
if (source === 'retry') return '错题再练';
|
||||
if (source === 'camp') return '训练营';
|
||||
return '专项训练';
|
||||
};
|
||||
|
||||
const snippetExcerpt = (text = '') => {
|
||||
const value = text.trim();
|
||||
return value.length > 180 ? `${value.slice(0, 180)}...` : value;
|
||||
@@ -648,6 +662,16 @@ onShow(() => {
|
||||
color: #166534;
|
||||
}
|
||||
|
||||
.task-badge.retry {
|
||||
background: #fff1f2;
|
||||
color: #be123c;
|
||||
}
|
||||
|
||||
.task-badge.camp {
|
||||
background: #eff6ff;
|
||||
color: #1d4ed8;
|
||||
}
|
||||
|
||||
.task-title,
|
||||
.snippet-title,
|
||||
.prep-label {
|
||||
|
||||
@@ -149,6 +149,8 @@ test('学习页展示真实错题本并可进入已有再练任务', async () =>
|
||||
assert.match(source, /pendingAssignmentKey/);
|
||||
assert.match(source, /mistakeFilters/);
|
||||
assert.match(source, /visibleMistakes/);
|
||||
assert.match(source, /source === 'retry'[\s\S]*错题再练/);
|
||||
assert.match(source, /source === 'camp'[\s\S]*训练营/);
|
||||
assert.match(practiceService, /\/api\/aihr\/mobile\/practice\/mistakes/);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user