|
|
@ -6,21 +6,40 @@ |
|
|
|
<el-col :span="24"> |
|
|
|
<el-col :span="24"> |
|
|
|
<el-form-item label="题目" prop="question"> |
|
|
|
<el-form-item label="题目" prop="question"> |
|
|
|
<div>{{ dialogForm.question }}</div> |
|
|
|
<div>{{ dialogForm.question }}</div> |
|
|
|
<img v-if="dialogForm.imageUrl" :src="dialogForm.imageUrl" width="100" alt=""> |
|
|
|
<img v-if="dialogForm.imageUrl" :src="dialogForm.imageUrl" width="200" alt="" /> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
</el-row> |
|
|
|
|
|
|
|
<el-row> |
|
|
|
|
|
|
|
<el-form-item label="替换图片"> |
|
|
|
|
|
|
|
<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: 300px" /> |
|
|
|
|
|
|
|
<i v-else class="el-icon-plus" /> |
|
|
|
|
|
|
|
</el-upload> |
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
</el-row> |
|
|
|
<el-row> |
|
|
|
<el-row> |
|
|
|
<el-col :span="24"> |
|
|
|
<el-col :span="24"> |
|
|
|
<el-form-item label="选项" prop="question"> |
|
|
|
<el-form-item label="选项" prop="question"> |
|
|
|
<span v-if="dialogForm.chooseA">A:{{ dialogForm.chooseA }}<span> |
|
|
|
<span v-if="dialogForm.chooseA" |
|
|
|
|
|
|
|
>A:{{ dialogForm.chooseA |
|
|
|
|
|
|
|
}}<span> |
|
|
|
<span v-if="dialogForm.chooseB">B:{{ dialogForm.chooseB }} </span> |
|
|
|
<span v-if="dialogForm.chooseB">B:{{ dialogForm.chooseB }} </span> |
|
|
|
<span v-if="dialogForm.chooseC">C:{{ dialogForm.chooseC }} </span> |
|
|
|
<span v-if="dialogForm.chooseC">C:{{ dialogForm.chooseC }} </span> |
|
|
|
<span v-if="dialogForm.chooseD">D:{{ dialogForm.chooseD }}</span> |
|
|
|
<span v-if="dialogForm.chooseD">D:{{ dialogForm.chooseD }}</span> |
|
|
|
<span v-if="dialogForm.chooseE">E:{{ dialogForm.chooseE }}</span> |
|
|
|
<span v-if="dialogForm.chooseE">E:{{ dialogForm.chooseE }}</span> |
|
|
|
<span v-if="dialogForm.chooseF">F:{{ dialogForm.chooseF }}</span> |
|
|
|
<span v-if="dialogForm.chooseF">F:{{ dialogForm.chooseF }}</span> |
|
|
|
<span v-if="dialogForm.chooseG">G:{{ dialogForm.chooseG }}</span> |
|
|
|
<span v-if="dialogForm.chooseG">G:{{ dialogForm.chooseG }}</span> |
|
|
|
</span></span></el-form-item> |
|
|
|
</span></span |
|
|
|
|
|
|
|
></el-form-item |
|
|
|
|
|
|
|
> |
|
|
|
</el-col> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
</el-row> |
|
|
|
<el-row> |
|
|
|
<el-row> |
|
|
@ -104,18 +123,17 @@ |
|
|
|
</el-col> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
</el-row> |
|
|
|
</el-form> |
|
|
|
</el-form> |
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<span slot="footer" class="dialog-footer"> |
|
|
|
<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> |
|
|
|
<el-button v-jclick type="primary" :disabled="!canSubmit" @click="dialogFormSubmit()">确定</el-button> |
|
|
|
</span> |
|
|
|
</span> |
|
|
|
</el-dialog> |
|
|
|
</el-dialog> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
<script> |
|
|
|
import { updateQuestion } from '@/api/question'; |
|
|
|
import { updateQuestion, uploadFile } from '@/api/question'; |
|
|
|
|
|
|
|
// import axios from 'axios'; |
|
|
|
export default { |
|
|
|
export default { |
|
|
|
data() { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
return { |
|
|
@ -146,6 +164,7 @@ export default { |
|
|
|
// this.$refs['dialogForm'].resetFields(); |
|
|
|
// this.$refs['dialogForm'].resetFields(); |
|
|
|
if (info) { |
|
|
|
if (info) { |
|
|
|
this.dialogForm = this.deepClone(info); |
|
|
|
this.dialogForm = this.deepClone(info); |
|
|
|
|
|
|
|
this.fileUrl = info.imageUrl; |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
@ -168,7 +187,7 @@ export default { |
|
|
|
dialogFormSubmit() { |
|
|
|
dialogFormSubmit() { |
|
|
|
this.$refs.dialogForm.validate((valid) => { |
|
|
|
this.$refs.dialogForm.validate((valid) => { |
|
|
|
if (valid) { |
|
|
|
if (valid) { |
|
|
|
updateQuestion(this.dialogForm).then(response => { |
|
|
|
updateQuestion(this.dialogForm).then((response) => { |
|
|
|
if (response.code == 200) { |
|
|
|
if (response.code == 200) { |
|
|
|
this.$modal.msgSuccess('修改成功'); |
|
|
|
this.$modal.msgSuccess('修改成功'); |
|
|
|
this.$emit('update'); |
|
|
|
this.$emit('update'); |
|
|
@ -177,6 +196,32 @@ export default { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
handleImport(opt) { |
|
|
|
|
|
|
|
const data = new FormData(); |
|
|
|
|
|
|
|
data.append('file', opt.file); |
|
|
|
|
|
|
|
// axios({ |
|
|
|
|
|
|
|
// method: 'post', |
|
|
|
|
|
|
|
// url: 'http://xj.ahduima.com/xunjia/tiku/question/upload', |
|
|
|
|
|
|
|
// data: data |
|
|
|
|
|
|
|
// }).then((resp) => { |
|
|
|
|
|
|
|
// console.log(resp.data); |
|
|
|
|
|
|
|
// if (resp.data.code == 200) { |
|
|
|
|
|
|
|
// this.$modal.msgSuccess('文件上传成功'); |
|
|
|
|
|
|
|
// this.dialogForm.imageUrl = resp.data.msg; |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
// console.log(this.dialogForm) |
|
|
|
|
|
|
|
// }); |
|
|
|
|
|
|
|
// 上传 |
|
|
|
|
|
|
|
uploadFile(data).then(resp => { |
|
|
|
|
|
|
|
if (resp.code == 200) { |
|
|
|
|
|
|
|
this.$modal.msgSuccess('文件上传成功'); |
|
|
|
|
|
|
|
this.dialogForm.imageUrl = resp.msg; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
handleExceed(files) { |
|
|
|
|
|
|
|
this.handleImport({ file: files[0] }); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|