题库细节优化

This commit is contained in:
18571350067 2021-11-09 19:08:12 +08:00
parent b45eddb9ee
commit 8228dd9b0f
6 changed files with 156 additions and 112 deletions

View File

@ -115,13 +115,15 @@ export default {
data() { data() {
return { return {
dataValue: 1, dataValue: 1,
form: {}, form: {
coverPath:'',
},
personType: [ personType: [
{ id: '1', name: '人员类别1' }, { id: '1', name: '人员类别1' },
{ id: '2', name: '人员类别2' }, { id: '2', name: '人员类别2' },
{ id: '3', name: '人员类别3' }, { id: '3', name: '人员类别3' },
], ],
url:'',
previewVisible: false, previewVisible: false,
fileList: [], fileList: [],
previewImage :[ previewImage :[
@ -147,7 +149,6 @@ export default {
} }
}, },
methods: { methods: {
//
// getPersonType() { // getPersonType() {
// return dictGet(Object.assign(parameter)).then((res) => { // return dictGet(Object.assign(parameter)).then((res) => {
// return res // return res
@ -171,7 +172,9 @@ export default {
// //
goback(){ goback(){
this.$router.push({path:"/course/CourseList",query:{} }) this.$router.push({path:"/course/CourseList",query:{
courseName:this.$route.query.courseName
} })
}, },
getToken() { getToken() {
@ -195,6 +198,17 @@ export default {
}, },
handleChange({ fileList }) { handleChange({ fileList }) {
this.fileList = 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)
}, },
}, },

View File

@ -1,87 +1,109 @@
<template> <template>
<a-card :bordered="false" title="课程列表"> <a-card :bordered="false" title="课程列表">
<div class="table-page-search-wrapper"> <div class="table-page-search-wrapper">
<SearchCom :form="queryParam" :list="queryOptions" @search="handleRefresh" @reset="() => {queryParam = {}, handleRefresh()}" ></SearchCom> <SearchCom
<div style="width: 100%; height: 32px; margin-bottom: 8px;"> :form="queryParam"
<a-button type="primary" @click="courseAdd">新建课程</a-button> :list="queryOptions"
</div> @search="handleRefresh"
@reset="
() => {
;(queryParam = {}), handleRefresh()
}
"
></SearchCom>
<div style="width: 100%; height: 32px; margin-bottom: 8px">
<a-button type="primary" @click="courseAdd">新建课程</a-button>
</div> </div>
<s-table ref="table" size="default" rowKey="id" :columns="columns" :data="loadData" :pageNum="Number(this.$route.query.PageNum) || 1"> </div>
<template slot="action" slot-scope="text, record"> <s-table
<a href="javascript:;" @click="detail(record)">详情</a> ref="table"
<a-divider type="vertical" /> size="default"
<a href="javascript:;" @click="courseWare(record)">课件</a> rowKey="id"
<a-divider type="vertical" /> :columns="columns"
<a href="javascript:;" @click="courseWare(record)">课件预览</a> :data="loadData"
<a-divider type="vertical" /> :pageNum="Number(this.$route.query.PageNum) || 1"
<a-popconfirm title="是否删除?" @confirm="() => del(record)"> >
<a href="javascript:;">删除</a> <template slot="action" slot-scope="text, record">
</a-popconfirm> <a href="javascript:;" @click="detail(record)">详情</a>
<a-divider type="vertical" /> <a-divider type="vertical" />
<a href="javascript:;" @click="courseQuestion(record)">题库</a> <a href="javascript:;" @click="courseWare(record)">课件</a>
</template> <a-divider type="vertical" />
</s-table> <a href="javascript:;" @click="courseWare(record)">课件预览</a>
</a-card> <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> </template>
<script> <script>
import { STable, SearchCom } from '@/components' import { STable, SearchCom } from '@/components'
import { getCourseList,deleteCourse } from '@/api/course/course' import { getCourseList, deleteCourse } from '@/api/course/course'
export default { export default {
components: { components: {
STable, SearchCom STable,
SearchCom,
}, },
data() { data() {
return { return {
queryParam: { courseName : this.$route.query.courseName || ''},//, orgId: this.$route.query.courseUserOrgId || '' queryParam: { courseName: this.$route.query.courseName || '' }, //, orgId: this.$route.query.courseUserOrgId || ''
queryOptions: [ queryOptions: [{ type: 'input', placeholder: '课程名称', key: 'courseName' }],
{ type: 'input', placeholder: '课程名称', key: 'courseName' }, loadData: (parameter) => {
], return getCourseList(Object.assign(parameter, this.queryParam)).then((res) => {
loadData: parameter => { return res
return getCourseList(Object.assign(parameter, this.queryParam)).then(res => { return res }); })
}, },
columns: [ columns: [
{ title: '课程编号', width: '160px', align: 'center', dataIndex: 'courseCode', key: 'courseCode' }, { title: '课程编号', width: '160px', align: 'center', dataIndex: 'courseCode', key: 'courseCode' },
{ title: '课程名称', width: 'auto', align: 'center', dataIndex: 'courseName', key: 'courseName' }, { title: '课程名称', width: 'auto', align: 'center', dataIndex: 'courseName', key: 'courseName' },
{ title: '课时/分', width: '160px', align: 'center', dataIndex: 'hour', key: 'hour' }, { title: '课时/分', width: '160px', align: 'center', dataIndex: 'hour', key: 'hour' },
{ title: '数量', width: '160px', align: 'center', dataIndex: 'questionCount', key: 'questionCount' }, { 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: { methods: {
handleRefresh () { handleRefresh() {
this.$refs.table.refresh(true) this.$refs.table.refresh(true)
}, },
detail(record){ detail(record) {
this.$router.push({ path: '/course/CourseDetail', query: { id: record.id } }); this.$router.push({ path: '/course/CourseDetail', query: { id: record.id } })
}, },
courseWare(record){ courseWare(record) {
this.$router.push({ path: '/course/CoursewareList', query: { id: record.id } }); this.$router.push({ path: '/course/CoursewareList', query: { id: record.id } })
}, },
del(record){ del(record) {
deleteCourse({ids:record.id}).then(res => { deleteCourse({ ids: record.id }).then((res) => {
if(res.code == 200) this.$refs.table.refresh(true); if (res.code == 200) this.$refs.table.refresh(true)
}); })
}, },
// //
courseAdd(){ courseAdd() {
this.$router.push({ path : '/course/CourseAdd' , query : {}}) this.$router.push({
path: '/course/CourseAdd',
query: {
courseName: this.queryParam.courseName
},
})
}, },
// //
courseQuestion(record){ courseQuestion(record) {
this.$router.push({ this.$router.push({
path: '/course/question/QuestionList', query :{ path: '/course/question/QuestionList',
id: record.id, query: {
courseName : this.queryParam.courseName, id: record.id,
// courseUserOrgId : this.queryParam.orgId, courseName: this.queryParam.courseName,
PageNum : this.$refs.table.localPagination.current pageNum: this.$refs.table.pageNum
}}); },
})
}, },
}, },
} }

View File

@ -1,5 +1,5 @@
<template> <template>
<a-card :bordered="false" title="项目档案"> <a-card :bordered="false" title="课件信息">
<template slot="extra"> <template slot="extra">
<a-button size="small" @click="goback">返回</a-button> <a-button size="small" @click="goback">返回</a-button>
</template> </template>

View File

@ -1,7 +1,6 @@
<template> <template>
<page-header-wrapper :title="false"> <a-card :bordered="false" title="课程详情">
<a-card :bordered="false"> <a-descriptions layout="horizontal" bordered size="small" :column="1">
<a-descriptions title="课程详情" layout="horizontal" bordered size="small" :column="1">
<a-descriptions-item label="课程编号"> {{ detailData.courseCode }} </a-descriptions-item> <a-descriptions-item label="课程编号"> {{ detailData.courseCode }} </a-descriptions-item>
<a-descriptions-item label="课程名称"> {{ detailData.courseName }} </a-descriptions-item> <a-descriptions-item label="课程名称"> {{ detailData.courseName }} </a-descriptions-item>
<a-descriptions-item label="课程类别"> {{ detailData.courseType }} </a-descriptions-item> <a-descriptions-item label="课程类别"> {{ detailData.courseType }} </a-descriptions-item>
@ -15,7 +14,6 @@
<a-button type="primary" @click="edit"> 编辑 </a-button> <a-button type="primary" @click="edit"> 编辑 </a-button>
</div> </div>
</a-card> </a-card>
</page-header-wrapper>
</template> </template>
<script> <script>
import { getCourseDetails } from '@/api/course/course' import { getCourseDetails } from '@/api/course/course'

View File

@ -92,8 +92,8 @@
<a-card :bordered="false"> <a-card :bordered="false">
<template slot="title"> <template slot="title">
选项从选项中选择一个作为答案<br /> 选项从选项中选择一个作为答案<br />
<a-radio :value="1"> 正确 </a-radio> <a-radio value="1"> 正确 </a-radio>
<a-radio :value="2"> 错误 </a-radio> <a-radio value="2"> 错误 </a-radio>
</template> </template>
</a-card> </a-card>
<a-card title="答案解析" :bordered="false"> <a-card title="答案解析" :bordered="false">
@ -161,6 +161,8 @@ export default {
}, },
created() { created() {
//
if (this.$route.query.id && !this.$route.query.opt) { if (this.$route.query.id && !this.$route.query.opt) {
this.radio.disabled = true; this.radio.disabled = true;
@ -250,7 +252,6 @@ export default {
console.log('5---', this.Completion) console.log('5---', this.Completion)
} }
console.log('a--')
from.courseId = this.$route.query.courseId from.courseId = this.$route.query.courseId
questionAdd(from).then((res) => { questionAdd(from).then((res) => {

View File

@ -46,7 +46,7 @@
<b><h1 class="questionContent">课程题目库预览</h1></b> <b><h1 class="questionContent">课程题目库预览</h1></b>
<a-divider :style="{ backgroundColor: '#000' }" /> <a-divider :style="{ backgroundColor: '#000' }" />
<div class="question"> <div class="question">
<h1 class="questionName"> <h1 class="questionName" v-if="quesitonList != null && quesitonList.length !=0">
{{ questionDetail.questionTypeName }}{{ questionDetail.questionName }} {{ questionDetail.questionTypeName }}{{ questionDetail.questionName }}
<span class="edit" @click="edit(questionDetail.id)">编辑</span> <span class="edit" @click="edit(questionDetail.id)">编辑</span>
<a-popconfirm title="确定要删除此题?" ok-text="确定" cancel-text="取消" @confirm="del(questionDetail.id)"> <a-popconfirm title="确定要删除此题?" ok-text="确定" cancel-text="取消" @confirm="del(questionDetail.id)">
@ -69,10 +69,12 @@
<!-- 显示填空题 --> <!-- 显示填空题 -->
<div v-if="questionDetail.questionType == 5"> <div v-if="questionDetail.questionType == 5">
<div class="answer" v-for="(item,ind) in questionDetail.answerList" :key="ind">正确答案{{ ind+1 }}:&nbsp;&nbsp;&nbsp;&nbsp;{{ item }}</div> <div class="answer" v-for="(item, ind) in questionDetail.answerList" :key="ind">
正确答案{{ ind + 1 }}:&nbsp;&nbsp;&nbsp;&nbsp;{{ item }}
</div>
</div> </div>
<div class="info_parent"> <div class="info_parent" v-if="quesitonList != null && quesitonList.length !=0">
<div class="info">解析</div> <div class="info">解析</div>
<div class="info_main"> <div class="info_main">
{{ questionDetail.asnwerParse }} {{ questionDetail.asnwerParse }}
@ -82,7 +84,7 @@
</div> </div>
</div> </div>
<input ref="inputFile" type="file" style="display: none;" @change="questionBatchImport"> <input ref="inputFile" type="file" style="display: none" @change="questionBatchImport" />
</a-card> </a-card>
<!-- </page-header-wrapper> --> <!-- </page-header-wrapper> -->
</template> </template>
@ -115,32 +117,37 @@ export default {
this.quesitonList = res.data this.quesitonList = res.data
if (!res.data) return 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 //ID
quesionId: function (i, index) { quesionId: function (i, index) {
this.isactive = index; if (this.quesitonList != null && this.quesitonList.length != 0) {//ID
this.questionId = i; console.log("题目!!!!",this.quesitonList.length)
this.isactive = index
getQuestionDeatil({ id: i }).then((res) => { this.questionId = i
this.questionDetail = res.data
// getQuestionDeatil({ id: i }).then((res) => {
if (this.questionDetail.questionType == '1') this.questionDetail.questionTypeName = '单选题' this.questionDetail = res.data
if (this.questionDetail.questionType == '2') this.questionDetail.questionTypeName = '多选题' //
if (this.questionDetail.questionType == '3') this.questionDetail.questionTypeName = '判断题' if (this.questionDetail.questionType == '1') this.questionDetail.questionTypeName = '单选题'
if (this.questionDetail.questionType == '4') this.questionDetail.questionTypeName = '简答题' if (this.questionDetail.questionType == '2') this.questionDetail.questionTypeName = '多选题'
if (this.questionDetail.questionType == '5') 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() { questionColse() {
this.$router.push({ this.$router.push({
path: '/course/CourseList', path: '/course/CourseList',
query: {}, query: {
courseName:this.$route.query.courseName,
pageNum:this.$route.query.pageNum
},
}) })
}, },
questionSave() { questionSave() {
@ -150,7 +157,7 @@ export default {
courseId: this.$route.query.id, courseId: this.$route.query.id,
isactive: this.isactive, isactive: this.isactive,
id: this.questionId, id: this.questionId,
opt: 'add' opt: 'add',
}, },
}) })
}, },
@ -162,7 +169,7 @@ export default {
id: record, id: record,
isactive: this.isactive, isactive: this.isactive,
questionType: this.questionDetail.questionType, questionType: this.questionDetail.questionType,
courseId: this.$route.query.id courseId: this.$route.query.id,
}, },
}) })
}, },
@ -176,36 +183,38 @@ export default {
// //
questionBatch() { questionBatch() {
this.$refs.inputFile.click(); this.$refs.inputFile.click()
}, },
questionBatchImport(){ questionBatchImport() {
if(!this.$refs.inputFile.value || this.$refs.inputFile.value === '') return; if (!this.$refs.inputFile.value || this.$refs.inputFile.value === '') return
const data = new FormData(); const data = new FormData()
data.append('file', this.$refs.inputFile.files[0]); data.append('file', this.$refs.inputFile.files[0])
data.append('sourceId', 'questionImport'); data.append('sourceId', 'questionImport')
data.append('fileType', 'excel'); data.append('fileType', 'excel')
const header = {}; const header = {}
header['Content-Type'] = 'multipart/form-data'; header['Content-Type'] = 'multipart/form-data'
header[ACCESS_TOKEN] = storage.get(ACCESS_TOKEN); 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 = '';
});
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 = ''
})
}, },
// //