欢迎加入开源鸿蒙跨平台社区:
https://openharmonycrossplatform.csdn.net

一、项目概述

运行效果图

image-20260410232224950

image-20260410232229779

image-20260410232233531

image-20260410232237550

1.1 应用简介

班级通知公告系统是一款专为班级管理设计的通知发布与查看应用,支持老师发布通知、学生查看公告、作业提醒、活动通知等功能。应用内置消息分类、已读未读状态、定时提醒,让班级信息传递更高效。

应用以清新的蓝色为主色调,象征专业与可靠。涵盖通知公告、作业管理、班级活动、个人中心四大模块。老师可以发布各类通知、布置作业、组织活动,学生可以及时查看、确认收到、参与互动。

1.2 核心功能

功能模块 功能描述 实现方式
通知公告 发布班级通知 列表展示
作业管理 布置与提交作业 任务系统
班级活动 组织班级活动 活动管理
消息提醒 重要通知提醒 推送通知
已读确认 查看阅读状态 状态追踪

1.3 通知类型定义

序号 类型名称 Emoji 描述
1 紧急通知 🚨 重要紧急事项
2 日常通知 📢 一般性通知
3 作业布置 📝 作业相关信息
4 考试安排 📚 考试相关信息
5 活动通知 🎉 班级活动信息
6 缴费通知 💰 费用缴纳信息
7 放假通知 🏖️ 假期安排信息
8 其他通知 📌 其他类型通知

1.4 通知优先级定义

序号 优先级 Emoji 描述
1 紧急 🔴 需立即处理
2 重要 🟠 需尽快查看
3 普通 🟢 一般性通知
4 低优先级 可稍后查看

1.5 阅读状态定义

序号 状态名称 Emoji 描述
1 未读 🔵 未查看
2 已读 已查看
3 已确认 ✔️ 已确认收到

1.6 技术栈

技术领域 技术选型 版本要求
开发框架 Flutter >= 3.0.0
编程语言 Dart >= 2.17.0
设计规范 Material Design 3 -
本地存储 shared_preferences -
目标平台 鸿蒙OS / Web API 21+

1.7 项目结构

lib/
└── main_class_notification.dart
    ├── ClassNotificationApp         # 应用入口
    ├── Notification                 # 通知模型
    ├── Homework                     # 作业模型
    ├── Activity                     # 活动模型
    ├── NotificationType             # 通知类型枚举
    ├── Priority                     # 优先级枚举
    ├── ReadStatus                   # 阅读状态枚举
    ├── NotificationService          # 通知服务
    ├── NotificationController       # 通知控制器
    ├── ClassNotificationHomePage    # 主页面
    ├── _buildNoticePage             # 通知公告页面
    ├── _buildHomeworkPage           # 作业管理页面
    ├── _buildActivityPage           # 班级活动页面
    └── _buildProfilePage            # 个人中心页面

二、系统架构

2.1 整体架构图

Data Layer

Business Layer

Presentation Layer

主页面
ClassNotificationHomePage

通知公告

作业管理

班级活动

个人中心

通知列表

通知详情

阅读确认

作业列表

作业提交

作业批改

活动列表

活动报名

活动签到

个人信息

消息设置

通知控制器
NotificationController

通知服务
NotificationService

数据管理
DataManager

Notification
通知模型

Homework
作业模型

Activity
活动模型

LocalStorage
本地存储

2.2 类图设计

uses

uses

manages

manages

manages

uses

returns

returns

ClassNotificationApp

+Widget build()

Notification

+String id

+String title

+String content

+NotificationType type

+Priority priority

+String author

+DateTime createdAt

+DateTime expireDate

+bool requireConfirm

+Map<String, ReadStatus> readStatus

Homework

+String id

+String title

+String subject

+String content

+DateTime deadline

+bool isSubmitted

+DateTime? submitTime

+String? attachment

Activity

+String id

+String title

+String description

+DateTime startTime

+DateTime endTime

+String location

+int maxParticipants

+List<String> participants

«enumeration»

NotificationType

+String label

+String emoji

+urgent()

+general()

+homework()

+exam()

+activity()

+payment()

