refactor(report): 性格类型页合并,删除最强/较弱能力解读,将性格分析移至第1页
- CharacterTypes第1页删除最强能力解读和较弱能力解读卡片 - 将第2页CharacterTypesConclusion的性格分析内容合并到第1页图表下方 - code-behind移除StrongestConclusion/WeakestConclusion,新增ConclusionContent - CSS替换结论卡片样式为性格分析卡片样式 - 数据库禁用character-types-conclusion页面(Status=0)
This commit is contained in:
parent
20a5c1b1de
commit
5754d89d20
|
|
@ -36,33 +36,11 @@ else
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 下半部分:结论卡片 -->
|
||||
<div class="ct-conclusions">
|
||||
<div class="ct-conclusion-card ct-card-strong">
|
||||
<div class="ct-badge ct-badge-strong">最强能力解读</div>
|
||||
<div class="ct-conclusion-content">
|
||||
@if (Model.StrongestConclusion != null)
|
||||
{
|
||||
@Html.Raw(Model.StrongestConclusion.Content?.Replace("\\n", "<br/>").Replace("\n", "<br/>") ?? "暂无结论")
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="no-content">暂无结论数据</span>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="ct-conclusion-card ct-card-weak">
|
||||
<div class="ct-badge ct-badge-weak">较弱能力解读</div>
|
||||
<div class="ct-conclusion-content">
|
||||
@if (Model.WeakestConclusion != null)
|
||||
{
|
||||
@Html.Raw(Model.WeakestConclusion.Content?.Replace("\\n", "<br/>").Replace("\n", "<br/>") ?? "暂无结论")
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="no-content">暂无结论数据</span>
|
||||
}
|
||||
</div>
|
||||
<!-- 下半部分:性格分析卡片 -->
|
||||
<div class="ct-analysis-card">
|
||||
<div class="ct-analysis-badge">性格分析</div>
|
||||
<div class="ct-analysis-content">
|
||||
@Html.Raw(Model.ConclusionContent.Replace("\\n", "<br/>").Replace("\n", "<br/>"))
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -28,24 +28,9 @@ public class CharacterTypesModel : ReportPageModelBase
|
|||
public decimal TotalScore { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最强类型名称
|
||||
/// 性格分析结论内容
|
||||
/// </summary>
|
||||
public string StrongestName { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// 最强类型结论
|
||||
/// </summary>
|
||||
public ConclusionDataDto? StrongestConclusion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 较弱类型名称
|
||||
/// </summary>
|
||||
public string WeakestName { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// 较弱类型结论
|
||||
/// </summary>
|
||||
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<ConclusionDataDto?> 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 ?? "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user