From 890a5b7e76f3b4334be6c21a5aa3875c332cd410 Mon Sep 17 00:00:00 2001 From: Guarp <guarp2022@163.com> Date: Sun, 16 Mar 2025 21:32:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8F=91=E5=B8=83=E5=86=85?= =?UTF-8?q?=E5=AE=B9=E5=AD=97=E6=95=B0=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Blog_replyInput.vue | 4 ++++ src/pages/EmailVerify.vue | 4 ++-- src/pages/blogPages/SingleBlog_page.vue | 4 ++++ src/pages/demoPages/messageBoard/Board_page.vue | 7 ++++++- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/components/Blog_replyInput.vue b/src/components/Blog_replyInput.vue index 9661486..eae4b09 100644 --- a/src/components/Blog_replyInput.vue +++ b/src/components/Blog_replyInput.vue @@ -70,6 +70,10 @@ const submitComment = async () => { if (!commentBody) { return; } + if (commentBody.length > 400) { + swal.tip('error', '太长了! '); + return; + } commentSubmitLoading.value = true; try { const response = await api.post(`/comments/${props.commentId}/replies`, (() => { diff --git a/src/pages/EmailVerify.vue b/src/pages/EmailVerify.vue index 906356a..28b43e0 100644 --- a/src/pages/EmailVerify.vue +++ b/src/pages/EmailVerify.vue @@ -36,7 +36,7 @@ onMounted(async () => { // 根据返回的 code 判断是否成功 if (code === 0) { textDisplay.value = '验证成功! '; - swal.tip('success', '创建账户成功,即将跳转登录页面'); + swal.tip('success', '创建账户成功', '即将跳转登录页面'); // 延迟跳转到登录页面 setTimeout(() => { router.push('/login'); @@ -51,7 +51,7 @@ onMounted(async () => { } catch (error) { console.error('验证请求失败:', error); textDisplay.value = '服务器错误,请稍后再试'; - swal.tip('error', '服务器错误,请稍后再试'); + swal.tip('error', '服务器错误', '请稍后再试'); } }); </script> diff --git a/src/pages/blogPages/SingleBlog_page.vue b/src/pages/blogPages/SingleBlog_page.vue index 3d3f76e..be20e36 100644 --- a/src/pages/blogPages/SingleBlog_page.vue +++ b/src/pages/blogPages/SingleBlog_page.vue @@ -132,6 +132,10 @@ const submitComment = async () => { if (!commentBody) { return; } + if (commentBody.length > 400) { + swal.tip('error', '太长了! '); + return; + } commentSubmitLoading.value = true; try { const response = await api.post(`/blogs/${id}/comments`, (() => { diff --git a/src/pages/demoPages/messageBoard/Board_page.vue b/src/pages/demoPages/messageBoard/Board_page.vue index f7eaea8..5c86970 100644 --- a/src/pages/demoPages/messageBoard/Board_page.vue +++ b/src/pages/demoPages/messageBoard/Board_page.vue @@ -79,13 +79,18 @@ async function sendMessage() { swal.tip('info', '不得为空') return; } + if (userInput.value.trim().length > 500) { + swal.tip('error', '太长了!') + return; + } sendCD.value = 'wait'; try { const response = await api.post('/postmessage', { TOKEN: AuthService.getToken(), - CONTENT: userInput.value + CONTENT: userInput.value.trim() }); if (response.code !== 0) { + sendCD.value = 0; swal.tip('error', '发送失败'); return; }