feat:发表评论及回复增加点击限制、增加loading提示

This commit is contained in:
wyx
2023-02-28 00:51:05 +08:00
parent 0677f3bf2d
commit d15df2e90a

View File

@@ -135,7 +135,7 @@
</UploadPostImg>
</div>
<button class="btntwo" @click="submitComment">发表</button>
<button class="btntwo" @click="submitComment" v-loading="submitLoading">发表</button>
</div>
</div>
@@ -280,7 +280,7 @@
<div class="shangchuan">上传图片</div>
</button>
</UploadPostImg>
<button class="btntwo" @click="submitReplayComment" style="top:206px;">
<button class="btntwo" @click="submitReplayComment" style="top:206px;" v-loading="submitReplayLoading">
发表
</button>
</datagrid>
@@ -417,9 +417,13 @@ const getData = () => {
console.log('我是获取当前帖子的评论', res)
commontList.value = res.data.records;
hfPage.value.total = Number(res.data.total);
submitLoading.value = false;
submitReplayLoading.value = false;
clearText()
}).catch(err=>{
console.log(err)
submitLoading.value = false;
submitReplayLoading.value = false;
})
})
}
@@ -490,6 +494,8 @@ function commentComment(obj) {
replayComment.value.pid = obj.id;
}
const submitLoading = ref(false);
// 提交评论
function submitComment() {
console.log(disDetail.value, fileListComment.value)
@@ -501,6 +507,11 @@ function submitComment() {
ElMessage.error(`请输入评论内容`);
return
}
if(submitLoading.value){
ElMessage.error(`请勿频繁点击`)
return
}
submitLoading.value = true;
console.table('帖子评论参数',{
id: disDetail.value.id,
targetId: disDetail.value.id,
@@ -518,10 +529,13 @@ function submitComment() {
console.log(res)
getData();
}).catch(err=>{
submitLoading.value = false;
console.log(err)
});
}
const submitReplayLoading = ref(false);
// 回复评论
function submitReplayComment() {
let imgFileUrl = []
@@ -532,6 +546,11 @@ function submitReplayComment() {
ElMessage.error(`请输入回复内容`);
return
}
if(submitReplayLoading.value){
ElMessage.error(`请勿频繁点击`)
return
}
submitReplayLoading.value = true;
console.table('帖子回复评论参数',{
id: disDetail.value.id,
targetId: disDetail.value.id,
@@ -552,6 +571,7 @@ function submitReplayComment() {
getData();
}).catch(err=>{
console.log(err)
submitReplayLoading.value = false;
});
}