+holiday()

+other()

«enumeration»

Priority

+String label

+String emoji

+urgent()

+high()

+normal()

+low()

«enumeration»

ReadStatus

+String label

+String emoji

+unread()

+read()

+confirmed()

NotificationService

+List<Notification> getAllNotifications()

+List<Notification> getNotificationsByType(NotificationType type)

+void markAsRead(String id)

+void confirmReceipt(String id)

+void publishNotification(Notification notification)

NotificationController

+List<Notification> notifications

+List<Homework> homeworks

+List<Activity> activities

+Future loadNotifications()

+void markAsRead(String id)

+void confirmReceipt(String id)

+void publishNotification(Notification notification)

2.3 页面导航流程

公告

作业

活动

我的

应用启动

通知公告

底部导航

通知列表

作业管理

班级活动

个人中心

查看通知

筛选类型

确认收到

作业列表

提交作业

活动列表

报名活动

个人信息

消息设置

2.4 通知发布流程

学生 数据管理 通知控制器 发布页面 老师 学生 数据管理 通知控制器 发布页面 老师 填写通知内容 选择通知类型 设置优先级 点击发布 提交通知 保存通知 确认保存 发布成功 显示成功提示 推送通知 查看通知 更新阅读状态 确认更新

三、核心模块设计

3.1 数据模型设计

3.1.1 通知模型 (Notification)
class Notification {
  final String id;
  final String title;
  final String content;
  final NotificationType type;
  final Priority priority;
  final String author;
  final DateTime createdAt;
  final DateTime? expireDate;
  final bool requireConfirm;
  final Map<String, ReadStatus> readStatus;
  final List<String> attachments;
  
  Notification({
    required this.id,
    required this.title,
    required this.content,
    required this.type,
    required this.priority,
    required this.author,
    required this.createdAt,
    this.expireDate,
    required this.requireConfirm,
    required this.readStatus,
    required this.attachments,
  });
}
3.1.2 作业模型 (Homework)
class Homework {
  final String id;
  final String title;
  final String subject;
  final String content;
  final DateTime deadline;
  final bool isSubmitted;
  final DateTime? submitTime;
  final String? attachment;
  final String? feedback;
  final int? score;
  
  Homework({
    required this.id,
    required this.title,
    required this.subject,
    required this.content,
    required this.deadline,
    required this.isSubmitted,
    this.submitTime,
    this.attachment,
    this.feedback,
    this.score,
  });
}
3.1.3 活动模型 (Activity)
class Activity {
  final String id;
  final String title;
  final String description;
  final DateTime startTime;
  final DateTime endTime;
  final String location;
  final int maxParticipants;
  final List<String> participants;
  final String organizer;
  final ActivityStatus status;
  
  Activity({
    required this.id,
    required this.title,
    required this.description,
    required this.startTime,
    required this.endTime,
    required this.location,
    required this.maxParticipants,
    required this.participants,
    required this.organizer,
    required this.status,
  });
}
3.1.4 通知类型枚举 (NotificationType)
enum NotificationType {
  urgent(label: '紧急通知', emoji: '🚨'),
  general(label: '日常通知', emoji: '📢'),
  homework(label: '作业布置', emoji: '📝'),
  exam(label: '考试安排', emoji: '📚'),
  activity(label: '活动通知', emoji: '🎉'),
  payment(label: '缴费通知', emoji: '💰'),
  holiday(label: '放假通知', emoji: '🏖️'),
  other(label: '其他通知', emoji: '📌');

  final String label;
  final String emoji;

  const NotificationType({required this.label, required this.emoji});
}
3.1.5 优先级枚举 (Priority)
enum Priority {
  urgent(label: '紧急', emoji: '🔴'),
  high(label: '重要', emoji: '🟠'),
  normal(label: '普通', emoji: '🟢'),
  low(label: '低优先级', emoji: '⚪');

  final String label;
  final String emoji;

  const Priority({required this.label, required this.emoji});
}
3.1.6 阅读状态枚举 (ReadStatus)
enum ReadStatus {
  unread(label: '未读', emoji: '🔵'),
  read(label: '已读', emoji: '✅'),
  confirmed(label: '已确认', emoji: '✔️');

