题目列表页面优化,课件页面标题显示、题目新增页面标题显示、课程新增预留课时
This commit is contained in:
parent
bc386d6c32
commit
390cf5720f
|
@ -26,7 +26,7 @@
|
|||
</a-form-model-item>
|
||||
</a-col>
|
||||
|
||||
<!-- 课件大小 -->
|
||||
<!-- 课时 -->
|
||||
<a-col :span="9">
|
||||
<a-form-item label="课时" :label-col="{ span: 4 }" :wrapper-col="{ span: 10 }">
|
||||
<a-input-number id="hour" v-model="dataValue" :min="1" :max="1000" @change="onChange" :style="{ display: 'ln', width: '100%' }" />
|
||||
|
@ -165,6 +165,7 @@ export default {
|
|||
},
|
||||
|
||||
save() {
|
||||
this.form.hour = this.dataValue;
|
||||
this.form.coverPath = JSON.stringify(this.fileList)
|
||||
courseAdd(this.form).then((res) => {
|
||||
if (res.code == 200) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<a-card :bordered="false" title="添加课件">
|
||||
<a-card :bordered="false" :title="pageName">
|
||||
<template slot="extra">
|
||||
<a-button @click="goback">返回</a-button>
|
||||
<a-button type="primary" @click="save">保存</a-button>
|
||||
|
@ -217,6 +217,7 @@ import { dictionaryDropDown } from '@/api/sys/dictionaryItem'
|
|||
export default {
|
||||
data() {
|
||||
return {
|
||||
pageName: this.$route.query.coursewareId ? '课件编辑' : '课件新增',
|
||||
// treeData: [],
|
||||
ifResources : this.$route.query.ifResources,
|
||||
coursewareClassfiy: [],
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<a-card :bordered="false" title="新增习题">
|
||||
<a-card :bordered="false" :title="pageName">
|
||||
<template slot="extra">
|
||||
<a-button size="small" @click="close">返回</a-button>
|
||||
<a-button size="small" type="primary" @click="queding">确定</a-button>
|
||||
|
@ -167,6 +167,7 @@ export default {
|
|||
components: {},
|
||||
data() {
|
||||
return {
|
||||
pageName : this.$route.query.id ? "习题编辑" : "题目新增",
|
||||
isactive:this.$route.query.isactive,
|
||||
quesitonList: [],
|
||||
checkedValues: [],
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
<div class="questionLeft">
|
||||
<h1 class="questionNumber">题序</h1>
|
||||
<!-- 题目序号 -->
|
||||
<div v-if="quesitonList.length == 0" style="height:300px">
|
||||
<a-empty description="暂无题目" />
|
||||
</div>
|
||||
<div v-for="(item, index) in quesitonList" :key="item" class="questionLeftItem" @click="quesionId(item, index)" :class="{ active_color: index == isactive }">
|
||||
{{ index + 1 }}
|
||||
</div>
|
||||
|
@ -31,6 +34,9 @@
|
|||
</b>
|
||||
<a-divider :style="{ backgroundColor: '#000' }" />
|
||||
<div class="question">
|
||||
<div v-if="quesitonList.length == 0" style="height:200px">
|
||||
<a-empty description="暂无题目" />
|
||||
</div>
|
||||
<h1 class="questionName" v-if="quesitonList != null && quesitonList.length != 0">
|
||||
({{ questionDetail.questionTypeName }}){{ questionDetail.questionName }}
|
||||
<span v-if="!courseId" class="edit" @click="edit(questionDetail.id)">编辑</span>
|
||||
|
@ -76,45 +82,46 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { getQuestionListByCourseId } from '@/api/course/course'
|
||||
import { getQuestionDeatil, deleteQuestion, importTemplate } from '@/api/course/question/question'
|
||||
import { ossUpload } from '@/api/sys/oss'
|
||||
import { getQuestionListByCourseId } from '@/api/course/course';
|
||||
import { getQuestionDeatil, deleteQuestion, importTemplate } from '@/api/course/question/question';
|
||||
import { ossUpload } from '@/api/sys/oss';
|
||||
|
||||
import axios from 'axios'
|
||||
import storage from 'store'
|
||||
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
||||
import axios from 'axios';
|
||||
import storage from 'store';
|
||||
import { ACCESS_TOKEN } from '@/store/mutation-types';
|
||||
|
||||
export default {
|
||||
props: {
|
||||
courseId: {
|
||||
type: String,
|
||||
}
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
title:"题库管理",
|
||||
title: '题库管理',
|
||||
quesitonList: [],
|
||||
questionDetail: {},
|
||||
isactive: 1,
|
||||
visible: false,
|
||||
add: 'add',
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
created: function () {
|
||||
this.getQuestion()
|
||||
this.getQuestion();
|
||||
},
|
||||
methods: {
|
||||
getQuestion() {
|
||||
// 查询所有题目id列表
|
||||
getQuestionListByCourseId({ id: this.$route.query.id || this.courseId }).then((res) => {
|
||||
this.quesitonList = res.data
|
||||
getQuestionListByCourseId({ id: this.$route.query.id || this.courseId }).then(res => {
|
||||
this.quesitonList = res.data;
|
||||
|
||||
if (!res.data) return
|
||||
if (!res.data) return;
|
||||
|
||||
let questionId = 0, index = 0;
|
||||
let questionId = 0,
|
||||
index = 0;
|
||||
if (this.$route.query.questionId) {
|
||||
questionId = 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];
|
||||
|
@ -124,33 +131,40 @@ export default {
|
|||
index = 0;
|
||||
}
|
||||
|
||||
this.quesionId(questionId, index)
|
||||
})
|
||||
this.quesionId(questionId, index);
|
||||
});
|
||||
},
|
||||
|
||||
//题目ID查看题目
|
||||
quesionId: function (i, index) {
|
||||
if (this.quesitonList != null && this.quesitonList.length != 0) {
|
||||
//ID不为空则执行下面
|
||||
this.isactive = index
|
||||
this.questionId = i
|
||||
this.isactive = index;
|
||||
this.questionId = i;
|
||||
|
||||
getQuestionDeatil({ id: i }).then((res) => {
|
||||
this.questionDetail = res.data
|
||||
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 = '填空题'
|
||||
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 = '填空题';
|
||||
|
||||
if (this.questionDetail.questionType == 3 && this.questionDetail.rightAnswers == 1) {
|
||||
this.questionDetail.rightAnswers = '正确'
|
||||
} else {
|
||||
this.questionDetail.rightAnswers = '错误'
|
||||
this.questionDetail.rightAnswers = '正确';
|
||||
} else if (
|
||||
this.questionDetail.questionType == 3 &&
|
||||
this.questionDetail.rightAnswers == 0
|
||||
) {
|
||||
this.questionDetail.rightAnswers = '错误';
|
||||
}
|
||||
|
||||
})
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -162,7 +176,7 @@ export default {
|
|||
courseName: this.$route.query.courseName,
|
||||
pageNum: this.$route.query.pageNum,
|
||||
},
|
||||
})
|
||||
});
|
||||
},
|
||||
questionSave() {
|
||||
this.$router.push({
|
||||
|
@ -174,7 +188,7 @@ export default {
|
|||
opt: this.add,
|
||||
types: this.$route.query.type,
|
||||
},
|
||||
})
|
||||
});
|
||||
},
|
||||
edit(record) {
|
||||
this.$router.push({
|
||||
|
@ -186,74 +200,74 @@ export default {
|
|||
courseId: this.$route.query.id,
|
||||
types: this.$route.query.type,
|
||||
},
|
||||
})
|
||||
});
|
||||
},
|
||||
|
||||
//删除
|
||||
del(id) {
|
||||
deleteQuestion({ id: id }).then((res) => {
|
||||
deleteQuestion({ id: id }).then(res => {
|
||||
if (res.code == 200) {
|
||||
this.getQuestion()
|
||||
this.$message.success('删除成功!')
|
||||
this.getQuestion();
|
||||
this.$message.success('删除成功!');
|
||||
} else {
|
||||
this.getQuestion()
|
||||
this.$message.error('后台报错了~')
|
||||
this.getQuestion();
|
||||
this.$message.error('后台报错了~');
|
||||
}
|
||||
})
|
||||
});
|
||||
},
|
||||
|
||||
//批量导入
|
||||
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')
|
||||
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)
|
||||
const header = {};
|
||||
header['Content-Type'] = 'multipart/form-data';
|
||||
header[ACCESS_TOKEN] = storage.get(ACCESS_TOKEN);
|
||||
|
||||
axios
|
||||
.post(ossUpload(), data, { headers: header })
|
||||
.then((res) => {
|
||||
this.$refs.inputFile.value = ''
|
||||
.then(res => {
|
||||
this.$refs.inputFile.value = '';
|
||||
if (res.data.code === 200) {
|
||||
let params = { fileUrl: res.data.url, courseId: this.$route.query.id }
|
||||
importTemplate(params).then((res1) => {
|
||||
this.$message.success('题目导入成功!')
|
||||
this.getQuestion()
|
||||
})
|
||||
let params = { fileUrl: res.data.url, courseId: this.$route.query.id };
|
||||
importTemplate(params).then(res1 => {
|
||||
this.$message.success('题目导入成功!');
|
||||
this.getQuestion();
|
||||
});
|
||||
} else {
|
||||
this.$message.error(res.data.msg)
|
||||
this.$message.error(res.data.msg);
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
this.$refs.inputFile.value = ''
|
||||
this.$message.error(res)
|
||||
})
|
||||
.catch(err => {
|
||||
this.$refs.inputFile.value = '';
|
||||
this.$message.error(res);
|
||||
});
|
||||
},
|
||||
|
||||
showModal() {
|
||||
this.visible = true
|
||||
this.visible = true;
|
||||
},
|
||||
handleOk(e) {
|
||||
this.visible = false
|
||||
this.visible = false;
|
||||
},
|
||||
|
||||
// 下载模板
|
||||
questionBatchDownload() {
|
||||
window.location.href = '/dawa/sys/oss/show?id=1'
|
||||
window.location.href = '/dawa/sys/oss/show?id=1';
|
||||
},
|
||||
//下载示例模板
|
||||
questionBatchDownloadDemo() {
|
||||
window.location.href = '/dawa/sys/oss/show?id=2'
|
||||
window.location.href = '/dawa/sys/oss/show?id=2';
|
||||
},
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
|
Loading…
Reference in New Issue