浏览代码

当用户尝试发送空消息时,会显示"消息不能为空"的错误提示。

yourname 6 月之前
父节点
当前提交
17d37c2237
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. 5 0
      client/mobile/components/Classroom/useClassroom.ts

+ 5 - 0
client/mobile/components/Classroom/useClassroom.ts

@@ -506,6 +506,11 @@ export const useClassroom = ({ user }:{ user : User }) => {
   const sendMessage = async (): Promise<void> => {
     if (!imMessageManager.current || !classId) return;
 
+    if (!msgText.trim()) {
+      showToast('error', '消息不能为空');
+      return;
+    }
+
     try {
       await imMessageManager.current.sendGroupMessage({
         groupId: classId,