feat:完善评论功能

This commit is contained in:
陈淳
2023-03-24 17:33:05 +08:00
parent af80d8e89b
commit fd3142bc19
7 changed files with 18 additions and 11 deletions

View File

@@ -5,7 +5,7 @@
</el-tabs>
<div class="total">
<div style="align-self: center;"> {{total}}个评论</div>
<div style="align-self: center;"> {{total}}个评论</div>
<div> <el-radio-group v-model="selectRadio">
<el-radio-button label="new" name="new">最新</el-radio-button>
<el-radio-button label="host" name="host">最热</el-radio-button>
@@ -15,7 +15,7 @@
<el-divider />
<el-input v-model="form.content" placeholder="发表一个友善的评论吧~" :rows="5" type="textarea"></el-input>
<el-input v-model="topContent" placeholder="发表一个友善的评论吧~" :rows="5" type="textarea"></el-input>
<el-button @click="addTopComment" type="primary" class="btn-top-comment">发表评论</el-button>
<el-button class="btn-top-comment">其他</el-button>
@@ -66,11 +66,10 @@
</div>
<el-divider />
</div>
<el-empty v-show="commentList.length<=0" description="评论空空如也,快来抢占沙发~" />
</template>
<script setup>
import { onMounted, reactive, ref } from "vue";
@@ -82,6 +81,7 @@ const route = useRoute();
const router = useRouter();
const commentList = ref([]);
const query = reactive({});
const topContent=ref('');
//当前回复id
const replayId = ref('');
//回复文本框
@@ -104,6 +104,7 @@ onMounted(async () => {
await loadComment();
});
const loadComment = async () => {
topContent.value='';
form.content = '';
const response = await getListByDiscussId(route.params.discussId, query);
commentList.value = response.data.items;
@@ -112,6 +113,7 @@ const loadComment = async () => {
const addTopComment = async () => {
form.parentId = 0;
form.rootId = 0;
form.content=topContent.value;
await addComment();
}
const addComment = async () => {

View File

@@ -261,12 +261,14 @@ const updateArticle = (node, data) => {
router.push(routerPer);
}
//单机节点
const handleNodeClick = (data) => {
const handleNodeClick = async(data) => {
//跳转路由
router.push(`/article/${route.params.discussId}/${data.id}`);
discuss.value.content = data.content;
const response=await articleGet(data.id);
discuss.value.content = response.data.content;
ContentHander();
}
//删除子文章

View File

@@ -10,7 +10,9 @@ namespace Yi.BBS.Application.Contracts.Forum.Dtos
public class ArticleAllOutputDto : IEntityDto<long>
{
public long Id { get; set; }
public string Content { get; set; }
//批量查询,不给内容,性能考虑
//public string Content { get; set; }
public string Name { get; set; }
public long DiscussId { get; set; }
public long ParentId { get; set; }

View File

@@ -10,7 +10,8 @@ namespace Yi.BBS.Application.Contracts.Forum.Dtos
public class ArticleGetListOutputDto : IEntityDto<long>
{
public long Id { get; set; }
public string Content { get; set; }
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD>ܿ<EFBFBD><DCBF><EFBFBD>
//public string Content { get; set; }
public string Name { get; set; }
public long DiscussId { get; set; }

View File

@@ -21,8 +21,8 @@ namespace Yi.BBS.Application.Contracts.Forum.Dtos
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD>ܿ<EFBFBD><DCBF><EFBFBD>
//public string Content { get; set; }
public string Content { get; set; }
/// <summary>