Browse Source

错题统计页面

daijiajun/feature-20251107115823-股票知识测评
daijiajun 2 months ago
parent
commit
cb97f9974e
  1. 70
      src/components/WrongQuestion/WrongQuestionSearch.vue
  2. 99
      src/components/WrongQuestion/WrongQuestionTable.vue
  3. 51
      src/views/WrongQuestion.vue

70
src/components/WrongQuestion/WrongQuestionSearch.vue

@ -0,0 +1,70 @@
<!-- src/components/WrongQuestion/WrongQuestionSearch.vue -->
<template>
<!-- 搜索区域容器 -->
<div class="search-area">
<!-- 题目类型筛选项 -->
<div class="search-item">
<label>题目类型</label>
<select v-model="filters.type">
<option value="">全部</option>
<option value="股票知识">股票知识</option>
<option value="基金知识">基金知识</option>
<option value="投资策略">投资策略</option>
</select>
</div>
<!-- 题干关键词搜索项 -->
<div class="search-item">
<label>题干查找</label>
<input type="text" v-model="filters.questionText" placeholder="请输入题干关键词" />
</div>
<!-- 推荐课程筛选项 -->
<div class="search-item">
<label>推荐课程</label>
<select v-model="filters.course">
<option value="">全部</option>
<option value="量能擒牛">量能擒牛</option>
<option value="趋势交易">趋势交易</option>
<option value="基本面分析">基本面分析</option>
</select>
</div>
<!-- 操作按钮组 -->
<div class="btn-group">
<!-- 查找按钮触发搜索逻辑 -->
<button class="btn-red" @click="searchWrongQuestions">查找</button>
<!-- Excel导出按钮触发导出逻辑 -->
<button class="btn-red" @click="exportToExcel">Excel导出</button>
</div>
</div>
</template>
<script>
export default {
//
name: 'WrongQuestionSearch',
data() {
return {
//
filters: {
type: '', //
questionText: '', //
course: '' //
}
}
},
methods: {
//
searchWrongQuestions() {
console.log('搜索条件:', this.filters)
// API
},
// Excel
exportToExcel() {
console.log('导出 Excel')
// 使 `xlsx`
}
}
}
</script>

99
src/components/WrongQuestion/WrongQuestionTable.vue

@ -0,0 +1,99 @@
<!-- src/components/WrongQuestion/WrongQuestionTable.vue -->
<template>
<!-- 表格容器用于展示错题统计数据 -->
<div class="table-container">
<!-- 数据表格 -->
<table>
<!-- 表头部分 -->
<thead>
<tr>
<th>ID</th>
<th>题干</th>
<th>题目类型</th>
<th>出错次数</th>
<th>出错率</th>
<th>推荐课程</th>
<th>操作</th>
</tr>
</thead>
<!-- 表格主体循环渲染每条错题数据 -->
<tbody>
<tr v-for="item in wrongQuestions" :key="item.id">
<td>{{ item.id }}</td>
<td>{{ item.questionText }}</td>
<td>{{ item.type }}</td>
<td>{{ item.errorCount }}</td>
<td>{{ item.errorRate }}</td>
<td>{{ item.recommendedCourse }}</td>
<td>
<!-- 查看出错用户按钮 -->
<button class="btn-red small" @click="viewUser(item)">出错用户</button>
<!-- 查看题目详情按钮 -->
<button class="btn-red small" @click="viewQuestion(item)">查看题目</button>
</td>
</tr>
</tbody>
</table>
</div>
</template>
<script>
export default {
//
name: 'WrongQuestionTable',
//
props: {
wrongQuestions: {
type: Array,
default: () => []
}
},
//
methods: {
//
viewUser(item) {
console.log('查看出错用户:', item)
},
//
viewQuestion(item) {
console.log('查看题目:', item)
}
}
}
</script>
<style scoped>
/* 表格容器样式 */
.table-container {
width: 100%;
border-collapse: collapse;
margin-top: 10px;
}
/* 表格整体样式 */
table {
width: 100%;
border-collapse: collapse;
background-color: white;
}
/* 表头和表体单元格通用样式 */
th,
td {
padding: 12px;
text-align: left;
border-bottom: 1px solid #ddd;
}
/* 表头样式 */
th {
background-color: #f2f2f2;
font-weight: normal;
color: #333;
}
/* 鼠标悬停行高亮效果 */
tr:hover {
background-color: #f9f9f9;
}
</style>

51
src/views/WrongQuestion.vue

@ -1,18 +1,61 @@
<template>
<!-- 错题统计页面容器 -->
<div class="wrong-question">
<p>错题统计模块</p>
<p>当前模块内容暂未开发</p>
<!-- 搜索区域组件用于筛选错题数据 -->
<WrongQuestionSearch />
<!-- 错题表格组件展示筛选后的错题列表 -->
<WrongQuestionTable :wrongQuestions="wrongQuestions" />
</div>
</template>
<script>
//
import WrongQuestionSearch from '@/components/WrongQuestion/WrongQuestionSearch.vue'
//
import WrongQuestionTable from '@/components/WrongQuestion/WrongQuestionTable.vue'
export default {
name: 'WrongQuestion'
//
name: 'WrongQuestion',
//
components: {
WrongQuestionSearch,
WrongQuestionTable
},
//
data() {
return {
//
wrongQuestions: [
{
id: 1,
questionText: '以下哪项不是股票的基本特征?',
type: '股票知识',
errorCount: 50,
errorRate: '50%',
recommendedCourse: '量能擒牛'
}
]
}
},
//
methods: {
// API
fetchWrongQuestions() {
console.log('获取错题数据...')
}
},
//
mounted() {
//
this.fetchWrongQuestions()
}
}
</script>
<style scoped>
/* 错题统计页面整体样式 */
.wrong-question {
padding: 20px;
padding: 20px; /* 内边距设置为20px,保持内容与边界间距 */
}
</style>
Loading…
Cancel
Save