|
|
|
@ -1,7 +1,14 @@ |
|
|
|
|
<template> |
|
|
|
|
<el-dialog title="试题" :close-on-click-modal="false" append-to-body :visible.sync="visible" width="900px" @close="closeDialog"> |
|
|
|
|
<div> |
|
|
|
|
<el-form ref="dialogForm" :model="dialogForm" :rules="dataRule" label-position="left" @keyup.enter.native="dialogFormSubmit()"> |
|
|
|
|
<el-form |
|
|
|
|
ref="dialogForm" |
|
|
|
|
:model="dialogForm" |
|
|
|
|
:rules="dataRule" |
|
|
|
|
label-width="80px" |
|
|
|
|
label-position="left" |
|
|
|
|
@keyup.enter.native="dialogFormSubmit()" |
|
|
|
|
> |
|
|
|
|
<el-row> |
|
|
|
|
<el-col :span="24"> |
|
|
|
|
<el-form-item label="题目" prop="question"> |
|
|
|
@ -9,7 +16,7 @@ |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-col> |
|
|
|
|
</el-row> |
|
|
|
|
<el-row> |
|
|
|
|
<el-row :gutter="20"> |
|
|
|
|
<el-col :span="12"> |
|
|
|
|
<el-form-item label="选项A" prop="question"> |
|
|
|
|
<el-input v-model="dialogForm.chooseA" maxlength="200" placeholder="请输入" clearable /> |
|
|
|
@ -21,7 +28,7 @@ |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-col> |
|
|
|
|
</el-row> |
|
|
|
|
<el-row> |
|
|
|
|
<el-row :gutter="20"> |
|
|
|
|
<el-col :span="12"> |
|
|
|
|
<el-form-item label="选项C" prop="question"> |
|
|
|
|
<el-input v-model="dialogForm.chooseC" maxlength="200" placeholder="请输入" clearable /> |
|
|
|
@ -33,7 +40,7 @@ |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-col> |
|
|
|
|
</el-row> |
|
|
|
|
<el-row> |
|
|
|
|
<el-row :gutter="20"> |
|
|
|
|
<el-col :span="12"> |
|
|
|
|
<el-form-item label="选项E" prop="question"> |
|
|
|
|
<el-input v-model="dialogForm.chooseE" maxlength="200" placeholder="请输入" clearable /> |
|
|
|
@ -45,7 +52,7 @@ |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-col> |
|
|
|
|
</el-row> |
|
|
|
|
<el-row> |
|
|
|
|
<el-row :gutter="20"> |
|
|
|
|
<el-col :span="12"> |
|
|
|
|
<el-form-item label="选项G" prop="question"> |
|
|
|
|
<el-input v-model="dialogForm.chooseG" maxlength="200" placeholder="请输入" clearable /> |
|
|
|
@ -63,11 +70,11 @@ |
|
|
|
|
<el-col :span="24"> |
|
|
|
|
<el-form-item label="科目" prop="subject"> |
|
|
|
|
<span v-if="dialogForm.subject == 1">科一</span> |
|
|
|
|
<span v-if="dialogForm.subject == 4">科四</span> |
|
|
|
|
<span v-else-if="dialogForm.subject == 4">科四</span> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-col> |
|
|
|
|
</el-row> |
|
|
|
|
<el-row> |
|
|
|
|
<el-row :gutter="20"> |
|
|
|
|
<el-col :span="8"> |
|
|
|
|
<el-form-item label="精选500题" prop="isVip"> |
|
|
|
|
<el-radio-group v-model="dialogForm.isVip" size="small"> |
|
|
|
@ -132,11 +139,25 @@ |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-col> |
|
|
|
|
</el-row> |
|
|
|
|
<el-row :gutter="20"> |
|
|
|
|
<el-form-item label="题目图片" prop="imageUrl"> |
|
|
|
|
<el-upload |
|
|
|
|
action="#" |
|
|
|
|
accept=".png,.jpg,.jpeg,.gif" |
|
|
|
|
:limit="1" |
|
|
|
|
:http-request="handleImport" |
|
|
|
|
:on-exceed="handleExceed" |
|
|
|
|
:show-file-list="false" |
|
|
|
|
> |
|
|
|
|
<img v-if="dialogForm.imageUrl" :src="dialogForm.imageUrl" style="width: 200px;"> |
|
|
|
|
<i v-else class="el-icon-plus" /> |
|
|
|
|
</el-upload> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-row> |
|
|
|
|
</el-form> |
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
|
<span slot="footer" class="dialog-footer"> |
|
|
|
|
<el-button plain @click="(visible=false)">取消</el-button> |
|
|
|
|
<el-button plain @click="visible = false">取消</el-button> |
|
|
|
|
<el-button v-jclick type="primary" :disabled="!canSubmit" @click="dialogFormSubmit()">确定</el-button> |
|
|
|
|
</span> |
|
|
|
|
</el-dialog> |
|
|
|
@ -197,7 +218,7 @@ export default { |
|
|
|
|
dialogFormSubmit() { |
|
|
|
|
this.$refs.dialogForm.validate((valid) => { |
|
|
|
|
if (valid) { |
|
|
|
|
updateQuestion(this.dialogForm).then(response => { |
|
|
|
|
addQuestion(this.dialogForm).then((response) => { |
|
|
|
|
if (response.code == 200) { |
|
|
|
|
this.$modal.msgSuccess('修改成功'); |
|
|
|
|
// this.visible = true; |
|
|
|
@ -205,6 +226,20 @@ export default { |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
handleImport(opt) { |
|
|
|
|
const data = new FormData(); |
|
|
|
|
data.append('file', opt.file); |
|
|
|
|
// 上传 |
|
|
|
|
// api.upload(data).then(resp => { |
|
|
|
|
// if (resp.code == 200) { |
|
|
|
|
// this.$modal.msgSuccess('文件上传成功'); |
|
|
|
|
// this.dialogForm.imageUrl = resp.data; |
|
|
|
|
// } |
|
|
|
|
// }); |
|
|
|
|
}, |
|
|
|
|
handleExceed(files) { |
|
|
|
|
this.handleImport({ file: files[0] }); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|