  final String label;
  final String emoji;

  const ReadStatus({required this.label, required this.emoji});
}

3.2 页面结构设计

3.2.1 主页面布局

ClassNotificationHomePage

IndexedStack

通知公告页面

作业管理页面

班级活动页面

个人中心页面

NavigationBar

公告 Tab

作业 Tab

活动 Tab

我的 Tab

3.2.2 通知公告页面结构

通知公告页面

顶部筛选栏

通知列表

发布按钮

全部

紧急

作业

活动

通知卡片

类型图标

标题内容

时间状态

新建通知

3.2.3 作业管理页面结构

作业管理页面

作业统计

作业列表

待完成

已提交

已批改

作业卡片

科目名称

截止时间

提交状态

3.2.4 班级活动页面结构

班级活动页面

活动列表

活动筛选

即将开始

进行中

已结束

活动卡片

活动封面

活动信息

时间地点

报名状态

3.3 通知发布逻辑

进入发布页面

填写通知内容

内容完整?

提示补充

选择通知类型

设置优先级

选择接收人

设置截止时间

点击发布

确认发布?

保存通知

推送通知

发布成功

3.4 阅读确认逻辑

收到通知

显示未读标记

查看通知

标记为已读

需要确认?

结束

显示确认按钮

点击确认

标记为已确认

通知发送者


四、UI设计规范

4.1 配色方案

应用以清新的蓝色为主色调,象征专业与可靠:

颜色类型 色值 用途
主色 #2196F3 (Blue) 导航、主题元素
辅助色 #64B5F6 按钮、强调
第三色 #90CAF9 背景、卡片
背景色 #F5F5F5 页面背景
卡片背景 #FFFFFF 信息卡片

4.2 优先级色彩映射

优先级 色值 视觉效果
紧急 #F44336 红色
重要 #FF9800 橙色
普通 #4CAF50 绿色
低优先级 #9E9E9E 灰色

4.3 通知类型色彩映射

类型 色值 视觉效果
紧急通知 #F44336 红色
日常通知 #2196F3 蓝色
作业布置 #4CAF50 绿色
考试安排 #9C27B0 紫色
活动通知 #FF9800 橙色
缴费通知 #FF5722 深橙色
放假通知 #00BCD4 青色
其他通知 #607D8B 蓝灰色

4.4 字体规范

元素 字号 字重 颜色
页面标题 24px Bold 主色
通知标题 16px Medium #333333
通知内容 14px Regular #666666
时间信息 12px Regular #999999
状态标签 12px Regular 对应状态色

4.5 组件规范

4.5.1 通知卡片
┌─────────────────────────────────────┐
│  🚨 紧急通知                         │
│  ─────────────────────────────────  │
│  关于期中考试安排的通知              │
│                                     │
│  各位同学:期中考试将于下周...       │
│                                     │
│  发布:张老师    2小时前            │
│  🔵 未读        [确认收到]          │
└─────────────────────────────────────┘
4.5.2 作业卡片
┌─────────────────────────────────────┐
│  数学作业                            │
│  ─────────────────────────────────  │
│  内容:完成习题3.1-3.5              │
│                                     │
│  截止:2024-01-15 23:59             │
│  状态:待完成 ⚠️                    │
│                                     │
│  [提交作业]                         │
└─────────────────────────────────────┘
4.5.3 活动卡片
┌─────────────────────────────────────┐
│  班级春游活动                        │
│  ─────────────────────────────────  │
│  时间:2024-03-15 08:00             │
│  地点:市郊公园                      │
│  人数:25/30人                       │
│                                     │
│  [立即报名]                         │
└─────────────────────────────────────┘

五、核心功能实现

5.1 通知服务实现

class NotificationService {
  final List<Notification> _notifications = [];

  List<Notification> getAllNotifications() {
    return _notifications..sort((a, b) => b.createdAt.compareTo(a.createdAt));
  }

  List<Notification> getNotificationsByType(NotificationType type) {
    return _notifications
        .where((n) => n.type == type)
        .toList()
      ..sort((a, b) => b.createdAt.compareTo(a.createdAt));
  }

  List<Notification> getUnreadNotifications() {
    return _notifications
        .where((n) => n.readStatus['current_user'] == ReadStatus.unread)
        .toList();
  }

  void markAsRead(String id) {
    final notification = _notifications.firstWhere((n) => n.id == id);
    notification.readStatus['current_user'] = ReadStatus.read;
  }

  void confirmReceipt(String id) {
    final notification = _notifications.firstWhere((n) => n.id == id);
    notification.readStatus['current_user'] = ReadStatus.confirmed;
  }

  void publishNotification(Notification notification) {
    _notifications.insert(0, notification);
  }

  void deleteNotification(String id) {
    _notifications.removeWhere((n) => n.id == id);
  }
}

5.2 通知控制器实现

class NotificationController {
  final NotificationService _notificationService;
  final DataManager _dataManager;
  List<Notification> notifications = [];
  List<Homework> homeworks = [];
  List<Activity> activities = [];

  NotificationController(this._notificationService, this._dataManager);

  Future<void> initialize() async {
    await loadNotifications();
    await loadHomeworks();
    await loadActivities();
  }

  Future<void> loadNotifications() async {
    notifications = _notificationService.getAllNotifications();
  }

  Future<void> loadHomeworks() async {
    homeworks = await _dataManager.loadHomeworks();
  }

  Future<void> loadActivities() async {
    activities = await _dataManager.loadActivities();
  }

  void markAsRead(String id) {
    _notificationService.markAsRead(id);
    final index = notifications.indexWhere((n) => n.id == id);
    if (index != -1) {
      notifications[index].readStatus['current_user'] = ReadStatus.read;
    }
  }

  void confirmReceipt(String id) {
    _notificationService.confirmReceipt(id);
    final index = notifications.indexWhere((n) => n.id == id);
    if (index != -1) {
      notifications[index].readStatus['current_user'] = ReadStatus.confirmed;
    }
  }

  void publishNotification(Notification notification) {
    _notificationService.publishNotification(notification);
    notifications.insert(0, notification);
    _dataManager.saveNotifications(notifications);
  }

  int getUnreadCount() {
    return notifications
        .where((n) => n.readStatus['current_user'] == ReadStatus.unread)
        .length;
  }
}

5.3 数据管理实现

class DataManager {
  static const String _notificationsKey = 'notifications';
  static const String _homeworksKey = 'homeworks';
  static const String _activitiesKey = 'activities';

  static Map<String, String> _storage = {};

  Future<List<Notification>> loadNotifications() async {
    final jsonString = _storage[_notificationsKey];
    if (jsonString == null) return [];

    final jsonList = json.decode(jsonString) as List;
    return jsonList.map((data) => Notification.fromJson(data)).toList();
  }

  Future<void> saveNotifications(List<Notification> notifications) async {
    final jsonList = notifications.map((n) => n.toJson()).toList();
    _storage[_notificationsKey] = json.encode(jsonList);
  }

  Future<List<Homework>> loadHomeworks() async {
    final jsonString = _storage[_homeworksKey];
    if (jsonString == null) return [];

    final jsonList = json.decode(jsonString) as List;
    return jsonList.map((data) => Homework.fromJson(data)).toList();
  }

  Future<void> saveHomeworks(List<Homework> homeworks) async {
    final jsonList = homeworks.map((h) => h.toJson()).toList();
    _storage[_homeworksKey] = json.encode(jsonList);
  }

  Future<List<Activity>> loadActivities() async {
    final jsonString = _storage[_activitiesKey];
    if (jsonString == null) return [];

    final jsonList = json.decode(jsonString) as List;
    return jsonList.map((data) => Activity.fromJson(data)).toList();
  }

  Future<void> saveActivities(List<Activity> activities) async {
    final jsonList = activities.map((a) => a.toJson()).toList();
    _storage[_activitiesKey] = json.encode(jsonList);
  }
}

六、交互设计

6.1 通知浏览交互流程

通知服务 通知控制器 通知页面 学生 通知服务 通知控制器 通知页面 学生 打开应用 加载通知 获取通知列表 返回通知 更新显示 显示通知列表 点击通知 标记已读 更新阅读状态 确认更新 更新状态 显示通知详情

6.2 通知发布交互流程

进入发布页面

填写通知标题

填写通知内容

选择通知类型

设置优先级

选择接收人

是否需要确认

开启确认功能

直接发布

点击发布

发布成功

6.3 作业提交流互流程

提交作业

老师批改

超过截止时间

待完成

已提交

已批改

已逾期


七、扩展功能规划

7.1 后续版本规划

2024-01-07 2024-01-14 2024-01-21 2024-01-28 2024-02-04 2024-02-11 2024-02-18 2024-02-25 2024-03-03 2024-03-10 2024-03-17 2024-03-24 基础UI框架 通知发布功能 阅读确认功能 作业管理功能 活动管理功能 消息推送功能 文件附件功能 成绩查询功能 家长端功能 V1.0 基础版本 V1.1 增强版本 V1.2 进阶版本 班级通知公告系统应用开发计划

7.2 功能扩展建议

7.2.1 文件附件

附件功能:

  • 上传文件附件
  • 下载查看附件
  • 图片预览功能
  • 文档在线查看
7.2.2 成绩查询

成绩功能:

  • 成绩录入
  • 成绩查询
  • 成绩统计
  • 成绩分析
7.2.3 家长端

家长功能:

  • 查看孩子通知
  • 作业完成情况
  • 成绩查看
  • 与老师沟通

八、注意事项

8.1 开发注意事项

  1. 消息推送:重要通知需要及时推送给用户

  2. 数据同步:多设备间的数据同步需要处理好

  3. 权限控制:老师和学生的操作权限需要区分

  4. 用户体验:通知查看和确认流程需要简洁

  5. 数据安全:学生信息需要安全存储

8.2 常见问题

问题 原因 解决方案
通知收不到 推送服务异常 检查推送配置
已读状态不同步 数据未刷新 手动刷新数据
作业提交失败 文件过大 压缩文件
活动报名失败 人数已满 提示名额已满
应用崩溃 空指针异常 增加空值检查

8.3 使用技巧

📢 班级通知公告系统使用技巧 📢

通知查看

  • 及时查看新通知
  • 重要通知及时确认
  • 设置消息提醒
  • 分类筛选通知

作业管理

  • 关注截止时间
  • 提前完成作业
  • 及时提交作业
  • 查看作业反馈

活动参与

  • 关注班级活动
  • 及时报名参与
  • 准时参加活动
  • 活动后分享感受

个人设置

  • 完善个人信息
  • 设置消息提醒
  • 绑定联系方式
  • 定期修改密码

九、运行说明

9.1 环境要求

环境 版本要求
Flutter SDK >= 3.0.0
Dart SDK >= 2.17.0
鸿蒙OS API 21+
Web浏览器 Chrome 90+

9.2 运行命令

# 查看可用设备
flutter devices

# 运行到Web服务器
flutter run -d web-server -t lib/main_class_notification.dart --web-port 8161

# 运行到鸿蒙设备
flutter run -d 127.0.0.1:5555 lib/main_class_notification.dart

# 代码分析
flutter analyze lib/main_class_notification.dart

十、总结

班级通知公告系统应用通过通知公告、作业管理、班级活动、个人中心四大模块,为班级提供了一个高效的信息传递平台。老师可以发布各类通知、布置作业、组织活动,学生可以及时查看、确认收到、参与互动。

核心功能包括通知发布、阅读确认、作业提交、活动报名等。应用采用清新的蓝色为主色调,象征专业与可靠,界面简洁美观,交互流畅自然。

通过本应用,希望能够帮助班级更高效地进行信息传递,提升班级管理效率,促进师生互动。

班级通知公告系统——让信息传递更高效


Logo

AtomGit 是由开放原子开源基金会联合 CSDN 等生态伙伴共同推出的新一代开源与人工智能协作平台。平台坚持“开放、中立、公益”的理念,把代码托管、模型共享、数据集托管、智能体开发体验和算力服务整合在一起,为开发者提供从开发、训练到部署的一站式体验。

更多推荐