feat: 更新心情记录功能及相关组件

- 在心情日历中新增心情圆环展示,显示心情强度
- 修改心情记录编辑页面,支持使用图标替代表情
- 优化心情类型配置,使用图片资源替代原有表情
- 新增多种心情图标,丰富用户选择
- 更新相关样式,提升用户体验和界面美观性
- 更新文档,详细描述新功能和使用方法
This commit is contained in:
richarjiang
2025-08-25 09:33:54 +08:00
parent 23aa15f76e
commit 4f2d47c23f
17 changed files with 298 additions and 144 deletions

View File

@@ -1,17 +1,5 @@
import { api } from './api';
// 心情类型定义
export type MoodType =
| 'happy' // 开心
| 'excited' // 心动
| 'thrilled' // 兴奋
| 'calm' // 平静
| 'anxious' // 焦虑
| 'sad' // 难过
| 'lonely' // 孤独
| 'wronged' // 委屈
| 'angry' // 生气
| 'tired'; // 心累
// 心情打卡记录类型
export type MoodCheckin = {
@@ -115,25 +103,55 @@ export async function getMoodStatistics(params: {
// 心情类型配置
export const MOOD_CONFIG = {
happy: { emoji: '😊', label: '开心', color: '#4CAF50' },
excited: { emoji: '💓', label: '心动', color: '#E91E63' },
thrilled: { emoji: '🤩', label: '兴奋', color: '#FF9800' },
calm: { emoji: '😌', label: '平静', color: '#2196F3' },
anxious: { emoji: '😰', label: '焦虑', color: '#FF9800' },
sad: { emoji: '😢', label: '难过', color: '#2196F3' },
lonely: { emoji: '🥺', label: '孤独', color: '#9C27B0' },
wronged: { emoji: '😔', label: '委屈', color: '#607D8B' },
angry: { emoji: '😡', label: '生气', color: '#F44336' },
tired: { emoji: '😴', label: '心累', color: '#9C27B0' },
happy: { image: require('@/assets/images/icons/mood/kaixin.png'), label: '开心', color: '#4CAF50' },
excited: { image: require('@/assets/images/icons/mood/xindong.png'), label: '心动', color: '#E91E63' },
thrilled: { image: require('@/assets/images/icons/mood/xingfen.png'), label: '兴奋', color: '#FF9800' },
calm: { image: require('@/assets/images/icons/mood/pingjing.png'), label: '平静', color: '#2196F3' },
anxious: { image: require('@/assets/images/icons/mood/jiaolv.png'), label: '焦虑', color: '#FF9800' },
sad: { image: require('@/assets/images/icons/mood/nanguo.png'), label: '难过', color: '#2196F3' },
lonely: { image: require('@/assets/images/icons/mood/weiqu.png'), label: '孤独', color: '#9C27B0' },
wronged: { image: require('@/assets/images/icons/mood/weiqu.png'), label: '委屈', color: '#607D8B' },
angry: { image: require('@/assets/images/icons/mood/shengqi.png'), label: '生气', color: '#F44336' },
tired: { image: require('@/assets/images/icons/mood/xinlei.png'), label: '心累', color: '#9C27B0' },
} as const;
// 心情类型定义
export type MoodType =
| 'happy' // 开心
| 'excited' // 心动
| 'thrilled' // 兴奋
| 'calm' // 平静
| 'anxious' // 焦虑
| 'sad' // 难过
| 'lonely' // 孤独
| 'wronged' // 委屈
| 'angry' // 生气
| 'tired'; // 心累
// 心情配置类型
export type MoodConfig = {
[K in MoodType]: {
image: any;
label: string;
color: string;
}
};
// 单个心情选项类型
export type MoodOption = {
type: MoodType;
image: any;
label: string;
color: string;
};
// 获取心情配置
export function getMoodConfig(moodType: MoodType) {
return MOOD_CONFIG[moodType];
}
// 获取所有心情选项
export function getMoodOptions() {
export function getMoodOptions(): MoodOption[] {
return Object.entries(MOOD_CONFIG).map(([type, config]) => ({
type: type as MoodType,
...config,