Commit d27c444f authored by 徐一鸣's avatar 徐一鸣

问答中心

parent 6cb66255
<template>
<div class="detail_box">
<p class="now_page_title">
技术支持 / 问答中心 /
<span>发帖提问</span>
</p>
<div class="apass_breadcrumb">
<el-breadcrumb separator="/">
<el-breadcrumb-item to="/technical_support">
技术支持
</el-breadcrumb-item>
<el-breadcrumb-item to="/technical_support/answer_center">
问答中心
</el-breadcrumb-item>
<el-breadcrumb-item> 发帖提问 </el-breadcrumb-item>
</el-breadcrumb>
</div>
<div class="detail_content">
<div class="detail_title">
<el-input v-model="title" placeholder="请输入问题标题"></el-input>
......@@ -93,15 +100,8 @@ export default {
</script>
<style scoped>
.detail_box {
}
.now_page_title {
margin: 13px 0;
color: #898d9e;
}
.now_page_title span {
color: #242c43;
.apass_breadcrumb > .el-breadcrumb {
padding: 12px 0 11px;
}
.detail_content {
width: 100%;
......
......@@ -29,7 +29,11 @@
</el-button>
</span>
<span>
<el-input placeholder="请输入搜索内容"></el-input>
<el-input
v-model="searchText"
placeholder="请输入搜索内容"
@input="searchInput"
></el-input>
</span>
<span>
<el-button type="primary" @click="intoAnswerPage">
......@@ -48,13 +52,13 @@
@click="viewItem(item)"
>
<h3 class="answer_title" v-text="item.title"></h3>
<p class="answer_content" v-text="item.content"></p>
<p class="answer_content" v-text="getContentText(item.content)"></p>
<p class="answer_info">
<span>
<img class="user_img" :src="item.picture_path" />
<span class="user_name" v-text="item.user_name"></span>
<span class="user_text">发布于</span>
<span class="user_time" v-text="item.created"></span>
<span class="user_time" v-text="getTimeText(item.created)"></span>
</span>
<span>
<span class="num_answer" v-text="item.answer_num"></span>
......@@ -78,6 +82,7 @@
</template>
<script>
import helper from "@/services/helper.js";
import ListPagination from "@/components/comments-pagination";
export default {
......@@ -87,11 +92,13 @@ export default {
data() {
return {
answerList: [],
sortType: 0, // 0:最新问题 1:最热问题
listTotal: 0,
pageSizes: [10, 20, 50],
pageSize: 10,
currentPage: 1,
sortType: 0, // 0:最新问题 1:最热问题
searchText: "",
inputTimer: null,
};
},
created() {
......@@ -99,144 +106,38 @@ export default {
},
methods: {
getAnwerList() {
this.answerList = [
{
id: 1,
title: "平台的流程引擎怎么样", // 标题
content: "我们想用流程引擎,不会用,求大神指点", // 内容
created_by: "abc", // 发布人的userid
created: "2020-10-21T14:28:10+08:00", // 发布时间
updated: "2020-10-21T14:28:10+08:00", // 更新时间
view: 0, // 浏览量
answer_num: 2, // 回答数,
user_name: "普通neo", // 发布人
picture_path:
"http://pic1.win4000.com/tj/2017-07-11/596437562ae53.jpg",
},
{
id: 2,
title: "平台的流程引擎怎么样6666", // 标题
content: "我们想用流程引擎,不会用,求大神指点", // 内容
created_by: "abc", // 发布人的userid
created: "2020-10-21T14:28:10+08:00", // 发布时间
updated: "2020-10-21T14:28:10+08:00", // 更新时间
view: 0, // 浏览量
answer_num: 2, // 回答数,
user_name: "普通neo", // 发布人
picture_path:
"http://pic1.win4000.com/tj/2017-07-11/596437562ae53.jpg",
},
{
id: 3,
title: "平台的流程引擎怎么样23233333", // 标题
content: "我们想用流程引擎,不会用,求大神指点", // 内容
created_by: "abc", // 发布人的userid
created: "2020-10-21T14:28:10+08:00", // 发布时间
updated: "2020-10-21T14:28:10+08:00", // 更新时间
view: 0, // 浏览量
answer_num: 2, // 回答数,
user_name: "普通neo", // 发布人
picture_path:
"http://pic1.win4000.com/tj/2017-07-11/596437562ae53.jpg",
},
{
id: 4,
title: "平台的流程引擎怎么样23233333", // 标题
content: "我们想用流程引擎,不会用,求大神指点", // 内容
created_by: "abc", // 发布人的userid
created: "2020-10-21T14:28:10+08:00", // 发布时间
updated: "2020-10-21T14:28:10+08:00", // 更新时间
view: 0, // 浏览量
answer_num: 2, // 回答数,
user_name: "普通neo", // 发布人
picture_path:
"http://pic1.win4000.com/tj/2017-07-11/596437562ae53.jpg",
},
{
id: 5,
title: "平台的流程引擎怎么样23233333", // 标题
content: "我们想用流程引擎,不会用,求大神指点", // 内容
created_by: "abc", // 发布人的userid
created: "2020-10-21T14:28:10+08:00", // 发布时间
updated: "2020-10-21T14:28:10+08:00", // 更新时间
view: 0, // 浏览量
answer_num: 2, // 回答数,
user_name: "普通neo", // 发布人
picture_path:
"http://pic1.win4000.com/tj/2017-07-11/596437562ae53.jpg",
},
{
id: 1,
title: "平台的流程引擎怎么样", // 标题
content: "我们想用流程引擎,不会用,求大神指点", // 内容
created_by: "abc", // 发布人的userid
created: "2020-10-21T14:28:10+08:00", // 发布时间
updated: "2020-10-21T14:28:10+08:00", // 更新时间
view: 0, // 浏览量
answer_num: 2, // 回答数,
user_name: "普通neo", // 发布人
picture_path:
"http://pic1.win4000.com/tj/2017-07-11/596437562ae53.jpg",
},
{
id: 2,
title: "平台的流程引擎怎么样6666", // 标题
content: "我们想用流程引擎,不会用,求大神指点", // 内容
created_by: "abc", // 发布人的userid
created: "2020-10-21T14:28:10+08:00", // 发布时间
updated: "2020-10-21T14:28:10+08:00", // 更新时间
view: 0, // 浏览量
answer_num: 2, // 回答数,
user_name: "普通neo", // 发布人
picture_path:
"http://pic1.win4000.com/tj/2017-07-11/596437562ae53.jpg",
},
{
id: 3,
title: "平台的流程引擎怎么样23233333", // 标题
content: "我们想用流程引擎,不会用,求大神指点", // 内容
created_by: "abc", // 发布人的userid
created: "2020-10-21T14:28:10+08:00", // 发布时间
updated: "2020-10-21T14:28:10+08:00", // 更新时间
view: 0, // 浏览量
answer_num: 2, // 回答数,
user_name: "普通neo", // 发布人
picture_path:
"http://pic1.win4000.com/tj/2017-07-11/596437562ae53.jpg",
},
{
id: 4,
title: "平台的流程引擎怎么样23233333", // 标题
content: "我们想用流程引擎,不会用,求大神指点", // 内容
created_by: "abc", // 发布人的userid
created: "2020-10-21T14:28:10+08:00", // 发布时间
updated: "2020-10-21T14:28:10+08:00", // 更新时间
view: 0, // 浏览量
answer_num: 2, // 回答数,
user_name: "普通neo", // 发布人
picture_path:
"http://pic1.win4000.com/tj/2017-07-11/596437562ae53.jpg",
},
{
id: 5,
title: "平台的流程引擎怎么样23233333", // 标题
content: "我们想用流程引擎,不会用,求大神指点", // 内容
created_by: "abc", // 发布人的userid
created: "2020-10-21T14:28:10+08:00", // 发布时间
updated: "2020-10-21T14:28:10+08:00", // 更新时间
view: 0, // 浏览量
answer_num: 2, // 回答数,
user_name: "普通neo", // 发布人
picture_path:
"http://pic1.win4000.com/tj/2017-07-11/596437562ae53.jpg",
},
];
this.listTotal = 15;
this.$http
.get("/apaas/support/qa/question/list", {
params: {
style: 1,
order: this.sortType === 0 ? "" : "created",
search: this.searchText,
limit: this.pageSize,
page: this.currentPage,
},
})
.then(({ data }) => {
if (data.success) {
this.answerList = data.data || [];
this.listTotal = data.total;
}
});
},
selectSortType(type) {
this.sortType = type;
this.getAnwerList();
},
searchInput() {
if (this.inputTimer) {
clearTimeout(this.inputTimer);
}
this.inputTimer = setTimeout(() => {
console.log(this.searchText);
this.currentPage = 1;
this.getAnwerList();
}, 200);
},
changePageSize(value) {
this.pageSize = value;
this.currentPage = 1;
......@@ -252,6 +153,18 @@ export default {
intoAnswerPage() {
this.$router.push("/technical_support/answer_center/edit");
},
getTimeText(time) {
return helper.dateStringTransform(time || "");
},
getContentText(content) {
let text = content.replace(/<img[^>]+>/g, "【图片】");
text = text.replace(/<iframe(([\s\S])*?)<\/iframe>/g, "【视频】");
text = text.replace(/<pre(([\s\S])*?)<\/pre>/g, "【代码】");
text = text.replace(/<\/?.+?>/g, "");
return text;
},
},
};
</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