| | |
| | | <el-form-item label="试卷名称:" prop="name" required> |
| | | <el-input style="width: 300px" v-model="form.name"/> |
| | | </el-form-item> |
| | | <!-- 题目详细信息 --> |
| | | <el-form-item :key="index" :label="'标题'+(index+1)+':'" required |
| | | v-for="(titleItem,index) in form.questionTitleList" v-show="form.paperType===1"> |
| | | v-for="(titleItem,index) in form.questionTitleList" |
| | | v-show="form.paperType===1 || (form.paperType ===3 && form.id)"> |
| | | <el-input v-model="titleItem.title" style="width: 50%"/> |
| | | <el-select @change="addQuestionType" v-model="titleItem.questionType" style="margin-left: 20px" |
| | | placeholder="请选择题目类型"> |
| | |
| | | :value="item.value" |
| | | :disabled="addedQuestionTypes.includes(item.value)"/><!-- 禁用已添加的选项 --> |
| | | </el-select> |
| | | <el-input-number v-show ="titleItem.questionList.length > 0" v-model="titleItem.eachScore" @change="updateScores(titleItem)" :min="0" :precision="1" |
| | | <el-input-number v-show="titleItem.questionList.length > 0" v-model="titleItem.eachScore" |
| | | @change="updateScores(titleItem)" :min="0" :precision="1" |
| | | style="margin-left: 20px" placeholder="每题分数"></el-input-number> |
| | | <el-button type="text" class="link-left" style="margin-left: 20px" size="mini" @click="addQuestion(titleItem)"> |
| | | 添加题目 |
| | |
| | | :controls="false" @change="updateTotalScore"/> |
| | | </el-col> |
| | | <el-col :span="3"> |
| | | <el-button type="text" size="mini" @click="removeQuestion(titleItem,questionItem)">删除 |
| | | <el-button type="text" size="mini" @click="removeQuestion(titleItem,questionIndex)">删除 |
| | | </el-button> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | <el-radio v-model="form.visibility" :label="'1'">私有</el-radio> |
| | | <el-radio v-model="form.visibility" :label="'2'">公开</el-radio> |
| | | </el-form-item> |
| | | <el-form-item v-show="form.paperType ===2 ||form.paperType ===3" :key="index" |
| | | <!-- 题目配置信息 随机试卷或新建随序才显示 --> |
| | | <el-form-item v-show="form.paperType ===2 || (form.paperType ===3 && !form.id)" :key="index" |
| | | :label="translateQuestionType(item.questionType)+':'" v-for="(item,index) in form.questionSetting"> |
| | | <div style="display: flex;"> |
| | | <div> |
| | | <span style="margin-right: 10px">{{ '标题' }}</span> |
| | | <el-input v-model="item.title" style="margin-right: 50px;width: 500px"/> |
| | | <span style="margin-right: 10px">{{ '数量' }}</span> |
| | | <el-input-number v-model="item.num" :precision="0" :min="0" style="margin-right: 50px"/> |
| | | <span style="margin-right: 10px">{{ '每题分数' }}</span> |
| | | <el-input-number v-model="item.score" :min="0" :precision="1"/> |
| | | <el-input v-model="item.title" style="margin-bottom: 20px;margin-right: 30px;width: 800px"/> |
| | | <el-button type="primary" @click=addToQuestionSetting(item.questionType) >添加</el-button> |
| | | |
| | | <div style="display: flex;" :key="index" v-for="(setting,index) in item.settingList"> |
| | | <span style="margin-right: 10px;margin-bottom: 10px;">{{ '难度' }}</span> |
| | | <el-rate v-model="setting.difficult" :precision="0" :min="0" style="margin-right: 25px;padding: 5px 0"/> |
| | | <span style="margin-right: 10px">{{ '科目' }}</span> |
| | | <el-select v-model="setting.subjectId" placeholder="学科" style="margin-right: 25px"> |
| | | <el-option v-for="item in subjects" :key="item.id" :label="item.name" :value="item.id"/> |
| | | </el-select> |
| | | <span style="margin-right: 10px">{{ '数量' }}</span> |
| | | <el-input-number v-model="setting.num" :precision="0" :min="0" style="margin-right: 25px"/> |
| | | <span style="margin-right: 10px">{{ '每题分数' }}</span> |
| | | <el-input-number v-model="setting.score" :min="0" :precision="1"/> |
| | | </div> |
| | | |
| | | </div> |
| | | </el-form-item> |
| | | <el-form-item label="合计:"> |
| | | <div style="display: flex;"> |
| | | <span style="margin-right: 10px">{{ '数量:' }}</span> |
| | | <span v-if ="form.paperType ===2 || (form.paperType ===3 && !form.id)" style="margin-right: 50px;width: 100px">{{ totalNum }}</span> |
| | | <span v-if ="form.paperType ===1" style="margin-right: 50px;width: 100px">{{ form.num }}</span> |
| | | <span v-if="form.paperType ===2 || (form.paperType ===3 && !form.id)" style="margin-right: 50px;width: 100px">{{ |
| | | totalNum |
| | | }}</span> |
| | | <span v-if="form.paperType ===1 || (form.paperType ===3 && form.id)" style="margin-right: 50px;width: 100px">{{ |
| | | form.num |
| | | }}</span> |
| | | <span style="margin-right: 10px">{{ '总分:' }}</span> |
| | | <span v-if ="form.paperType ===2 || (form.paperType ===3 && !form.id)" style="width: 100px">{{ totalScore }}</span> |
| | | <span v-if ="form.paperType ===1" style="width: 100px">{{ form.score }}</span> |
| | | <span v-if="form.paperType ===2 || (form.paperType ===3 && !form.id)" style="width: 100px">{{ |
| | | totalScore |
| | | }}</span> |
| | | <span v-if="form.paperType ===1 || (form.paperType ===3 && form.id)" style="width: 100px">{{ |
| | | form.score |
| | | }}</span> |
| | | </div> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="submitForm">提交</el-button> |
| | | <el-button @click="resetForm">重置</el-button> |
| | | <el-button type="success" @click="addTitle" v-show="form.paperType ===1">添加标题</el-button> |
| | | <el-button type="success" @click="addTitle" v-show="form.paperType ===1 ||(form.paperType ===3 && form.id)"> |
| | | 添加标题 |
| | | </el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | |
| | |
| | | deductTypeScore: 0, |
| | | visibility: '1', |
| | | questionSetting: [ |
| | | { questionType: 1, title: '单选题', score: null, num: null }, |
| | | { questionType: 2, title: '多选题', score: null, num: null }, |
| | | { questionType: 3, title: '判断题', score: null, num: null }, |
| | | { questionType: 4, title: '填空题', score: null, num: null }, |
| | | { questionType: 5, title: '简答题', score: null, num: null }, |
| | | { questionType: 6, title: '语音题', score: null, num: null }, |
| | | { questionType: 7, title: '计算题', score: null, num: null }, |
| | | { questionType: 8, title: '分析题', score: null, num: null }, |
| | | { |
| | | title: '单选题', |
| | | questionType: 1, |
| | | settingList: [{ difficult: null, score: null, num: null, subjectId: null }] |
| | | }, |
| | | { |
| | | title: '多选题', |
| | | questionType: 2, |
| | | settingList: [{ difficult: null, score: null, num: null, subjectId: null }] |
| | | }, |
| | | { |
| | | title: '判断题', |
| | | questionType: 3, |
| | | settingList: [{ difficult: null, score: null, num: null, subjectId: null }] |
| | | }, |
| | | { |
| | | title: '填空题', |
| | | questionType: 4, |
| | | settingList: [{ difficult: null, score: null, num: null, subjectId: null }] |
| | | }, |
| | | { |
| | | title: '简答题', |
| | | questionType: 5, |
| | | settingList: [{ difficult: null, score: null, num: null, subjectId: null }] |
| | | }, |
| | | { |
| | | title: '语音题', |
| | | questionType: 6, |
| | | settingList: [{ difficult: null, score: null, num: null, subjectId: null }] |
| | | }, |
| | | { |
| | | title: '计算题', |
| | | questionType: 7, |
| | | settingList: [{ difficult: null, score: null, num: null, subjectId: null }] |
| | | }, |
| | | { |
| | | title: '分析题', |
| | | questionType: 8, |
| | | settingList: [{ difficult: null, score: null, num: null, subjectId: null }] |
| | | } |
| | | ], |
| | | questionTitleList: [] |
| | | }, |
| | |
| | | { name: '简答题', value: 5 }, |
| | | { name: '语音题', value: 6 }, |
| | | { name: '计算题', value: 7 }, |
| | | { name: '分析题', value: 8 }, |
| | | { name: '分析题', value: 8 } |
| | | ], |
| | | addedQuestionTypes: [], // 已添加的题目类型 |
| | | subjects: [], |
| | |
| | | examPaperApi.select(id).then(re => { |
| | | _this.form = re.data |
| | | _this.formLoading = false |
| | | this.addQuestionType() |
| | | }) |
| | | } |
| | | }, |
| | | methods: { |
| | | addToQuestionSetting (questionType) { |
| | | this.form.questionSetting.forEach(item => { |
| | | if (item.questionType === questionType) { |
| | | item.settingList.push({ difficult: null, score: null, num: null, subjectId: null }) |
| | | } |
| | | }) |
| | | }, |
| | | updateTotalScore () { |
| | | this.form.score = 0 |
| | | this.form.questionTitleList.forEach(titleItem => { |
| | |
| | | this.questionPage.showDialog = true |
| | | this.search() |
| | | }, |
| | | removeTitleItem (titleItem ,index) { |
| | | removeTitleItem (titleItem, index) { |
| | | this.form.questionTitleList.splice(index, 1) |
| | | this.form.num = this.form.num - titleItem.questionList.length |
| | | this.updateTotalScore(); |
| | | this.updateTotalScore() |
| | | if (!this.form.questionTitleList || this.form.questionTitleList.length === 0) { |
| | | this.addedQuestionTypes = [] |
| | | } else { |
| | | this.addQuestionType() |
| | | } |
| | | }, |
| | | removeQuestion (titleItem ,questionIndex) { |
| | | titleItem.questionList.splice(questionIndex ,1) |
| | | this.updateTotalScore(); |
| | | removeQuestion (titleItem, questionIndex) { |
| | | titleItem.questionList.splice(questionIndex, 1) |
| | | this.updateTotalScore() |
| | | this.form.num = this.form.num - 1 |
| | | }, |
| | | queryForm () { |
| | |
| | | { questionType: 3, title: '判断题', score: null, num: null }, |
| | | { questionType: 4, title: '填空题', score: null, num: null }, |
| | | { questionType: 5, title: '简答题', score: null, num: null }, |
| | | { questionType: 6, title: '计算题', score: null, num: null }, |
| | | { questionType: 6, title: '语音题', score: null, num: null }, |
| | | { questionType: 7, title: '计算题', score: null, num: null }, |
| | | { questionType: 8, title: '分析题', score: null, num: null }, |
| | | ], |
| | | questionTitleList: [] |
| | | } |