yujialong 4 months ago
parent 87b03ed8b6
commit 016dd0a9ab
  1. 3
      src/pages/ques/detail/index.vue
  2. 80
      src/pages/testPaper/detail/index.vue
  3. 9
      src/pages/testPaper/detail/manual.vue
  4. 80
      src/pages/testPaper/detail/repeatQues.vue

@ -711,7 +711,8 @@ export default {
margin-bottom: 15px; margin-bottom: 15px;
} }
.el-radio { .el-radio,
.el-checkbox {
margin-right: 15px; margin-right: 15px;
} }

@ -310,6 +310,11 @@ export default {
detailType: '', detailType: '',
difficultSelected: false, difficultSelected: false,
repeatVisible: false,
repeatQues: [],
tempForm: {},
}; };
}, },
computed: { computed: {
@ -671,15 +676,67 @@ export default {
item.examQuestions.splice(i, 1) item.examQuestions.splice(i, 1)
this.calcDifficult() this.calcDifficult()
}, },
//
hasRepeatQues (list) {
const result = list.filter(e => {
if (e.questionType !== 'fill_blank' && e.questionType !== 'essay') {
// ++
const opts = e.questionAnswerVersionsList
//
const first = opts[0].optionText
const someOpt = opts.every(n => n.optionText === first)
return e.questionType === e.questionType && e.stem === e.stem && someOpt
} else {
// /+
return (e.questionType === e.questionType && e.stem === e.stem)
}
})
//
if (result.length) {
this.repeatVisible = true
this.repeatQues = result
return true
}
return false
},
// //
async submit (status) { submit (status) {
if (this.submiting) return false if (status) {
// 稿
if (!this.form.name) return Util.warningMsg('请输入试卷名称')
this.validForm(status)
} else {
this.$refs.form.validate(async (valid) => { this.$refs.form.validate(async (valid) => {
if (valid) { if (valid) {
this.validForm(status)
}
})
}
},
//
async saveTestPaper () {
try {
await this.$post(this.api.saveExamPaper, this.tempForm)
Util.successMsg('保存成功')
this.submiting = false
this.back()
} catch (e) {
this.submiting = false
}
},
//
async validForm (status) {
if (this.submiting) return false
const { isCopy } = this // const { isCopy } = this //
const form = _.cloneDeep(this.form) const form = _.cloneDeep(this.form)
if (isNaN(form.suggestTime) || form.suggestTime < 1 || form.suggestTime % 1) return Util.warningMsg('估计用时请输入正整数')
const paper = form.paperOutline const paper = form.paperOutline
const allQues = []
//
if (!status) {
if (isNaN(form.suggestTime) || form.suggestTime < 1 || form.suggestTime % 1) return Util.warningMsg('估计用时请输入正整数')
let invalid = 0 let invalid = 0
for (const i in paper) { for (const i in paper) {
const e = paper[i] const e = paper[i]
@ -740,10 +797,13 @@ export default {
invalid = 1 invalid = 1
break break
} }
allQues.push(...e.examQuestions)
} }
if (invalid) return false if (invalid) return false
}
this.submiting = true this.submiting = true
form.particularYear = +(dayjs(form.particularYear).format('YYYY')) form.particularYear = +(dayjs(form.particularYear).format('YYYY'))
form.libraryId = this.libraryId form.libraryId = this.libraryId
form.questionCount = this.questionCount form.questionCount = this.questionCount
@ -791,17 +851,11 @@ export default {
form.questionType = [...new Set(paper.map(e => e.questionType))].join('、') // form.questionType = [...new Set(paper.map(e => e.questionType))].join('、') //
form.createSource = 1 form.createSource = 1
if (isCopy) form.paperId = '' if (isCopy) form.paperId = ''
this.tempForm = form
// debugger // debugger
try { // if (this.hasRepeatQues(allQues)) return false
await this.$post(this.api.saveExamPaper, form) this.saveTestPaper()
Util.successMsg('保存成功')
this.submiting = false
this.back()
} catch (e) {
this.submiting = false
}
}
})
}, },
// //
back () { back () {

@ -27,7 +27,7 @@
</div> </div>
<!-- 题目 --> <!-- 题目 -->
<div class="item"> <div class="item">
<p class="total">单选题{{ ques.length }}道题</p> <p class="total">{{ questionTypeName }}{{ ques.length }}道题</p>
<div class="ques"> <div class="ques">
<div class="line"> <div class="line">
<el-checkbox v-model="quesAllCheck" @change="quesAllCheckChange"></el-checkbox> <el-checkbox v-model="quesAllCheck" @change="quesAllCheckChange"></el-checkbox>
@ -125,6 +125,10 @@ export default {
checkedLen () { checkedLen () {
return this.curCheckQues.length + this.checked.length return this.curCheckQues.length + this.checked.length
}, },
// name
questionTypeName () {
return this.questionType ? QuesConst.questionTypes.find(e => e.id === this.questionType).name : ''
},
// //
diaTitle () { diaTitle () {
const { curQuesIndex, curQues } = this.$parent const { curQuesIndex, curQues } = this.$parent
@ -391,8 +395,7 @@ export default {
.line { .line {
display: flex; display: flex;
align-items: center; margin: 8px 0;
margin: 5px 0;
} }
.serial { .serial {

@ -0,0 +1,80 @@
<template>
<el-dialog title="提示" :visible.sync="listVisible" width="800px" :close-on-click-modal="false">
<el-alert title="以下试题在试卷中疑似出现重复,是否要继续发布!" type="warning" effect="dark" :closable="false">
</el-alert>
<el-table class="m-t-10" :data="list" stripe header-align="center" row-key="id">
<el-table-column prop="name" label="大题名称" align="center" width="90"></el-table-column>
<el-table-column prop="name" label="题号" align="center" width="60"></el-table-column>
<el-table-column prop="stem" label="题干" align="center" min-width="120" show-overflow-tooltip></el-table-column>
<el-table-column label="操作" align="center" width="240">
<template slot-scope="scope">
<el-button type="text">详情</el-button>
<el-button type="text">移除</el-button>
<el-button type="text">替换</el-button>
</template>
</el-table-column>
</el-table>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="check">检查一下</el-button>
<el-button @click="submit">继续发布</el-button>
</span>
</el-dialog>
</template>
<script>
import Setting from '@/setting'
import Util from '@/libs/util'
import _ from 'lodash'
export default {
props: ['visible', 'list'],
data () {
return {
listVisible: false,
// list: [],
submiting: false,
};
},
watch: {
visible () {
this.listVisible = this.visible
this.visible && this.init()
}
},
mounted () {
},
methods: {
init () {
},
//
async getList () {
try {
const res = await this.$post(this.api.examPaperTemplateList, {
pageNum: this.page,
pageSize: this.pageSize,
...this.filter
})
this.list = res.pageList.records
this.total = res.pageList.total
} catch (e) { }
},
//
async check () {
this.listVisible = false
},
//
async submit () {
if (this.submiting) return false
this.submiting = true
this.$parent.saveTestPaper()
},
//
closeDia () {
this.$emit('update:visible', false)
}
}
};
</script>
<style lang="scss" scoped></style>
Loading…
Cancel
Save