diff --git a/docs/报告页面开发清单.md b/docs/报告页面开发清单.md index 4cb056b..6332715 100644 --- a/docs/报告页面开发清单.md +++ b/docs/报告页面开发清单.md @@ -21,6 +21,7 @@ | 11 | 科学大脑类型分析 | `/report/brain-types?recordId=3` | 网页截图 | CategoryType=6 环形图+雷达图+竖向柱状图+结论 | ✅ 已完成 | | 12 | 性格类型分析 | `/report/character-types?recordId=3` | 网页截图 | CategoryType=7 环形图+雷达图+竖向柱状图+结论 | ✅ 已完成 | | 12.1 | 性格类型-图表页 | `/report/character-types-chart?recordId=3` | 网页截图 | CategoryType=7 雷达图+横向柱状图(无结论) | ✅ 已完成 | +| 12.2 | 性格类型结论 | `/report/character-types-conclusion?recordId=3` | 网页截图 | CategoryType=7 最强性格结论详情(全页文本卡片) | ✅ 已完成 | | 13 | 未来关键发展能力分析 | `/report/future-abilities?recordId=3` | 网页截图 | CategoryType=8 雷达图+横向柱状图+结论 | ✅ 已完成 | ## 静态资源目录 diff --git a/server/MiAssessment/src/MiAssessment.Api/Pages/Report/CharacterTypesConclusion.cshtml b/server/MiAssessment/src/MiAssessment.Api/Pages/Report/CharacterTypesConclusion.cshtml new file mode 100644 index 0000000..49d7fe0 --- /dev/null +++ b/server/MiAssessment/src/MiAssessment.Api/Pages/Report/CharacterTypesConclusion.cshtml @@ -0,0 +1,39 @@ +@page "/report/character-types-conclusion" +@model MiAssessment.Api.Pages.Report.CharacterTypesConclusionModel +@{ + ViewData["Title"] = "性格分析"; + ViewData["PageTitle"] = null; + ViewData["PageNumber"] = null; +} + +@if (!Model.IsSuccess) +{ +
+

@Model.ErrorMessage

+
+} +else +{ +
+ +
+ +
性格分析
+ + +
+ @Html.Raw(Model.ConclusionContent.Replace("\\n", "
").Replace("\n", "
")) +
+
+
+} + +@section Styles { + +} + +@section Scripts { + +} diff --git a/server/MiAssessment/src/MiAssessment.Api/Pages/Report/CharacterTypesConclusion.cshtml.cs b/server/MiAssessment/src/MiAssessment.Api/Pages/Report/CharacterTypesConclusion.cshtml.cs new file mode 100644 index 0000000..110f9e2 --- /dev/null +++ b/server/MiAssessment/src/MiAssessment.Api/Pages/Report/CharacterTypesConclusion.cshtml.cs @@ -0,0 +1,71 @@ +using Microsoft.EntityFrameworkCore; +using MiAssessment.Core.Interfaces; +using MiAssessment.Model.Data; +using MiAssessment.Model.Models.Report; + +namespace MiAssessment.Api.Pages.Report; + +/// +/// 性格类型结论页 PageModel +/// 路由:/report/character-types-conclusion?recordId=3 +/// 展示最强性格类型的详细结论(全页文本卡片) +/// +public class CharacterTypesConclusionModel : ReportPageModelBase +{ + /// + /// 最强性格类型名称 + /// + public string StrongestName { get; set; } = ""; + + /// + /// 结论内容 + /// + public string ConclusionContent { get; set; } = ""; + + private readonly MiAssessmentDbContext _dbContext; + + public CharacterTypesConclusionModel(IReportDataService reportDataService, MiAssessmentDbContext dbContext) + : base(reportDataService) + { + _dbContext = dbContext; + } + + protected override async Task OnDataLoadedAsync() + { + if (ReportData?.ResultsByType == null || + !ReportData.ResultsByType.TryGetValue(7, out var allItems)) + { + ErrorMessage = "缺少性格类型数据"; + return; + } + + var items = allItems.OrderByDescending(x => x.Score).ToList(); + if (items.Count == 0) + { + ErrorMessage = "未找到性格类型数据"; + return; + } + + // 最强性格类型 + var strongest = items.First(); + StrongestName = strongest.CategoryName; + + // 从测评记录结论中查找 + if (ReportData.ConclusionsByCategory.TryGetValue(strongest.CategoryId, out var sc) && sc.Content != null) + { + ConclusionContent = sc.Content; + } + else + { + // fallback: 从模板表查 ConclusionType=1(最强) + var template = await _dbContext.ReportConclusions + .AsNoTracking() + .FirstOrDefaultAsync(t => + t.CategoryId == strongest.CategoryId && + t.ConclusionType == 1 && + !t.IsDeleted); + + ConclusionContent = template?.Content ?? ""; + } + } +} diff --git a/server/MiAssessment/src/MiAssessment.Api/wwwroot/css/pages/character-types-conclusion.css b/server/MiAssessment/src/MiAssessment.Api/wwwroot/css/pages/character-types-conclusion.css new file mode 100644 index 0000000..c13fa31 --- /dev/null +++ b/server/MiAssessment/src/MiAssessment.Api/wwwroot/css/pages/character-types-conclusion.css @@ -0,0 +1,48 @@ +/* ============================================ + 性格类型结论页 + 页面固定尺寸:1309×926px + 全页红色边框卡片 + 顶部红色badge + ============================================ */ + +.ctc-page { + display: flex; + width: 100%; + height: 100%; + padding: 20px 0 0; +} + +/* 全页卡片 */ +.ctc-card { + flex: 1; + border: 3px solid #C0392B; + border-radius: 12px; + padding: 44px 36px 28px; + position: relative; + display: flex; + flex-direction: column; +} + +/* 顶部红色 badge */ +.ctc-badge { + position: absolute; + top: 0px; + left: 50%; + transform: translateX(-50%) translateY(-1px); + padding: 6px 40px; + border-radius: 0 0 10px 10px; + font-size: 20px; + font-weight: 700; + color: #fff; + background: #C0392B; + white-space: nowrap; + letter-spacing: 3px; +} + +/* 结论文字 */ +.ctc-content { + font-size: 16px; + line-height: 2; + color: #333; + font-weight: 500; + overflow: hidden; +}