题目新增、编辑下标显示问题,课程列表显示课程类别
This commit is contained in:
parent
ef74dfef4a
commit
9aef31c7cb
|
@ -3,7 +3,7 @@
|
||||||
<a-descriptions layout="horizontal" bordered size="small" :column="1">
|
<a-descriptions 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="课程类别" v-for="(item,index) in dictCourseType" :key="index" :value="item.value"> {{ item.name }} </a-descriptions-item>
|
<a-descriptions-item label="课程类别"> {{detailData.courseTypeName}} </a-descriptions-item>
|
||||||
<a-descriptions-item label="课时"> {{ detailData.hour }} </a-descriptions-item>
|
<a-descriptions-item label="课时"> {{ detailData.hour }} </a-descriptions-item>
|
||||||
<a-descriptions-item label="学习内容"> {{ detailData.learningContent }} </a-descriptions-item>
|
<a-descriptions-item label="学习内容"> {{ detailData.learningContent }} </a-descriptions-item>
|
||||||
<a-descriptions-item label="试题数量"> {{ detailData.questionCount }} </a-descriptions-item>
|
<a-descriptions-item label="试题数量"> {{ detailData.questionCount }} </a-descriptions-item>
|
||||||
|
@ -13,6 +13,11 @@
|
||||||
<img :src="detailData.coverPath">
|
<img :src="detailData.coverPath">
|
||||||
</div>
|
</div>
|
||||||
</a-descriptions-item>
|
</a-descriptions-item>
|
||||||
|
<a-descriptions-item label="标签">
|
||||||
|
<a-tag color="blue" v-for="(item,index) in detailData.tags" :key="index ">
|
||||||
|
{{item}}
|
||||||
|
</a-tag>
|
||||||
|
</a-descriptions-item>
|
||||||
</a-descriptions>
|
</a-descriptions>
|
||||||
<div class="buttonGroup">
|
<div class="buttonGroup">
|
||||||
<a-button type="primary" @click="close"> 返回 </a-button>
|
<a-button type="primary" @click="close"> 返回 </a-button>
|
||||||
|
@ -32,17 +37,20 @@ export default {
|
||||||
detailData: {
|
detailData: {
|
||||||
coverPath: [],
|
coverPath: [],
|
||||||
},
|
},
|
||||||
dictCourseType:[]
|
dictCourseType: [],
|
||||||
|
dictCourseTag: [],
|
||||||
|
tags:[] //用于存放标签
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created: function () {
|
created: function () {
|
||||||
let parameter = {}
|
let parameter = {}
|
||||||
getCourseDetails(Object.assign(parameter, this.queryParam)).then((res) => {
|
getCourseDetails(Object.assign(parameter, this.queryParam)).then((res) => {
|
||||||
this.detailData = res.data
|
this.detailData = res.data
|
||||||
|
console.log(this.detailData)
|
||||||
})
|
})
|
||||||
|
|
||||||
//调用词典
|
//调用词典
|
||||||
this.dictionaryDropDown();
|
this.dictionaryDropDown()
|
||||||
|
this.getTagName();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
close() {
|
close() {
|
||||||
|
@ -54,11 +62,34 @@ export default {
|
||||||
|
|
||||||
//获取数据字典
|
//获取数据字典
|
||||||
dictionaryDropDown() {
|
dictionaryDropDown() {
|
||||||
this.formLoading = true
|
|
||||||
// 课程类别
|
// 课程类别
|
||||||
dictionaryDropDown({ dictionaryCode: '0006' }).then((res) => {
|
dictionaryDropDown({ dictionaryCode: '0006' }).then((res) => {
|
||||||
this.dictCourseType = res.data
|
this.dictCourseType = res.data
|
||||||
this.formLoading = false
|
|
||||||
|
//课程类别的value转换成字典name
|
||||||
|
for (let i = 0; i < this.dictCourseType.length; i++) {
|
||||||
|
if (this.dictCourseType[i].value == this.detailData.courseType) {
|
||||||
|
this.detailData.courseTypeName = this.dictCourseType[i].name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getTagName() {
|
||||||
|
dictionaryDropDown({ dictionaryCode: '0008' }).then((res) => {
|
||||||
|
this.dictCourseTag = res.data
|
||||||
|
|
||||||
|
console.log(this.dictCourseTag);
|
||||||
|
|
||||||
|
let tags = [];
|
||||||
|
for (let i = 0; i < this.dictCourseTag.length; i++) {
|
||||||
|
for (let j = 0; j < this.detailData.courseTags.length; j++) {
|
||||||
|
if(this.dictCourseTag[i].value == this.detailData.courseTags[j].dictValue){
|
||||||
|
tags.push(this.dictCourseTag[i].name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log('tagagagaga',tags);
|
||||||
|
this.detailData.tags = tags;
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -56,7 +56,7 @@ export default {
|
||||||
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: 'auto', align: 'center', dataIndex: 'courseType', key: 'courseType' },
|
{ title: '课程类别', width: 'auto', align: 'center', dataIndex: 'courseTypeName', key: 'courseTypeName' },
|
||||||
{ 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' } },
|
||||||
|
@ -73,6 +73,7 @@ export default {
|
||||||
|
|
||||||
//课程类别
|
//课程类别
|
||||||
dictionaryDropDown({ dictionaryCode: '0006' }).then((res) => {
|
dictionaryDropDown({ dictionaryCode: '0006' }).then((res) => {
|
||||||
|
console.log('课程类别----',res)
|
||||||
this.queryOptions[1].options = dictToTree(res.data, [], 0);
|
this.queryOptions[1].options = dictToTree(res.data, [], 0);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -162,12 +162,14 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { questionAdd, getQuestionDeatil } from '@/api/course/question/question'
|
import { questionAdd, getQuestionDeatil } from '@/api/course/question/question'
|
||||||
|
import { getQuestionListByCourseId } from '@/api/course/course'
|
||||||
export default {
|
export default {
|
||||||
components: {},
|
components: {},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
checkedValues:[],
|
isactive:this.$route.query.isactive,
|
||||||
|
quesitonList: [],
|
||||||
|
checkedValues: [],
|
||||||
radio: {},
|
radio: {},
|
||||||
multiselect: {},
|
multiselect: {},
|
||||||
estimate: {},
|
estimate: {},
|
||||||
|
@ -192,9 +194,9 @@ export default {
|
||||||
this.radio.disabled = false
|
this.radio.disabled = false
|
||||||
} else if (this.tabKey == '2') {
|
} else if (this.tabKey == '2') {
|
||||||
this.multiselect = res.data
|
this.multiselect = res.data
|
||||||
console.log('c---------------s------------',this.multiselect)
|
console.log('c---------------s------------', this.multiselect)
|
||||||
if(this.multiselect.rightAnswers) this.checkedValues = this.multiselect.rightAnswers.split('')
|
if (this.multiselect.rightAnswers) this.checkedValues = this.multiselect.rightAnswers.split('')
|
||||||
console.log('arr',this.checkedValues)
|
console.log('arr', this.checkedValues)
|
||||||
this.multiselect.disabled = false
|
this.multiselect.disabled = false
|
||||||
} else if (this.tabKey == '3') {
|
} else if (this.tabKey == '3') {
|
||||||
this.estimate = res.data
|
this.estimate = res.data
|
||||||
|
@ -217,7 +219,8 @@ export default {
|
||||||
query: {
|
query: {
|
||||||
id: this.$route.query.courseId,
|
id: this.$route.query.courseId,
|
||||||
questionId: this.$route.query.id,
|
questionId: this.$route.query.id,
|
||||||
isactive: this.$route.query.isactive,
|
isactive: this.isactive,
|
||||||
|
opt: this.$route.query.opt
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -271,11 +274,25 @@ export default {
|
||||||
from.courseId = this.$route.query.courseId
|
from.courseId = this.$route.query.courseId
|
||||||
|
|
||||||
questionAdd(from).then((res) => {
|
questionAdd(from).then((res) => {
|
||||||
|
if (res.code == 200) {
|
||||||
this.$message.success('新增题目成功!')
|
this.$message.success('新增题目成功!')
|
||||||
|
// this.getQuestion()
|
||||||
this.close()
|
this.close()
|
||||||
|
} else {
|
||||||
|
this.$message.error('新增题目成功!')
|
||||||
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
//设置返回下标
|
||||||
|
// getQuestion() {
|
||||||
|
// getQuestionListByCourseId({ id: this.$route.query.courseId }).then((res) => {
|
||||||
|
// if (!this.$route.query.id) {
|
||||||
|
// this.isactive = res.data.length - 1
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// },
|
||||||
|
|
||||||
//验证是否为空单选题
|
//验证是否为空单选题
|
||||||
radioV() {
|
radioV() {
|
||||||
//验证题目是否为空
|
//验证题目是否为空
|
||||||
|
@ -314,8 +331,8 @@ export default {
|
||||||
|
|
||||||
//多选题选中
|
//多选题选中
|
||||||
onChange(checkedValues) {
|
onChange(checkedValues) {
|
||||||
console.log('checked = ', checkedValues);
|
console.log('checked = ', checkedValues)
|
||||||
this.checkedValues = checkedValues;
|
this.checkedValues = checkedValues
|
||||||
},
|
},
|
||||||
|
|
||||||
// 验证多选题
|
// 验证多选题
|
||||||
|
@ -352,17 +369,16 @@ export default {
|
||||||
from.questionType = 2
|
from.questionType = 2
|
||||||
from.rightAnswers = ''
|
from.rightAnswers = ''
|
||||||
|
|
||||||
|
console.log('this.checkedValues', this.checkedValues)
|
||||||
console.log('this.checkedValues',this.checkedValues)
|
|
||||||
|
|
||||||
if (this.checkedValues.length < 1 || this.checkedValues.length == 0) {
|
if (this.checkedValues.length < 1 || this.checkedValues.length == 0) {
|
||||||
this.$message.error('请选择正确答案!')
|
this.$message.error('请选择正确答案!')
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
for(let i = 0 ; i<this.checkedValues.length; i++) from.rightAnswers =from.rightAnswers+this.checkedValues[i];
|
for (let i = 0; i < this.checkedValues.length; i++) from.rightAnswers = from.rightAnswers + this.checkedValues[i]
|
||||||
|
|
||||||
console.log("rightAnswers",from.rightAnswers);
|
console.log('rightAnswers', from.rightAnswers)
|
||||||
|
|
||||||
return from
|
return from
|
||||||
},
|
},
|
||||||
|
@ -414,7 +430,6 @@ export default {
|
||||||
from.questionType = 5
|
from.questionType = 5
|
||||||
return from
|
return from
|
||||||
},
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -6,13 +6,7 @@
|
||||||
<div class="questionLeft">
|
<div class="questionLeft">
|
||||||
<h1 class="questionNumber">题序</h1>
|
<h1 class="questionNumber">题序</h1>
|
||||||
<!-- 题目序号 -->
|
<!-- 题目序号 -->
|
||||||
<div
|
<div v-for="(item, index) in quesitonList" :key="item" class="questionLeftItem" @click="quesionId(item, index)" :class="{ active_color: index == isactive }">
|
||||||
v-for="(item, index) in quesitonList"
|
|
||||||
:key="item"
|
|
||||||
class="questionLeftItem"
|
|
||||||
@click="quesionId(item, index)"
|
|
||||||
:class="{ active_color: index == isactive }"
|
|
||||||
>
|
|
||||||
{{ index + 1 }}
|
{{ index + 1 }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -20,27 +14,11 @@
|
||||||
<div class="questionDetail">
|
<div class="questionDetail">
|
||||||
<br />
|
<br />
|
||||||
<div>
|
<div>
|
||||||
<a-button
|
<a-button type="primary" class="create-button" style="font-size: 15px; margin: 0px 10px 10px 0px" @click="questionSave">新增题目</a-button>
|
||||||
type="primary"
|
<a-button type="primary" class="create-button" style="font-size: 15px; margin: 0px 10px 10px 0px" @click="questionBatch">
|
||||||
class="create-button"
|
|
||||||
style="font-size: 15px; margin: 0px 10px 10px 0px"
|
|
||||||
@click="questionSave"
|
|
||||||
>新增题目</a-button
|
|
||||||
>
|
|
||||||
<a-button
|
|
||||||
type="primary"
|
|
||||||
class="create-button"
|
|
||||||
style="font-size: 15px; margin: 0px 10px 10px 0px"
|
|
||||||
@click="questionBatch"
|
|
||||||
>
|
|
||||||
批量导入
|
批量导入
|
||||||
</a-button>
|
</a-button>
|
||||||
<a-button
|
<a-button type="primary" class="create-button" style="font-size: 15px; margin: 0px 10px 10px 0px" @click="showModal">
|
||||||
type="primary"
|
|
||||||
class="create-button"
|
|
||||||
style="font-size: 15px; margin: 0px 10px 10px 0px"
|
|
||||||
@click="showModal"
|
|
||||||
>
|
|
||||||
模板下载
|
模板下载
|
||||||
</a-button>
|
</a-button>
|
||||||
<a-modal v-model="visible" title="模板下载" cancelText="关闭" :ok-button-props="{ style: { display: 'none' } }">
|
<a-modal v-model="visible" title="模板下载" cancelText="关闭" :ok-button-props="{ style: { display: 'none' } }">
|
||||||
|
@ -48,7 +26,9 @@
|
||||||
<a-button type="primary" class="create-button" style="font-size: 15px; margin:-15px 30px 3px 70px" @click="questionBatchDownload">纯净模板</a-button>
|
<a-button type="primary" class="create-button" style="font-size: 15px; margin:-15px 30px 3px 70px" @click="questionBatchDownload">纯净模板</a-button>
|
||||||
</a-modal>
|
</a-modal>
|
||||||
</div>
|
</div>
|
||||||
<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" v-if="quesitonList != null && quesitonList.length != 0">
|
<h1 class="questionName" v-if="quesitonList != null && quesitonList.length != 0">
|
||||||
|
@ -111,6 +91,7 @@ export default {
|
||||||
questionDetail: {},
|
questionDetail: {},
|
||||||
isactive: 1,
|
isactive: 1,
|
||||||
visible: false,
|
visible: false,
|
||||||
|
add:'add',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -124,7 +105,20 @@ export default {
|
||||||
this.quesitonList = res.data
|
this.quesitonList = res.data
|
||||||
|
|
||||||
if (!res.data) return
|
if (!res.data) return
|
||||||
this.quesionId(this.$route.query.questionId || this.quesitonList[0], this.$route.query.isactive || 0)
|
|
||||||
|
let questionId = 0, index = 0;
|
||||||
|
if(this.$route.query.questionId){
|
||||||
|
questionId = this.$route.query.questionId
|
||||||
|
index = this.$route.query.isactive;
|
||||||
|
} else if(this.$route.query.opt){
|
||||||
|
questionId = this.quesitonList[this.quesitonList.length-1];
|
||||||
|
index = this.quesitonList.length-1;
|
||||||
|
} else{
|
||||||
|
questionId = this.quesitonList[0];
|
||||||
|
index = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.quesionId(questionId, index)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -163,8 +157,8 @@ export default {
|
||||||
query: {
|
query: {
|
||||||
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: this.add,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -185,10 +179,10 @@ export default {
|
||||||
deleteQuestion({ id: id }).then((res) => {
|
deleteQuestion({ id: id }).then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
this.getQuestion()
|
this.getQuestion()
|
||||||
this.$message.success('删除成功!');
|
this.$message.success('删除成功!')
|
||||||
}else{
|
} else {
|
||||||
this.getQuestion();
|
this.getQuestion()
|
||||||
this.$message.error('后台报错了~');
|
this.$message.error('后台报错了~')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue