fix: 首页我的计划点击跳转错页 + feat: 新增留言反馈功能
fix: - 首页'我的计划'卡片误绑 onExercise(跳动作详情),改为 onPlanTap 正确跳训练计划详情页 - 修复后点击计划可正常打开 plan-detail feat(留言反馈): - 后端新增 feedback 模块:POST /api/feedback(AuthGuard,content 必填/contact 选填),JsonStore 持久化 - 前端新增 pages/feedback 页面(留言内容 textarea + 联系方式选填 + 提交),profile 菜单新增'意见反馈'入口 - icon-svg 新增 message-circle 图标(反馈页用)
This commit is contained in:
31
backend/src/feedback/feedback.controller.ts
Normal file
31
backend/src/feedback/feedback.controller.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { Body, Controller, Post, UseGuards } from '@nestjs/common';
|
||||
import { FeedbackService } from './feedback.service';
|
||||
import { AuthGuard } from '../common/auth.guard';
|
||||
import { CurrentUser } from '../common/current-user.decorator';
|
||||
import { IsOptional, IsString, MaxLength, MinLength } from 'class-validator';
|
||||
|
||||
class FeedbackBody {
|
||||
@IsString()
|
||||
@MinLength(1, { message: '留言内容不能为空' })
|
||||
@MaxLength(1000, { message: '留言内容不能超过 1000 字' })
|
||||
content: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MaxLength(100, { message: '联系方式不能超过 100 字' })
|
||||
contact?: string;
|
||||
}
|
||||
|
||||
@Controller('api/feedback')
|
||||
@UseGuards(AuthGuard)
|
||||
export class FeedbackController {
|
||||
constructor(private readonly svc: FeedbackService) {}
|
||||
|
||||
@Post()
|
||||
submit(
|
||||
@CurrentUser() u: { openid: string },
|
||||
@Body() body: FeedbackBody,
|
||||
) {
|
||||
return this.svc.submit(u.openid, body.content, body.contact);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user