diff --git a/server/MiAssessment/src/MiAssessment.Admin/admin-web/src/views/business/content/banner/index.vue b/server/MiAssessment/src/MiAssessment.Admin/admin-web/src/views/business/content/banner/index.vue index 7cd724e..6317f46 100644 --- a/server/MiAssessment/src/MiAssessment.Admin/admin-web/src/views/business/content/banner/index.vue +++ b/server/MiAssessment/src/MiAssessment.Admin/admin-web/src/views/business/content/banner/index.vue @@ -260,6 +260,14 @@ :value="tab.value" /> + + + @@ -326,6 +334,7 @@ import { type CreateBannerRequest, type UpdateBannerRequest } from '@/api/business/content' +import { getBusinessPageList } from '@/api/business/businessPage' import { DictSelect, ImageUpload } from '@/components' // ============ Constants ============ @@ -433,6 +442,7 @@ const isInternalPage = computed(() => { const staticPageOptions = [ { label: '首页', value: '/pages/index/index' }, { label: '产品页', value: '/pages/team/index' }, + { label: '多元智能测评', value: '/pages/assessment/info/index?typeId=1' }, { label: '我的', value: '/pages/mine/index' }, { label: '往期测评', value: '/pages/assessment/history/index' }, { label: '我的订单', value: '/pages/order/list/index' }, @@ -444,6 +454,9 @@ const staticPageOptions = [ /** 产品页标签选项(从宣传图 position=2 动态加载) */ const productTabOptions = ref<{ label: string; value: string }[]>([]) +/** 业务介绍页选项(动态加载) */ +const businessPageOptions = ref<{ label: string; value: string }[]>([]) + /** 加载产品页标签选项 */ async function loadProductTabOptions() { try { @@ -459,6 +472,21 @@ async function loadProductTabOptions() { } } +/** 加载业务介绍页选项 */ +async function loadBusinessPageOptions() { + try { + const res = await getBusinessPageList({ page: 1, pageSize: 100, status: 1 }) + if (res.code === 0 && res.data?.list) { + businessPageOptions.value = res.data.list.map(item => ({ + label: `业务介绍 - ${item.title}`, + value: `/pages/business/detail/index?id=${item.id}` + })) + } + } catch (error) { + console.error('加载业务介绍页失败:', error) + } +} + // ============ Form Rules ============ /** 链接地址验证器 */ @@ -801,6 +829,7 @@ function handleDialogClosed() { onMounted(() => { loadBannerList() loadProductTabOptions() + loadBusinessPageOptions() }) diff --git a/server/MiAssessment/src/MiAssessment.Core/Services/PdfGenerationService.cs b/server/MiAssessment/src/MiAssessment.Core/Services/PdfGenerationService.cs index e6a7603..0fda822 100644 --- a/server/MiAssessment/src/MiAssessment.Core/Services/PdfGenerationService.cs +++ b/server/MiAssessment/src/MiAssessment.Core/Services/PdfGenerationService.cs @@ -76,9 +76,6 @@ public class PdfGenerationService : IPdfGenerationService throw new InvalidOperationException("ReportSettings:BaseUrl 未配置"); } - // 1.5 检查八大智能同分情况:>=6项同分时不生成PDF - await CheckIntelligenceTiedScoresAsync(recordId); - // 2. 查询启用的页面配置,按 SortOrder 升序 var pageConfigs = await _dbContext.ReportPageConfigs .Where(p => p.Status == 1) @@ -170,43 +167,6 @@ public class PdfGenerationService : IPdfGenerationService recordId, reportUrl); } - /// - /// 检查八大智能(CategoryType=1)是否存在>=6项同分的情况 - /// 如果存在,抛出异常阻止PDF生成 - /// - /// 测评记录ID - private async Task CheckIntelligenceTiedScoresAsync(long recordId) - { - // 查询八大智能(CategoryType=1)的测评结果 - var intelligenceScores = await _dbContext.AssessmentResults - .AsNoTracking() - .Join( - _dbContext.ReportCategories.AsNoTracking().Where(c => !c.IsDeleted && c.CategoryType == 1), - r => r.CategoryId, - c => c.Id, - (r, c) => new { r.RecordId, r.Percentage }) - .Where(x => x.RecordId == recordId) - .Select(x => x.Percentage) - .ToListAsync(); - - if (intelligenceScores.Count == 0) - { - return; - } - - // 按百分比分组,检查是否有任意一个分数出现>=6次 - var maxTiedCount = intelligenceScores - .GroupBy(p => p) - .Max(g => g.Count()); - - if (maxTiedCount >= 6) - { - _logger.LogWarning("八大智能存在 {TiedCount} 项同分,不生成PDF,RecordId: {RecordId}", - maxTiedCount, recordId); - throw new InvalidOperationException($"八大智能存在{maxTiedCount}项同分(>=6项),无法生成有效的测评报告"); - } - } - /// /// 处理单个页面配置,获取图片字节数组 /// diff --git a/server/MiAssessment/src/MiAssessment.Core/Services/ReportGenerationService.cs b/server/MiAssessment/src/MiAssessment.Core/Services/ReportGenerationService.cs index 098d9d7..6e071d3 100644 --- a/server/MiAssessment/src/MiAssessment.Core/Services/ReportGenerationService.cs +++ b/server/MiAssessment/src/MiAssessment.Core/Services/ReportGenerationService.cs @@ -323,6 +323,20 @@ public class ReportGenerationService $"八大智能8项得分全部相同({intelligenceScores.First()}%),无法生成差异化报告"); } + // 八大智能>=6项同分时也无法生成有效报告 + if (intelligenceScores.Count >= 6) + { + var maxTiedCount = intelligenceScores + .GroupBy(p => p) + .Max(g => g.Count()); + + if (maxTiedCount >= 6) + { + throw new AllScoresEqualException("Intelligence", + $"八大智能存在{maxTiedCount}项同分(>=6项),无法生成有效的测评报告"); + } + } + // CategoryType=3 为细分能力维度 var abilityScores = categoryScores .Where(s => s.CategoryType == 3) diff --git a/uniapp/pages/assessment/history/index.vue b/uniapp/pages/assessment/history/index.vue index abbdd7f..aa77264 100644 --- a/uniapp/pages/assessment/history/index.vue +++ b/uniapp/pages/assessment/history/index.vue @@ -165,6 +165,14 @@ function viewResult(record) { }) return } + + // 生成失败 - 跳转到测评首页重新开始 + if (record.status === ASSESSMENT_STATUS.FAILED) { + uni.navigateTo({ + url: `/pages/assessment/info/index?typeId=${record.assessmentTypeId || 1}` + }) + return + } } /** @@ -231,6 +239,12 @@ onMounted(() => { + + + 重新测试 + + + diff --git a/uniapp/pages/assessment/info/index.vue b/uniapp/pages/assessment/info/index.vue index 66130a2..6dbd7c7 100644 --- a/uniapp/pages/assessment/info/index.vue +++ b/uniapp/pages/assessment/info/index.vue @@ -481,7 +481,7 @@ - + {{ isContinueMode ? '您有一份进行中的测评,信息已自动填充' : '正式测评前,请先填写您的基本信息' }} @@ -679,7 +679,7 @@ } .form-tip { - text-align: center; + text-align: left; font-size: $font-size-md; color: $text-secondary; margin-bottom: $spacing-xl; diff --git a/uniapp/pages/assessment/loading/index.vue b/uniapp/pages/assessment/loading/index.vue index 874929d..8d2c005 100644 --- a/uniapp/pages/assessment/loading/index.vue +++ b/uniapp/pages/assessment/loading/index.vue @@ -112,19 +112,10 @@ async function checkStatus() { needRetest.value = true retestMessage.value = res.data.message || '分析得出多个智能处于同一梯队,我们需要更细致的分析维度,接下来请您重新进行测评' } else if (status === 5) { - // 生成失败 + // 生成失败:停止轮询,显示提示和重新测试按钮 stopPolling() - - uni.showModal({ - title: '提示', - content: res.data.message || '报告生成失败,请联系客服', - showCancel: false, - success: () => { - uni.switchTab({ - url: '/pages/index/index' - }) - } - }) + needRetest.value = true + retestMessage.value = res.data.message || '报告生成失败,请重新进行测评' } // status === 3 或 6 继续轮询 } diff --git a/uniapp/pages/mine/index.vue b/uniapp/pages/mine/index.vue index 9a64047..f2f1bd3 100644 --- a/uniapp/pages/mine/index.vue +++ b/uniapp/pages/mine/index.vue @@ -1,7 +1,7 @@