Commit d8accb64 authored by 张俊's avatar 张俊

接口对接完成

parent e7ec996a
......@@ -66,13 +66,13 @@ export default {
this.editor = new E(this.$refs.toolbar);
this.editor.config.uploadImgShowBase64 = false; // base 64 存储图片
this.editor.config.uploadImgServer =
"/tp-jiwei-pcsvc/display/cigApi/common/uploadFile"; // 配置服务器端地址
"/apaas/static/image/upload"; // 配置服务器端地址
this.editor.config.uploadImgHeaders = {}; // 自定义 header
this.editor.config.uploadFileName = "file"; // 后端接受上传文件的参数名
// this.editor.config.uploadImgMaxSize = 2 * 1024 * 1024; // 将图片大小限制为 2M
this.editor.config.uploadImgMaxSize = 2 * 1024 * 1024; // 将图片大小限制为 2M
this.editor.config.uploadImgMaxLength = 6; // 限制一次最多上传 3 张图片
this.editor.config.uploadImgTimeout = 3 * 60 * 1000; // 设置超时时间
this.editor.config.uploadImgParams = { category: "图片" };
this.editor.config.uploadImgParams = { directory: "image" };
this.editor.config.uploadImgHooks = {
fail: (xhr, editor, result) => {
......@@ -95,13 +95,13 @@ export default {
//循环插入图片
// for (let i = 0; i < 1; i++) {
console.log(result);
let imgUrl = "/tp-jiwei-pcsvc/display" + result.data.visitPath;
let imgUrl = result.data;
console.log(imgUrl);
insertImg(imgUrl);
// }
}
};
this.editor.config.onchange = html => {
this.editor.config.onblur = html => {
this.info_ = html; // 绑定当前逐渐地值
this.$emit("change", this.info_); // 将内容同步到父组件中
};
......
......@@ -74,13 +74,13 @@ export default {
this.editor = new E(this.$refs.toolbar);
this.editor.config.uploadImgShowBase64 = false; // base 64 存储图片
this.editor.config.uploadImgServer =
"/tp-jiwei-pcsvc/display/cigApi/common/uploadFile"; // 配置服务器端地址
"/apaas/static/image/upload"; // 配置服务器端地址
this.editor.config.uploadImgHeaders = {}; // 自定义 header
this.editor.config.uploadFileName = "file"; // 后端接受上传文件的参数名
// this.editor.config.uploadImgMaxSize = 2 * 1024 * 1024; // 将图片大小限制为 2M
this.editor.config.uploadImgMaxSize = 2 * 1024 * 1024; // 将图片大小限制为 2M
this.editor.config.uploadImgMaxLength = 6; // 限制一次最多上传 3 张图片
this.editor.config.uploadImgTimeout = 3 * 60 * 1000; // 设置超时时间
this.editor.config.uploadImgParams = { category: "图片" };
this.editor.config.uploadImgParams = { directory: "image" };
this.editor.config.uploadImgHooks = {
fail: (xhr, editor, result) => {
......@@ -103,7 +103,7 @@ export default {
//循环插入图片
// for (let i = 0; i < 1; i++) {
console.log(result);
let imgUrl = "/tp-jiwei-pcsvc/display" + result.data.visitPath;
let imgUrl = result.data;
console.log(imgUrl);
insertImg(imgUrl);
// }
......@@ -113,7 +113,7 @@ export default {
this.editor.config.menus = this.menu
}
this.editor.config.showFullScreen = this.full
this.editor.config.onchange = html => {
this.editor.config.onblur = html => {
this.info_ = html; // 绑定当前逐渐地值
this.$emit("change", this.info_); // 将内容同步到父组件中
};
......
......@@ -5,28 +5,28 @@
<span>详情</span>
</p>
<div class="detail_content">
<div class="question">
<div class="question" v-if="question.title">
<p>{{ question.title }}</p>
<p>
<span class="left">
<span>{{ question.asker }}</span
>发布于 <span>{{ question.time }}</span>
<span>{{ question.user_name }}</span
>发布于 <span>{{ deal_time(question.updated) }}</span>
</span>
<span class="right">
<img src="../../../assets/imgs/jszc_ic_huida.png" alt="" />
<span>{{ question.info_count }}</span>
<span>{{ question.answer_num }}</span>
<img src="../../../assets/imgs/jszc_ic_liulan.png" alt="" />
<span>{{ question.watcher }}</span>
<span>{{ question.view }}</span>
</span>
</p>
<div class="ques_content" v-html="question.content"></div>
</div>
<div class="answer">
<p>{{question.info_count}}条回答</p>
<p>{{answer_total}}条回答</p>
<div class="answer_list">
<div class="answer_box" v-for="(item,index) in answer" :key="'answer'+index+200">
<div class="picture">
<img src="../../../assets/imgs/img_head.png" alt="" style="width:100%">
<img :src="item.user_picture_path" alt="" style="width:100%">
</div>
<div class="text" :style="index == answer.length-1||item.children?{border:'0'}:''">
<p>
......@@ -40,20 +40,21 @@
<div @click="showinput(index)" class="back" :style="item.children?{marginBottom:'10px'}:''"><img src="../../../assets/imgs/jszc_btn_huifu.png" alt=""> 回复</div>
<div class="back_input" v-if="answer_index === index">
<el-input
:placeholder="'回复'+back_person"
:placeholder="'回复'+item.username"
@blur="clear_index"
:ref="'input'+index"
v-model="back_info">
<div slot="prefix" style="height:48px;line-height:48px;">
<img src="../../../assets/imgs/img_head.png" alt="" style="width:24px;margin:0 10px 0 10px;vertical-align:-6px;"></div>
<div slot="suffix" class="back_solt">回复</div>
<img :src="user_info.picture_path" alt="" style="width:24px;margin:0 10px 0 10px;vertical-align:-6px;border-radius:50%;"></div>
<div slot="suffix" class="back_solt" @click="answer_question(item.id,item.user_id)">回复</div>
</el-input>
</div>
<div class="back_fllow answer_box" v-for="(it,idx) in item.children" :key="'ans_child'+idx+5000" v-if="idx<=4||answer_child_index===index">
<div :style="idx == item.children.length-1&&item.children.length<=5?{border:'0',overflow:'hidden',}:{borderBottom:'2px solid #f4f7fc',overflow:'hidden',}" >
<div class="picture">
<img src="../../../assets/imgs/img_head.png" alt="" style="width:100%">
<img :src="it.user_picture_path" alt="" style="width:100%">
</div>
<div class="text" :style="idx == item.children.length-1?{border:'0'}:''">
<div class="text" style="border:0;">
<p>
<span class="left">{{it.username}} <span><span style="color:#bcc1d0;margin:0 9px;">回复</span>{{it.answered_user}}</span> </span>
<span class="right">
......@@ -65,28 +66,32 @@
</div>
<div class="back_input" style="padding:0;height:auto;margin-bottom:0;" v-if="answer_count[0]==index&&answer_count[1]==idx">
<el-input
:placeholder="'回复'+back_person"
:placeholder="'回复'+it.username"
@blur="clear_index"
:ref="'input'+index+idx"
v-model="back_info">
<div slot="prefix" style="height:48px;line-height:48px;">
<img src="../../../assets/imgs/img_head.png" alt="" style="width:24px;margin:0 10px 0 10px;vertical-align:-6px;"></div>
<div slot="suffix" class="back_solt">回复</div>
<img :src="user_info.picture_path" alt="" style="width:24px;margin:0 10px 0 10px;vertical-align:-6px;border-radius:50%;"></div>
<div slot="suffix" class="back_solt" @click="answer_question(it.id,it.user_id)">回复</div>
</el-input>
</div>
</div>
</div>
<div class="under_count" v-if="item.children&&item.children.length>5&&answer_child_index!==index">
还有{{item.children.length-5}}条回复,<span @click="answer_child_index=index">点击查看</span>
</div>
<div class="under_count" v-if="item.children&&item.children.length>5&&answer_child_index===index">
<span @click="answer_child_index=-1">点击收起</span>
</div>
</div>
</div>
</div>
</div>
<div class="ans_self">
<p><img src="../../../assets/imgs/img_head.png" alt=""> <span>用户</span> </p>
<p><img :src="user_info.picture_path" alt=""> <span>{{user_info.user_name}}</span> </p>
<wang-e-bd class="editbox" v-model="editstr" :menu="menu" :full="false"></wang-e-bd>
<div class="pubilc"><img src="../../../assets/imgs/jszc_ic_fabu.png" alt="">发表</div>
<div class="pubilc" @click="answer_question1"><img src="../../../assets/imgs/jszc_ic_fabu.png" alt="">发表</div>
</div>
</div>
</div>
......@@ -101,19 +106,15 @@ export default {
},
data() {
return {
question: {
title: "为什么感知服务提示无法注册",
asker: "林有有",
time: "2020-10-11 18:23:52",
info_count: 12,
watcher: "1,024",
content: "<h1>hahahahha</h1><p>13123123123123</p>",
},
question: {},
answer_count:[],
answer_total:'',
answer_index:'',
answer_child_index:'',
back_person:'lll',
back_info:'',
user_info:{},
back_flag:true,
menu:[
'bold',
'foreColor',
......@@ -252,35 +253,130 @@ export default {
watch: {},
computed: {},
created() {
this.get_question()
this.get_answer()
this.get_user_info()
},
mounted() {},
methods: {
get_question(){
// /apaas/support/qa/question/detail?id=${this.$route.params.id}
this.$http
.get(
`/apaas/support/qa/question/detail?id=${this.$route.params.id}`
).then((res)=>{
if(res.data.success){
this.question = res.data.data
}
})
},
get_answer(){
// /apaas/support/qa/question/detail?id=${this.$route.params.id}
this.$http
.get(
`/apaas/support/qa/answer/detailList?id=${this.$route.params.id}&limit=1000&page=1`
).then((res)=>{
if(res.data.success){
this.answer = res.data.data
this.answer_total = res.data.total
}
})
},
get_user_info(){
this.$http
.get(
`/apaas/support/qa/info`
).then((res)=>{
if(res.data.success){
this.user_info = res.data.data
}
})
},
answer_question(contentid,userid){
if(this.back_info){
}else{
this.$message.error('请填写回复')
return
}
this.$http
.post(
`/apaas/support/qa/answer/create`,{
"question_id":parseInt(this.$route.params.id),
    "content":this.back_info,
    "parent_id":contentid,
    "answered_user_id":userid
}
).then((res)=>{
if(res.data.success){
this.$message.success('添加成功')
this.get_question()
this.get_answer()
}else{
this.$message.error('添加失败')
}
})
},
answer_question1(){
setTimeout(()=>{
if(!this.back_flag){
return
}
if(this.editstr){
}else{
this.$message.error('请填写回复')
return
}
this.back_flag = false
this.$http
.post(
`/apaas/support/qa/answer/create`,{
"question_id":parseInt(this.$route.params.id),
    "content":this.editstr,
}
).then((res)=>{
this.back_flag = true
if(res.data.success){
this.$message.success('添加成功')
this.editstr = ''
this.get_question()
this.get_answer()
}else{
this.$message.error('添加失败')
}
})
},100)
},
deal_time(time){
console.log(time);
return time.split('+')[0].replace("T"," ")
},
showinput(...arg){
console.log(arg);
this.answer_count=[]
this.answer_index=''
this.back_info = ''
if(!arg[1]&&arg[1]!==0){
this.answer_index = arg[0]
setTimeout(()=>{
this.$nextTick(()=>{
var temp = 'input'+arg[0]
this.$refs[temp][0].$refs.input.focus()
},200)
})
}else{
this.answer_count=arg
setTimeout(()=>{
this.$nextTick(()=>{
this.$refs['input'+arg[0]+arg[1]][0].$refs.input.focus();
},200)
})
}
},
clear_index(){
this.answer_count=[]
this.answer_index=''
setTimeout(()=>{
this.answer_count=[]
this.answer_index=''
this.back_info = ''
},500)
}
},
};
......@@ -489,6 +585,7 @@ export default {
font-size: 14px;
background-color: #fbfbfc;
padding-left: 24px;
margin-top: -16px;
}
.under_count span{
color: #515fe7;
......
......@@ -10,7 +10,7 @@
</div>
<div class="detail_edit">
<wang-e-bd class="editbox" v-model="editstr" :menu="menu" :full="false"></wang-e-bd>
<div class="pubilc"><img src="../../../assets/imgs/jszc_ic_fabu.png" alt="">发表</div>
<div class="pubilc" @click="add_question"><img src="../../../assets/imgs/jszc_ic_fabu.png" alt="">发表</div>
</div>
</div>
</div>
......@@ -35,6 +35,7 @@ export default {
'video'
],
editstr:'',
click_flag:true,
};
},
watch: {
......@@ -50,7 +51,43 @@ export default {
},
methods: {
add_question(){
if(!this.click_flag){
return
}
setTimeout(()=>{
if(this.title){
}else{
this.$message.error('请填写标题')
return
}
if(this.editstr){
}else{
this.$message.error('请填写内容')
return
}
this.click_flag = false
this.$http
.post(
`/apaas/support/qa/question/create`,{
title:this.title,
content:this.editstr
}
).then((res)=>{
this.click_flag = true
this.title = ''
this.editstr = ''
if(res.data.success){
this.$message.success('添加成功')
this.$router.push('/technical_support/answer_center/list')
}else{
this.$message.error('添加失败')
}
})
},100)
}
},
};
</script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment