Files
learning-system-portal/src/views/feedback/Index.vue
2022-05-31 19:58:00 +08:00

223 lines
7.9 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<div class="g-content">
<div style="display:flex;justify-content: space-between;height: 40px;">
<div>
<div style="color: #ffaa00; ">您在使用的过程中碰到的问题都可以在这里提问我们会尽快回复您 </div>
</div>
<div style="text-align: right;">
<el-button @click="showAdd()" type="primary">反馈问题</el-button>
</div>
</div>
<div>
<el-row>
<el-col :span="24">
<div v-for="(item,idx) in pageData.list" :key="idx" class="problem" style="margin-top: 10px;">
<div class="problem-header">
<span style="padding-top: 10px;">{{item.userName}} {{item.addTime}}</span>
<span style="padding-right: 10px">
</span>
</div>
<div class="problem-body">
<div>{{item.content}}</div>
<div v-if="item.lastAnswer!=''" class="problem-reply">
<div><span style="color: #0081C2;"> 回复</span> <span>{{item.lastUser}} {{item.lastTime}}</span></div>
<div style="padding-left: 20px;">{{item.lastAnswer}}</div>
</div>
</div>
</div>
<div v-if="pageData.count>pageData.pageSize">
<pagination :size="pageData.pageSize" :total="pageData.count" :page="pageData.pageIndex" @change-size="changePageSize" @change-page="loadData" ></pagination>
</div>
</el-col>
</el-row>
</div>
<!--提交新问题-->
<el-dialog title="提交新问题" :close-on-click-modal="false" :visible.sync="formData.dlgShow" width="800px" custom-class="g-dialog">
<el-form :model="formData.data" size="medium" label-width="100px">
<el-form-item label="问题类型" >
<el-select clearable v-model="formData.data.qtype">
<el-option label="程序错误" value="程序错误"></el-option>
<el-option label="账号问题" value="账号问题"></el-option>
<el-option label="数据丢失" value="数据丢失"></el-option>
<el-option label="其它" value="其它"></el-option>
</el-select>
</el-form-item>
<el-form-item label="问题描述">
<el-input v-model="formData.data.content" rows="10" type="textarea" placeholder="尽量的详细描述问题" :maxlength="500" show-word-limit clearable :style="{width: '100%'}"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="formData.dlgShow= false"> </el-button>
<el-button type="primary" @click="submitAdd"> </el-button>
</span>
</el-dialog>
<!--回复问题-->
<el-dialog title="回复" :close-on-click-modal="false" :visible.sync="replyData.dlgShow" width="800px" custom-class="g-dialog">
<el-form :model="replyData.data" size="medium" label-width="100px">
<el-form-item label="问题">
{{replyData.content}}
</el-form-item>
<el-form-item label="回复内容">
<el-input v-model="replyData.data.content" rows="10" type="textarea" placeholder="" :maxlength="500" show-word-limit clearable :style="{width: '100%'}"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="replyData.dlgShow= false"> </el-button>
<el-button type="primary" @click="submitReply"> </el-button>
</span>
</el-dialog>
<el-dialog title="全部回复内容" :close-on-click-modal="false" :visible.sync="detail.dlgShow" width="800px" custom-class="g-dialog">
<div>
<div class="answer" v-for="(answer,aidx) in detail.answers" :key="aidx">
<div class="answer-header">{{answer.userName}} {{answer.addTime}}</div>
<div class="answer-body">{{answer.content}}</div>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="detail.dlgShow= false"> </el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
import feedback from '@/api/modules/feedback'
export default {
computed:{
...mapGetters(['userInfo']),
},
data(){
return {
queryPars:{name:'',mobile:'',status:''},
pageData:{list:[],count:0, pageIndex:1,pageSize:10},
formData:{
dlgShow:false,
data:{id:'',qtype:'',top:false,content:'',aid:'',userName:''}
},
replyData:{
dlgShow:false,
content:'',
data:{qid:'',best:false,parentId:'-1',content:'',aid:'',userName:'',valid:true}
},
detail:{
dlgShow:false,
answers:[]
}
}
},
mounted() {
this.loadData(1);
},
methods:{
loadData(pindex){
this.pageData.pageIndex=pindex;
let $this=this;
//加载加入申请
let params={
status:this.queryPars.status,
pageSize:this.pageData.pageSize,
pageIndex:this.pageData.pageIndex,
aid:this.userInfo.aid
}
feedback.list(params).then(res=>{
if(res.status==200){
$this.pageData.list=res.result.list;
$this.pageData.count=res.result.count;
}
}).catch(err=>{
$this.$message({ type: 'error', message: '查询数据错误:'+err});
});
},
changePageSize(ps){
this.pageData.pageSize=ps;
this.loadData(1);
},
showAdd(){
this.formData.dlgShow=true;
this.formData.data={id:'',qtype:'',top:false,content:'',aid:'',userName:''};
},
showDetail(item){
qa.detail(item.id).then(rs=>{
this.detail.answers=rs.result.answerList;
})
this.detail.dlgShow=true;
},
showReply(item){
this.replyData.dlgShow=true;
this.replyData.content=item.content;
this.replyData.data.qid=item.id;
this.replyData.data.content='';
this.replyData.data.userName=this.userInfo.name;
},
submitAdd(){
this.formData.data.userName=this.userInfo.name;
if(this.formData.data.qtype==''){
this.$message({ type: 'error', message: '请选择问题类型'});
return
}
if(this.formData.data.content==''){
this.$message({ type: 'error', message: '问题内容不能为空'});
return
}
qa.save(this.formData.data).then(res=>{
this.formData.dlgShow=false;
this.$message({ type: 'success', message:'添加成功'});
this.loadData(1);
}).catch(err=>{
this.$message({ type: 'error', message: '添加失败:'+err});
})
},
submitReply(){
if(this.replyData.data.content==''){
this.$message({ type: 'error', message: '回复内容不能为空'});
return
}
qa.reply(this.replyData.data).then(res=>{
this.replyData.dlgShow=false;
this.$message({ type: 'success', message:'回复成功'});
}).catch(err=>{
this.$message({ type: 'error', message: '回复处理失败:'+err});
})
}
}
}
</script>
<style lang="scss" scoped>
.problem{
margin: 10px;
border: 1px solid #e4e4e4;
}
.problem-header{
padding: 5px 10px;
line-height: 20px;
color: #8a8a8a;
display: flex;
justify-content: space-between;
border-bottom: 1px solid #e4e4e4;
}
.problem-body{
padding: 10px;
line-height: 28px;
}
.problem-reply{
padding-top: 8px;
color: #585858;
}
.answer{
margin: 10px;
border: 1px solid #f0f0f0;
}
.answer-header{
padding: 5px 10px;
color: #8a8a8a;
border-bottom: 1px solid #f0f0f0;
}
.answer-body{
padding: 10px;
line-height: 28px;
}
</style>