|
|
@@ -2,53 +2,61 @@
|
|
|
<div class="paper-list">
|
|
|
<!-- 任务中心开始 -->
|
|
|
<div class="task-center" style="margin-bottom: 24px">
|
|
|
- <h3 style="border-left: solid 4px #3651d4; padding-left: 8px; margin-bottom: 12px; font-size: 18px">任务中心</h3>
|
|
|
+ <h3 style="border-left: solid 4px #3651d4; padding-left: 8px; margin-bottom: 12px; font-size: 18px">
|
|
|
+ 调查问卷/考试
|
|
|
+ </h3>
|
|
|
<a-spin :spinning="taskLoading">
|
|
|
- <a-collapse v-if="taskList.length !== 0" accordion>
|
|
|
- <a-collapse-panel v-for="taskItem in taskList" :key="taskItem.id" :header="taskItem.title">
|
|
|
- <a-table
|
|
|
- :dataSource="taskItem.paperItems"
|
|
|
- :columns="taskColumns"
|
|
|
- :pagination="false"
|
|
|
- rowKey="examPaperId"
|
|
|
- size="small"
|
|
|
- >
|
|
|
- <template #bodyCell="{ column, record }">
|
|
|
- <template v-if="column.key === 'examPaperName'">
|
|
|
- {{ record.examPaperName }}
|
|
|
- </template>
|
|
|
- <template v-else-if="column.key === 'status'">
|
|
|
- <a-tag v-if="record.status !== null" :color="statusTagFormatter(record.status)" size="small">
|
|
|
- {{ statusTextFormatter(record.status) }}
|
|
|
- </a-tag>
|
|
|
- </template>
|
|
|
- <template v-else-if="column.key === 'action'">
|
|
|
- <router-link
|
|
|
- v-if="record.status === null"
|
|
|
- :to="{ path: '/student/do', query: { id: record.examPaperId } }"
|
|
|
- target="_blank"
|
|
|
- >
|
|
|
- <a-button type="link" size="small">开始答题</a-button>
|
|
|
- </router-link>
|
|
|
- <router-link
|
|
|
- v-else-if="record.status === 1"
|
|
|
- :to="{ path: '/student/edit', query: { id: record.examPaperAnswerId } }"
|
|
|
- target="_blank"
|
|
|
- >
|
|
|
- <a-button type="link" size="small">批改试卷</a-button>
|
|
|
- </router-link>
|
|
|
- <router-link
|
|
|
- v-else-if="record.status === 2"
|
|
|
- :to="{ path: '/student/read', query: { id: record.examPaperAnswerId } }"
|
|
|
- target="_blank"
|
|
|
- >
|
|
|
- <a-button type="link" size="small">查看试卷</a-button>
|
|
|
- </router-link>
|
|
|
- </template>
|
|
|
- </template>
|
|
|
- </a-table>
|
|
|
- </a-collapse-panel>
|
|
|
- </a-collapse>
|
|
|
+ <a-table
|
|
|
+ v-if="taskList.length !== 0"
|
|
|
+ :dataSource="taskList"
|
|
|
+ :columns="taskColumns"
|
|
|
+ :pagination="false"
|
|
|
+ rowKey="id"
|
|
|
+ size="middle"
|
|
|
+ >
|
|
|
+ <template #bodyCell="{ column, record }">
|
|
|
+ <template v-if="column.key === 'examName'">
|
|
|
+ {{ record.examName }}
|
|
|
+ </template>
|
|
|
+ <template v-else-if="column.key === 'examType'">
|
|
|
+ {{ record.examType }}
|
|
|
+ </template>
|
|
|
+ <template v-else-if="column.key === 'startTime'">
|
|
|
+ {{ record.startTime }}
|
|
|
+ </template>
|
|
|
+ <template v-else-if="column.key === 'endTime'">
|
|
|
+ {{ record.endTime }}
|
|
|
+ </template>
|
|
|
+ <template v-else-if="column.key === 'examStatus'">
|
|
|
+ <a-tag :color="statusTagFormatter(record.examStatus)" size="small">
|
|
|
+ {{ statusTextFormatter(record.examStatus) }}
|
|
|
+ </a-tag>
|
|
|
+ </template>
|
|
|
+ <template v-else-if="column.key === 'action'">
|
|
|
+ <router-link
|
|
|
+ v-if="record.examStatus === 0"
|
|
|
+ :to="{ path: '/student/do', query: { id: record.paperId } }"
|
|
|
+ target="_blank"
|
|
|
+ >
|
|
|
+ <a-button type="link" size="small">查看问卷</a-button>
|
|
|
+ </router-link>
|
|
|
+ <router-link
|
|
|
+ v-else-if="record.examStatus === 1"
|
|
|
+ :to="{ path: '/student/do', query: { id: record.paperId } }"
|
|
|
+ target="_blank"
|
|
|
+ >
|
|
|
+ <a-button type="link" size="small">填写问卷</a-button>
|
|
|
+ </router-link>
|
|
|
+ <router-link
|
|
|
+ v-else-if="record.examStatus === 2"
|
|
|
+ :to="{ path: '/student/read', query: { id: record.paperId } }"
|
|
|
+ target="_blank"
|
|
|
+ >
|
|
|
+ <a-button type="link" size="small">查看结果</a-button>
|
|
|
+ </router-link>
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
+ </a-table>
|
|
|
<div v-else style="color: #999; padding: 16px 0">暂无任务</div>
|
|
|
</a-spin>
|
|
|
</div>
|
|
|
@@ -103,27 +111,35 @@
|
|
|
const taskList = ref([])
|
|
|
const taskLoading = ref(false)
|
|
|
const taskColumns = [
|
|
|
- { title: '试卷名称', dataIndex: 'examPaperName', key: 'examPaperName' },
|
|
|
- { title: '状态', dataIndex: 'status', key: 'status', width: 90 },
|
|
|
+ { title: '问卷名称', dataIndex: 'examName', key: 'examName' },
|
|
|
+ { title: '问卷类型', dataIndex: 'examType', key: 'examType', width: 120 },
|
|
|
+ { title: '开始时间', dataIndex: 'startTime', key: 'startTime', width: 180 },
|
|
|
+ { title: '结束时间', dataIndex: 'endTime', key: 'endTime', width: 180 },
|
|
|
+ { title: '状态', dataIndex: 'examStatus', key: 'examStatus', width: 90 },
|
|
|
{ title: '操作', key: 'action', align: 'right', width: 120 }
|
|
|
]
|
|
|
|
|
|
const statusTextFormatter = (status) => {
|
|
|
- if (status === null) return '未作答'
|
|
|
- if (status === 1) return '待批改'
|
|
|
- if (status === 2) return '已批改'
|
|
|
+ if (status === 0) return '未开始'
|
|
|
+ if (status === 1) return '已开始'
|
|
|
+ if (status === 2) return '已结束'
|
|
|
return ''
|
|
|
}
|
|
|
const statusTagFormatter = (status) => {
|
|
|
- if (status === 1) return 'orange'
|
|
|
- if (status === 2) return 'green'
|
|
|
+ if (status === 0) return 'blue'
|
|
|
+ if (status === 1) return 'green'
|
|
|
+ if (status === 2) return 'gray'
|
|
|
return 'default'
|
|
|
}
|
|
|
const getTaskList = async () => {
|
|
|
taskLoading.value = true
|
|
|
try {
|
|
|
- const res = await taskApi.task()
|
|
|
- taskList.value = res || []
|
|
|
+ const res = await taskApi.pageExamList({
|
|
|
+ current: 1,
|
|
|
+ size: 10
|
|
|
+ })
|
|
|
+ console.log('res', res)
|
|
|
+ taskList.value = res?.records || []
|
|
|
} catch (e) {
|
|
|
taskList.value = []
|
|
|
}
|