parent
25cd675698
commit
50a64770ee
@ -0,0 +1,174 @@ |
||||
<template> |
||||
<el-dialog title="试题" :close-on-click-modal="false" append-to-body :visible.sync="visible" width="800px" @close="closeDialog"> |
||||
<div> |
||||
<el-form ref="dialogForm" :model="dialogForm" :rules="dataRule" label-position="left" @keyup.enter.native="dialogFormSubmit()"> |
||||
<el-row> |
||||
<el-col :span="24"> |
||||
<el-form-item label="题目" prop="question"> |
||||
<el-input v-model="dialogForm.question" maxlength="200" placeholder="请输入题目" clearable /> |
||||
</el-form-item> |
||||
</el-col> |
||||
</el-row> |
||||
<el-row> |
||||
<el-col :span="24"> |
||||
<el-form-item label="选项" prop="question"> |
||||
A:<el-input v-model="dialogForm.chooseA" maxlength="200" placeholder="请输入" clearable /> |
||||
B:<el-input v-model="dialogForm.chooseB" maxlength="200" placeholder="请输入" clearable /> |
||||
C:<el-input v-model="dialogForm.chooseC" maxlength="200" placeholder="请输入" clearable /> |
||||
D:<el-input v-model="dialogForm.chooseD" maxlength="200" placeholder="请输入" clearable /> |
||||
E:<el-input v-model="dialogForm.chooseE" maxlength="200" placeholder="请输入" clearable /> |
||||
F:<el-input v-model="dialogForm.chooseF" maxlength="200" placeholder="请输入" clearable /> |
||||
G:<el-input v-model="dialogForm.chooseG" maxlength="200" placeholder="请输入" clearable /> |
||||
</el-form-item> |
||||
</el-col> |
||||
</el-row> |
||||
<el-row> |
||||
<el-col :span="24"> |
||||
<el-form-item label="答案" prop="trueAnswer"> |
||||
<span>{{ dialogForm.trueAnswer }}</span> |
||||
</el-form-item> |
||||
</el-col> |
||||
</el-row> |
||||
<el-row> |
||||
<el-col :span="24"> |
||||
<el-form-item label="科目" prop="subject"> |
||||
<span v-if="dialogForm.subject == 1">科一</span> |
||||
<span v-if="dialogForm.subject == 4">科四</span> |
||||
</el-form-item> |
||||
</el-col> |
||||
</el-row> |
||||
<el-row> |
||||
<el-col :span="8"> |
||||
<el-form-item label="精选500题" prop="isVip"> |
||||
<el-radio-group v-model="dialogForm.isVip" size="small"> |
||||
<el-radio :label="1">是</el-radio> |
||||
<el-radio :label="0">否</el-radio> |
||||
</el-radio-group> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="8"> |
||||
<el-form-item label="精选600题" prop="isVip2"> |
||||
<el-radio-group v-model="dialogForm.isVip2" size="small"> |
||||
<el-radio :label="1">是</el-radio> |
||||
<el-radio :label="0">否</el-radio> |
||||
</el-radio-group> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="8"> |
||||
<el-form-item label="是否易错题" prop="isError"> |
||||
<el-radio-group v-model="dialogForm.isError" size="small"> |
||||
<el-radio :label="1">是</el-radio> |
||||
<el-radio :label="0">否</el-radio> |
||||
</el-radio-group> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="8"> |
||||
<el-form-item label="是否新规" prop="isNew"> |
||||
<el-radio-group v-model="dialogForm.isNew" size="small"> |
||||
<el-radio :label="1">是</el-radio> |
||||
<el-radio :label="0">否</el-radio> |
||||
</el-radio-group> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="8"> |
||||
<el-form-item label="是否密卷1" prop="isExam1"> |
||||
<el-radio-group v-model="dialogForm.isExam1" size="small"> |
||||
<el-radio :label="1">是</el-radio> |
||||
<el-radio :label="0">否</el-radio> |
||||
</el-radio-group> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="8"> |
||||
<el-form-item label="是否密卷2" prop="isExam2"> |
||||
<el-radio-group v-model="dialogForm.isExam2" size="small"> |
||||
<el-radio :label="1">是</el-radio> |
||||
<el-radio :label="0">否</el-radio> |
||||
</el-radio-group> |
||||
</el-form-item> |
||||
</el-col> |
||||
</el-row> |
||||
<el-row> |
||||
<el-col :span="24"> |
||||
<el-form-item label="考点" prop="examKeys"> |
||||
<el-input v-model="dialogForm.examKeys" maxlength="200" placeholder="请输入考点" clearable /> |
||||
<span style="color:red;">包含多个考点,以英文";"分割!</span> |
||||
</el-form-item> |
||||
</el-col> |
||||
</el-row> |
||||
</el-form> |
||||
|
||||
</div> |
||||
<span slot="footer" class="dialog-footer"> |
||||
<el-button plain @click="(visible=false)">取消</el-button> |
||||
<el-button v-jclick type="primary" :disabled="!canSubmit" @click="dialogFormSubmit()">确定</el-button> |
||||
</span> |
||||
</el-dialog> |
||||
</template> |
||||
|
||||
<script> |
||||
import { addQuestion } from '@/api/question'; |
||||
|
||||
export default { |
||||
data () { |
||||
return { |
||||
visible: false, |
||||
canSubmit: true, |
||||
dialogForm: { |
||||
questionId: undefined, |
||||
isVip: 0, |
||||
isVip2: 0, |
||||
isError: 0, |
||||
isNew: 0, |
||||
isExam1: 0, |
||||
isExam2: 0, |
||||
examKeys: undefined |
||||
}, |
||||
dataRule: { |
||||
schoolName: [{ required: true, message: '驾校名称不能为空', trigger: 'blur' }], |
||||
status: [{ required: true, message: '状态不能为空', trigger: 'blur' }] |
||||
} |
||||
}; |
||||
}, |
||||
methods: { |
||||
init (info = undefined) { |
||||
// debugger |
||||
this.visible = true; |
||||
this.$nextTick(() => { |
||||
this.resetDialogForm(); |
||||
// this.$refs['dialogForm'].resetFields(); |
||||
if (info) { |
||||
this.dialogForm = this.deepClone(info); |
||||
} |
||||
}); |
||||
}, |
||||
resetDialogForm () { |
||||
this.dialogForm = { |
||||
questionId: undefined, |
||||
isVip: 0, |
||||
isVip2: 0, |
||||
isError: 0, |
||||
isNew: 0, |
||||
isExam1: 0, |
||||
isExam2: 0, |
||||
examKeys: undefined |
||||
}; |
||||
}, |
||||
closeDialog () { |
||||
this.$emit('update:dialogVisible', false); |
||||
}, |
||||
// 表单提交 |
||||
dialogFormSubmit () { |
||||
this.$refs.dialogForm.validate((valid) => { |
||||
if (valid) { |
||||
updateQuestion(this.dialogForm).then(response => { |
||||
if (response.code == 200) { |
||||
this.$modal.msgSuccess('修改成功'); |
||||
// this.visible = true; |
||||
} |
||||
}); |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
}; |
||||
</script> |
Loading…
Reference in new issue