优化工具箱详情页评论功能及API接口
This commit is contained in:
@ -1,6 +1,8 @@
|
||||
<template>
|
||||
<div class="mt-[30px] w-[100%]">
|
||||
<div class="h-[48px] w-[100%] rounded-[1px] bg-[#F8F8F8] pl-[10px] text-[16px] text-[#333333] font-normal line-height-[50px]"> 共有{{ result.total || 0 }}条评论 </div>
|
||||
<div class="h-[48px] w-[100%] rounded-[1px] bg-[#F8F8F8] pl-[10px] text-[16px] text-[#333333] font-normal line-height-[50px]">
|
||||
共有{{ result.total || 0 }}条评论
|
||||
</div>
|
||||
<div v-for="item in result.list" :key="item.id" class="mt-[20px] border-b-[1px] border-b-[#eee] border-b-solid pb-[14px]">
|
||||
<div class="flex items-start">
|
||||
<el-avatar :src="item.creatorInfo.avatar" alt="" srcset="" class="h-[50px] w-[49px] rounded-full" />
|
||||
@ -44,7 +46,7 @@
|
||||
},
|
||||
projectId: {
|
||||
type: Number,
|
||||
required: true,
|
||||
required: false,
|
||||
},
|
||||
})
|
||||
|
||||
@ -66,7 +68,12 @@
|
||||
|
||||
// 获取评论列表
|
||||
const handleGetCommentList = async () => {
|
||||
const res = await getCommentList({ relationId: props.relationId, pageNum: query.value.pageNo, pageSize: query.value.pageSize })
|
||||
const res = await getCommentList({
|
||||
relationId: props.relationId,
|
||||
pageNum: query.value.pageNo,
|
||||
pageSize: query.value.pageSize,
|
||||
type: props.projectId ? 1 : 2,
|
||||
})
|
||||
if (res.code === 0) {
|
||||
result.value.list = res.data.list
|
||||
result.value.total = res.data.total
|
||||
@ -75,7 +82,7 @@
|
||||
|
||||
// 发表评论
|
||||
const handleCreateComment = async () => {
|
||||
const res = await createComment({ relationId: props.relationId, content: commentContent.value, projectId: props.projectId })
|
||||
const res = await createComment({ relationId: props.relationId, content: commentContent.value, projectId: props.projectId, type: props.projectId ? 1 : 2 })
|
||||
if (res.code === 0) {
|
||||
commentContent.value = ''
|
||||
query.value.pageNo = 1
|
||||
@ -87,8 +94,9 @@
|
||||
() => props.relationId,
|
||||
() => {
|
||||
handleGetCommentList()
|
||||
},{
|
||||
immediate: true
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
}
|
||||
)
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user