Merge branch 'develop' of https://gitee.com/siwa-team/dawa-vue into develop
This commit is contained in:
commit
5c3c8179c5
|
@ -0,0 +1,64 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
const api = {
|
||||
list: '/sys/dictionary/item/list',
|
||||
findMaxValue: '/sys/dictionary/item/findMaxValue',
|
||||
get: '/sys/dictionary/item/get',
|
||||
add: '/sys/dictionary/item/add',
|
||||
del: '/sys/dictionary/item/del',
|
||||
edit: '/sys/dictionary/item/edit'
|
||||
}
|
||||
|
||||
// 证书类型 列表
|
||||
export function getCertificateTypeList(params) {
|
||||
return request({
|
||||
url: api.list,
|
||||
method: 'get',
|
||||
params: params
|
||||
})
|
||||
}
|
||||
|
||||
// 查询最大词典项值 列表
|
||||
export function getCertificateTypeMaxValue(params) {
|
||||
return request({
|
||||
url: api.findMaxValue,
|
||||
method: 'get',
|
||||
params: params
|
||||
})
|
||||
}
|
||||
|
||||
// 根据ID查询证书类型 列表
|
||||
export function getCertificateType(params) {
|
||||
return request({
|
||||
url: api.get,
|
||||
method: 'post',
|
||||
params: params
|
||||
})
|
||||
}
|
||||
|
||||
// 证书类型 新增
|
||||
export function addCertificateType(params) {
|
||||
return request({
|
||||
url: api.add,
|
||||
method: 'post',
|
||||
data: params
|
||||
})
|
||||
}
|
||||
|
||||
// 证书类型 删除
|
||||
export function delCertificateType(params) {
|
||||
return request({
|
||||
url: api.del,
|
||||
method: 'post',
|
||||
params: params
|
||||
})
|
||||
}
|
||||
|
||||
// 证书类型 修改
|
||||
export function editCertificateType(params) {
|
||||
return request({
|
||||
url: api.edit,
|
||||
method: 'post',
|
||||
data: params
|
||||
})
|
||||
}
|
|
@ -4,11 +4,12 @@ const questionApi = {
|
|||
add: 'courseManagement/question/addOrUpdate',
|
||||
get: '/courseManagement/question/details',
|
||||
// update: 'sys/menu/update',
|
||||
del: 'courseManagement/course/delete',
|
||||
del: 'courseManagement/question/delete',
|
||||
// updateStatus: 'sys/menu/updateStatus',
|
||||
// list: '/courseManagement/course/listPage',
|
||||
// coursewareList:'/courseManagement/course/courseware/details',
|
||||
// questionList:'/courseManagement/course/questionList'
|
||||
// questionList:'/courseManagement/course/questionList',
|
||||
importTemplate: "courseManagement/question/importTemplate"
|
||||
|
||||
}
|
||||
|
||||
|
@ -54,5 +55,13 @@ export function getQuestionDeatil (params) {
|
|||
})
|
||||
}
|
||||
|
||||
// 题目批量导入
|
||||
export function importTemplate (params) {
|
||||
return request({
|
||||
url: questionApi.importTemplate,
|
||||
method: 'post',
|
||||
params: params
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
const ossApi = {
|
||||
list: '/sys/oss/list'
|
||||
list: '/sys/oss/list',
|
||||
upload: '/sys/oss/upload'
|
||||
}
|
||||
|
||||
export function ossList (params) {
|
||||
|
@ -11,3 +12,7 @@ export function ossList (params) {
|
|||
params: params
|
||||
})
|
||||
}
|
||||
|
||||
export function ossUpload () {
|
||||
return process.env.VUE_APP_API_BASE_URL + ossApi.upload;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,155 @@
|
|||
<template>
|
||||
<a-card :bordered="false" title="证书类型">
|
||||
<template slot="extra">
|
||||
<a-button size="small" @click="close">返回</a-button>
|
||||
</template>
|
||||
|
||||
<div class="table-page-search-wrapper">
|
||||
<div style="width: 100%; height: 32px; margin-bottom: 8px;">
|
||||
<a-button type="primary" @click="addCertificateType()">新增证书类型</a-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<s-table ref="table" size="small" rowKey="id" :columns="columns" :data="loadData" :showPagination="false">
|
||||
<template slot="action" slot-scope="text, record">
|
||||
<a href="javascript:;" @click="edit(record)">编辑</a>
|
||||
|
||||
<a-popconfirm title="确定要删除该证书类型?" ok-text="确认" cancel-text="取消" @confirm="del(record)">
|
||||
<a href="javascript:;">删除</a>
|
||||
</a-popconfirm>
|
||||
</template>
|
||||
</s-table>
|
||||
|
||||
<a-modal v-model="isAdd" :width="700" title="新增证书类型" ok-text="确认" cancel-text="取消" @ok="addCertificateTypeQR">
|
||||
<a-form-model :model="addForm" :label-col="{span: 5}" :wrapper-col="{span: 19}">
|
||||
<a-form-model-item label="证书类型名称" :rules="{ required: true, message: '请输入证书类型名称!' }">
|
||||
<a-input v-model="addForm.name" />
|
||||
</a-form-model-item>
|
||||
</a-form-model>
|
||||
</a-modal>
|
||||
</a-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { STable } from '@/components'
|
||||
import { getCertificateTypeList, getCertificateType, getCertificateTypeMaxValue, addCertificateType, delCertificateType, editCertificateType } from '@/api/archives/certificate'
|
||||
|
||||
export default {
|
||||
// import引入的组件需要注入到对象中才能使用
|
||||
components: { STable },
|
||||
props: {},
|
||||
data() {
|
||||
// 这里存放数据
|
||||
return {
|
||||
isAdd: false,
|
||||
addForm: {
|
||||
name: ''
|
||||
},
|
||||
editForm: {},
|
||||
queryParam: { dictionaryCode: '0001' },
|
||||
columns: [
|
||||
{ title: '证书类型', width: 'auto', align: 'center', dataIndex: 'name', key: 'name' },
|
||||
{ title: '操作', width: '170px', key: 'operation', align: 'center', scopedSlots: { customRender: 'action' } }
|
||||
],
|
||||
loadData: parameter => { return getCertificateTypeList(Object.assign(parameter, this.queryParam)).then((res) => { return res.data; }); },
|
||||
};
|
||||
},
|
||||
// 计算属性 类似于data概念
|
||||
computed: {},
|
||||
// 监控data中的数据变化
|
||||
watch: {},
|
||||
// 方法集合
|
||||
methods: {
|
||||
// 返回 按钮
|
||||
close() {
|
||||
this.$router.push({
|
||||
path: '/archives/certificate/Index', query: {
|
||||
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 新增证书类型
|
||||
addCertificateType() {
|
||||
this.addForm.name = "";
|
||||
this.isAdd = true;
|
||||
},
|
||||
addCertificateTypeQR() {
|
||||
if (!this.addForm.name || this.addForm.name === '') {
|
||||
this.$message.error("请输入证书类型名称!");
|
||||
return;
|
||||
}
|
||||
|
||||
// 如果修改form内有值 则走修改
|
||||
if (this.editForm.id) {
|
||||
if (this.editForm.name === this.addForm.name) {
|
||||
this.$message.success("证书类型名称与之前一致,不需要发起修改");
|
||||
this.isAdd = false;
|
||||
return;
|
||||
}
|
||||
|
||||
this.editForm.name = this.addForm.name;
|
||||
editCertificateType(this.editForm).then(res => {
|
||||
this.$message.success("修改成功!");
|
||||
this.editForm = {};
|
||||
this.isAdd = false;
|
||||
this.$refs.table.refresh(true);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
let certificateType = {};
|
||||
certificateType.dictionaryCode = '0001';
|
||||
certificateType.name = this.addForm.name;
|
||||
certificateType.parentid = 0;
|
||||
|
||||
// 先获取该词典项下最大value
|
||||
getCertificateTypeMaxValue(certificateType).then(res => {
|
||||
certificateType.value = res.data;
|
||||
|
||||
// 再发起新增
|
||||
addCertificateType(certificateType).then(res => {
|
||||
this.$message.success("新增成功!");
|
||||
this.isAdd = false;
|
||||
this.$refs.table.refresh(true);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
// 编辑词典项
|
||||
edit(record) {
|
||||
getCertificateType({ id: record.id }).then(res => {
|
||||
this.isAdd = true;
|
||||
this.addForm.name = res.data.name;
|
||||
this.editForm = res.data;
|
||||
});
|
||||
},
|
||||
|
||||
// 删除证书类型
|
||||
del(record) {
|
||||
delCertificateType({ ids: record.id, deleteReason: '' }).then(res => { this.$refs.table.refresh(true); });
|
||||
}
|
||||
},
|
||||
// 生命周期 - 创建完成(可以访问当前this实例)
|
||||
created() { },
|
||||
// 生命周期 - 挂载完成(可以访问DOM元素)
|
||||
mounted() { },
|
||||
// 生命周期 - 创建之前
|
||||
beforeCreate() { },
|
||||
// 生命周期 - 挂载之前
|
||||
beforeMount() { },
|
||||
// 生命周期 - 更新之前
|
||||
beforeUpdate() { },
|
||||
// 生命周期 - 更新之后
|
||||
updated() { },
|
||||
// 生命周期 - 销毁之前
|
||||
beforeDestroy() { },
|
||||
// 生命周期 - 销毁完成
|
||||
destroyed() { },
|
||||
// 如果页面有keep-alive缓存功能,这个函数会触发
|
||||
activated() { }
|
||||
};
|
||||
|
||||
</script>
|
||||
<style scoped>
|
||||
</style>
|
|
@ -0,0 +1,81 @@
|
|||
<template>
|
||||
<a-card :bordered="false" title="证书档案">
|
||||
<div class="table-page-search-wrapper">
|
||||
<SearchCom :form="queryParam" :list="queryOptions" @search="handleRefresh" @reset="() => {queryParam = {}, handleRefresh()}"></SearchCom>
|
||||
<div style="width: 100%; height: 32px; margin-bottom: 8px;">
|
||||
<a-button type="primary" @click="editCertificateType()">编辑证书类型</a-button>
|
||||
</div>
|
||||
</div>
|
||||
</a-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { STable, SearchCom } from '@/components'
|
||||
import { getCertificateTypeList } from '@/api/archives/certificate'
|
||||
|
||||
export default {
|
||||
// import引入的组件需要注入到对象中才能使用
|
||||
components: { STable, SearchCom },
|
||||
props: {},
|
||||
data() {
|
||||
// 这里存放数据
|
||||
return {
|
||||
queryParam: { orgId: '', name: '', type: '' },
|
||||
type: []
|
||||
};
|
||||
},
|
||||
// 计算属性 类似于data概念
|
||||
computed: {
|
||||
queryOptions: function () {
|
||||
return [
|
||||
{ type: 'input', placeholder: '证书名称', key: 'name' },
|
||||
{ type: 'select', placeholder: '培训种类', key: 'type', options: [{ id: '', name: '全部' }, ...this.type] },
|
||||
]
|
||||
},
|
||||
},
|
||||
// 监控data中的数据变化
|
||||
watch: {},
|
||||
// 方法集合
|
||||
methods: {
|
||||
// 编辑证书类型
|
||||
editCertificateType() {
|
||||
this.$router.push({
|
||||
path: '/archives/certificate/CertificateType', query: {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
// 生命周期 - 创建完成(可以访问当前this实例)
|
||||
created() {
|
||||
// 获取所有证书类型
|
||||
getCertificateTypeList({ dictionaryCode: '0001' }).then(res => {
|
||||
for (let index in res.data) {
|
||||
let item = {};
|
||||
item.id = res.data[index].value;
|
||||
item.name = res.data[index].name;
|
||||
this.type.push(item)
|
||||
}
|
||||
});
|
||||
},
|
||||
// 生命周期 - 挂载完成(可以访问DOM元素)
|
||||
mounted() { },
|
||||
// 生命周期 - 创建之前
|
||||
beforeCreate() { },
|
||||
// 生命周期 - 挂载之前
|
||||
beforeMount() { },
|
||||
// 生命周期 - 更新之前
|
||||
beforeUpdate() { },
|
||||
// 生命周期 - 更新之后
|
||||
updated() { },
|
||||
// 生命周期 - 销毁之前
|
||||
beforeDestroy() { },
|
||||
// 生命周期 - 销毁完成
|
||||
destroyed() { },
|
||||
// 如果页面有keep-alive缓存功能,这个函数会触发
|
||||
activated() { }
|
||||
};
|
||||
|
||||
</script>
|
||||
<style scoped>
|
||||
</style>
|
|
@ -115,13 +115,15 @@ export default {
|
|||
data() {
|
||||
return {
|
||||
dataValue: 1,
|
||||
form: {},
|
||||
form: {
|
||||
coverPath:'',
|
||||
},
|
||||
personType: [
|
||||
{ id: '1', name: '人员类别1' },
|
||||
{ id: '2', name: '人员类别2' },
|
||||
{ id: '3', name: '人员类别3' },
|
||||
],
|
||||
|
||||
url:'',
|
||||
previewVisible: false,
|
||||
fileList: [],
|
||||
previewImage :[
|
||||
|
@ -147,7 +149,6 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
//获取字典值
|
||||
// getPersonType() {
|
||||
// return dictGet(Object.assign(parameter)).then((res) => {
|
||||
// return res
|
||||
|
@ -171,7 +172,9 @@ export default {
|
|||
|
||||
//返回
|
||||
goback(){
|
||||
this.$router.push({path:"/course/CourseList",query:{} })
|
||||
this.$router.push({path:"/course/CourseList",query:{
|
||||
courseName:this.$route.query.courseName
|
||||
} })
|
||||
},
|
||||
|
||||
getToken() {
|
||||
|
@ -195,6 +198,17 @@ export default {
|
|||
},
|
||||
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)
|
||||
|
||||
|
||||
},
|
||||
|
||||
},
|
||||
|
|
|
@ -1,12 +1,28 @@
|
|||
<template>
|
||||
<a-card :bordered="false" title="课程列表">
|
||||
<div class="table-page-search-wrapper">
|
||||
<SearchCom :form="queryParam" :list="queryOptions" @search="handleRefresh" @reset="() => {queryParam = {}, handleRefresh()}" ></SearchCom>
|
||||
<div style="width: 100%; height: 32px; margin-bottom: 8px;">
|
||||
<SearchCom
|
||||
:form="queryParam"
|
||||
:list="queryOptions"
|
||||
@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">
|
||||
<s-table
|
||||
ref="table"
|
||||
size="default"
|
||||
rowKey="id"
|
||||
:columns="columns"
|
||||
:data="loadData"
|
||||
:pageNum="Number(this.$route.query.PageNum) || 1"
|
||||
>
|
||||
<template slot="action" slot-scope="text, record">
|
||||
<a href="javascript:;" @click="detail(record)">详情</a>
|
||||
<a-divider type="vertical" />
|
||||
|
@ -30,58 +46,64 @@ import { getCourseList,deleteCourse } from '@/api/course/course'
|
|||
|
||||
export default {
|
||||
components: {
|
||||
STable, SearchCom
|
||||
STable,
|
||||
SearchCom,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
queryParam: { courseName: this.$route.query.courseName || '' }, //, orgId: this.$route.query.courseUserOrgId || ''
|
||||
queryOptions: [
|
||||
{ type: 'input', placeholder: '课程名称', key: 'courseName' },
|
||||
],
|
||||
loadData: parameter => {
|
||||
return getCourseList(Object.assign(parameter, this.queryParam)).then(res => { return res });
|
||||
queryOptions: [{ type: 'input', placeholder: '课程名称', key: 'courseName' }],
|
||||
loadData: (parameter) => {
|
||||
return getCourseList(Object.assign(parameter, this.queryParam)).then((res) => {
|
||||
return res
|
||||
})
|
||||
},
|
||||
columns: [
|
||||
{ title: '课程编号', width: '160px', align: 'center', dataIndex: 'courseCode', key: 'courseCode' },
|
||||
{ title: '课程名称', width: 'auto', align: 'center', dataIndex: 'courseName', key: 'courseName' },
|
||||
{ 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' } }
|
||||
{ title: '操作', key: 'operation', width: '300px', align: 'center', scopedSlots: { customRender: 'action' } },
|
||||
],
|
||||
}
|
||||
},
|
||||
created() {
|
||||
},
|
||||
created() {},
|
||||
methods: {
|
||||
handleRefresh() {
|
||||
this.$refs.table.refresh(true)
|
||||
},
|
||||
detail(record) {
|
||||
this.$router.push({ path: '/course/CourseDetail', query: { id: record.id } });
|
||||
this.$router.push({ path: '/course/CourseDetail', query: { id: record.id } })
|
||||
},
|
||||
courseWare(record) {
|
||||
this.$router.push({ path: '/course/CoursewareList', query: { id: record.id } });
|
||||
this.$router.push({ path: '/course/CoursewareList', query: { id: record.id } })
|
||||
},
|
||||
del(record) {
|
||||
deleteCourse({ids:record.id}).then(res => {
|
||||
if(res.code == 200) this.$refs.table.refresh(true);
|
||||
});
|
||||
deleteCourse({ ids: record.id }).then((res) => {
|
||||
if (res.code == 200) this.$refs.table.refresh(true)
|
||||
})
|
||||
},
|
||||
|
||||
//課程新增
|
||||
courseAdd() {
|
||||
this.$router.push({ path : '/course/CourseAdd' , query : {}})
|
||||
this.$router.push({
|
||||
path: '/course/CourseAdd',
|
||||
query: {
|
||||
courseName: this.queryParam.courseName
|
||||
},
|
||||
})
|
||||
},
|
||||
|
||||
//题库
|
||||
courseQuestion(record) {
|
||||
this.$router.push({
|
||||
path: '/course/question/QuestionList', query :{
|
||||
path: '/course/question/QuestionList',
|
||||
query: {
|
||||
id: record.id,
|
||||
courseName: this.queryParam.courseName,
|
||||
// courseUserOrgId : this.queryParam.orgId,
|
||||
PageNum : this.$refs.table.localPagination.current
|
||||
}});
|
||||
pageNum: this.$refs.table.localPagination.current
|
||||
},
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<a-card :bordered="false" title="项目档案">
|
||||
<a-card :bordered="false" title="课件信息">
|
||||
<template slot="extra">
|
||||
<a-button size="small" @click="goback">返回</a-button>
|
||||
</template>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<template>
|
||||
<page-header-wrapper :title="false">
|
||||
<a-card :bordered="false">
|
||||
<a-descriptions title="课程详情" layout="horizontal" bordered size="small" :column="1">
|
||||
<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>
|
||||
|
@ -15,7 +14,6 @@
|
|||
<a-button type="primary" @click="edit"> 编辑 </a-button>
|
||||
</div>
|
||||
</a-card>
|
||||
</page-header-wrapper>
|
||||
</template>
|
||||
<script>
|
||||
import { getCourseDetails } from '@/api/course/course'
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
</template>
|
||||
<a-tabs :animated="false" :default-active-key="tabKey" @change="callback" :headStyle="{ paddingTop: '0px' }">
|
||||
<!-- 单选题 -->
|
||||
<a-tab-pane key="1" tab="单选">
|
||||
<a-tab-pane key="1" tab="单选" :disabled="radio.disabled">
|
||||
<a-radio-group v-model="radio.rightAnswers" style="width: 100%">
|
||||
<a-card title="题目(题干内容)" :bordered="false">
|
||||
<a-textarea placeholder="" :rows="6" v-model="radio.questionName" style="width: 100%" />
|
||||
|
@ -46,7 +46,7 @@
|
|||
</a-tab-pane>
|
||||
|
||||
<!-- 多选题 -->
|
||||
<a-tab-pane key="2" tab="多选">
|
||||
<a-tab-pane key="2" tab="多选" :disabled="multiselect.disabled">
|
||||
<a-card title="题目(题干内容)" :bordered="false">
|
||||
<a-textarea placeholder="" :rows="6" v-model="multiselect.questionName" style="width: 100%" />
|
||||
</a-card>
|
||||
|
@ -84,7 +84,7 @@
|
|||
</a-tab-pane>
|
||||
|
||||
<!-- 判断题 -->
|
||||
<a-tab-pane key="3" tab="判断">
|
||||
<a-tab-pane key="3" tab="判断" :disabled="estimate.disabled">
|
||||
<a-radio-group v-model="estimate.rightAnswers" style="width: 100%">
|
||||
<a-card title="题目(题干内容)" :bordered="false">
|
||||
<a-textarea placeholder="" :rows="6" v-model="estimate.questionName" style="width: 100%" />
|
||||
|
@ -92,8 +92,8 @@
|
|||
<a-card :bordered="false">
|
||||
<template slot="title">
|
||||
选项(从选项中选择一个作为答案)<br />
|
||||
<a-radio :value="1"> 正确 </a-radio>
|
||||
<a-radio :value="2"> 错误 </a-radio>
|
||||
<a-radio value="1"> 正确 </a-radio>
|
||||
<a-radio value="2"> 错误 </a-radio>
|
||||
</template>
|
||||
</a-card>
|
||||
<a-card title="答案解析" :bordered="false">
|
||||
|
@ -103,7 +103,7 @@
|
|||
</a-tab-pane>
|
||||
|
||||
<!-- 简答题 -->
|
||||
<a-tab-pane key="4" tab="简答">
|
||||
<a-tab-pane key="4" tab="简答" :disabled="shortAnswer.disabled">
|
||||
<a-card title="题目(题干内容)" :bordered="false">
|
||||
<a-textarea placeholder="" :rows="6" v-model="shortAnswer.questionName" style="width: 100%" />
|
||||
</a-card>
|
||||
|
@ -117,7 +117,7 @@
|
|||
</a-tab-pane>
|
||||
|
||||
<!-- 填空题 -->
|
||||
<a-tab-pane key="5" tab="填空">
|
||||
<a-tab-pane key="5" tab="填空" :disabled="Completion.disabled">
|
||||
<a-card title="题目(题干内容)" :bordered="false">
|
||||
<a-textarea placeholder="" :rows="6" v-model="Completion.questionName" style="width: 100%" />
|
||||
</a-card>
|
||||
|
@ -126,8 +126,8 @@
|
|||
<a-button type="primary" style="width: 40%" @click="addAnswerSize">添加一个新填空</a-button>
|
||||
<a-button style="width: 40%" @click="delAnswerSize">刪除一个新填空</a-button>
|
||||
</div>
|
||||
<div v-for="(answer, index) in answerList" :key="index" style="margin-bottom: 10px">
|
||||
<a-input :value="answerList[index]" @change="onChangeInput">
|
||||
<div v-for="(answer, index) in Completion.answerList" :key="index" style="margin-bottom: 10px">
|
||||
<a-input v-model="Completion.answerList[index]">
|
||||
<template slot="addonBefore">
|
||||
<b>填空{{ index+1 }}:</b>
|
||||
</template>
|
||||
|
@ -155,21 +155,39 @@ export default {
|
|||
multiselect: {},
|
||||
estimate: {},
|
||||
shortAnswer: {},
|
||||
answerList: ["111","222","333"],
|
||||
Completion: { },
|
||||
Completion: { answerList: [''] },
|
||||
tabKey: this.$route.query.questionType ? this.$route.query.questionType : '1'
|
||||
// tabKey,
|
||||
}
|
||||
},
|
||||
|
||||
created() {
|
||||
if (this.$route.query.id) {
|
||||
|
||||
//判断是否是编辑
|
||||
if (this.$route.query.id && !this.$route.query.opt) {
|
||||
|
||||
this.radio.disabled = true;
|
||||
this.multiselect.disabled = true;
|
||||
this.estimate.disabled = true;
|
||||
this.shortAnswer.disabled = true;
|
||||
this.Completion.disabled = true;
|
||||
|
||||
getQuestionDeatil({ id: this.$route.query.id }).then((res) => {
|
||||
console.log(this.tabKey)
|
||||
if (this.tabKey == '1') {
|
||||
this.radio = res.data
|
||||
this.radio = res.data;
|
||||
this.radio.disabled = false;
|
||||
} else if (this.tabKey == '2') {
|
||||
this.multiselect = res.data
|
||||
this.multiselect = res.data;
|
||||
this.multiselect.disabled = false;
|
||||
this.getRightAnswer();
|
||||
} else if(this.tabKey == '3') {
|
||||
this.estimate = res.data;
|
||||
this.estimate.disabled = false;
|
||||
} else if (this.tabKey == '4') {
|
||||
this.shortAnswer = res.data;
|
||||
this.shortAnswer.disabled = false;
|
||||
} else if (this.tabKey == '5') {
|
||||
this.Completion = res.data;
|
||||
this.Completion.disabled = false;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -181,41 +199,36 @@ export default {
|
|||
path: '/course/question/QuestionList',
|
||||
query: {
|
||||
id: this.$route.query.courseId,
|
||||
questionId: this.$route.query.id,
|
||||
isactive: this.$route.query.isactive,
|
||||
},
|
||||
})
|
||||
},
|
||||
|
||||
// getQuestionType() {
|
||||
// if (!this.$route.query.questionType || this.$route.query.questionType === '') tabKey = '1'
|
||||
// tabKey = this.$route.query.questionType
|
||||
// },
|
||||
|
||||
callback(key) {
|
||||
this.radio = {}
|
||||
this.multiselect = {}
|
||||
this.estimate = {}
|
||||
this.shortAnswer = {}
|
||||
this.Completion = { answerSize: 2 }
|
||||
this.Completion = { answerList: [''] }
|
||||
this.tabKey = key
|
||||
},
|
||||
onChangeInput(e) {
|
||||
|
||||
},
|
||||
// 添加填空
|
||||
addAnswerSize() {
|
||||
if (this.answerList.length == 10) {
|
||||
if (this.Completion.answerList.length == 10) {
|
||||
this.$message.error('填空数量最多不能超过10个')
|
||||
return
|
||||
}
|
||||
this.answerList.push('')
|
||||
this.Completion.answerList.push('')
|
||||
},
|
||||
// 刪除填空
|
||||
delAnswerSize() {
|
||||
if (this.answerList.length == 1) {
|
||||
if (this.Completion.answerList.length == 1) {
|
||||
this.$message.error('填空数量最少不能少于1个')
|
||||
return
|
||||
}
|
||||
this.Completion.answerSize--
|
||||
this.Completion.answerList.splice(this.Completion.answerList.length-1, 1);
|
||||
},
|
||||
|
||||
// 确定
|
||||
|
@ -239,7 +252,6 @@ export default {
|
|||
console.log('5---', this.Completion)
|
||||
}
|
||||
|
||||
console.log('a--')
|
||||
from.courseId = this.$route.query.courseId
|
||||
|
||||
questionAdd(from).then((res) => {
|
||||
|
@ -368,25 +380,20 @@ export default {
|
|||
this.$message.error('题干不能为空!')
|
||||
return false
|
||||
}
|
||||
|
||||
console.log(this.Completion.conten)
|
||||
// if (!this.Completion.rightAnswers || this.Completion.rightAnswers === '') {
|
||||
// this.$message.error('正确答案不能为空!')
|
||||
// return false
|
||||
// }
|
||||
|
||||
// let answer =[];
|
||||
// for(i in answerSize) {
|
||||
// let daan ={};
|
||||
// }
|
||||
|
||||
let tiank = this.Completion
|
||||
console.log('tiank ', tiank)
|
||||
|
||||
let from = this.Completion
|
||||
from.questionType = 5
|
||||
return from
|
||||
},
|
||||
|
||||
// 获取多选题的正确答案
|
||||
getRightAnswer(){
|
||||
if(this.multiselect.rightAnswers.indexOf('A') > -1) this.multiselect.a = true;
|
||||
if(this.multiselect.rightAnswers.indexOf('B') > -1) this.multiselect.b = true;
|
||||
if(this.multiselect.rightAnswers.indexOf('C') > -1) this.multiselect.c = true;
|
||||
if(this.multiselect.rightAnswers.indexOf('D') > -1) this.multiselect.d = true;
|
||||
console.log('1---', this.multiselect)
|
||||
},
|
||||
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -1,35 +1,80 @@
|
|||
<template>
|
||||
<page-header-wrapper>
|
||||
<a-card :bordered="false">
|
||||
<!-- <page-header-wrapper> -->
|
||||
<a-card :bordered="false" title="题库管理">
|
||||
<template slot="extra">
|
||||
<a-button size="small" @click="questionColse">返回</a-button>
|
||||
</template>
|
||||
<div class="questionLeft">
|
||||
<div class="div-button">
|
||||
<a-button type="primary" class="close-button" style="font-size: 15px" @click="questionColse"> 关闭 </a-button>
|
||||
<a-button type="primary" class="create-button" style="font-size: 15px" @click="questionSave"> 新增 </a-button>
|
||||
</div>
|
||||
<h1 class="questionNumber">题序</h1>
|
||||
<!-- 题目序号 -->
|
||||
<div v-for="(item, index) in quesitonList" :key="item" class="questionLeftItem" @click="quesionId(item)">
|
||||
<div
|
||||
v-for="(item, index) in quesitonList"
|
||||
:key="item"
|
||||
class="questionLeftItem"
|
||||
@click="quesionId(item, index)"
|
||||
:class="{ active_color: index == isactive }"
|
||||
>
|
||||
{{ index + 1 }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="questionDetail">
|
||||
<br />
|
||||
<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>
|
||||
<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>
|
||||
<b><h1 class="questionContent">课程题目库预览</h1></b>
|
||||
<a-divider :style="{ backgroundColor: '#000' }" />
|
||||
<div class="question">
|
||||
<h1 class="questionName">
|
||||
({{ questionDetail.questionType }}){{questionDetail.questionName}}
|
||||
<h1 class="questionName" v-if="quesitonList != null && quesitonList.length !=0">
|
||||
({{ questionDetail.questionTypeName }}){{ questionDetail.questionName }}
|
||||
<span class="edit" @click="edit(questionDetail.id)">编辑</span>
|
||||
<span class="edit" @click="del(questionDetail.id)">删除</span>
|
||||
<a-popconfirm title="确定要删除此题?" ok-text="确定" cancel-text="取消" @confirm="del(questionDetail.id)">
|
||||
<span class="edit">删除</span>
|
||||
</a-popconfirm>
|
||||
</h1>
|
||||
|
||||
<!-- 显示单选题和多选题 -->
|
||||
<div v-if="questionDetail.questionType == 1 || questionDetail.questionType == 2">
|
||||
<div class="answer">A. {{ questionDetail.answerA }}</div>
|
||||
<div class="answer">B. {{ questionDetail.answerB }}</div>
|
||||
<div class="answer">C. {{ questionDetail.answerC }}</div>
|
||||
<div class="answer">D. {{ questionDetail.answerD }}</div>
|
||||
<div class="info_parent">
|
||||
</div>
|
||||
|
||||
<!-- 显示简答题 -->
|
||||
<div v-if="questionDetail.questionType == 4">
|
||||
<div class="answer">正确答案: {{ questionDetail.rightAnswers }}</div>
|
||||
</div>
|
||||
|
||||
<!-- 显示填空题 -->
|
||||
<div v-if="questionDetail.questionType == 5">
|
||||
<div class="answer" v-for="(item, ind) in questionDetail.answerList" :key="ind">
|
||||
正确答案{{ ind + 1 }}: {{ item }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="info_parent" v-if="quesitonList != null && quesitonList.length !=0">
|
||||
<div class="info">解析</div>
|
||||
<div class="info_main">
|
||||
{{ questionDetail.asnwerParse }}
|
||||
|
@ -38,40 +83,61 @@
|
|||
<a-divider :style="{ backgroundColor: '#000' }" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input ref="inputFile" type="file" style="display: none" @change="questionBatchImport" />
|
||||
</a-card>
|
||||
</page-header-wrapper>
|
||||
<!-- </page-header-wrapper> -->
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getQuestionListByCourseId } from '@/api/course/course'
|
||||
import { getQuestionDeatil,deleteQuestion } from '@/api/course/question/question'
|
||||
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'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
quesitonList: [],
|
||||
questionDetail: {},
|
||||
isactive: 1,
|
||||
}
|
||||
},
|
||||
|
||||
created: function () {
|
||||
let parameter = {id : this.$route.query.id}
|
||||
this.getQuestion()
|
||||
},
|
||||
methods: {
|
||||
getQuestion() {
|
||||
// 查询所有题目id列表
|
||||
getQuestionListByCourseId(parameter).then((res) => {
|
||||
getQuestionListByCourseId({ id: this.$route.query.id }).then((res) => {
|
||||
this.quesitonList = res.data
|
||||
|
||||
if (!res.data.length) return
|
||||
this.quesionId(this.quesitonList[0])
|
||||
if (!res.data) return
|
||||
this.quesionId(this.$route.query.questionId || this.quesitonList[0], this.$route.query.isactive || 0)
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
methods: {
|
||||
//题目ID
|
||||
quesionId: function (i) {
|
||||
//题目ID查看题目
|
||||
quesionId: function (i, index) {
|
||||
if (this.quesitonList != null && this.quesitonList.length != 0) {//ID不为空则执行下面
|
||||
console.log("题目!!!!",this.quesitonList.length)
|
||||
this.isactive = index
|
||||
this.questionId = i
|
||||
|
||||
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 = '填空题'
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
//关闭按钮
|
||||
|
@ -79,35 +145,82 @@ export default {
|
|||
this.$router.push({
|
||||
path: '/course/CourseList',
|
||||
query: {
|
||||
courseName:this.$route.query.courseName,
|
||||
pageNum:this.$route.query.pageNum
|
||||
},
|
||||
})
|
||||
},
|
||||
questionSave() {
|
||||
this.$router.push({
|
||||
path: '/course/question/QuestionAdd', query :{
|
||||
path: '/course/question/QuestionAdd',
|
||||
query: {
|
||||
courseId: this.$route.query.id,
|
||||
}});
|
||||
isactive: this.isactive,
|
||||
id: this.questionId,
|
||||
opt: 'add',
|
||||
},
|
||||
})
|
||||
},
|
||||
edit(record) {
|
||||
console.log(record)
|
||||
this.$router.push({ path : '/course/question/QuestionAdd', query:{ id: record , questionType:this.questionDetail.questionType ,courseId:this.$route.query.id}});
|
||||
this.$router.push({
|
||||
path: '/course/question/QuestionAdd',
|
||||
query: {
|
||||
id: record,
|
||||
isactive: this.isactive,
|
||||
questionType: this.questionDetail.questionType,
|
||||
courseId: this.$route.query.id,
|
||||
},
|
||||
del(record){
|
||||
console.log(record)
|
||||
deleteQuestion({id:record}).then(res => {
|
||||
if(res.code == 200) this.$refs.table.refresh(true);
|
||||
})
|
||||
},
|
||||
|
||||
//删除
|
||||
del(id) {
|
||||
deleteQuestion({ id: id }).then((res) => {
|
||||
if (res.code == 200) this.getQuestion()
|
||||
})
|
||||
},
|
||||
|
||||
//批量导入
|
||||
questionBatch() {
|
||||
alert('批量导入')
|
||||
courseId:this.$route.query.id
|
||||
this.$refs.inputFile.click()
|
||||
},
|
||||
questionBatchDownload(){
|
||||
window.location.href="/dawa/sys/oss/show/20211108/2420f1de94174bb8a0fb1a2f1e9e1742.xlsx";
|
||||
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')
|
||||
|
||||
const header = {}
|
||||
header['Content-Type'] = 'multipart/form-data'
|
||||
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 = ''
|
||||
})
|
||||
},
|
||||
|
||||
// 下载模板
|
||||
questionBatchDownload() {
|
||||
window.location.href = '/dawa/sys/oss/show/20211108/2420f1de94174bb8a0fb1a2f1e9e1742.xlsx'
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
@ -128,8 +241,14 @@ export default {
|
|||
border: 1px solid #000;
|
||||
margin: 5px 5px;
|
||||
cursor: pointer;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.active_color {
|
||||
background-color: wheat;
|
||||
}
|
||||
|
||||
/* wheat */
|
||||
.questionDetail {
|
||||
width: calc(100% - 300px - 20px);
|
||||
height: auto;
|
||||
|
@ -158,7 +277,7 @@ export default {
|
|||
font-size: 23px;
|
||||
font: bold;
|
||||
background-color: gainsboro;
|
||||
margin-top: 45px;
|
||||
/* margin-top: 45px; */
|
||||
}
|
||||
.questionContent {
|
||||
margin-left: 10px;
|
||||
|
|
Loading…
Reference in New Issue