mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-21 16:56:43 +08:00
2022年5月29日从svn移到git
This commit is contained in:
88
src/components/Qa/editQuestion.vue
Normal file
88
src/components/Qa/editQuestion.vue
Normal file
@@ -0,0 +1,88 @@
|
||||
<template>
|
||||
<el-dialog :close-on-click-modal="false" title="编辑问答" width="600px" :visible.sync="updateDialog" custom-class="g-dialog">
|
||||
<el-form ref="form" :model="editData" label-position="top" label-width="80px">
|
||||
<el-form-item label="回答内容">
|
||||
<el-input
|
||||
type="textarea"
|
||||
v-model="editData.content"
|
||||
placeholder="请输入详细描述"
|
||||
rows="8"
|
||||
minlength="1"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="updateDialog = false">取 消</el-button>
|
||||
<el-button type="success" @click="enSure">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import apiQa from '@/api/modules/qa.js';
|
||||
export default{
|
||||
props:{
|
||||
editData:{
|
||||
default:function(){
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
type:Object
|
||||
}
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
updateDialog:false,
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
//确认修改回答
|
||||
enSure() {
|
||||
if (!this.editData.content) {
|
||||
return this.$message({
|
||||
message: '回复内容不能为空',
|
||||
type: 'warning'
|
||||
});
|
||||
}
|
||||
// if(this.editData.content.length<0||this.editData.content.length>255){
|
||||
// return this.$message({
|
||||
// message: '回复内容为0-800个字',
|
||||
// type: 'warning'
|
||||
// });
|
||||
// }
|
||||
// let {answercontent,}
|
||||
let {answerid,content,sysCreateAid,favorites,praises,shares}=this.editData;
|
||||
apiQa
|
||||
.updateAnswer({id:answerid,sysCreateAid,content})
|
||||
.then(res => {
|
||||
if (res.status == 200) {
|
||||
this.$message({
|
||||
message: '修改成功',
|
||||
type: 'success'
|
||||
});
|
||||
this.updateDialog = false;
|
||||
this.$emit('enSure',true)
|
||||
} else {
|
||||
this.$message({
|
||||
message: '修改失败',
|
||||
type: 'error'
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.$message({
|
||||
message: '修改失败',
|
||||
type: 'error'
|
||||
});
|
||||
});
|
||||
// this.$message("修改成功")
|
||||
// this.editData={}
|
||||
// this.updateDialog = false
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
Reference in New Issue
Block a user