diff --git a/server/MiAssessment/src/MiAssessment.Api/Pages/Report/CharacterTypes.cshtml b/server/MiAssessment/src/MiAssessment.Api/Pages/Report/CharacterTypes.cshtml index 3ad36d1..52dd7ce 100644 --- a/server/MiAssessment/src/MiAssessment.Api/Pages/Report/CharacterTypes.cshtml +++ b/server/MiAssessment/src/MiAssessment.Api/Pages/Report/CharacterTypes.cshtml @@ -36,33 +36,11 @@ else - -
-
-
最强能力解读
-
- @if (Model.StrongestConclusion != null) - { - @Html.Raw(Model.StrongestConclusion.Content?.Replace("\\n", "
").Replace("\n", "
") ?? "暂无结论") - } - else - { - 暂无结论数据 - } -
-
-
-
较弱能力解读
-
- @if (Model.WeakestConclusion != null) - { - @Html.Raw(Model.WeakestConclusion.Content?.Replace("\\n", "
").Replace("\n", "
") ?? "暂无结论") - } - else - { - 暂无结论数据 - } -
+ +
+
性格分析
+
+ @Html.Raw(Model.ConclusionContent.Replace("\\n", "
").Replace("\n", "
"))
diff --git a/server/MiAssessment/src/MiAssessment.Api/Pages/Report/CharacterTypes.cshtml.cs b/server/MiAssessment/src/MiAssessment.Api/Pages/Report/CharacterTypes.cshtml.cs index 4c1d5ee..fdac2f1 100644 --- a/server/MiAssessment/src/MiAssessment.Api/Pages/Report/CharacterTypes.cshtml.cs +++ b/server/MiAssessment/src/MiAssessment.Api/Pages/Report/CharacterTypes.cshtml.cs @@ -28,24 +28,9 @@ public class CharacterTypesModel : ReportPageModelBase public decimal TotalScore { get; set; } /// - /// 最强类型名称 + /// 性格分析结论内容 /// - public string StrongestName { get; set; } = ""; - - /// - /// 最强类型结论 - /// - public ConclusionDataDto? StrongestConclusion { get; set; } - - /// - /// 较弱类型名称 - /// - public string WeakestName { get; set; } = ""; - - /// - /// 较弱类型结论 - /// - public ConclusionDataDto? WeakestConclusion { get; set; } + public string ConclusionContent { get; set; } = ""; private readonly MiAssessmentDbContext _dbContext; @@ -74,38 +59,21 @@ public class CharacterTypesModel : ReportPageModelBase ItemsByScore = Items.OrderByDescending(x => x.Score).ToList(); TotalScore = Items.Sum(x => x.Score); - // 最强结论 + // 加载最强性格类型的性格分析结论 var strongest = ItemsByScore.First(); - StrongestName = strongest.CategoryName; - if (ReportData.ConclusionsByCategory.TryGetValue(strongest.CategoryId, out var sc)) - StrongestConclusion = sc; - else - StrongestConclusion = await GetTemplateConclusionAsync(strongest.CategoryId, 1); - - // 较弱结论 - var weakest = ItemsByScore.Last(); - WeakestName = weakest.CategoryName; - if (ReportData.ConclusionsByCategory.TryGetValue(weakest.CategoryId, out var wc)) - WeakestConclusion = wc; - else - WeakestConclusion = await GetTemplateConclusionAsync(weakest.CategoryId, 4); - } - - private async Task GetTemplateConclusionAsync(long categoryId, int conclusionType) - { - var template = await _dbContext.ReportConclusions - .AsNoTracking() - .FirstOrDefaultAsync(t => - t.CategoryId == categoryId && - t.ConclusionType == conclusionType && - !t.IsDeleted); - if (template == null) return null; - return new ConclusionDataDto + if (ReportData.ConclusionsByCategory.TryGetValue(strongest.CategoryId, out var sc) && sc.Content != null) { - CategoryId = template.CategoryId, - ConclusionType = template.ConclusionType, - Title = template.Title, - Content = template.Content - }; + ConclusionContent = sc.Content; + } + else + { + 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.css b/server/MiAssessment/src/MiAssessment.Api/wwwroot/css/pages/character-types.css index e6e062f..31056d9 100644 --- a/server/MiAssessment/src/MiAssessment.Api/wwwroot/css/pages/character-types.css +++ b/server/MiAssessment/src/MiAssessment.Api/wwwroot/css/pages/character-types.css @@ -47,59 +47,37 @@ text-align: center; } -/* ---- 下半部分:结论卡片 ---- */ -.ct-conclusions { - display: flex; - gap: 30px; +/* ---- 下半部分:性格分析卡片 ---- */ +.ct-analysis-card { flex: 1; - min-height: 0; -} - -.ct-conclusion-card { - flex: 1; - border: 3px solid; + border: 3px solid #C0392B; border-radius: 12px; - padding: 34px 20px 14px; + padding: 40px 28px 16px; position: relative; display: flex; flex-direction: column; + min-height: 0; } -.ct-card-strong { - border-color: #E67E73; - background: #FFF5F5; -} - -.ct-card-weak { - border-color: #E67E73; - background: #FFF5F5; -} - -.ct-badge { +.ct-analysis-badge { position: absolute; top: 0px; left: 50%; transform: translateX(-50%) translateY(-1px); - padding: 5px 24px; + padding: 5px 32px; border-radius: 0 0 8px 8px; font-size: 16px; font-weight: 700; color: #fff; + background: #C0392B; white-space: nowrap; letter-spacing: 2px; } -.ct-badge-strong { background: #C0392B; } -.ct-badge-weak { background: #C0392B; } - -.ct-conclusion-content { +.ct-analysis-content { font-size: 13px; line-height: 1.7; - color: var(--text-secondary); - font-weight: 600; + color: #333; + font-weight: 500; overflow: hidden; - text-overflow: ellipsis; - display: -webkit-box; - -webkit-line-clamp: 9; - -webkit-box-orient: vertical; }