<template>
|
<div class='comment'>
|
<v-header title="评论详情"></v-header>
|
<div class="text">
|
<section>
|
<p>评论内容:</p>
|
<article>{{detail.content}}</article>
|
</section>
|
<section>
|
<p>点赞数:</p>
|
<article>{{detail.fabulousNum}}</article>
|
</section>
|
<section>
|
<p>评论人:</p>
|
<article>{{detail.userName}}</article>
|
</section>
|
<section>
|
<p>账号:</p>
|
<article>{{detail.userPhone}}</article>
|
</section>
|
<section>
|
<p>评论时间:</p>
|
<article>{{detail.createAt?appTimeout(new Date(detail.createAt).getTime()):'--'}}</article>
|
</section>
|
</div>
|
<v-header title="评论回复列表"></v-header>
|
<div class="tab">
|
<v-tool-table
|
:trs="trs"
|
:tds="tds"
|
>
|
<template v-slot:btn="{scope}">
|
<div class="table_flex">
|
<span @click="onShowDetail(scope)">查看</span>
|
<span
|
@click="onToggleComment(scope,2)"
|
v-if="+scope.status===1"
|
>隐藏</span>
|
<span
|
@click="onToggleComment(scope,1)"
|
v-else
|
>显示</span>
|
</div>
|
</template>
|
<template v-slot:time="{scope}">
|
<span>{{scope.createAt?appTimeout(new Date(scope.createAt).getTime()):''}}</span>
|
</template>
|
<template v-slot:status="{scope}">
|
<span>{{+scope.status===1?'显示':'隐藏'}}</span>
|
</template>
|
</v-tool-table>
|
</div>
|
<v-tool-page
|
:item="paged"
|
@on-page="onPage"
|
></v-tool-page>
|
<div class="back"><button
|
class="m_btn small"
|
@click="$router.back()"
|
>返回</button></div>
|
</div>
|
</template>
|
|
<script>
|
export default {
|
props: {},
|
components: {},
|
data() {
|
return {
|
trs: [
|
{ text: "姓名", val: "userName" },
|
{ text: "账号", val: "userPhone" },
|
{ text: "内容", val: "replyContent" },
|
// { text: "点赞数(个)", val: "fabulousNum" },
|
{ text: "状态", val: "btn", slot: "status" },
|
{ text: "提交时间", val: "btn", slot: "time" },
|
{ text: "操作", val: "btn" },
|
],
|
paged: { page: 0, total: 0, r: 0, limit: 10 },
|
tds: [],
|
detail: {},
|
};
|
},
|
watch: {},
|
inject: ["appTimeout"],
|
methods: {
|
onPage(v) {
|
if (v.page === this.paged.page && v.page && !v.reset) {
|
return 0;
|
}
|
this.paged.page = v.page;
|
this.paged.limit = v.limit;
|
this.init();
|
},
|
init() {
|
let v = {
|
pageNum: this.paged.page,
|
pageSize: this.paged.limit,
|
id: this.$route.params.id,
|
};
|
this.$api.post("neighbor/detailNeighborCommentAllReply", v, (e) => {
|
this.paged.total = e.total;
|
this.tds = e.records;
|
});
|
},
|
onToggleComment(v, n) {
|
let txt = n === 1 ? "显示" : "隐藏";
|
this.$js.model("", "是否" + txt, (res) => {
|
if (res) {
|
this.$api.post(
|
"neighbor/changeCommentReplyStatusByAdmin",
|
{ id: v.id, status: n },
|
() => {
|
demo.toast(txt + "成功");
|
v.status = n;
|
}
|
);
|
}
|
});
|
},
|
onShowDetail(v) {
|
let v2 = demo.copy(v);
|
v2.time = this.appTimeout(new Date(v.createAt).getTime());
|
v2.status = +v2.status === 1 ? "显示" : "隐藏";
|
this.$store.dispatch("setFixed", {
|
event: "add",
|
data: { type: "neigh-comment", data: v2 },
|
timeout: Date.now(),
|
});
|
},
|
},
|
mounted() {
|
this.$api.get(
|
"neighbor/detailNeighborCommentByAdmin",
|
{ id: this.$route.params.id },
|
(e) => {
|
this.detail = e;
|
}
|
);
|
this.init();
|
},
|
};
|
</script>
|
<style lang='less' scoped>
|
.comment {
|
overflow-y: auto;
|
.text {
|
font-size: 14px;
|
section {
|
display: flex;
|
margin-bottom: 8px;
|
line-height: 1.5;
|
> p {
|
width: 80px;
|
text-align: right;
|
box-sizing: border-box;
|
padding-right: 8px;
|
}
|
article {
|
width: calc(100% - 120px);
|
}
|
}
|
}
|
.back {
|
margin: 30px 0;
|
.m_btn {
|
min-width: 80px;
|
}
|
}
|
}
|
</style>
|