This commit is contained in:
yanran200730
2023-02-14 10:13:38 +08:00
parent 093d46ee4e
commit 7aaf9cd6be
3 changed files with 216 additions and 75 deletions

View File

@@ -19,26 +19,17 @@
<span class="type-name">{{ dict.getLabel('qjEAType', item.assessmentType) }}</span>
<ai-select
style="width: 180px;"
v-model="item.qjEACondition"
v-model="item.upCondition"
clearable
placeholder="请选择"
:selectList="dict.getDict('qjEACondition')">
</ai-select>
<el-input size="small" style="width: 180px;" v-model="item.upScore" placeholder="请输入"></el-input>
<span></span>
<ai-select
style="width: 180px;"
v-model="item.downCondition"
clearable
placeholder="请选择"
:selectList="dict.getDict('qjEACondition')">
</ai-select>
<el-input size="small" style="width: 180px;" v-model="item.downScore" placeholder="请输入"></el-input>
</div>
</div>
</el-form-item>
<el-form-item prop="chooseType" label="选题方式" :rules="[{required: true, message: '请选择选题方式', trigger: 'change'}]">
<el-radio-group v-model="form.chooseType">
<el-radio-group v-model="form.chooseType" @change="form.questions = []">
<el-radio :label="item.dictValue" :key="item.dictValue" v-for="item in dict.getDict('qjEIChooseType')">{{ item.dictName }}</el-radio>
</el-radio-group>
</el-form-item>
@@ -53,7 +44,7 @@
</div>
<div class="form-item">
<span>每题分数</span>
<el-input-number size="small" v-model="item.eachScore" :min="0"></el-input-number>
<el-input-number size="small" v-model="item.eachScore" :min="0"></el-input-number>
</div>
</div>
</div>
@@ -65,6 +56,7 @@
</el-form>
<ai-dialog
:visible.sync="isShow"
@onConfirm="onConfirm"
width="890px"
title="选择试题">
<ai-search-bar class="search-bar">
@@ -105,7 +97,7 @@
:page-size="search.size"
:page-sizes="[10, 20, 50, 100]"
layout="slot,->, prev, pager, next, sizes, jumper"
:pager-count="search.current"
:pager-count="7"
@size-change="getList"
@current-change="getList">
<!-- <div class="paginationPre" v-if="isMultiple">
@@ -115,6 +107,31 @@
</ai-dialog>
</template>
</ai-card>
<ai-card title="试题" v-if="form.questions.length">
<template #content>
<ai-wrapper
class="topic-item"
v-for="(item, index) in form.questions"
:key="index"
label-width="120px">
<ai-info-item label="题目描述" isLine :value="item.title"></ai-info-item>
<ai-info-item label="题目类型" :value="dict.getLabel('qjQBType', item.type)"></ai-info-item>
<ai-info-item label="正确答案" :value="item.answer"></ai-info-item>
<ai-info-item label="题目选项" isLine>
<div class="">
<div class="options" v-for="(e, index) in item.items" :key="index">
<span>{{ e.sort }}</span>
<span>{{ e.content }}</span>
</div>
</div>
</ai-info-item>
<ai-info-item label="答案解析" isLine>
<AiArticle :value="item.analysis"></AiArticle>
</ai-info-item>
</ai-wrapper>
</template>
</ai-card>
</template>
<template #footer>
<el-button @click="cancel">取消</el-button>
@@ -136,35 +153,28 @@
return {
info: {},
form: {
examinationName: '',
title: '',
showIndex: '',
chooseType: '0',
questions: [],
assessments: [{
assessmentType: '0',
downCondition: '',
downScore: '',
status: '',
upCondition: '',
upScore: ''
}, {
assessmentType: '1',
downCondition: '',
downScore: '',
status: '',
upCondition: '',
upScore: ''
}, {
assessmentType: '2',
downCondition: '',
downScore: '',
status: '',
upCondition: '',
upScore: ''
}, {
assessmentType: '3',
downCondition: '',
downScore: '',
status: '',
upCondition: '',
upScore: ''
@@ -201,6 +211,17 @@
}
},
computed: {
answerTotal () {
let subjectNumber = 0
this.form.subjectConfigs.forEach(v => {
subjectNumber = Number(v.subjectNumber) + subjectNumber
})
return subjectNumber
}
},
created () {
this.getList()
this.dict.load(['qjQBType', 'qjEIChooseType', 'qjEACondition', 'qjEAType']).then(() => {
@@ -213,30 +234,31 @@
methods: {
getInfo (id) {
this.instance.post(`/app/appcontentinfo/queryDetailById?id=${id}`).then(res => {
this.instance.post(`/app/appexaminationinfo/queryDetailById?id=${id}`).then(res => {
if (res.code === 0) {
this.form = res.data
}
})
},
onChange (e) {
onChange () {
this.getList()
this.initChoose()
},
initChoose () {
console.log(1)
this.ids.forEach(v => {
this.$refs.aitable.toggleRowSelection(v, true)
onConfirm () {
if (this.ids.length !== this.answerTotal) {
return this.$message.error(`请选择${this.answerTotal}道题目`)
}
this.instance.post(`/app/appquestionbank/queryDetailByIds`, this.ids).then(res => {
if (res.code == 0) {
this.form.questions = res.data
this.isShow = false
}
})
},
handleSelectionChange (e) {
this.ids = e
console.log(this.ids)
},
getList() {
this.instance.post(`/app/appquestionbank/list`, null, {
params: {
@@ -272,7 +294,12 @@
this.instance.post(`/app/appquestionbank/randomChoose`, this.form.subjectConfigs).then(res => {
if (res.code == 0) {
this.form.questions = res.data
this.form.questions = res.data.map(v => {
return {
...v,
answer: v.items.filter(v => v.checked === '1').map(v => v.content).join(',')
}
})
}
})
},
@@ -280,6 +307,20 @@
confirm () {
this.$refs.form.validate((valid) => {
if (valid) {
let subjectNumber = 0
let eachScore = 0
this.form.subjectConfigs.forEach(v => {
eachScore = Number(v.eachScore) + eachScore
subjectNumber = Number(v.subjectNumber) + subjectNumber
})
if (subjectNumber === 0 || eachScore === 0) {
return this.$message.error('请进行题目设置')
}
if (!this.form.questions.length) {
return this.$message.error('请选择试题')
}
this.instance.post(`/app/appexaminationinfo/addOrUpdate`, {
...this.form,
id: this.params.id || ''
@@ -307,6 +348,19 @@
<style scoped lang="scss">
.AppExaminationManage {
.topic-item {
padding: 40px 0 0;
border-bottom: 1px solid #eee;
&:first-child {
padding-top: 0;
}
&:last-child {
border: none;
}
}
.el-checkbox-group {
width: 100%;

View File

@@ -1,7 +1,7 @@
<template>
<ai-detail>
<ai-detail class="AppExaminationManage-detail">
<template slot="title">
<ai-title title="课程详情" isShowBack isShowBottomBorder @onBackClick="cancel(false)">
<ai-title title="考试详情" isShowBack isShowBottomBorder @onBackClick="cancel(false)">
</ai-title>
</template>
<template slot="content">
@@ -9,30 +9,39 @@
<template #content>
<ai-wrapper
label-width="120px">
<ai-info-item label="标题" isLine :value="info.title"></ai-info-item>
<ai-info-item label="发布地区" isLine :value="info.areaName"></ai-info-item>
<ai-info-item label="文章类型" isLine :value="info.contentType === '0' ? '图文' : '视频'"></ai-info-item>
<ai-info-item label="正文" v-if="info.contentType === '0'" isLine>
<AiArticle :value="info.content"></AiArticle>
<ai-info-item label="考试名称" :value="info.examinationName"></ai-info-item>
<ai-info-item label="排序" :value="info.showIndex"></ai-info-item>
<ai-info-item label="成绩评核" isLine :value="assessmentsName"></ai-info-item>
<ai-info-item label="选题方式" isLine :value="dict.getLabel('qjEIChooseType', info.chooseType)">
</ai-info-item>
<ai-info-item v-if="info.contentType === '0'" isLine label="封面图片">
<ai-uploader
:instance="instance"
disabled
v-model="info.files"
:limit="9">
</ai-uploader>
<ai-info-item label="试题总数" :value="info.questions && info.questions.length"></ai-info-item>
<ai-info-item label="总分数" :value="info.subjectScore"></ai-info-item>
<ai-info-item label="考试人数" :value="info.examinationNumber"></ai-info-item>
<ai-info-item label="通过人数" :value="info.passNumber"></ai-info-item>
<ai-info-item label="状态" :value="dict.getLabel('qjEIStatus', info.status)"></ai-info-item>
</ai-wrapper>
</template>
</ai-card>
<ai-card title="试题" v-if="info.questions && info.questions.length">
<template #content>
<ai-wrapper
class="topic-item"
v-for="(item, index) in info.questions"
:key="index"
label-width="120px">
<ai-info-item label="题目描述" isLine :value="item.title"></ai-info-item>
<ai-info-item label="题目类型" :value="dict.getLabel('qjQBType', item.type)"></ai-info-item>
<ai-info-item label="正确答案" :value="item.answer"></ai-info-item>
<ai-info-item label="题目选项" isLine>
<div class="">
<div class="options" v-for="(e, index) in item.items" :key="index">
<span>{{ e.sort }}</span>
<span>{{ e.content }}</span>
</div>
</div>
</ai-info-item>
<ai-info-item v-if="info.contentType === '1'" isLine label="封面图片">
<video style="width:100%; height:100%; object-fit: fill;" :src="info.files[0].url" controls></video>
</ai-info-item>
<ai-info-item v-if="info.contentType === '1'" isLine label="视频封面">
<ai-uploader
:instance="instance"
disabled
v-model="info.pictureUrl"
:limit="1">
</ai-uploader>
<ai-info-item label="答案解析" isLine>
<AiArticle :value="item.analysis"></AiArticle>
</ai-info-item>
</ai-wrapper>
</template>
@@ -48,32 +57,35 @@
props: {
instance: Function,
dict: Object,
params: Object,
moduleId: String
params: Object
},
data () {
return {
info: {},
id: ''
id: '',
assessmentsName: ''
}
},
created () {
if (this.params && this.params.id) {
this.id = this.params.id
this.getInfo(this.params.id)
}
this.dict.load(['qjQBType', 'qjEIChooseType', 'qjEACondition', 'qjEAType', 'qjEIStatus']).then(() => {
if (this.params && this.params.id) {
this.id = this.params.id
this.getInfo(this.params.id)
}
})
},
methods: {
getInfo (id) {
this.instance.post(`/app/appcontentinfo/queryDetailById?id=${id}`).then(res => {
this.instance.post(`/app/appexaminationinfo/queryDetailById?id=${id}`).then(res => {
if (res.code === 0) {
this.info = res.data
this.info.pictureUrl = res.data.pictureUrl ? [{
url: res.data.pictureUrl
}] : []
this.assessmentsName = res.data.assessments.map(v => {
return `${this.dict.getLabel('qjEAType', v.assessmentType)} ${this.dict.getLabel('qjEACondition', v.upCondition)} ${v.upScore} `
}).join('、')
}
})
},
@@ -89,4 +101,16 @@
</script>
<style scoped lang="scss">
.AppExaminationManage-detail .topic-item {
padding: 40px 0 0;
border-bottom: 1px solid #eee;
&:first-child {
padding-top: 0;
}
&:last-child {
border: none;
}
}
</style>

View File

@@ -9,7 +9,7 @@
<ai-select
v-model="search.status"
clearable
placeholder="请选择课程状态"
placeholder="请选择考试状态"
:selectList="dict.getDict('qjEIStatus')"
@change="search.current = 1, getList()">
</ai-select>
@@ -17,7 +17,7 @@
</template>
<template #right>
<el-input
v-model="search.title"
v-model="search.examinationName"
class="search-input"
size="small"
v-throttle="() => {search.current = 1, getList()}"
@@ -36,16 +36,36 @@
:current.sync="search.current"
:size.sync="search.size"
@getList="getList">
<el-table-column slot="options" width="120px" fixed="right" label="操作" align="center">
<el-table-column slot="options" width="160px" fixed="right" label="操作" align="center">
<template slot-scope="{ row }">
<div class="table-options">
<el-button type="text" v-if="row.status === '0'" @click="id = row.id, isShow = true">审核</el-button>
<el-button type="text" @click="toAdd(row.id)">编辑</el-button>
<el-button type="text" @click="toDetail(row.id)">详情</el-button>
<el-button type="text" @click="remove(row.id)">删除</el-button>
<el-button type="text" v-if="row.status === '1'" @click="unshelf(row.id)">下架</el-button>
<!-- <el-button type="text" @click="remove(row.id)">删除</el-button> -->
</div>
</template>
</el-table-column>
</ai-table>
<ai-dialog
:visible.sync="isShow"
@onConfirm="onConfirm"
@onClose="onClose"
width="890px"
title="审核">
<el-form class="ai-form" :model="form" label-width="120px" ref="form">
<el-form-item label="是否通过" prop="pass" style="width: 100%;" :rules="[{required: true, message: '请输入考试名称', trigger: 'change'}]">
<el-radio-group v-model="form.pass">
<el-radio label="0"></el-radio>
<el-radio label="1"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item prop="opinion" label="审批意见" :rules="[{required: true, message: '请输入审批意见', trigger: 'blur'}]">
<el-input size="small" v-model="form.opinion" clearable placeholder="请输入审批意见"></el-input>
</el-form-item>
</el-form>
</ai-dialog>
</template>
</ai-list>
</template>
@@ -64,19 +84,25 @@
search: {
current: 1,
size: 10,
title: '',
examinationName: '',
status: ''
},
isShow: false,
total: 10,
colConfigs: [
{ prop: 'examinationName', label: '考试名称', align: 'left' },
{ prop: 'allSubjectNumber', label: '试题总数', align: 'center' },
{ prop: 'beginTime', label: '通过分数', align: 'center' },
{ prop: 'status', label: '状态', align: 'center', format: v => this.dict.getLable('qjEIStatus', v) },
{ prop: 'status', label: '状态', align: 'center', format: v => this.dict.getLabel('qjEIStatus', v) },
{ prop: 'examinationNumber', label: '考试人数', align: 'center' },
{ prop: 'passNumber', label: '通过人数', align: 'center' }
],
tableData: [],
form: {
opinion: '',
pass: ''
},
id: '',
statusList: [
{
dictValue: '0',
@@ -114,6 +140,43 @@
})
},
onClose () {
this.id = ''
this.form.opinion = ''
this.form.pass = ''
},
onConfirm () {
this.$refs.form.validate((valid) => {
if (valid) {
this.instance.post(`/app/appexaminationinfo/examine`, null, {
params: {
...this.form,
id: this.id
}
}).then(res => {
if (res.code == 0) {
this.$message.success('审核成功!')
this.isShow = false
this.getList()
}
})
}
})
},
unshelf (id) {
this.$confirm('确定下架该活动?').then(() => {
this.instance.post(`/app/appexaminationinfo/revoke?id=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('下架成功!')
this.getList()
}
})
})
},
remove (id) {
this.$confirm('确定删除该活动?').then(() => {
this.instance.post(`/app/appexaminationinfo/delete?id=${id}`).then(res => {