Merge branch 'bjxz-cjw' into bjxz-dev
This commit is contained in:
commit
e2e3ca95d4
@ -2,6 +2,7 @@
|
|||||||
* 考试系统api接口统一管理
|
* 考试系统api接口统一管理
|
||||||
*/
|
*/
|
||||||
import { post, get } from '../../http'
|
import { post, get } from '../../http'
|
||||||
|
import axios from 'axios'
|
||||||
|
|
||||||
//杂项Api
|
//杂项Api
|
||||||
export const getWorkerInfoListApi = data => post('xmgl/workerInfo/selectWorkerInfoList', data); // 查询临时人员
|
export const getWorkerInfoListApi = data => post('xmgl/workerInfo/selectWorkerInfoList', data); // 查询临时人员
|
||||||
@ -72,6 +73,10 @@ export const importQuestionBankApi = data => post('exam/questionBank/importExcel
|
|||||||
export const detailIdQuestionBankApi = data => post('exam/questionBank/queryById', data) //查询题目详情
|
export const detailIdQuestionBankApi = data => post('exam/questionBank/queryById', data) //查询题目详情
|
||||||
export const moveQuestionBankApi = data => post('exam/questionBank/move', data) //移动科目类别
|
export const moveQuestionBankApi = data => post('exam/questionBank/move', data) //移动科目类别
|
||||||
export const getRandomQuestionApi = data => post('exam/questionBank/random', data) //随机获取题目
|
export const getRandomQuestionApi = data => post('exam/questionBank/random', data) //随机获取题目
|
||||||
|
// 题库模板下载
|
||||||
|
export function downloadTheTemplate(projectSn) {
|
||||||
|
window.location.href = axios.defaults.baseURL + `xmgl/download/exporExcelExamQuestionTemplate?projectSn=${projectSn}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 考试管理
|
// 考试管理
|
||||||
|
|||||||
@ -61,10 +61,10 @@
|
|||||||
v-permission="{key: 'questionManagement_add', menuPath: '/project/examSystem2/questionManagement'}">
|
v-permission="{key: 'questionManagement_add', menuPath: '/project/examSystem2/questionManagement'}">
|
||||||
添加试题
|
添加试题
|
||||||
</el-button>
|
</el-button>
|
||||||
<!-- <el-button type="primary" plain size="medium" @click="downloadFn"
|
<el-button type="primary" plain size="medium" @click="downloadFn"
|
||||||
v-permission="{key: 'questionManagement_download', menuPath: '/project/examSystem2/questionManagement'}">
|
v-permission="{key: 'questionManagement_download', menuPath: '/project/examSystem2/questionManagement'}">
|
||||||
下载题库导入模板
|
下载题库导入模板
|
||||||
</el-button> -->
|
</el-button>
|
||||||
<el-button type="primary" plain size="medium" @click="exportFn"
|
<el-button type="primary" plain size="medium" @click="exportFn"
|
||||||
v-permission="{key: 'questionManagement_export', menuPath: '/project/examSystem2/questionManagement'}">
|
v-permission="{key: 'questionManagement_export', menuPath: '/project/examSystem2/questionManagement'}">
|
||||||
导出题库
|
导出题库
|
||||||
@ -116,7 +116,8 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="options" width="100px" label="试题答案">
|
<el-table-column prop="options" width="100px" label="试题答案">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{sortedOptions(scope.row.options)}}
|
<!-- {{sortedOptions(scope.row.options)}} -->
|
||||||
|
{{scope.row.options}}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="createTime" width="180px" label="创建时间"></el-table-column>
|
<el-table-column prop="createTime" width="180px" label="创建时间"></el-table-column>
|
||||||
@ -503,6 +504,7 @@ import {
|
|||||||
detailIdQuestionBankApi,
|
detailIdQuestionBankApi,
|
||||||
moveQuestionBankApi,
|
moveQuestionBankApi,
|
||||||
importQuestionBankApi,
|
importQuestionBankApi,
|
||||||
|
downloadTheTemplate,
|
||||||
} from '@/assets/js/api/examSystem/examSystem'
|
} from '@/assets/js/api/examSystem/examSystem'
|
||||||
export default {
|
export default {
|
||||||
name: "questionManagement",
|
name: "questionManagement",
|
||||||
@ -636,10 +638,11 @@ export default {
|
|||||||
this.$refs.upload.clearFiles()
|
this.$refs.upload.clearFiles()
|
||||||
this.fullscreenLoading = false
|
this.fullscreenLoading = false
|
||||||
if (res.code == 200 || res.code == 0) {
|
if (res.code == 200 || res.code == 0) {
|
||||||
this.$message.success('题库导入成功')
|
this.$message.success(res.message)
|
||||||
this.getList()
|
this.getList()
|
||||||
} else {
|
} else {
|
||||||
this.$message.error('题库导入失败')
|
//导入失败提示
|
||||||
|
this.$message.error(res.message)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeAvatarUpload() {
|
beforeAvatarUpload() {
|
||||||
@ -651,10 +654,18 @@ export default {
|
|||||||
exportFn() {
|
exportFn() {
|
||||||
// fetch(this.$http.defaults.baseURL + 'exam/questionBank/exportXls?&projectSn=' + this.projectSn + '&endReceiveTime=' + this.time[1] + '&startReceiveTime=' + this.time[0] + '&devName=' + this.devName, {
|
// fetch(this.$http.defaults.baseURL + 'exam/questionBank/exportXls?&projectSn=' + this.projectSn + '&endReceiveTime=' + this.time[1] + '&startReceiveTime=' + this.time[0] + '&devName=' + this.devName, {
|
||||||
// + '&endReceiveTime=' + this.time[1] + '&startReceiveTime=' + this.time[0] + '&devName=' + this.devName, {
|
// + '&endReceiveTime=' + this.time[1] + '&startReceiveTime=' + this.time[0] + '&devName=' + this.devName, {
|
||||||
fetch(this.$http.defaults.baseURL + 'exam/questionBank/exportXls?&projectSn=' + this.projectSn + "&subjectId=" + this.subjectId,{
|
// fetch(this.$http.defaults.baseURL + 'exam/questionBank/exportXls?&projectSn=' + this.projectSn + "&subjectId=" + this.subjectId,{
|
||||||
|
let data = {
|
||||||
|
projectSn:this.projectSn,
|
||||||
|
subjectId:this.subjectId
|
||||||
|
}
|
||||||
|
fetch(this.$http.defaults.baseURL + 'exam/questionBank/exportXls',{
|
||||||
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': this.$store.state.userInfo.token
|
'Authorization': this.$store.state.userInfo.token,
|
||||||
}
|
'Content-Type': 'application/json' // 指定请求体为 JSON 格式
|
||||||
|
},
|
||||||
|
body: JSON.stringify(data)
|
||||||
})
|
})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
// 处理响应
|
// 处理响应
|
||||||
@ -679,6 +690,7 @@ export default {
|
|||||||
window.URL.revokeObjectURL(url);
|
window.URL.revokeObjectURL(url);
|
||||||
// 处理导出的文件
|
// 处理导出的文件
|
||||||
// 这里可以使用blob对象来获取导出的文件内容或者将其保存到本地
|
// 这里可以使用blob对象来获取导出的文件内容或者将其保存到本地
|
||||||
|
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
// 处理错误
|
// 处理错误
|
||||||
@ -687,39 +699,40 @@ export default {
|
|||||||
},
|
},
|
||||||
// 下载模板
|
// 下载模板
|
||||||
downloadFn() {
|
downloadFn() {
|
||||||
fetch(this.$http.defaults.baseURL + 'exam/questionBank/exportXls?&projectSn=' + this.projectSn, {
|
downloadTheTemplate(this.projectSn)
|
||||||
headers: {
|
// fetch(this.$http.defaults.baseURL + 'exam/questionBank/exportXls?&projectSn=' + this.projectSn, {
|
||||||
'Authorization': this.$store.state.userInfo.token
|
// headers: {
|
||||||
}
|
// 'Authorization': this.$store.state.userInfo.token
|
||||||
})
|
// }
|
||||||
.then(response => {
|
// })
|
||||||
// 处理响应
|
// .then(response => {
|
||||||
if (!response.ok) {
|
// // 处理响应
|
||||||
throw new Error('导出失败');
|
// if (!response.ok) {
|
||||||
}
|
// throw new Error('导出失败');
|
||||||
return response.blob();
|
// }
|
||||||
})
|
// return response.blob();
|
||||||
.then(blob => {
|
// })
|
||||||
console.log('导出成功');
|
// .then(blob => {
|
||||||
// 创建一个下载链接
|
// console.log('导出成功');
|
||||||
const url = window.URL.createObjectURL(blob);
|
// // 创建一个下载链接
|
||||||
// 创建一个<a>元素
|
// const url = window.URL.createObjectURL(blob);
|
||||||
const link = document.createElement('a');
|
// // 创建一个<a>元素
|
||||||
link.href = url;
|
// const link = document.createElement('a');
|
||||||
link.download = '题库导入模板.xlsx'; // 指定下载文件的文件名
|
// link.href = url;
|
||||||
// 模拟点击下载链接
|
// link.download = '题库导入模板.xlsx'; // 指定下载文件的文件名
|
||||||
document.body.appendChild(link);
|
// // 模拟点击下载链接
|
||||||
link.click();
|
// document.body.appendChild(link);
|
||||||
document.body.removeChild(link);
|
// link.click();
|
||||||
// 释放URL对象
|
// document.body.removeChild(link);
|
||||||
window.URL.revokeObjectURL(url);
|
// // 释放URL对象
|
||||||
// 处理导出的文件
|
// window.URL.revokeObjectURL(url);
|
||||||
// 这里可以使用blob对象来获取导出的文件内容或者将其保存到本地
|
// // 处理导出的文件
|
||||||
})
|
// // 这里可以使用blob对象来获取导出的文件内容或者将其保存到本地
|
||||||
.catch(error => {
|
// })
|
||||||
// 处理错误
|
// .catch(error => {
|
||||||
console.error(error);
|
// // 处理错误
|
||||||
});
|
// console.error(error);
|
||||||
|
// });
|
||||||
},
|
},
|
||||||
handleInputArea(){
|
handleInputArea(){
|
||||||
this.$forceUpdate()
|
this.$forceUpdate()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user