课程数据字典及题目批量新增和删除
This commit is contained in:
parent
d0e56e7b99
commit
c85f134c9d
|
@ -2,13 +2,16 @@
|
|||
<a-card :bordered="false" title="系統新增">
|
||||
<a-form-model :model="form">
|
||||
<div style="width: 100%; height: 40px; margin-bottom: 8px; margin-left: 80%">
|
||||
<a-button type="primary" @click="goback">返回</a-button>
|
||||
<a-button type="primary" @click="goback">返回</a-button>
|
||||
</div>
|
||||
<a-row>
|
||||
<!-- 课程名称 -->
|
||||
<a-col :span="18" :offset="3">
|
||||
<a-form-model-item label="课程名称" :label-col="{ span: 4 }" :wrapper-col="{ span: 15 }">
|
||||
<a-input v-model="form.courseName" v-decorator="['courseName', { rules: [{ required: true, message: '请填写课程名称' }] }]" />
|
||||
<a-input
|
||||
v-model="form.courseName"
|
||||
v-decorator="['courseName', { rules: [{ required: true, message: '请填写课程名称' }] }]"
|
||||
/>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
|
||||
|
@ -16,8 +19,7 @@
|
|||
<a-col :span="9" :offset="3">
|
||||
<a-form-model-item label="课程类别" :label-col="{ span: 8 }" :wrapper-col="{ span: 12 }">
|
||||
<a-select v-model="form.courseType" placeholder="--请选择--">
|
||||
<a-select-option value="1"> 商业 </a-select-option>
|
||||
<a-select-option value="2"> 政务 </a-select-option>
|
||||
<a-select-option v-for="(item,index) in dictCourseType" :key="index" :value="item.value"> {{item.name}} </a-select-option>
|
||||
</a-select>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
|
@ -25,7 +27,14 @@
|
|||
<!-- 课件大小 -->
|
||||
<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%' }" />
|
||||
<a-input-number
|
||||
id="hour"
|
||||
v-model="dataValue"
|
||||
:min="1"
|
||||
:max="1000"
|
||||
@change="onChange"
|
||||
:style="{ display: 'ln', width: '100%' }"
|
||||
/>
|
||||
{{ dataValue }}分钟
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
@ -41,8 +50,7 @@
|
|||
<a-col :span="9" :offset="3">
|
||||
<a-form-model-item label="所属行业" :label-col="{ span: 8 }" :wrapper-col="{ span: 12 }">
|
||||
<a-select v-model="form.industryInvolved" placeholder="--请选择--">
|
||||
<a-select-option value="1"> 医疗 </a-select-option>
|
||||
<a-select-option value="0"> 建筑 </a-select-option>
|
||||
<a-select-option v-for="(item,index) in industry" :key="index" :value="item.value"> {{item.name}} </a-select-option>
|
||||
</a-select>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
|
@ -61,7 +69,7 @@
|
|||
<a-col :span="9" :offset="3">
|
||||
<a-form-model-item label="选择岗位" :label-col="{ span: 8 }" :wrapper-col="{ span: 12 }">
|
||||
<a-select v-model="form.job" placeholder="--请选择--">
|
||||
<a-select-option v-for="item in personType" :key="item.id"> {{ item.name }} </a-select-option>
|
||||
<a-select-option v-for="(item,index) in dictPerson" :key="index" :value="item.value"> {{ item.name }} </a-select-option>
|
||||
</a-select>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
|
@ -76,7 +84,14 @@
|
|||
<!-- 上传封面图片 -->
|
||||
<a-col :span="18" :offset="3">
|
||||
<a-form-model-item label="上传封面图片" :label-col="{ span: 4 }" :wrapper-col="{ span: 15 }">
|
||||
<a-upload action="/dawa/sys/oss/upload?sourceId=course" list-type="picture-card" :file-list="fileList" :headers="getToken()" @change="handleChange" @preview="handlePreview">
|
||||
<a-upload
|
||||
action="/dawa/sys/oss/upload?sourceId=course"
|
||||
list-type="picture-card"
|
||||
:file-list="fileList"
|
||||
:headers="getToken()"
|
||||
@change="handleChange"
|
||||
@preview="handlePreview"
|
||||
>
|
||||
<div v-if="fileList.length < 1">
|
||||
<a-icon type="plus" />
|
||||
<div class="ant-upload-text">上传</div>
|
||||
|
@ -96,9 +111,9 @@
|
|||
</a-form-model-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<div style="width: 100%; height: 40px; margin-bottom: 8px; margin-left: 50%">
|
||||
<a-button type="primary" @click="save">保存</a-button>
|
||||
</div>
|
||||
<div style="width: 100%; height: 40px; margin-bottom: 8px; margin-left: 50%">
|
||||
<a-button type="primary" @click="save">保存</a-button>
|
||||
</div>
|
||||
</a-form-model>
|
||||
</a-card>
|
||||
</template>
|
||||
|
@ -109,6 +124,7 @@
|
|||
import { courseAdd, getCourseDetails } from '@/api/course/course'
|
||||
import storage from 'store'
|
||||
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
||||
import { dictionaryDropDown } from '@/api/sys/dictionaryItem'
|
||||
|
||||
export default {
|
||||
name: 'step1',
|
||||
|
@ -116,38 +132,37 @@ export default {
|
|||
return {
|
||||
dataValue: 1,
|
||||
form: {
|
||||
coverPath:'',
|
||||
coverPath: '',
|
||||
},
|
||||
personType: [
|
||||
{ id: '1', name: '人员类别1' },
|
||||
{ id: '2', name: '人员类别2' },
|
||||
{ id: '3', name: '人员类别3' },
|
||||
],
|
||||
url:'',
|
||||
url: '',
|
||||
previewVisible: false,
|
||||
fileList: [],
|
||||
previewImage :[
|
||||
|
||||
]
|
||||
|
||||
previewImage: [],
|
||||
dictPerson:[],
|
||||
dictCourseType:[],
|
||||
industry:[]
|
||||
}
|
||||
},
|
||||
components: {
|
||||
courseAdd,
|
||||
getCourseDetails
|
||||
getCourseDetails,
|
||||
},
|
||||
created() {
|
||||
if (this.$route.query.id) {
|
||||
getCourseDetails({ id: this.$route.query.id }).then(res => {
|
||||
this.form = res.data;
|
||||
getCourseDetails({ id: this.$route.query.id }).then((res) => {
|
||||
this.form = res.data
|
||||
|
||||
this.form.courseType = this.form.courseType + '';
|
||||
this.form.industryInvolved = this.form.industryInvolved + '';
|
||||
this.form.isRequired = this.form.isRequired + '';
|
||||
|
||||
});
|
||||
// this.form.courseType = this.form.courseType + ''
|
||||
// this.form.industryInvolved = this.form.industryInvolved + ''
|
||||
this.form.isRequired = this.form.isRequired + ''
|
||||
// this.form.is
|
||||
this.dictEcho();
|
||||
})
|
||||
}
|
||||
|
||||
this.dictionaryDropDown()
|
||||
},
|
||||
|
||||
methods: {
|
||||
// getPersonType() {
|
||||
// return dictGet(Object.assign(parameter)).then((res) => {
|
||||
|
@ -170,60 +185,75 @@ export default {
|
|||
})
|
||||
},
|
||||
|
||||
dictionaryDropDown () {
|
||||
this.formLoading = true
|
||||
// 行业
|
||||
dictionaryDropDown({ dictionaryCode: '0007' }).then((res) => {
|
||||
this.industry = res.data
|
||||
this.formLoading = false
|
||||
})
|
||||
// 课程类别
|
||||
dictionaryDropDown({ dictionaryCode: '0006' }).then((res) => {
|
||||
this.dictCourseType = res.data
|
||||
this.formLoading = false
|
||||
})
|
||||
// 人员类型
|
||||
dictionaryDropDown({ dictionaryCode: '0005' }).then((res) => {
|
||||
this.dictPerson = res.data
|
||||
this.formLoading = false
|
||||
})
|
||||
},
|
||||
|
||||
// 编辑回显字典项
|
||||
dictEcho(){
|
||||
console.log("form___",this.form)
|
||||
},
|
||||
|
||||
|
||||
|
||||
//返回
|
||||
goback(){
|
||||
this.$router.push({path:"/course/CourseList",query:{
|
||||
courseName:this.$route.query.courseName
|
||||
} })
|
||||
goback() {
|
||||
this.$router.push({
|
||||
path: '/course/CourseList',
|
||||
query: {
|
||||
courseName: this.$route.query.courseName,
|
||||
},
|
||||
})
|
||||
},
|
||||
|
||||
getToken() {
|
||||
let hreader = {};
|
||||
hreader[ACCESS_TOKEN] = storage.get(ACCESS_TOKEN);
|
||||
return hreader;
|
||||
let hreader = {}
|
||||
hreader[ACCESS_TOKEN] = storage.get(ACCESS_TOKEN)
|
||||
return hreader
|
||||
},
|
||||
onSuccess(file) {
|
||||
console.log('1---', file);
|
||||
|
||||
console.log('1---', file)
|
||||
},
|
||||
handleCancel() {
|
||||
this.previewVisible = false;
|
||||
this.previewVisible = false
|
||||
},
|
||||
async handlePreview(file) {
|
||||
if (!file.url && !file.preview) {
|
||||
file.preview = await getBase64(file.originFileObj);
|
||||
file.preview = await getBase64(file.originFileObj)
|
||||
}
|
||||
this.previewImage = file.url || file.preview;
|
||||
this.previewVisible = true;
|
||||
this.previewImage = file.url || file.preview
|
||||
this.previewVisible = true
|
||||
},
|
||||
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)
|
||||
|
||||
|
||||
this.fileList = fileList
|
||||
this.fileList.file = fileList[0]
|
||||
this.form.coverPath = this.fileList.file.response.url
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
// 图片预览Base64
|
||||
function getBase64(file) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const reader = new FileReader();
|
||||
reader.readAsDataURL(file);
|
||||
reader.onload = () => resolve(reader.result);
|
||||
reader.onerror = error => reject(error);
|
||||
});
|
||||
const reader = new FileReader()
|
||||
reader.readAsDataURL(file)
|
||||
reader.onload = () => resolve(reader.result)
|
||||
reader.onerror = (error) => reject(error)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
|
|
@ -1,45 +1,69 @@
|
|||
<template>
|
||||
<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>
|
||||
<a-descriptions-item label="课时"> {{ detailData.hour }} </a-descriptions-item>
|
||||
<a-descriptions-item label="试题数量"> {{ detailData.questionCount }} </a-descriptions-item>
|
||||
<a-descriptions-item label="学习内容"> {{ detailData.learningContent }} </a-descriptions-item>
|
||||
<a-descriptions-item label="备注"> {{ detailData.remark }} </a-descriptions-item>
|
||||
</a-descriptions>
|
||||
<div class="buttonGroup">
|
||||
<a-button type="primary" @click="close"> 返回 </a-button>
|
||||
<a-button type="primary" @click="edit"> 编辑 </a-button>
|
||||
</div>
|
||||
</a-card>
|
||||
<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="课程类别" v-for="(item,index) in dictCourseType" :key="index" :value="item.value"> {{ item.name }} </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>
|
||||
<a-descriptions-item label="备注"> {{ detailData.remark }} </a-descriptions-item>
|
||||
<a-descriptions-item label="课程封面图">
|
||||
<viewer :images="detailData.coverPath">
|
||||
<img :src="detailData.coverPath" />
|
||||
</viewer>
|
||||
<!-- <div>
|
||||
<img :src="detailData.coverPath" v-image-preview width="100" height="100">
|
||||
</div> -->
|
||||
</a-descriptions-item>
|
||||
</a-descriptions>
|
||||
<div class="buttonGroup">
|
||||
<a-button type="primary" @click="close"> 返回 </a-button>
|
||||
<a-button type="primary" @click="edit"> 编辑 </a-button>
|
||||
</div>
|
||||
</a-card>
|
||||
</template>
|
||||
<script>
|
||||
import { getCourseDetails } from '@/api/course/course'
|
||||
|
||||
import { dictionaryDropDown } from '@/api/sys/dictionaryItem'
|
||||
export default {
|
||||
name: 'details',
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
queryParam: { id: this.$route.query.id },
|
||||
detailData: {}
|
||||
detailData: {
|
||||
coverPath: [],
|
||||
},
|
||||
dictCourseType:[]
|
||||
}
|
||||
},
|
||||
created: function() {
|
||||
let parameter = {};
|
||||
getCourseDetails(Object.assign(parameter, this.queryParam)).then(res => { this.detailData = res.data });
|
||||
created: function () {
|
||||
let parameter = {}
|
||||
getCourseDetails(Object.assign(parameter, this.queryParam)).then((res) => {
|
||||
this.detailData = res.data
|
||||
})
|
||||
|
||||
//调用词典
|
||||
this.dictionaryDropDown();
|
||||
},
|
||||
methods: {
|
||||
close () {
|
||||
this.$router.push({ path: '/course/CourseList', query: { } });
|
||||
close() {
|
||||
this.$router.push({ path: '/course/CourseList', query: {} })
|
||||
},
|
||||
edit(record) {
|
||||
this.$router.push({ path : '/course/CourseAdd', query:{ id: this.queryParam.id }});
|
||||
}
|
||||
},
|
||||
this.$router.push({ path: '/course/CourseAdd', query: { id: this.queryParam.id } })
|
||||
},
|
||||
|
||||
//获取数据字典
|
||||
dictionaryDropDown() {
|
||||
// 课程类别
|
||||
dictionaryDropDown({ dictionaryCode: '0006' }).then((res) => {
|
||||
this.dictCourseType = res.data
|
||||
this.formLoading = false
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
|
@ -48,7 +72,7 @@ export default {
|
|||
width: 100px;
|
||||
text-align: center;
|
||||
}
|
||||
.buttonGroup{
|
||||
.buttonGroup {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
text-align: center;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<template>
|
||||
<!-- <page-header-wrapper> -->
|
||||
<a-card :bordered="false" title="题库管理">
|
||||
<template slot="extra">
|
||||
<a-button size="small" @click="questionColse">返回</a-button>
|
||||
|
@ -20,33 +19,39 @@
|
|||
|
||||
<div class="questionDetail">
|
||||
<br />
|
||||
<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="questionBatchDownload"
|
||||
>
|
||||
模板下载
|
||||
</a-button>
|
||||
<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>
|
||||
<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' } }">
|
||||
<a-button type="primary" class="create-button" style="font-size: 15px; margin:-15px 50px 3px 50px" @click="questionBatchDownloadDemo">示例模板</a-button>
|
||||
<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>
|
||||
<a-divider :style="{ backgroundColor: '#000' }" />
|
||||
<div class="question">
|
||||
<h1 class="questionName" v-if="quesitonList != null && quesitonList.length !=0">
|
||||
<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)">
|
||||
|
@ -74,7 +79,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="info_parent" v-if="quesitonList != null && quesitonList.length !=0">
|
||||
<div class="info_parent" v-if="quesitonList != null && quesitonList.length != 0">
|
||||
<div class="info">解析</div>
|
||||
<div class="info_main">
|
||||
{{ questionDetail.asnwerParse }}
|
||||
|
@ -86,7 +91,6 @@
|
|||
|
||||
<input ref="inputFile" type="file" style="display: none" @change="questionBatchImport" />
|
||||
</a-card>
|
||||
<!-- </page-header-wrapper> -->
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
@ -104,6 +108,7 @@ export default {
|
|||
quesitonList: [],
|
||||
questionDetail: {},
|
||||
isactive: 1,
|
||||
visible: false,
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -123,8 +128,9 @@ export default {
|
|||
|
||||
//题目ID查看题目
|
||||
quesionId: function (i, index) {
|
||||
if (this.quesitonList != null && this.quesitonList.length != 0) {//ID不为空则执行下面
|
||||
console.log("题目!!!!",this.quesitonList.length)
|
||||
if (this.quesitonList != null && this.quesitonList.length != 0) {
|
||||
//ID不为空则执行下面
|
||||
console.log('题目!!!!', this.quesitonList.length)
|
||||
this.isactive = index
|
||||
this.questionId = i
|
||||
|
||||
|
@ -145,8 +151,8 @@ export default {
|
|||
this.$router.push({
|
||||
path: '/course/CourseList',
|
||||
query: {
|
||||
courseName:this.$route.query.courseName,
|
||||
pageNum:this.$route.query.pageNum
|
||||
courseName: this.$route.query.courseName,
|
||||
pageNum: this.$route.query.pageNum,
|
||||
},
|
||||
})
|
||||
},
|
||||
|
@ -217,10 +223,22 @@ export default {
|
|||
})
|
||||
},
|
||||
|
||||
showModal() {
|
||||
this.visible = true
|
||||
},
|
||||
handleOk(e) {
|
||||
console.log(e)
|
||||
this.visible = false
|
||||
},
|
||||
|
||||
// 下载模板
|
||||
questionBatchDownload() {
|
||||
window.location.href = '/dawa/sys/oss/show/20211108/2420f1de94174bb8a0fb1a2f1e9e1742.xlsx'
|
||||
},
|
||||
//下载示例模板
|
||||
questionBatchDownloadDemo() {
|
||||
window.location.href = '/dawa/sys/oss/show/20211114/d82abc89cfba4e18b3f4bc0f9dfa6b96.xlsx'
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue