# 微迹Tracelet **Repository Path**: iesap/tracelet ## Basic Information - **Project Name**: 微迹Tracelet - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2026-07-12 - **Last Updated**: 2026-07-12 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 微迹(Tracelet) > 轻量级生活痕迹记录与提醒工具,不打扰,但有用。 ## 📱 项目简介 微迹是一款基于 HarmonyOS 3.0+ 开发的轻量级生活助手应用,帮助用户记录生活中的小痕迹,提供温柔的提醒。完全离线运行,保护用户隐私。 ### 核心特性 - 🎯 **时光轮** - 物品寿命追踪,环形进度条可视化提醒 - 📍 **此刻记忆** - 快速标记物品位置,防丢神器 - ⏰ **轻提醒** - 周期任务提醒,支持每天/每X天/每周 - 📦 **服务卡片** - 桌面快捷卡片,无需打开App即可查看 - 💾 **数据备份** - 本地导入导出,数据安全可控 - 🎨 **精致UI** - 莫兰迪配色,HarmonyOS Design 2.0 ### 技术特点 - 安装包 ≤ 5MB - 完全离线运行 - 无第三方依赖 - 本地数据存储 - 支持手机、平板、手表 --- ## 🚀 快速开始 ### 环境要求 - DevEco Studio 4.0+ - HarmonyOS SDK 3.0+ - Node.js 14+ ### 安装步骤 1. 克隆项目 ```bash git clone cd Tracelet ``` 2. 打开项目 ```bash # 使用 DevEco Studio 打开项目目录 ``` 3. 同步依赖 ```bash ohpm install ``` 4. 编译运行 ```bash hvigorw assembleHap ``` --- ## 📁 项目结构 ``` Tracelet/ ├── entry/ # 主模块 │ └── src/main/ │ ├── ets/ │ │ ├── model/ # 数据模型 │ │ │ ├── TrackItem.ets # 物品追踪实体 │ │ │ ├── MomentMemory.ets # 此刻记忆实体 │ │ │ └── Reminder.ets # 周期提醒实体 │ │ │ │ │ ├── repository/ # 数据存储层 │ │ │ ├── DatabaseRepository.ets # SQLite数据库 │ │ │ ├── PreferencesRepository.ets # 键值存储 │ │ │ └── DataExporter.ets # 数据导入导出 │ │ │ │ │ ├── pages/ # 页面 │ │ │ ├── Index.ets # 主页 │ │ │ ├── ItemDetail.ets # 物品详情页 │ │ │ ├── AddItem.ets # 添加物品页 │ │ │ ├── AddReminder.ets # 添加提醒页 │ │ │ └── Settings.ets # 设置页 │ │ │ │ │ ├── components/ # 可复用组件 │ │ │ ├── ProgressRing.ets # 环形进度条 │ │ │ ├── FeatureCard.ets # 功能卡片容器 │ │ │ └── CheckAnimation.ets # 完成动画 │ │ │ │ │ ├── widgets/ # 服务卡片 │ │ │ ├── TimeWheelWidget.ets # 时光轮卡片 │ │ │ └── QuickMarkWidget.ets # 此刻记忆卡片 │ │ │ │ │ ├── utils/ # 工具类 │ │ │ ├── DateUtils.ets # 日期工具 │ │ │ ├── NotificationHelper.ets # 通知工具 │ │ │ ├── VibrationHelper.ets # 震动工具 │ │ │ └── AnimationHelper.ets # 动画工具 │ │ │ │ │ ├── common/ # 常量配置 │ │ │ └── Constants.ets # 颜色、常量定义 │ │ │ │ │ ├── formability/ # 服务卡片能力 │ │ │ └── FormAbility.ets # 卡片生命周期 │ │ │ │ │ └── entryability/ # 应用入口 │ │ └── EntryAbility.ets # 应用生命周期 │ │ │ └── resources/ # 资源文件 │ ├── base/ │ │ ├── element/ # 字符串资源 │ │ ├── media/ # 图片资源 │ │ └── profile/ # 配置文件 │ └── AppScope/ # 应用全局配置 ``` --- ## 📚 API 文档 ### 数据模型 #### TrackItem - 物品追踪 ```typescript class TrackItem { id: number; // 唯一标识 name: string; // 物品名称 icon: string; // 物品图标(emoji) startTimestamp: number; // 开始时间戳 thresholdDays: number; // 建议更换天数 isActive: boolean; // 是否激活 // 计算已使用天数 getUsedDays(): number; // 计算进度百分比(0-100) getProgress(): number; // 判断是否超期 isOverdue(): boolean; // 获取剩余天数 getRemainingDays(): number; } ``` #### MomentMemory - 此刻记忆 ```typescript class MomentMemory { key: string; // 唯一键 name: string; // 名称 icon: string; // 图标 timestamp: number; // 记录时间戳 note: string; // 备注 // 是否已记录 hasRecord(): boolean; // 获取格式化时间 getFormattedTime(): string; // 清除记录 clear(): void; // 记录位置 record(note?: string): void; } ``` #### Reminder - 周期提醒 ```typescript enum ReminderType { DAILY = 'daily', // 每天 INTERVAL_DAYS = 'interval_days', // 每X天 WEEKLY = 'weekly' // 每周 } class Reminder { id: number; title: string; icon: string; type: ReminderType; intervalDays: number; weekdays: number[]; nextNotifyTime: number; enabled: boolean; lastNotifyTime: number; // 是否应该通知 shouldNotify(): boolean; // 标记为已通知 markAsNotified(): void; // 计算下次通知时间 calculateNextNotifyTime(): void; // 获取间隔文本描述 getIntervalText(): string; } ``` ### 数据存储 #### DatabaseRepository - 数据库存储 ```typescript class DatabaseRepository { static getInstance(): DatabaseRepository; async init(context: Context): Promise; // 物品追踪 async getAllTrackItems(): Promise; async addTrackItem(item: TrackItem): Promise; async updateTrackItem(item: TrackItem): Promise; async deleteTrackItem(id: number): Promise; async resetTrackItem(id: number): Promise; // 周期提醒 async getAllReminders(): Promise; async addReminder(reminder: Reminder): Promise; async updateReminder(reminder: Reminder): Promise; async deleteReminder(id: number): Promise; } ``` #### PreferencesRepository - 键值存储 ```typescript class PreferencesRepository { static getInstance(): PreferencesRepository; async init(context: Context): Promise; // 此刻记忆 async getMomentMemories(): Promise; async saveMomentMemories(memories: MomentMemory[]): Promise; // 通用配置 async getPreference(key: string, defaultValue: T): Promise; async setPreference(key: string, value: T): Promise; } ``` ### 工具类 #### DateUtils - 日期工具 ```typescript class DateUtils { static formatTimestamp(timestamp: number): string; static formatTime(timestamp: number): string; static formatDateTime(timestamp: number): string; static getDaysBetween(start: number, end: number): number; static isSameDay(timestamp1: number, timestamp2: number): boolean; } ``` #### NotificationHelper - 通知工具 ```typescript class NotificationHelper { static async notifyReminder(reminder: Reminder): Promise; static async notifyTrackItemOverdue(item: TrackItem): Promise; static async cancelNotification(id: number): Promise; static async cancelAllNotifications(): Promise; static async requestNotificationPermission(): Promise; } ``` #### VibrationHelper - 震动工具 ```typescript class VibrationHelper { static getInstance(): VibrationHelper; async init(): Promise; async light(): Promise; // 轻触感(15ms) async medium(): Promise; // 中等触感(30ms) async strong(): Promise; // 强触感(50ms) async pattern(): Promise; // 节奏震动 async stop(): Promise; setEnabled(enabled: boolean): void; } ``` --- ## 🎨 设计规范 ### 配色方案(莫兰迪低饱和) | 角色 | 色值 | 说明 | |------|------|------| | 主色 | `#7E9A9A` | 鼠尾草绿 - 按钮、重要强调 | | 辅助色 | `#D4B8A7` | 奶茶色 - 次要按钮、标签 | | 背景色 | `#F5F3F0` | 暖白 - 主背景 | | 卡片背景 | `#FFFFFF` | 白色 - 卡片、弹窗 | | 警示色 | `#E28B6E` | 陶土橙 - 到期提醒、删除 | | 文字主要 | `#2E2E2E` | 深灰 - 标题 | | 文字次要 | `#8E8E8E` | 中灰 - 辅助说明 | ### 字体规范 - 标题:22fp 半粗体 - 正文:16fp 常规 - 辅助:13fp 常规 ### 圆角规范 - 卡片圆角:24vp - 按钮圆角:40vp(胶囊) --- ## 🔧 配置说明 ### 权限配置 在 `module.json5` 中已配置以下权限: ```json5 { "requestPermissions": [ { "name": "ohos.permission.VIBRATE", "reason": "操作反馈震动" }, { "name": "ohos.permission.NOTIFICATION_CONTROLLER", "reason": "周期提醒通知" } ] } ``` ### 服务卡片配置 服务卡片配置位于 `resources/base/profile/form_config.json`: - **TimeWheelWidget** (2x2): 显示物品进度 - **QuickMarkWidget** (1x2): 快速位置标记 --- ## 📝 开发指南 ### 添加新物品类型 1. 在 `AddItem.ets` 的 `icons` 数组中添加新图标 2. 更新 `TrackItem` 模型(如需要新字段) 3. 在数据库中添加相应字段(需处理数据迁移) ### 添加新提醒类型 1. 在 `Reminder.ets` 的 `ReminderType` 枚举中添加新类型 2. 实现 `calculateNextNotifyTime()` 的新逻辑 3. 更新 `AddReminder.ets` 的UI选项 ### 自定义配色 修改 `common/Constants.ets` 中的 `Colors` 类: ```typescript export class Colors { static readonly Primary = '#7E9A9A'; // 修改主色 static readonly Secondary = '#D4B8A7'; // 修改辅助色 // ... } ``` --- ## 🧪 测试 ### 运行测试 ```bash # 单元测试 hvigorw test # 集成测试 hvigorw test@entry ``` --- ## 📦 构建发布 ### 构建HAP包 ```bash # Debug版本 hvigorw assembleHap --mode module -p module=entry@default # Release版本 hvigorw assembleHap --mode module -p module=entry@default -p product=default ``` ### 应用签名 1. 在 DevEco Studio 中配置签名证书 2. 构建 Release 版本 3. 上传至华为应用市场 --- ## 🤝 贡献指南 1. Fork 项目 2. 创建特性分支 (`git checkout -b feature/AmazingFeature`) 3. 提交更改 (`git commit -m 'Add some AmazingFeature'`) 4. 推送到分支 (`git push origin feature/AmazingFeature`) 5. 创建 Pull Request --- ## 📄 许可证 本项目采用 MIT 许可证 - 详见 [LICENSE](LICENSE) 文件 --- ## 👨‍💻 作者 - **开发者**: Huawei Cloud CodeArts - **项目名称**: 微迹(Tracelet) - **版本**: 1.0.0 --- ## 🙏 致谢 - [HarmonyOS](https://www.harmonyos.com/) - 华为鸿蒙操作系统 - [DevEco Studio](https://developer.harmonyos.com/cn/develop/deveco-studio) - 华为开发工具 --- ## 📮 反馈与支持 如有问题或建议,请提交 Issue 或联系开发者。 --- > 用极简操作对抗日常遗忘,提供确定性的小确幸。