题库细节优化
This commit is contained in:
parent
b45eddb9ee
commit
8228dd9b0f
|
@ -115,13 +115,15 @@ export default {
|
|||
data() {
|
||||
return {
|
||||
dataValue: 1,
|
||||
form: {},
|
||||
form: {
|
||||
coverPath:'',
|
||||
},
|
||||
personType: [
|
||||
{ id: '1', name: '人员类别1' },
|
||||
{ id: '2', name: '人员类别2' },
|
||||
{ id: '3', name: '人员类别3' },
|
||||
],
|
||||
|
||||
url:'',
|
||||
previewVisible: false,
|
||||
fileList: [],
|
||||
previewImage :[
|
||||
|
@ -147,7 +149,6 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
//获取字典值
|
||||
// getPersonType() {
|
||||
// return dictGet(Object.assign(parameter)).then((res) => {
|
||||
// return res
|
||||
|
@ -171,7 +172,9 @@ export default {
|
|||
|
||||
//返回
|
||||
goback(){
|
||||
this.$router.push({path:"/course/CourseList",query:{} })
|
||||
this.$router.push({path:"/course/CourseList",query:{
|
||||
courseName:this.$route.query.courseName
|
||||
} })
|
||||
},
|
||||
|
||||
getToken() {
|
||||
|
@ -195,6 +198,17 @@ export default {
|
|||
},
|
||||
handleChange({ fileList }) {
|
||||
this.fileList = fileList;
|
||||
console.log("fileList-------",fileList);
|
||||
this.fileList.file=fileList[0];
|
||||
console.log('file``````',this.fileList.file)
|
||||
console.log('response``````',this.fileList.file.response.url)
|
||||
|
||||
|
||||
this.form.coverPath = this.fileList.file.response.url;
|
||||
|
||||
console.log("url",this.form.coverPath)
|
||||
|
||||
|
||||
},
|
||||
|
||||
},
|
||||
|
|
|
@ -1,87 +1,109 @@
|
|||
<template>
|
||||
<a-card :bordered="false" title="课程列表">
|
||||
<div class="table-page-search-wrapper">
|
||||
<SearchCom :form="queryParam" :list="queryOptions" @search="handleRefresh" @reset="() => {queryParam = {}, handleRefresh()}" ></SearchCom>
|
||||
<div style="width: 100%; height: 32px; margin-bottom: 8px;">
|
||||
<a-button type="primary" @click="courseAdd">新建课程</a-button>
|
||||
</div>
|
||||
<a-card :bordered="false" title="课程列表">
|
||||
<div class="table-page-search-wrapper">
|
||||
<SearchCom
|
||||
:form="queryParam"
|
||||
:list="queryOptions"
|
||||
@search="handleRefresh"
|
||||
@reset="
|
||||
() => {
|
||||
;(queryParam = {}), handleRefresh()
|
||||
}
|
||||
"
|
||||
></SearchCom>
|
||||
<div style="width: 100%; height: 32px; margin-bottom: 8px">
|
||||
<a-button type="primary" @click="courseAdd">新建课程</a-button>
|
||||
</div>
|
||||
<s-table ref="table" size="default" rowKey="id" :columns="columns" :data="loadData" :pageNum="Number(this.$route.query.PageNum) || 1">
|
||||
<template slot="action" slot-scope="text, record">
|
||||
<a href="javascript:;" @click="detail(record)">详情</a>
|
||||
<a-divider type="vertical" />
|
||||
<a href="javascript:;" @click="courseWare(record)">课件</a>
|
||||
<a-divider type="vertical" />
|
||||
<a href="javascript:;" @click="courseWare(record)">课件预览</a>
|
||||
<a-divider type="vertical" />
|
||||
<a-popconfirm title="是否删除?" @confirm="() => del(record)">
|
||||
<a href="javascript:;">删除</a>
|
||||
</a-popconfirm>
|
||||
<a-divider type="vertical" />
|
||||
<a href="javascript:;" @click="courseQuestion(record)">题库</a>
|
||||
</template>
|
||||
</s-table>
|
||||
</a-card>
|
||||
</div>
|
||||
<s-table
|
||||
ref="table"
|
||||
size="default"
|
||||
rowKey="id"
|
||||
:columns="columns"
|
||||
:data="loadData"
|
||||
:pageNum="Number(this.$route.query.PageNum) || 1"
|
||||
>
|
||||
<template slot="action" slot-scope="text, record">
|
||||
<a href="javascript:;" @click="detail(record)">详情</a>
|
||||
<a-divider type="vertical" />
|
||||
<a href="javascript:;" @click="courseWare(record)">课件</a>
|
||||
<a-divider type="vertical" />
|
||||
<a href="javascript:;" @click="courseWare(record)">课件预览</a>
|
||||
<a-divider type="vertical" />
|
||||
<a-popconfirm title="是否删除?" @confirm="() => del(record)">
|
||||
<a href="javascript:;">删除</a>
|
||||
</a-popconfirm>
|
||||
<a-divider type="vertical" />
|
||||
<a href="javascript:;" @click="courseQuestion(record)">题库</a>
|
||||
</template>
|
||||
</s-table>
|
||||
</a-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { STable, SearchCom } from '@/components'
|
||||
import { getCourseList,deleteCourse } from '@/api/course/course'
|
||||
import { getCourseList, deleteCourse } from '@/api/course/course'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
STable, SearchCom
|
||||
STable,
|
||||
SearchCom,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
queryParam: { courseName : this.$route.query.courseName || ''},//, orgId: this.$route.query.courseUserOrgId || ''
|
||||
queryOptions: [
|
||||
{ type: 'input', placeholder: '课程名称', key: 'courseName' },
|
||||
],
|
||||
loadData: parameter => {
|
||||
return getCourseList(Object.assign(parameter, this.queryParam)).then(res => { return res });
|
||||
queryParam: { courseName: this.$route.query.courseName || '' }, //, orgId: this.$route.query.courseUserOrgId || ''
|
||||
queryOptions: [{ type: 'input', placeholder: '课程名称', key: 'courseName' }],
|
||||
loadData: (parameter) => {
|
||||
return getCourseList(Object.assign(parameter, this.queryParam)).then((res) => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
columns: [
|
||||
{ title: '课程编号', width: '160px', align: 'center', dataIndex: 'courseCode', key: 'courseCode' },
|
||||
{ title: '课程名称', width: 'auto', align: 'center', dataIndex: 'courseName', key: 'courseName' },
|
||||
{ title: '课时/分', width: '160px', align: 'center', dataIndex: 'hour', key: 'hour' },
|
||||
{ title: '数量', width: '160px', align: 'center', dataIndex: 'questionCount', key: 'questionCount' },
|
||||
{ title: '操作', key: 'operation', width: '300px', align: 'center', scopedSlots: { customRender: 'action' } }
|
||||
{ title: '操作', key: 'operation', width: '300px', align: 'center', scopedSlots: { customRender: 'action' } },
|
||||
],
|
||||
}
|
||||
},
|
||||
created() {
|
||||
},
|
||||
created() {},
|
||||
methods: {
|
||||
handleRefresh () {
|
||||
handleRefresh() {
|
||||
this.$refs.table.refresh(true)
|
||||
},
|
||||
detail(record){
|
||||
this.$router.push({ path: '/course/CourseDetail', query: { id: record.id } });
|
||||
detail(record) {
|
||||
this.$router.push({ path: '/course/CourseDetail', query: { id: record.id } })
|
||||
},
|
||||
courseWare(record){
|
||||
this.$router.push({ path: '/course/CoursewareList', query: { id: record.id } });
|
||||
courseWare(record) {
|
||||
this.$router.push({ path: '/course/CoursewareList', query: { id: record.id } })
|
||||
},
|
||||
del(record){
|
||||
deleteCourse({ids:record.id}).then(res => {
|
||||
if(res.code == 200) this.$refs.table.refresh(true);
|
||||
});
|
||||
del(record) {
|
||||
deleteCourse({ ids: record.id }).then((res) => {
|
||||
if (res.code == 200) this.$refs.table.refresh(true)
|
||||
})
|
||||
},
|
||||
|
||||
//課程新增
|
||||
courseAdd(){
|
||||
this.$router.push({ path : '/course/CourseAdd' , query : {}})
|
||||
courseAdd() {
|
||||
this.$router.push({
|
||||
path: '/course/CourseAdd',
|
||||
query: {
|
||||
courseName: this.queryParam.courseName
|
||||
},
|
||||
})
|
||||
},
|
||||
|
||||
//题库
|
||||
courseQuestion(record){
|
||||
courseQuestion(record) {
|
||||
this.$router.push({
|
||||
path: '/course/question/QuestionList', query :{
|
||||
id: record.id,
|
||||
courseName : this.queryParam.courseName,
|
||||
// courseUserOrgId : this.queryParam.orgId,
|
||||
PageNum : this.$refs.table.localPagination.current
|
||||
}});
|
||||
path: '/course/question/QuestionList',
|
||||
query: {
|
||||
id: record.id,
|
||||
courseName: this.queryParam.courseName,
|
||||
pageNum: this.$refs.table.pageNum
|
||||
},
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<a-card :bordered="false" title="项目档案">
|
||||
<a-card :bordered="false" title="课件信息">
|
||||
<template slot="extra">
|
||||
<a-button size="small" @click="goback">返回</a-button>
|
||||
</template>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<template>
|
||||
<page-header-wrapper :title="false">
|
||||
<a-card :bordered="false">
|
||||
<a-descriptions title="课程详情" layout="horizontal" bordered size="small" :column="1">
|
||||
<a-card :bordered="false" title="课程详情">
|
||||
<a-descriptions layout="horizontal" bordered size="small" :column="1">
|
||||
<a-descriptions-item label="课程编号"> {{ detailData.courseCode }} </a-descriptions-item>
|
||||
<a-descriptions-item label="课程名称"> {{ detailData.courseName }} </a-descriptions-item>
|
||||
<a-descriptions-item label="课程类别"> {{ detailData.courseType }} </a-descriptions-item>
|
||||
|
@ -15,7 +14,6 @@
|
|||
<a-button type="primary" @click="edit"> 编辑 </a-button>
|
||||
</div>
|
||||
</a-card>
|
||||
</page-header-wrapper>
|
||||
</template>
|
||||
<script>
|
||||
import { getCourseDetails } from '@/api/course/course'
|
||||
|
|
|
@ -92,8 +92,8 @@
|
|||
<a-card :bordered="false">
|
||||
<template slot="title">
|
||||
选项(从选项中选择一个作为答案)<br />
|
||||
<a-radio :value="1"> 正确 </a-radio>
|
||||
<a-radio :value="2"> 错误 </a-radio>
|
||||
<a-radio value="1"> 正确 </a-radio>
|
||||
<a-radio value="2"> 错误 </a-radio>
|
||||
</template>
|
||||
</a-card>
|
||||
<a-card title="答案解析" :bordered="false">
|
||||
|
@ -161,6 +161,8 @@ export default {
|
|||
},
|
||||
|
||||
created() {
|
||||
|
||||
//判断是否是编辑
|
||||
if (this.$route.query.id && !this.$route.query.opt) {
|
||||
|
||||
this.radio.disabled = true;
|
||||
|
@ -250,7 +252,6 @@ export default {
|
|||
console.log('5---', this.Completion)
|
||||
}
|
||||
|
||||
console.log('a--')
|
||||
from.courseId = this.$route.query.courseId
|
||||
|
||||
questionAdd(from).then((res) => {
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
<b><h1 class="questionContent">课程题目库预览</h1></b>
|
||||
<a-divider :style="{ backgroundColor: '#000' }" />
|
||||
<div class="question">
|
||||
<h1 class="questionName">
|
||||
<h1 class="questionName" v-if="quesitonList != null && quesitonList.length !=0">
|
||||
({{ questionDetail.questionTypeName }}){{ questionDetail.questionName }}
|
||||
<span class="edit" @click="edit(questionDetail.id)">编辑</span>
|
||||
<a-popconfirm title="确定要删除此题?" ok-text="确定" cancel-text="取消" @confirm="del(questionDetail.id)">
|
||||
|
@ -69,10 +69,12 @@
|
|||
|
||||
<!-- 显示填空题 -->
|
||||
<div v-if="questionDetail.questionType == 5">
|
||||
<div class="answer" v-for="(item,ind) in questionDetail.answerList" :key="ind">正确答案{{ ind+1 }}: {{ item }}</div>
|
||||
<div class="answer" v-for="(item, ind) in questionDetail.answerList" :key="ind">
|
||||
正确答案{{ ind + 1 }}: {{ item }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="info_parent">
|
||||
<div class="info_parent" v-if="quesitonList != null && quesitonList.length !=0">
|
||||
<div class="info">解析</div>
|
||||
<div class="info_main">
|
||||
{{ questionDetail.asnwerParse }}
|
||||
|
@ -82,7 +84,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<input ref="inputFile" type="file" style="display: none;" @change="questionBatchImport">
|
||||
<input ref="inputFile" type="file" style="display: none" @change="questionBatchImport" />
|
||||
</a-card>
|
||||
<!-- </page-header-wrapper> -->
|
||||
</template>
|
||||
|
@ -115,32 +117,37 @@ export default {
|
|||
this.quesitonList = res.data
|
||||
|
||||
if (!res.data) return
|
||||
// this.quesionId(this.quesitonList[0])
|
||||
this.quesionId(this.$route.query.questionId || this.quesitonList[0], this.$route.query.isactive || 0);
|
||||
this.quesionId(this.$route.query.questionId || this.quesitonList[0], this.$route.query.isactive || 0)
|
||||
})
|
||||
},
|
||||
|
||||
//题目ID查看题目
|
||||
quesionId: function (i, index) {
|
||||
this.isactive = index;
|
||||
this.questionId = i;
|
||||
if (this.quesitonList != null && this.quesitonList.length != 0) {//ID不为空则执行下面
|
||||
console.log("题目!!!!",this.quesitonList.length)
|
||||
this.isactive = index
|
||||
this.questionId = i
|
||||
|
||||
getQuestionDeatil({ id: i }).then((res) => {
|
||||
this.questionDetail = res.data
|
||||
//获取题目的名称
|
||||
if (this.questionDetail.questionType == '1') this.questionDetail.questionTypeName = '单选题'
|
||||
if (this.questionDetail.questionType == '2') this.questionDetail.questionTypeName = '多选题'
|
||||
if (this.questionDetail.questionType == '3') this.questionDetail.questionTypeName = '判断题'
|
||||
if (this.questionDetail.questionType == '4') this.questionDetail.questionTypeName = '简答题'
|
||||
if (this.questionDetail.questionType == '5') this.questionDetail.questionTypeName = '填空题'
|
||||
})
|
||||
getQuestionDeatil({ id: i }).then((res) => {
|
||||
this.questionDetail = res.data
|
||||
//获取题目的名称
|
||||
if (this.questionDetail.questionType == '1') this.questionDetail.questionTypeName = '单选题'
|
||||
if (this.questionDetail.questionType == '2') this.questionDetail.questionTypeName = '多选题'
|
||||
if (this.questionDetail.questionType == '3') this.questionDetail.questionTypeName = '判断题'
|
||||
if (this.questionDetail.questionType == '4') this.questionDetail.questionTypeName = '简答题'
|
||||
if (this.questionDetail.questionType == '5') this.questionDetail.questionTypeName = '填空题'
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
//关闭按钮
|
||||
questionColse() {
|
||||
this.$router.push({
|
||||
path: '/course/CourseList',
|
||||
query: {},
|
||||
query: {
|
||||
courseName:this.$route.query.courseName,
|
||||
pageNum:this.$route.query.pageNum
|
||||
},
|
||||
})
|
||||
},
|
||||
questionSave() {
|
||||
|
@ -150,7 +157,7 @@ export default {
|
|||
courseId: this.$route.query.id,
|
||||
isactive: this.isactive,
|
||||
id: this.questionId,
|
||||
opt: 'add'
|
||||
opt: 'add',
|
||||
},
|
||||
})
|
||||
},
|
||||
|
@ -162,7 +169,7 @@ export default {
|
|||
id: record,
|
||||
isactive: this.isactive,
|
||||
questionType: this.questionDetail.questionType,
|
||||
courseId: this.$route.query.id
|
||||
courseId: this.$route.query.id,
|
||||
},
|
||||
})
|
||||
},
|
||||
|
@ -176,36 +183,38 @@ export default {
|
|||
|
||||
//批量导入
|
||||
questionBatch() {
|
||||
this.$refs.inputFile.click();
|
||||
this.$refs.inputFile.click()
|
||||
},
|
||||
questionBatchImport(){
|
||||
if(!this.$refs.inputFile.value || this.$refs.inputFile.value === '') return;
|
||||
const data = new FormData();
|
||||
data.append('file', this.$refs.inputFile.files[0]);
|
||||
data.append('sourceId', 'questionImport');
|
||||
data.append('fileType', 'excel');
|
||||
questionBatchImport() {
|
||||
if (!this.$refs.inputFile.value || this.$refs.inputFile.value === '') return
|
||||
const data = new FormData()
|
||||
data.append('file', this.$refs.inputFile.files[0])
|
||||
data.append('sourceId', 'questionImport')
|
||||
data.append('fileType', 'excel')
|
||||
|
||||
const header = {};
|
||||
header['Content-Type'] = 'multipart/form-data';
|
||||
header[ACCESS_TOKEN] = storage.get(ACCESS_TOKEN);
|
||||
|
||||
axios.post(ossUpload(), data, { headers: header }).then(res => {
|
||||
if(res.data.code === 200){
|
||||
let params = { fileUrl: res.data.url, courseId: this.$route.query.id }
|
||||
importTemplate(params).then(res1 => {
|
||||
this.$refs.inputFile.value = '';
|
||||
this.$message.success('题目导入成功!');
|
||||
this.getQuestion()
|
||||
});
|
||||
}else{
|
||||
this.$message.error(res.data.msg);
|
||||
this.$refs.inputFile.value = '';
|
||||
}
|
||||
}).catch(err => {
|
||||
this.$message.error(res);
|
||||
this.$refs.inputFile.value = '';
|
||||
});
|
||||
const header = {}
|
||||
header['Content-Type'] = 'multipart/form-data'
|
||||
header[ACCESS_TOKEN] = storage.get(ACCESS_TOKEN)
|
||||
|
||||
axios
|
||||
.post(ossUpload(), data, { headers: header })
|
||||
.then((res) => {
|
||||
if (res.data.code === 200) {
|
||||
let params = { fileUrl: res.data.url, courseId: this.$route.query.id }
|
||||
importTemplate(params).then((res1) => {
|
||||
this.$refs.inputFile.value = ''
|
||||
this.$message.success('题目导入成功!')
|
||||
this.getQuestion()
|
||||
})
|
||||
} else {
|
||||
this.$message.error(res.data.msg)
|
||||
this.$refs.inputFile.value = ''
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
this.$message.error(res)
|
||||
this.$refs.inputFile.value = ''
|
||||
})
|
||||
},
|
||||
|
||||
// 下载模板
|
||||
|
|
Loading…
Reference in New Issue