|
|
@ -215,26 +215,47 @@ export default { |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
setFilters(filters) { |
|
|
|
|
|
this.currentFilters = filters; |
|
|
|
|
|
this.page = 1; |
|
|
|
|
|
this.fetchWrongQuestions(); |
|
|
|
|
|
|
|
|
setData(data) { |
|
|
|
|
|
this.wrongQuestions = data.list || []; |
|
|
|
|
|
this.total = data.total || 0; |
|
|
|
|
|
this.page = data.page || 1; |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
async fetchWrongQuestions() { |
|
|
async fetchWrongQuestions() { |
|
|
try { |
|
|
try { |
|
|
const params = { |
|
|
|
|
|
Page: this.page, |
|
|
|
|
|
PageSize: this.pageSize, |
|
|
|
|
|
question_type_id: this.currentFilters.type ? parseInt(this.currentFilters.type) : undefined, |
|
|
|
|
|
course_recommendation_id: this.currentFilters.course ? parseInt(this.currentFilters.course) : undefined, |
|
|
|
|
|
stem: this.currentFilters.questionText || '', |
|
|
|
|
|
sort_field: this.sortField, |
|
|
|
|
|
sort_direction: this.sortDirection |
|
|
|
|
|
|
|
|
const params = new URLSearchParams(); |
|
|
|
|
|
params.append('page', this.page); |
|
|
|
|
|
params.append('page_size', this.pageSize); |
|
|
|
|
|
|
|
|
|
|
|
// 处理过滤条件 |
|
|
|
|
|
const questionTypeIdMap = { |
|
|
|
|
|
'股票知识': 1, |
|
|
|
|
|
'企业文化': 2 |
|
|
|
|
|
}; |
|
|
|
|
|
if (this.currentFilters.questionType) { |
|
|
|
|
|
params.append('question_type_id', questionTypeIdMap[this.currentFilters.questionType]); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 使用 getQuestions 替代 axios.post |
|
|
|
|
|
const response = await getQuestions(params) |
|
|
|
|
|
|
|
|
const courseRecommendationIdMap = { |
|
|
|
|
|
'量能擒牛': 1, |
|
|
|
|
|
'价格破译': 2, |
|
|
|
|
|
'量价时空综合': 3 |
|
|
|
|
|
}; |
|
|
|
|
|
if (this.currentFilters.course) { |
|
|
|
|
|
params.append('course_recommendation_id', courseRecommendationIdMap[this.currentFilters.course]); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (this.currentFilters.keyword) { |
|
|
|
|
|
params.append('stem', this.currentFilters.keyword); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 添加排序参数 |
|
|
|
|
|
if (this.sortField) { |
|
|
|
|
|
params.append('sort_field', this.sortField); |
|
|
|
|
|
params.append('sort_direction', this.sortDirection); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const response = await getQuestions(params); |
|
|
|
|
|
|
|
|
if (response.data.code === 200) { |
|
|
if (response.data.code === 200) { |
|
|
this.wrongQuestions = response.data.data.list.map(item => ({ |
|
|
this.wrongQuestions = response.data.data.list.map(item => ({ |
|
|
@ -242,7 +263,7 @@ export default { |
|
|
stem: item.stem, |
|
|
stem: item.stem, |
|
|
questionTypeName: item.questionTypeName, |
|
|
questionTypeName: item.questionTypeName, |
|
|
errorCount: item.errorCount, |
|
|
errorCount: item.errorCount, |
|
|
errorRate: `${item.errorRate}%`, |
|
|
|
|
|
|
|
|
errorRate: item.errorRate, // 保持原始数值,不需要加% |
|
|
CrName: item.CrName |
|
|
CrName: item.CrName |
|
|
})) |
|
|
})) |
|
|
this.total = response.data.data.total || 0; |
|
|
this.total = response.data.data.total || 0; |
|
|
@ -252,8 +273,7 @@ export default { |
|
|
} catch (error) { |
|
|
} catch (error) { |
|
|
console.error('获取错题数据失败:', error) |
|
|
console.error('获取错题数据失败:', error) |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
, |
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
viewUser(item) { |
|
|
viewUser(item) { |
|
|
this.$emit('view-user', item) |
|
|
this.$emit('view-user', item) |
|
|
|