提交 c9583aa3 authored 作者: matian's avatar matian

代码提交

上级 ef96bacc
...@@ -40,3 +40,22 @@ export function addStudent(data) { ...@@ -40,3 +40,22 @@ export function addStudent(data) {
export function updateExam(data) { export function updateExam(data) {
return httpRequest.post('/api/exam/v1/exam/update', data) return httpRequest.post('/api/exam/v1/exam/update', data)
} }
/**
* 考试数据下载
*/
export function downloadExamData(params) {
return httpRequest.get('/api/exam/v1/exam/download-details', { params, responseType: 'blob' })
}
/**
* 删除考生
*/
export function deleteStudent(data) {
return httpRequest.post('/api/exam/v1/student/delete', data)
}
/**
* 发送成绩信息
*/
export function sendMessage(data) {
return httpRequest.post('/api/exam/v1/exam/send-msg', data)
}
...@@ -119,6 +119,8 @@ export default { ...@@ -119,6 +119,8 @@ export default {
}, },
saveExamInfo() { saveExamInfo() {
const params = { const params = {
id: this.row.exam_id,
type: 'basic',
name: this.name, name: this.name,
start_time: this.start_time, start_time: this.start_time,
end_time: this.end_time, end_time: this.end_time,
......
...@@ -78,7 +78,7 @@ export default { ...@@ -78,7 +78,7 @@ export default {
this.$emit('getCheckPaperList', this.checkedArrs) this.$emit('getCheckPaperList', this.checkedArrs)
}, },
saveExamInfo() { saveExamInfo() {
const params = { exam_paper: this.q.toString() } const params = { id: this.$route.query.id, type: 'paper', exam_paper: this.q.toString() }
updateExam(params).then(res => { updateExam(params).then(res => {
history.go(-1) history.go(-1)
}) })
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<app-card> <app-card>
<app-list v-bind="tableOptions" ref="list" @selection-change="handleSelectionChange"> <app-list v-bind="tableOptions" ref="list" @selection-change="handleSelectionChange">
<div style="margin-bottom: 30px"> <div style="margin-bottom: 30px">
<el-dropdown split-button size="small" style="margin-left: 10px; margin-right: 10px"> <el-dropdown split-button size="small" style="margin-left: 10px; margin-right: 10px; float: right">
操作 操作
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="editExamInfo">考试信息编辑</el-dropdown-item> <el-dropdown-item @click.native="editExamInfo">考试信息编辑</el-dropdown-item>
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
</template> </template>
<script> <script>
import { getExamPaperDetail } from '../api' import { getExamPaperDetail, deleteStudent, downloadExamData } from '../api'
const stuStatus = [ const stuStatus = [
{ id: '1', name: '未开考' }, { id: '1', name: '未开考' },
{ id: '1', name: '已登录' }, { id: '1', name: '已登录' },
...@@ -48,10 +48,7 @@ export default { ...@@ -48,10 +48,7 @@ export default {
remote: { remote: {
httpRequest: getExamPaperDetail, httpRequest: getExamPaperDetail,
params: { params: {
id: this.row.exam_id, id: this.row.exam_id
school: '',
relation_status: '',
name: this.row.name
} }
}, },
filters: [ filters: [
...@@ -98,6 +95,7 @@ export default { ...@@ -98,6 +95,7 @@ export default {
} }
}, },
methods: { methods: {
handleDetail() {},
handleSelectionChange(val) { handleSelectionChange(val) {
this.multipleSelection = val this.multipleSelection = val
}, },
...@@ -109,22 +107,58 @@ export default { ...@@ -109,22 +107,58 @@ export default {
query: { id: this.row.exam_id } query: { id: this.row.exam_id }
}) })
}, },
// 考试信息编辑
editExamInfo() { editExamInfo() {
this.$router.push({ path: 'baseInfo', query: { row: JSON.stringify(this.row), isEdit: '2' } }) this.$router.push({ path: 'baseInfo', query: { row: JSON.stringify(this.row), isEdit: '2' } })
}, },
// 考试试卷编辑
editExam() { editExam() {
console.log(this.row) console.log(this.row)
this.$router.push({ path: 'checkPaper', query: { papers: JSON.stringify(this.row.papers), isEdit: '2' } }) this.$router.push({
path: 'checkPaper',
query: { papers: JSON.stringify(this.row.papers), isEdit: '2', id: this.row.exam_id }
})
}, },
// 删除考生 // 删除考生
delStudent() {}, delStudent(row) {
const studentId = this.multipleSelection.map(item => item.student_id).toString()
const studentIds = studentId.toString()
deleteStudent({ id: studentIds }).then(res => {
this.$message.success('删除成功')
})
this.$refs.list.refetch()
},
// 导出明细 // 导出明细
exportDetail() {}, exportDetail() {
const params = {
id: this.row.exam_id,
name: '',
relation_status: '',
school: ''
}
downloadExamData(params).then(r => {
const blob = new Blob([r], { type: 'application/vnd.ms-excel' })
console.log(blob)
if ('download' in document.createElement('a')) {
const elink = document.createElement('a')
elink.download = '学员数据.xlsx'
elink.style.display = 'none'
elink.href = URL.createObjectURL(blob)
document.body.appendChild(elink)
elink.click()
URL.revokeObjectURL(elink.href)
document.body.removeChild(elink)
}
})
},
// 转移考生 // 转移考生
transferStudent() {}, transferStudent() {},
// 发送成绩信息 // 发送成绩信息
sendMessage() {}, sendMessage() {},
editInfo() {} // 信息采集编辑
editInfo() {},
// 考试配置编辑
editExamSetting() {}
} }
} }
</script> </script>
...@@ -49,8 +49,9 @@ httpRequest.interceptors.request.use( ...@@ -49,8 +49,9 @@ httpRequest.interceptors.request.use(
httpRequest.interceptors.response.use( httpRequest.interceptors.response.use(
function (response) { function (response) {
const { data } = response const { data } = response
console.log(response)
// 正常返回 // 正常返回
if (data.code === 0) { if (data.code === 0 || data.type === 'application/vnd.ms-excel') {
return data return data
} }
// 未登录 // 未登录
......
...@@ -29,7 +29,7 @@ export default defineConfig(({ mode }) => { ...@@ -29,7 +29,7 @@ export default defineConfig(({ mode }) => {
rewrite: path => path.replace(/^\/api\/qbs/, '') rewrite: path => path.replace(/^\/api\/qbs/, '')
}, },
'/api/exam': { '/api/exam': {
target: 'https://x-exam-admin-api.ezijing.com', target: 'http://localhost-exam-admin.ezijing.com',
changeOrigin: true, changeOrigin: true,
rewrite: path => path.replace(/^\/api\/exam/, '') rewrite: path => path.replace(/^\/api\/exam/, '')
}, },
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论