This commit is contained in:
parent
ff61ee72b1
commit
394e96eebe
|
|
@ -260,6 +260,14 @@
|
|||
:value="tab.value"
|
||||
/>
|
||||
</el-option-group>
|
||||
<el-option-group v-if="businessPageOptions.length > 0" label="业务介绍页">
|
||||
<el-option
|
||||
v-for="bp in businessPageOptions"
|
||||
:key="bp.value"
|
||||
:label="bp.label"
|
||||
:value="bp.value"
|
||||
/>
|
||||
</el-option-group>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
|
|
@ -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()
|
||||
})
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查八大智能(CategoryType=1)是否存在>=6项同分的情况
|
||||
/// 如果存在,抛出异常阻止PDF生成
|
||||
/// </summary>
|
||||
/// <param name="recordId">测评记录ID</param>
|
||||
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项),无法生成有效的测评报告");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 处理单个页面配置,获取图片字节数组
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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(() => {
|
|||
<view class="arrow-icon"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="card-footer" v-else-if="record.status === ASSESSMENT_STATUS.FAILED">
|
||||
<view class="view-btn retest-btn">
|
||||
<text>重新测试</text>
|
||||
<view class="arrow-icon"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 加载更多 -->
|
||||
|
|
|
|||
|
|
@ -481,7 +481,7 @@
|
|||
|
||||
<!-- 表单卡片 -->
|
||||
<view class="form-card">
|
||||
<view class="form-tip">
|
||||
<view class="form-tip" style="margin-bottom: 10rpx;">
|
||||
{{ isContinueMode ? '您有一份进行中的测评,信息已自动填充' : '正式测评前,请先填写您的基本信息' }}
|
||||
</view>
|
||||
<view class="form-tip">
|
||||
|
|
@ -679,7 +679,7 @@
|
|||
}
|
||||
|
||||
.form-tip {
|
||||
text-align: center;
|
||||
text-align: left;
|
||||
font-size: $font-size-md;
|
||||
color: $text-secondary;
|
||||
margin-bottom: $spacing-xl;
|
||||
|
|
|
|||
|
|
@ -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 继续轮询
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<view class="mine-page">
|
||||
<!-- 顶部渐变背景层 -->
|
||||
<view class="top-gradient"></view>
|
||||
<!-- <view class="top-gradient"></view> -->
|
||||
|
||||
<!-- 导航栏占位 -->
|
||||
<view class="navbar-placeholder" :style="{ height: totalNavbarHeight + 'px' }"></view>
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ function getDisplayStatus(order) {
|
|||
|
||||
// 已支付/已完成的订单,根据测评记录状态显示
|
||||
if (assessmentStatus) {
|
||||
const map = { 1: '待测评', 2: '测评中', 3: '测评生成中', 4: '已测评', 7: '待测评' }
|
||||
const map = { 1: '待测评', 2: '测评中', 3: '测评生成中', 4: '已测评', 5: '生成失败', 7: '待测评' }
|
||||
return map[assessmentStatus] || order.statusText || '已支付'
|
||||
}
|
||||
|
||||
|
|
@ -172,9 +172,17 @@ function viewResult(order) {
|
|||
* 开始测评
|
||||
*/
|
||||
function startAssessment(order) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/assessment/questions/index?recordId=${order.assessmentRecordId}`
|
||||
})
|
||||
const dst = getDisplayStatus(order)
|
||||
if (dst === '生成失败') {
|
||||
// 生成失败:跳转到测评首页重新开始
|
||||
uni.navigateTo({
|
||||
url: `/pages/assessment/info/index?typeId=${order.productId || 1}`
|
||||
})
|
||||
} else {
|
||||
uni.navigateTo({
|
||||
url: `/pages/assessment/questions/index?recordId=${order.assessmentRecordId}`
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -188,7 +196,8 @@ function showViewResultBtn(order) {
|
|||
* 判断是否显示开始测评按钮
|
||||
*/
|
||||
function showStartBtn(order) {
|
||||
return getDisplayStatus(order) === '待测评'
|
||||
const dst = getDisplayStatus(order)
|
||||
return dst === '待测评' || dst === '生成失败'
|
||||
}
|
||||
|
||||
onShow(() => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user