|
@@ -1,9 +1,37 @@
|
|
|
<template>
|
|
|
<div class="app-container">
|
|
|
<el-card>
|
|
|
- <dynamic-table :columns="columns" :rows="rows"></dynamic-table>
|
|
|
- <pagination v-if="total>0" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
|
|
|
+ <div class="fx-row fx-end-cen mb10">
|
|
|
+ <el-button icon="el-icon-refresh" circle @click="queryParams.pageNum=1,getList()"></el-button>
|
|
|
+ </div>
|
|
|
+ <dynamic-table :columns="columns" :rows="rows">
|
|
|
+ <template #type="{display}">
|
|
|
+ {{ translateType(display) }}
|
|
|
+ </template>
|
|
|
+ <template #status="{row}">
|
|
|
+ {{ row.isDo ? '已完成' : '未完成' }}
|
|
|
+ </template>
|
|
|
+ <template #action="{row}">
|
|
|
+ <el-button v-if="useVideoAction(row)" type="text" icon="el-icon-video-camera"
|
|
|
+ @click="handleVideo(row)">观看
|
|
|
+ </el-button>
|
|
|
+ <el-button v-if="usePaperAction(row)" type="text" icon="el-icon-edit"
|
|
|
+ @click="handlePaper(row)">做题
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </dynamic-table>
|
|
|
+ <pagination v-if="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
|
|
|
@pagination="getList"></pagination>
|
|
|
+ <el-dialog v-if="videoOption.dialogVisible" :visible.sync="videoOption.dialogVisible" :title="videoOption.title"
|
|
|
+ :close-on-click-modal="false" width="80%" @close="handleVideoClosed">
|
|
|
+ <mx-video :src="videoOption.src" :ali-id-type="videoOption.aliIdType"></mx-video>
|
|
|
+ </el-dialog>
|
|
|
+ <el-drawer v-if="paperOption.dialogVisible" :visible.sync="paperOption.dialogVisible" :title="paperOption.title"
|
|
|
+ :close-on-click-modal="false" append-to-body size="100%" @close="handlePaperClose">
|
|
|
+ <div class="pl30 pr30">
|
|
|
+ <homework-paper :params="paperOption.params"></homework-paper>
|
|
|
+ </div>
|
|
|
+ </el-drawer>
|
|
|
</el-card>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -11,19 +39,44 @@
|
|
|
<script>
|
|
|
import DynamicTable from '@/components/dynamic-table/index'
|
|
|
import { getStudentHomeworks } from '@/api/webApi/homework'
|
|
|
+import consts from '@/common/mx-const'
|
|
|
+import HomeworkPaper from '@/views/questioncenter/components/homework-paper'
|
|
|
|
|
|
export default {
|
|
|
name: 'homework',
|
|
|
- components: { DynamicTable },
|
|
|
+ components: { HomeworkPaper, DynamicTable },
|
|
|
data() {
|
|
|
return {
|
|
|
queryParams: {
|
|
|
pageNum: 1,
|
|
|
pageSize: 20
|
|
|
},
|
|
|
- columns: [],
|
|
|
+ columns: [
|
|
|
+ { prop: 'id', label: 'ID', width: '80px' },
|
|
|
+ { prop: 'type', label: '类型', width: '120px', slotBody: 'type' },
|
|
|
+ { prop: 'createTime', label: '创建时间', width: '180px' },
|
|
|
+ { prop: 'title', label: '标题' },
|
|
|
+ { prop: 'remark', label: '备注' },
|
|
|
+ { prop: 'status', label: '状态', width: '80px', slotBody: 'status' },
|
|
|
+ { prop: 'action', label: '操作', width: '120px', slotBody: 'action' }
|
|
|
+ ],
|
|
|
rows: [],
|
|
|
- total: 0
|
|
|
+ total: 0,
|
|
|
+ // dialog video
|
|
|
+ videoOption: {
|
|
|
+ dialogVisible: false,
|
|
|
+ title: '',
|
|
|
+ src: null,
|
|
|
+ aliIdType: consts.enum.aliIdType.AliIdResourcePerson
|
|
|
+ },
|
|
|
+ paperOption: {
|
|
|
+ dialogVisible: false,
|
|
|
+ params: {
|
|
|
+ id: '',
|
|
|
+ type: ''
|
|
|
+ },
|
|
|
+ title: ''
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
@@ -34,6 +87,34 @@ export default {
|
|
|
const res = await getStudentHomeworks(this.queryParams)
|
|
|
this.rows = res.rows || res.data
|
|
|
this.total = res.total || this.rows.length
|
|
|
+ },
|
|
|
+ translateType(type) {
|
|
|
+ const enumType = consts.enum.homeworkTypes.find(t => t.value == type)
|
|
|
+ return enumType?.label || type
|
|
|
+ },
|
|
|
+ usePaperAction(row) {
|
|
|
+ return consts.enum.homeworkTypes.find(t => t.value == row.type)?.usePaper
|
|
|
+ },
|
|
|
+ useVideoAction(row) {
|
|
|
+ return consts.enum.homeworkTypes.find(t => t.value == row.type)?.useVideo
|
|
|
+ },
|
|
|
+ handleVideo(row) {
|
|
|
+ this.videoOption.src = row.content
|
|
|
+ this.videoOption.title = row.title
|
|
|
+ this.videoOption.dialogVisible = true
|
|
|
+ },
|
|
|
+ handleVideoClosed() {
|
|
|
+ // 稍等,先让视频观看记录自动提交,再触发刷新,以获取到新的作业完成状态
|
|
|
+ setTimeout(() => this.getList(), 200)
|
|
|
+ },
|
|
|
+ handlePaper(row) {
|
|
|
+ this.paperOption.params.id = row.id
|
|
|
+ this.paperOption.params.type = row.type
|
|
|
+ this.paperOption.title = this.translateType(row.type)
|
|
|
+ this.paperOption.dialogVisible = true
|
|
|
+ },
|
|
|
+ handlePaperClose() {
|
|
|
+ setTimeout(() => this.getList(), 200)
|
|
|
}
|
|
|
}
|
|
|
}
|