|
|
@@ -1,6 +1,6 @@
|
|
|
<!-- 自主练习——查看练习结果 -->
|
|
|
<template>
|
|
|
- <div class="target_item">
|
|
|
+ <div class="practice_result">
|
|
|
<div class="page_search">
|
|
|
<div class="search_content">
|
|
|
<div class="content_left">
|
|
|
@@ -9,11 +9,25 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <FiltersItem :filtersData="filtersData" @selectItem="ChangeFilters"/>
|
|
|
+ <FiltersItem :filtersData="filtersData" @selectItem="ChangeFilters">
|
|
|
+ <template #rowItem-time>
|
|
|
+ <el-date-picker
|
|
|
+ v-if="filtersData[0].value == 'custom'"
|
|
|
+ style="height: 28px;flex-grow: 0;width: 225px;"
|
|
|
+ v-model="startAndEndTime"
|
|
|
+ type="daterange"
|
|
|
+ range-separator="至"
|
|
|
+ start-placeholder="开始日期"
|
|
|
+ end-placeholder="结束日期"
|
|
|
+ size="default"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+ </FiltersItem>
|
|
|
|
|
|
<Table class="practice_table"
|
|
|
:currentPage="currentPage" :pageSize="pageSize" :totalNum="totalNum"
|
|
|
- :tableData="tableData" :tableColumns="tableColumns">
|
|
|
+ :tableData="tableData" :tableColumns="tableColumns"
|
|
|
+ @paginationChange="HandlePaginationChange">
|
|
|
<template v-slot:gradingStatus="{row}">
|
|
|
<TableRowStatus :useStatus="row.gradingStatus"
|
|
|
:statusMsg="[
|
|
|
@@ -35,6 +49,10 @@
|
|
|
]">
|
|
|
</TableRowStatus>
|
|
|
</template>
|
|
|
+ <template v-slot:improvement="{row}">
|
|
|
+ <img width="16px" height="16px" style="margin-right: 2px;" :src="row.improvement.type == 'up' ? upIcon : (row.improvement.type == 'down' ? downIcon : '')" alt="" />
|
|
|
+ {{ row.improvement.value }}
|
|
|
+ </template>
|
|
|
<template v-slot:action="{row}">
|
|
|
<div class="table_row_operation">
|
|
|
<el-button type="text" @click="viewDetails(scope.row)">查看</el-button>
|
|
|
@@ -46,9 +64,21 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import FiltersItem from "@/components/FiltersItem_ruoyan.vue"//筛选组件
|
|
|
+import dayjs from 'dayjs';
|
|
|
+// 1. 引入 isoWeek 插件
|
|
|
+import isoWeek from 'dayjs/plugin/isoWeek';
|
|
|
+
|
|
|
+import FiltersItem from "../components/FiltersItem_ruoyan.vue"//筛选组件
|
|
|
import Table from "../components/Table.vue";
|
|
|
import TableRowStatus from "../components/TableRowStatus.vue";
|
|
|
+
|
|
|
+import upIcon from '@/assets/arrow-up.png'
|
|
|
+import downIcon from '@/assets/arrow-down.png'
|
|
|
+
|
|
|
+// 2. 全局扩展插件(只需调用一次即可)
|
|
|
+dayjs.extend(isoWeek);
|
|
|
+
|
|
|
+
|
|
|
export default ({
|
|
|
components: {
|
|
|
FiltersItem,
|
|
|
@@ -57,6 +87,8 @@ export default ({
|
|
|
},
|
|
|
data(){
|
|
|
return {
|
|
|
+ upIcon:upIcon,
|
|
|
+ downIcon:downIcon,
|
|
|
currentPage:1,
|
|
|
pageSize:20,
|
|
|
totalNum:0,
|
|
|
@@ -139,7 +171,6 @@ export default ({
|
|
|
practiceType: '指定练习',
|
|
|
knowledgeName: '一般词语',
|
|
|
questionCount: 3,
|
|
|
- // 状态对象,方便 custom 插槽渲染绿点和文字
|
|
|
gradingStatus: 0,
|
|
|
preScoreRate: '64.37%',
|
|
|
postScoreRate: '54.38%',
|
|
|
@@ -169,8 +200,9 @@ export default ({
|
|
|
],
|
|
|
filtersData: [
|
|
|
{
|
|
|
+ key:'time',
|
|
|
name: '时间',
|
|
|
- value: 'all', // 默认选中项
|
|
|
+ value: 'custom', // 默认选中项
|
|
|
list: [
|
|
|
{ label: '全部', value: 'all' },
|
|
|
{ label: '本周', value: 'this_week' },
|
|
|
@@ -180,15 +212,17 @@ export default ({
|
|
|
]
|
|
|
},
|
|
|
{
|
|
|
+ key:'type',
|
|
|
name: '类型',
|
|
|
value: 'all', // 默认选中项
|
|
|
list: [
|
|
|
{ label: '全部', value: 'all' },
|
|
|
- { label: '指定练习', value: 'assigned_practice' },
|
|
|
- { label: '自主练习', value: 'self_practice' }
|
|
|
+ { label: '指定练习', value: '2' },
|
|
|
+ { label: '自主练习', value: '1' }
|
|
|
]
|
|
|
}
|
|
|
- ]
|
|
|
+ ],
|
|
|
+ startAndEndTime:undefined,
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
@@ -197,9 +231,73 @@ export default ({
|
|
|
// console.log('当前选中的信息',e)
|
|
|
this.filtersData[e.index].value = e.value;
|
|
|
},
|
|
|
+ // 处理表格分页变化
|
|
|
+ HandlePaginationChange(params){
|
|
|
+ const {type, val} = params
|
|
|
+ if(type == 'currentPage'){
|
|
|
+ this.currentPage = val
|
|
|
+ }else if(type == 'pageSize'){
|
|
|
+ this.pageSize = val
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 获取本周一(本周起始日)的 00:00:00
|
|
|
+ getCurrentWeekStart(){
|
|
|
+ return dayjs().startOf('isoWeek').format("YYYY-MM-DD HH:mm:ss");
|
|
|
+ },
|
|
|
+ // 获取一个月前的时间
|
|
|
+ getOneMonthAgo(){
|
|
|
+ return dayjs().subtract(1, 'month').format("YYYY-MM-DD HH:mm:ss");
|
|
|
+ },
|
|
|
+ // 获取三个月前的时间
|
|
|
+ getThreeMonthsAgo(){
|
|
|
+ return dayjs().subtract(3, 'month').format("YYYY-MM-DD HH:mm:ss");
|
|
|
+ },
|
|
|
+
|
|
|
+ // 获取练习结果列表 _接口传参 ———— 待完善
|
|
|
+ GetTargetExerciseResult(){
|
|
|
+ let startDate = ''
|
|
|
+ let endDate = ''
|
|
|
+ switch(this.filtersData[0].value){
|
|
|
+ case 'all':
|
|
|
+ startDate = ''
|
|
|
+ endDate = ''
|
|
|
+ break
|
|
|
+ case 'this_week':
|
|
|
+ startDate = this.getCurrentWeekStart()
|
|
|
+ endDate = dayjs().format("YYYY-MM-DD HH:mm:ss")
|
|
|
+ break
|
|
|
+ case 'last_1_month':
|
|
|
+ startDate = this.getOneMonthAgo()
|
|
|
+ endDate = dayjs().format("YYYY-MM-DD HH:mm:ss")
|
|
|
+ break
|
|
|
+ case 'last_3_months':
|
|
|
+ startDate = this.getThreeMonthsAgo()
|
|
|
+ endDate = dayjs().format("YYYY-MM-DD HH:mm:ss")
|
|
|
+ break
|
|
|
+ case 'custom':
|
|
|
+ startDate = dayjs(this.startAndEndTime?.[0]).format("YYYY-MM-DD HH:mm:ss")
|
|
|
+ endDate = dayjs(this.startAndEndTime?.[1]).format("YYYY-MM-DD HH:mm:ss")
|
|
|
+ break
|
|
|
+ }
|
|
|
+ let prams = {
|
|
|
+ pageParam: {
|
|
|
+ pageNum: this.currentPage,
|
|
|
+ pageSize: this.pageSize,
|
|
|
+ },
|
|
|
+ beginAt: startDate, //开始时间
|
|
|
+ endAt: endDate, //结束时间
|
|
|
+ exerciseType: this.filtersData[1].value == 'all' ? '' : this.filtersData[1].value , // 练习类型0全部 1自主练习 2指定练习
|
|
|
+ levelCode: this.$store.state.target.levelCode, // 学段code
|
|
|
+ subjectCode: this.$store.state.target.subjectCode //学科code
|
|
|
+ }
|
|
|
+ this.$api.target.getTargetExerciseResult(prams).then(res=>{
|
|
|
+ })
|
|
|
+ },
|
|
|
},
|
|
|
computed:{},
|
|
|
- mounted() {},
|
|
|
+ mounted() {
|
|
|
+ this.GetTargetExerciseResult();
|
|
|
+ },
|
|
|
|
|
|
})
|
|
|
|
|
|
@@ -208,20 +306,35 @@ export default ({
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
+.practice_result{
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ overflow: auto;
|
|
|
|
|
|
-.page_search{
|
|
|
- margin-bottom: 16px;
|
|
|
-}
|
|
|
-.practice_table{
|
|
|
- margin-top: 2px;
|
|
|
- ::v-deep .el-table {
|
|
|
- thead{
|
|
|
- height: 40px !important;
|
|
|
- }
|
|
|
- .el-table__cell {
|
|
|
- height: 40px;
|
|
|
+ width: 100%;
|
|
|
+ height: calc(100% - 60px - 88px );
|
|
|
+ box-sizing: border-box;
|
|
|
+ background-color: #fff;
|
|
|
+ border-radius: 10px;
|
|
|
+ margin-bottom: 10px;
|
|
|
+ padding: 10px;
|
|
|
+
|
|
|
+ > *:last-child{
|
|
|
+ flex-grow: 1;
|
|
|
+ }
|
|
|
+ .page_search{
|
|
|
+ margin-bottom: 16px;
|
|
|
+ }
|
|
|
+ .practice_table{
|
|
|
+ margin-top: 2px;
|
|
|
+ ::v-deep .el-table {
|
|
|
+ thead{
|
|
|
+ height: 40px !important;
|
|
|
+ }
|
|
|
+ .el-table__cell {
|
|
|
+ height: 40px;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
</style>
|