题目新增、编辑下标显示问题,课程列表显示课程类别
This commit is contained in:
parent
ef74dfef4a
commit
9aef31c7cb
|
@ -3,7 +3,7 @@
|
|||
<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="课程类别" 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.learningContent }} </a-descriptions-item>
|
||||
<a-descriptions-item label="试题数量"> {{ detailData.questionCount }} </a-descriptions-item>
|
||||
|
@ -13,6 +13,11 @@
|
|||
<img :src="detailData.coverPath">
|
||||
</div>
|
||||
</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>
|
||||
<div class="buttonGroup">
|
||||
<a-button type="primary" @click="close"> 返回 </a-button>
|
||||
|
@ -32,17 +37,20 @@ export default {
|
|||
detailData: {
|
||||
coverPath: [],
|
||||
},
|
||||
dictCourseType:[]
|
||||
dictCourseType: [],
|
||||
dictCourseTag: [],
|
||||
tags:[] //用于存放标签
|
||||
}
|
||||
},
|
||||
created: function () {
|
||||
let parameter = {}
|
||||
getCourseDetails(Object.assign(parameter, this.queryParam)).then((res) => {
|
||||
this.detailData = res.data
|
||||
console.log(this.detailData)
|
||||
})
|
||||
|
||||
//调用词典
|
||||
this.dictionaryDropDown();
|
||||
this.dictionaryDropDown()
|
||||
this.getTagName();
|
||||
},
|
||||
methods: {
|
||||
close() {
|
||||
|
@ -54,11 +62,34 @@ export default {
|
|||
|
||||
//获取数据字典
|
||||
dictionaryDropDown() {
|
||||
this.formLoading = true
|
||||
// 课程类别
|
||||
dictionaryDropDown({ dictionaryCode: '0006' }).then((res) => {
|
||||
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: [
|
||||
{ title: '课程编号', width: '160px', align: 'center', dataIndex: 'courseCode', key: 'courseCode' },
|
||||
{ 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: 'questionCount', key: 'questionCount' },
|
||||
{ title: '操作', key: 'operation', width: '300px', align: 'center', scopedSlots: { customRender: 'action' } },
|
||||
|
@ -73,6 +73,7 @@ export default {
|
|||
|
||||
//课程类别
|
||||
dictionaryDropDown({ dictionaryCode: '0006' }).then((res) => {
|
||||
console.log('课程类别----',res)
|
||||
this.queryOptions[1].options = dictToTree(res.data, [], 0);
|
||||
})
|
||||
|
||||
|
|
|
@ -162,12 +162,14 @@
|
|||
|
||||
<script>
|
||||
import { questionAdd, getQuestionDeatil } from '@/api/course/question/question'
|
||||
|
||||
import { getQuestionListByCourseId } from '@/api/course/course'
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
checkedValues:[],
|
||||
isactive:this.$route.query.isactive,
|
||||
quesitonList: [],
|
||||
checkedValues: [],
|
||||
radio: {},
|
||||
multiselect: {},
|
||||
estimate: {},
|
||||
|
@ -192,9 +194,9 @@ export default {
|
|||
this.radio.disabled = false
|
||||
} else if (this.tabKey == '2') {
|
||||
this.multiselect = res.data
|
||||
console.log('c---------------s------------',this.multiselect)
|
||||
if(this.multiselect.rightAnswers) this.checkedValues = this.multiselect.rightAnswers.split('')
|
||||
console.log('arr',this.checkedValues)
|
||||
console.log('c---------------s------------', this.multiselect)
|
||||
if (this.multiselect.rightAnswers) this.checkedValues = this.multiselect.rightAnswers.split('')
|
||||
console.log('arr', this.checkedValues)
|
||||
this.multiselect.disabled = false
|
||||
} else if (this.tabKey == '3') {
|
||||
this.estimate = res.data
|
||||
|
@ -217,7 +219,8 @@ export default {
|
|||
query: {
|
||||
id: this.$route.query.courseId,
|
||||
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
|
||||
|
||||
questionAdd(from).then((res) => {
|
||||
if (res.code == 200) {
|
||||
this.$message.success('新增题目成功!')
|
||||
// this.getQuestion()
|
||||
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() {
|
||||
//验证题目是否为空
|
||||
|
@ -314,8 +331,8 @@ export default {
|
|||
|
||||
//多选题选中
|
||||
onChange(checkedValues) {
|
||||
console.log('checked = ', checkedValues);
|
||||
this.checkedValues = checkedValues;
|
||||
console.log('checked = ', checkedValues)
|
||||
this.checkedValues = checkedValues
|
||||
},
|
||||
|
||||
// 验证多选题
|
||||
|
@ -352,17 +369,16 @@ export default {
|
|||
from.questionType = 2
|
||||
from.rightAnswers = ''
|
||||
|
||||
|
||||
console.log('this.checkedValues',this.checkedValues)
|
||||
console.log('this.checkedValues', this.checkedValues)
|
||||
|
||||
if (this.checkedValues.length < 1 || this.checkedValues.length == 0) {
|
||||
this.$message.error('请选择正确答案!')
|
||||
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
|
||||
},
|
||||
|
@ -414,7 +430,6 @@ export default {
|
|||
from.questionType = 5
|
||||
return from
|
||||
},
|
||||
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -6,13 +6,7 @@
|
|||
<div class="questionLeft">
|
||||
<h1 class="questionNumber">题序</h1>
|
||||
<!-- 题目序号 -->
|
||||
<div
|
||||
v-for="(item, index) in quesitonList"
|
||||
:key="item"
|
||||
class="questionLeftItem"
|
||||
@click="quesionId(item, index)"
|
||||
:class="{ active_color: index == isactive }"
|
||||
>
|
||||
<div v-for="(item, index) in quesitonList" :key="item" class="questionLeftItem" @click="quesionId(item, index)" :class="{ active_color: index == isactive }">
|
||||
{{ index + 1 }}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -20,27 +14,11 @@
|
|||
<div class="questionDetail">
|
||||
<br />
|
||||
<div>
|
||||
<a-button
|
||||
type="primary"
|
||||
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 type="primary" 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
|
||||
type="primary"
|
||||
class="create-button"
|
||||
style="font-size: 15px; margin: 0px 10px 10px 0px"
|
||||
@click="showModal"
|
||||
>
|
||||
<a-button type="primary" class="create-button" style="font-size: 15px; margin: 0px 10px 10px 0px" @click="showModal">
|
||||
模板下载
|
||||
</a-button>
|
||||
<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-modal>
|
||||
</div>
|
||||
<b><h1 class="questionContent">课程题目库预览</h1></b>
|
||||
<b>
|
||||
<h1 class="questionContent">课程题目库预览</h1>
|
||||
</b>
|
||||
<a-divider :style="{ backgroundColor: '#000' }" />
|
||||
<div class="question">
|
||||
<h1 class="questionName" v-if="quesitonList != null && quesitonList.length != 0">
|
||||
|
@ -111,6 +91,7 @@ export default {
|
|||
questionDetail: {},
|
||||
isactive: 1,
|
||||
visible: false,
|
||||
add:'add',
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -124,7 +105,20 @@ export default {
|
|||
this.quesitonList = res.data
|
||||
|
||||
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: {
|
||||
courseId: this.$route.query.id,
|
||||
isactive: this.isactive,
|
||||
id: this.questionId,
|
||||
opt: 'add',
|
||||
// id: this.questionId,
|
||||
opt: this.add,
|
||||
},
|
||||
})
|
||||
},
|
||||
|
@ -185,10 +179,10 @@ export default {
|
|||
deleteQuestion({ id: id }).then((res) => {
|
||||
if (res.code == 200) {
|
||||
this.getQuestion()
|
||||
this.$message.success('删除成功!');
|
||||
}else{
|
||||
this.getQuestion();
|
||||
this.$message.error('后台报错了~');
|
||||
this.$message.success('删除成功!')
|
||||
} else {
|
||||
this.getQuestion()
|
||||
this.$message.error('后台报错了~')
|
||||
}
|
||||
})
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue