From d8accb6445ce7eaebf7f040dade9f180ecc4ee59 Mon Sep 17 00:00:00 2001 From: zhangjun1 Date: Sat, 24 Oct 2020 17:34:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=AF=B9=E6=8E=A5=E5=AE=8C?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/wangE.vue | 10 +- src/components/wangEBd.vue | 10 +- .../answer-center/detail.vue | 163 ++++++++++++++---- .../technical-support/answer-center/edit.vue | 41 ++++- 4 files changed, 179 insertions(+), 45 deletions(-) diff --git a/src/components/wangE.vue b/src/components/wangE.vue index a25acfb..a20bcd7 100644 --- a/src/components/wangE.vue +++ b/src/components/wangE.vue @@ -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_); // 将内容同步到父组件中 }; diff --git a/src/components/wangEBd.vue b/src/components/wangEBd.vue index 2200251..d8a0d9d 100644 --- a/src/components/wangEBd.vue +++ b/src/components/wangEBd.vue @@ -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_); // 将内容同步到父组件中 }; diff --git a/src/pages/technical-support/answer-center/detail.vue b/src/pages/technical-support/answer-center/detail.vue index d1a8d1a..65bc2c7 100644 --- a/src/pages/technical-support/answer-center/detail.vue +++ b/src/pages/technical-support/answer-center/detail.vue @@ -5,28 +5,28 @@ 详情

-
+

{{ question.title }}

- {{ question.asker }}发布于 {{ question.time }} + {{ question.user_name }}发布于 {{ deal_time(question.updated) }} - {{ question.info_count }} + {{ question.answer_num }} - {{ question.watcher }} + {{ question.view }}

-

{{question.info_count}}条回答

+

{{answer_total}}条回答

- +

@@ -40,20 +40,21 @@

回复
-
-
回复
+
+
回复
+
- +
-
+

{{it.username}} 回复{{it.answered_user}} @@ -65,28 +66,32 @@

-
-
回复
+
+
回复
+
还有{{item.children.length-5}}条回复,点击查看
+
+ 点击收起 +
-

用户

+

{{user_info.user_name}}

-
发表
+
发表
@@ -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: "

hahahahha

13123123123123

", - }, + 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; diff --git a/src/pages/technical-support/answer-center/edit.vue b/src/pages/technical-support/answer-center/edit.vue index 64b04b9..a21bc99 100644 --- a/src/pages/technical-support/answer-center/edit.vue +++ b/src/pages/technical-support/answer-center/edit.vue @@ -10,7 +10,7 @@
-
发表
+
发表
@@ -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) + } }, }; -- 2.26.0