mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-student.git
synced 2025-12-14 05:16:47 +08:00
feat:发表评论及回复增加点击限制、增加loading提示
This commit is contained in:
@@ -135,7 +135,7 @@
|
|||||||
</UploadPostImg>
|
</UploadPostImg>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button class="btntwo" @click="submitComment">发表</button>
|
<button class="btntwo" @click="submitComment" v-loading="submitLoading">发表</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -280,7 +280,7 @@
|
|||||||
<div class="shangchuan">上传图片</div>
|
<div class="shangchuan">上传图片</div>
|
||||||
</button>
|
</button>
|
||||||
</UploadPostImg>
|
</UploadPostImg>
|
||||||
<button class="btntwo" @click="submitReplayComment" style="top:206px;">
|
<button class="btntwo" @click="submitReplayComment" style="top:206px;" v-loading="submitReplayLoading">
|
||||||
发表
|
发表
|
||||||
</button>
|
</button>
|
||||||
</datagrid>
|
</datagrid>
|
||||||
@@ -417,9 +417,13 @@ const getData = () => {
|
|||||||
console.log('我是获取当前帖子的评论', res)
|
console.log('我是获取当前帖子的评论', res)
|
||||||
commontList.value = res.data.records;
|
commontList.value = res.data.records;
|
||||||
hfPage.value.total = Number(res.data.total);
|
hfPage.value.total = Number(res.data.total);
|
||||||
|
submitLoading.value = false;
|
||||||
|
submitReplayLoading.value = false;
|
||||||
clearText()
|
clearText()
|
||||||
}).catch(err=>{
|
}).catch(err=>{
|
||||||
console.log(err)
|
console.log(err)
|
||||||
|
submitLoading.value = false;
|
||||||
|
submitReplayLoading.value = false;
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -490,6 +494,8 @@ function commentComment(obj) {
|
|||||||
replayComment.value.pid = obj.id;
|
replayComment.value.pid = obj.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const submitLoading = ref(false);
|
||||||
|
|
||||||
// 提交评论
|
// 提交评论
|
||||||
function submitComment() {
|
function submitComment() {
|
||||||
console.log(disDetail.value, fileListComment.value)
|
console.log(disDetail.value, fileListComment.value)
|
||||||
@@ -501,6 +507,11 @@ function submitComment() {
|
|||||||
ElMessage.error(`请输入评论内容`);
|
ElMessage.error(`请输入评论内容`);
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if(submitLoading.value){
|
||||||
|
ElMessage.error(`请勿频繁点击`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
submitLoading.value = true;
|
||||||
console.table('帖子评论参数',{
|
console.table('帖子评论参数',{
|
||||||
id: disDetail.value.id,
|
id: disDetail.value.id,
|
||||||
targetId: disDetail.value.id,
|
targetId: disDetail.value.id,
|
||||||
@@ -518,10 +529,13 @@ function submitComment() {
|
|||||||
console.log(res)
|
console.log(res)
|
||||||
getData();
|
getData();
|
||||||
}).catch(err=>{
|
}).catch(err=>{
|
||||||
|
submitLoading.value = false;
|
||||||
console.log(err)
|
console.log(err)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const submitReplayLoading = ref(false);
|
||||||
|
|
||||||
// 回复评论
|
// 回复评论
|
||||||
function submitReplayComment() {
|
function submitReplayComment() {
|
||||||
let imgFileUrl = []
|
let imgFileUrl = []
|
||||||
@@ -532,6 +546,11 @@ function submitReplayComment() {
|
|||||||
ElMessage.error(`请输入回复内容`);
|
ElMessage.error(`请输入回复内容`);
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if(submitReplayLoading.value){
|
||||||
|
ElMessage.error(`请勿频繁点击`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
submitReplayLoading.value = true;
|
||||||
console.table('帖子回复评论参数',{
|
console.table('帖子回复评论参数',{
|
||||||
id: disDetail.value.id,
|
id: disDetail.value.id,
|
||||||
targetId: disDetail.value.id,
|
targetId: disDetail.value.id,
|
||||||
@@ -552,6 +571,7 @@ function submitReplayComment() {
|
|||||||
getData();
|
getData();
|
||||||
}).catch(err=>{
|
}).catch(err=>{
|
||||||
console.log(err)
|
console.log(err)
|
||||||
|
submitReplayLoading.value = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user