Files
fitness-coach/backend/src/feedback/feedback.service.ts
wm 4dba91a16e fix: 首页我的计划点击跳转错页 + feat: 新增留言反馈功能
fix:
- 首页'我的计划'卡片误绑 onExercise(跳动作详情),改为 onPlanTap 正确跳训练计划详情页
- 修复后点击计划可正常打开 plan-detail

feat(留言反馈):
- 后端新增 feedback 模块:POST /api/feedback(AuthGuard,content 必填/contact 选填),JsonStore 持久化
- 前端新增 pages/feedback 页面(留言内容 textarea + 联系方式选填 + 提交),profile 菜单新增'意见反馈'入口
- icon-svg 新增 message-circle 图标(反馈页用)
2026-07-22 23:21:18 +08:00

34 lines
777 B
TypeScript

import { Injectable } from '@nestjs/common';
import { randomUUID } from 'crypto';
import { getStore } from '../common/store';
export interface Feedback {
id: string;
openid: string;
content: string;
contact?: string;
createdAt: string;
}
@Injectable()
export class FeedbackService {
private store = getStore<Feedback>('feedback');
submit(openid: string, content: string, contact?: string): Feedback {
return this.store.insert({
id: randomUUID(),
openid,
content,
contact: contact || undefined,
createdAt: new Date().toISOString(),
});
}
// 管理员视角:按时间倒序返回全部留言
list(): Feedback[] {
return this.store
.all()
.sort((a, b) => (a.createdAt < b.createdAt ? 1 : -1));
}
}