Преглед на файлове

Merge remote-tracking branch 'origin/cfclub' into cfclub

Agnes Agent преди 1 седмица
родител
ревизия
63c60a93e
променени са 100 файла, в които са добавени 3471 реда и са изтрити 227 реда
  1. 86 0
      cfc-backend/src/main/java/com/etotem/cfc/common/constant/DimensionCodeConstants.java
  2. 100 0
      cfc-backend/src/main/java/com/etotem/cfc/config/DatabaseInitializer.java
  3. 4 1
      cfc-backend/src/main/java/com/etotem/cfc/config/JwtInterceptor.java
  4. 14 0
      cfc-backend/src/main/java/com/etotem/cfc/controller/HealthDimensionController.java
  5. 3 0
      cfc-backend/src/main/java/com/etotem/cfc/controller/MembershipController.java
  6. 6 0
      cfc-backend/src/main/java/com/etotem/cfc/controller/guide/GuideFamilyTaskController.java
  7. 32 1
      cfc-backend/src/main/java/com/etotem/cfc/controller/product/ProductController.java
  8. 176 0
      cfc-backend/src/main/java/com/etotem/cfc/controller/reward/RewardEstimateController.java
  9. 8 0
      cfc-backend/src/main/java/com/etotem/cfc/controller/task/TaskController.java
  10. 8 1
      cfc-backend/src/main/java/com/etotem/cfc/dto/DimensionNode.java
  11. 6 0
      cfc-backend/src/main/java/com/etotem/cfc/dto/ProductDTO.java
  12. 23 0
      cfc-backend/src/main/java/com/etotem/cfc/dto/RewardDisplayVO.java
  13. 26 0
      cfc-backend/src/main/java/com/etotem/cfc/dto/RewardEstimateRequest.java
  14. 43 0
      cfc-backend/src/main/java/com/etotem/cfc/dto/RewardEstimateVO.java
  15. 8 0
      cfc-backend/src/main/java/com/etotem/cfc/entity/GrowthTask.java
  16. 8 0
      cfc-backend/src/main/java/com/etotem/cfc/entity/Task.java
  17. 11 40
      cfc-backend/src/main/java/com/etotem/cfc/service/DanKnowledgeBaseService.java
  18. 110 0
      cfc-backend/src/main/java/com/etotem/cfc/service/DimensionRegistryService.java
  19. 36 0
      cfc-backend/src/main/java/com/etotem/cfc/service/IndicatorService.java
  20. 4 8
      cfc-backend/src/main/java/com/etotem/cfc/service/LanggraphSyncService.java
  21. 849 0
      cfc-backend/src/main/java/com/etotem/cfc/service/RewardRuleService.java
  22. 112 10
      cfc-backend/src/main/java/com/etotem/cfc/service/TaskService.java
  23. 55 0
      cfc-backend/src/main/resources/db/migrate_dimension_unified.sql
  24. 1 1
      cfc-backend/src/main/resources/schema.sql
  25. 85 0
      cfc-backend/src/test/java/com/etotem/cfc/controller/MembershipControllerPlansLevelOrderTest.java
  26. 321 0
      cfc-backend/src/test/java/com/etotem/cfc/controller/reward/RewardEstimateControllerTest.java
  27. 463 0
      cfc-backend/src/test/java/com/etotem/cfc/service/RewardRuleServiceEstimateTest.java
  28. 361 0
      cfc-backend/src/test/java/com/etotem/cfc/unit/TaskCreateScP10ContractTest.java
  29. 1 1
      cfc-frontend/components/ConfigurableGuide.vue
  30. 1 1
      cfc-frontend/components/MemberSelector.vue
  31. 1 1
      cfc-frontend/components/OnboardingGuide.vue
  32. 163 0
      cfc-frontend/composables/useDimensionRegistry.js
  33. 1 1
      cfc-frontend/pages/achievement/index.vue
  34. 1 1
      cfc-frontend/pages/action-detail/components/AbilityDiagram.vue
  35. 1 1
      cfc-frontend/pages/action-detail/components/OctopusDiagram.vue
  36. 1 1
      cfc-frontend/pages/action-detail/components/PearlDiagram.vue
  37. 1 1
      cfc-frontend/pages/action-detail/index.vue
  38. 2 2
      cfc-frontend/pages/action-detail/octopus-effects-list.vue
  39. 1 1
      cfc-frontend/pages/activity/activity-detail/activity-detail.vue
  40. 1 1
      cfc-frontend/pages/activity/create.vue
  41. 3 3
      cfc-frontend/pages/activity/index.vue
  42. 1 1
      cfc-frontend/pages/ai/chat.vue
  43. 1 1
      cfc-frontend/pages/ai/components/UpgradeGuideModal.vue
  44. 3 3
      cfc-frontend/pages/article-center/article-detail.vue
  45. 1 1
      cfc-frontend/pages/article-center/article-edit.vue
  46. 2 2
      cfc-frontend/pages/article-center/index.vue
  47. 1 1
      cfc-frontend/pages/article-center/my-posts.vue
  48. 1 1
      cfc-frontend/pages/assessment-plan/detail.vue
  49. 1 1
      cfc-frontend/pages/assessment-plan/list.vue
  50. 1 1
      cfc-frontend/pages/assessment/quota.vue
  51. 1 1
      cfc-frontend/pages/assessment/rating.vue
  52. 1 1
      cfc-frontend/pages/assessment/results.vue
  53. 1 1
      cfc-frontend/pages/body-detail/dimension-detail.vue
  54. 1 1
      cfc-frontend/pages/body-detail/dimension-questionnaire.vue
  55. 1 1
      cfc-frontend/pages/child/tasks.vue
  56. 1 1
      cfc-frontend/pages/cognitive-hall.vue
  57. 2 2
      cfc-frontend/pages/cognitive-test/language-test.vue
  58. 2 2
      cfc-frontend/pages/cognitive-test/logic-test.vue
  59. 3 3
      cfc-frontend/pages/cognitive-test/memory-test.vue
  60. 2 2
      cfc-frontend/pages/cognitive-test/perception-test.vue
  61. 4 4
      cfc-frontend/pages/cognitive-test/spatial-test.vue
  62. 2 2
      cfc-frontend/pages/cognitive-test/speed-test.vue
  63. 25 0
      cfc-frontend/pages/dan-assessment/comparison.vue
  64. 37 3
      cfc-frontend/pages/dan-assessment/report-result.vue
  65. 1 1
      cfc-frontend/pages/diet/meal-config.vue
  66. 1 1
      cfc-frontend/pages/diet/preferences.vue
  67. 2 2
      cfc-frontend/pages/diet/recommendation.vue
  68. 2 2
      cfc-frontend/pages/diet/records.vue
  69. 1 1
      cfc-frontend/pages/discover/circle-feed.vue
  70. 1 1
      cfc-frontend/pages/energy/detail.vue
  71. 1 1
      cfc-frontend/pages/energy/index.vue
  72. 1 1
      cfc-frontend/pages/family/mbti-profile.vue
  73. 1 1
      cfc-frontend/pages/family/mbti-result.vue
  74. 1 1
      cfc-frontend/pages/family/self-check-ai.vue
  75. 1 1
      cfc-frontend/pages/family/self-check-entry.vue
  76. 2 2
      cfc-frontend/pages/family/self-check-result.vue
  77. 1 1
      cfc-frontend/pages/games/list.vue
  78. 16 1
      cfc-frontend/pages/growth-main/index.vue
  79. 1 1
      cfc-frontend/pages/growth/caution-detail.vue
  80. 4 4
      cfc-frontend/pages/growth/sleep-checkin.vue
  81. 1 1
      cfc-frontend/pages/growth/supplement.vue
  82. 1 1
      cfc-frontend/pages/growth/upload.vue
  83. 2 2
      cfc-frontend/pages/guide/activities/index.vue
  84. 1 1
      cfc-frontend/pages/guide/bind/invite.vue
  85. 1 1
      cfc-frontend/pages/guide/hierarchy/index.vue
  86. 1 1
      cfc-frontend/pages/guide/packages/create.vue
  87. 1 1
      cfc-frontend/pages/guide/register/index.vue
  88. 174 64
      cfc-frontend/pages/health-main/index.vue
  89. 2 2
      cfc-frontend/pages/health/challenge-manage.vue
  90. 1 1
      cfc-frontend/pages/health/doa-index.vue
  91. 2 2
      cfc-frontend/pages/health/health-plan-summary.vue
  92. 2 2
      cfc-frontend/pages/health/indicator-timeline.vue
  93. 1 1
      cfc-frontend/pages/health/my-feedback.vue
  94. 2 2
      cfc-frontend/pages/health/nutrition-profile.vue
  95. 1 1
      cfc-frontend/pages/health/physical-exam-detail.vue
  96. 1 1
      cfc-frontend/pages/health/plan-list.vue
  97. 1 1
      cfc-frontend/pages/health/report-list.vue
  98. 5 5
      cfc-frontend/pages/health/report-upload.vue
  99. 1 1
      cfc-frontend/pages/health/survey-history.vue
  100. 1 1
      cfc-frontend/pages/health/teacher-service.vue

+ 86 - 0
cfc-backend/src/main/java/com/etotem/cfc/common/constant/DimensionCodeConstants.java

@@ -1,6 +1,7 @@
 package com.etotem.cfc.common.constant;
 
 public class DimensionCodeConstants {
+    // 统一维度体系常量:5 根(body/mind/wisdom/action/wealth)+ 子维构成 body7/wisdom7/mind10/action5/wealth4(共33子维)
     // 5 根维度
     public static final String BODY = "body";
     public static final String MIND = "mind";
@@ -32,4 +33,89 @@ public class DimensionCodeConstants {
     public static final String WUXING_METAL = "金";
     public static final String WUXING_WATER = "水";
     public static final String WUXING_EARTH = "土";
+
+    // ===== 增量子维常量(P0 增量,迁移448 seed;统一 code={root}.{key}) =====
+    // 维度构成:body7 / wisdom7 / mind10 / action5 / wealth4(共 33 子维 + 5 根 = 38 节点)
+
+    // wisdom 智/认知(7,source_system='cognitive')—— DAN 认知报告字段
+    public static final String WISDOM_MEMORY = "wisdom.memory";
+    public static final String WISDOM_ATTENTION = "wisdom.attention";
+    public static final String WISDOM_LOGIC = "wisdom.logic";
+    public static final String WISDOM_SPATIAL = "wisdom.spatial";
+    public static final String WISDOM_PERCEPTION = "wisdom.perception";
+    public static final String WISDOM_FOCUS = "wisdom.focus";
+    public static final String WISDOM_PROCESSING_SPEED = "wisdom.processingSpeed";
+
+    // mind 心/心理(10,source_system='emi')
+    public static final String MIND_OPENNESS = "mind.openness";
+    public static final String MIND_CONSCIENTIOUSNESS = "mind.conscientiousness";
+    public static final String MIND_EXTRAVERSION = "mind.extraversion";
+    public static final String MIND_AGREEABLENESS = "mind.agreeableness";
+    public static final String MIND_NEUROTICISM = "mind.neuroticism";
+    public static final String MIND_DRIVE_AUTONOMY = "mind.driveAutonomy";
+    public static final String MIND_DRIVE_COMPETENCE = "mind.driveCompetence";
+    public static final String MIND_DRIVE_RELATEDNESS = "mind.driveRelatedness";
+    public static final String MIND_EMOTION_STABILITY = "mind.emotionStability";
+    public static final String MIND_SELF_CONCEPT_OVERALL = "mind.selfConceptOverall";
+
+    // action 社会性(5,source_system='relationship')—— RelationshipScoreVO 字段
+    public static final String ACTION_PARENT_TRUST = "action.parentTrust";
+    public static final String ACTION_PARENT_INTIMACY = "action.parentIntimacy";
+    public static final String ACTION_COMMUNICATION = "action.communication";
+    public static final String ACTION_HEALTH_STATUS = "action.healthStatus";
+    public static final String ACTION_LAST_INTERACTION = "action.lastInteraction";
+
+    // wealth 富(4,source_system='energy')—— MemberEnergyDTO 字段
+    public static final String WEALTH_SKILL = "wealth.skill";
+    public static final String WEALTH_ALTRUISM = "wealth.altruism";
+    public static final String WEALTH_INCOME = "wealth.income";
+    public static final String WEALTH_FX = "wealth.fx";
+
+    // 增量 33 子维的 legacy_alias 映射(JSON数组字符串,单元素=后端 API 取数字段名)
+    public static final String LEGACY_MEMORY_SCORE = "memoryScore";
+    public static final String LEGACY_ATTENTION_SCORE = "attentionScore";
+    public static final String LEGACY_LOGIC_SCORE = "logicScore";
+    public static final String LEGACY_SPATIAL_SCORE = "spatialScore";
+    public static final String LEGACY_PERCEPTION_SCORE = "perceptionScore";
+    public static final String LEGACY_FOCUS_SCORE = "focusScore";
+    public static final String LEGACY_PROCESSING_SPEED_SCORE = "processingSpeedScore";
+    public static final String LEGACY_OPENNESS_SCORE = "opennessScore";
+    public static final String LEGACY_CONSCIENTIOUSNESS_SCORE = "conscientiousnessScore";
+    public static final String LEGACY_EXTRAVERSION_SCORE = "extraversionScore";
+    public static final String LEGACY_AGREEABLENESS_SCORE = "agreeablenessScore";
+    public static final String LEGACY_NEUROTICISM_SCORE = "neuroticismScore";
+    public static final String LEGACY_DRIVE_AUTONOMY = "driveAutonomy";
+    public static final String LEGACY_DRIVE_COMPETENCE = "driveCompetence";
+    public static final String LEGACY_DRIVE_RELATEDNESS = "driveRelatedness";
+    public static final String LEGACY_EMOTION_STABILITY = "emotionStability";
+    public static final String LEGACY_SELF_CONCEPT_OVERALL = "selfConceptOverall";
+    public static final String LEGACY_TRUST_SCORE = "trustScore";
+    public static final String LEGACY_INTIMACY_SCORE = "intimacyScore";
+    public static final String LEGACY_COMMUNICATION_SCORE = "communicationScore";
+    public static final String LEGACY_TOTAL_SCORE = "totalScore";
+    public static final String LEGACY_LAST_INTERACTION_AT = "lastInteractionAt";
+    public static final String LEGACY_WEALTH_SKILL = "wealthSkill";
+    public static final String LEGACY_WEALTH_ALTRUISM = "wealthAltruism";
+    public static final String LEGACY_WEALTH_INCOME = "wealthIncome";
+    public static final String LEGACY_WEALTH_FX = "wealthFx";
+
+    // ===== P2-T2 评分口径共享常量 =====
+    // 来源: docs/superpowers/specs/2026-11-05-dimension-scoring-convention.md
+    // 统一量纲 0-100(雷达 / 沙盘能量 / 指标归一化 三处共享同一量纲):
+    //   - 雷达(0-100): RadarChart.vue r = outerR × clamp(score/100,0,1),分值文本 Math.round(score)+'%'
+    //   - 沙盘能量(0-100%): EnergyService 各子维公式 clamp(...,0,100)
+    //   - 指标归一化: NormCompareEngine 按百分位带 P5/P25/P75/P95 判 偏低/正常/偏高
+    public static final int SCORE_MIN = 0;
+    public static final int SCORE_MAX = 100;
+
+    // 百分位带断点(NormCompareEngine.applyBandFromNorm / applyBandFromPopulation):
+    //   v < P5      → band=veryLow, status=偏低
+    //   P5 ≤ v < P25→ band=low,     status=偏低
+    //   P25 ≤ v ≤ P75 → band=mid,   status=正常
+    //   P75 < v ≤ P95 → band=high,  status=偏高
+    //   v > P95     → band=veryHigh,status=偏高
+    public static final int BAND_P5 = 5;
+    public static final int BAND_P25 = 25;
+    public static final int BAND_P75 = 75;
+    public static final int BAND_P95 = 95;
 }

+ 100 - 0
cfc-backend/src/main/java/com/etotem/cfc/config/DatabaseInitializer.java

@@ -3443,6 +3443,12 @@ insertSysConfigSeed("gift_membership_pay_price", "198000", "送会员商品达
         migrateUnifiedIndicatorTreeColumns();
         // 迁移447: 统一维度体系(P0-T3)—— 固化 5 根 + 7 body 子维度节点(幂等 seed)
         seedUnifiedDimensionRegistry();
+        // 迁移448: 统一维度体系(增量)—— 另外 4 根 33 子维 + 5 根五行归属(幂等 seed,仅追加,不改动 445-447)
+        seedUnifiedDimensionRegistryExpansion();
+        // 迁移449: 统一维度体系(P1-T3)—— indicator_definitions.dimension_code 扩宽至 VARCHAR(64),
+        // 以容纳注册中心子维度 code(如 mind.selfConceptOverall=23 字符 > 原 VARCHAR(16)),
+        // 指标可归属/挂接到任意维度节点(红线1:不动 id 主键与 5 张外键表)
+        migrateIndicatorDimensionCodeWidth();
     }
 
     /**
@@ -15169,6 +15175,100 @@ log.info("迁移298: 已为无 openid 的 child 账号补齐 family_members 记
         log.info("迁移447: 统一维度注册中心 5 根 + 7 body 子维度 seed 完成");
     }
 
+    /**
+     * 迁移448: 统一维度体系(增量)—— 固化另外 4 根(mind/wisdom/action/wealth)的 33 个子维度节点,
+     * 并补 5 根节点的五行归属(wuxing_rule_ref)。幂等 seed,仅追加,不改动 445-447。
+     * 子维 code = {root}.{key},legacy_alias = 后端 API 取数字段名(供 P1 健康页雷达按配置取数)。
+     */
+    void seedUnifiedDimensionRegistryExpansion() {
+        // 4 根 id(body 的 7 子维已在迁移447 固化;此处覆盖其余 4 根)
+        Long mindId = queryDimensionIdByCode("mind");
+        Long wisdomId = queryDimensionIdByCode("wisdom");
+        Long actionId = queryDimensionIdByCode("action");
+        Long wealthId = queryDimensionIdByCode("wealth");
+
+        // —— mind 心/心理(10,source_system='emi')——
+        if (mindId != null) {
+            upsertDimensionSeed("mind.openness", "开放性", "emi", mindId, 1, "emi", "sub", "[\"opennessScore\"]", null);
+            upsertDimensionSeed("mind.conscientiousness", "尽责性", "emi", mindId, 2, "emi", "sub", "[\"conscientiousnessScore\"]", null);
+            upsertDimensionSeed("mind.extraversion", "外向性", "emi", mindId, 3, "emi", "sub", "[\"extraversionScore\"]", null);
+            upsertDimensionSeed("mind.agreeableness", "宜人性", "emi", mindId, 4, "emi", "sub", "[\"agreeablenessScore\"]", null);
+            upsertDimensionSeed("mind.neuroticism", "神经质", "emi", mindId, 5, "emi", "sub", "[\"neuroticismScore\"]", null);
+            upsertDimensionSeed("mind.driveAutonomy", "自主性", "emi", mindId, 6, "emi", "sub", "[\"driveAutonomy\"]", null);
+            upsertDimensionSeed("mind.driveCompetence", "胜任感", "emi", mindId, 7, "emi", "sub", "[\"driveCompetence\"]", null);
+            upsertDimensionSeed("mind.driveRelatedness", "归属感", "emi", mindId, 8, "emi", "sub", "[\"driveRelatedness\"]", null);
+            upsertDimensionSeed("mind.emotionStability", "情绪稳定性", "emi", mindId, 9, "emi", "sub", "[\"emotionStability\"]", null);
+            upsertDimensionSeed("mind.selfConceptOverall", "自我概念", "emi", mindId, 10, "emi", "sub", "[\"selfConceptOverall\"]", null);
+        } else {
+            log.warn("迁移448: 未找到 mind 根节点 id,跳过 mind 子维度 seed");
+        }
+
+        // —— wisdom 智/认知(7,source_system='cognitive')——
+        if (wisdomId != null) {
+            upsertDimensionSeed("wisdom.memory", "记忆力", "cognitive", wisdomId, 1, "cognitive", "sub", "[\"memoryScore\"]", null);
+            upsertDimensionSeed("wisdom.attention", "注意力", "cognitive", wisdomId, 2, "cognitive", "sub", "[\"attentionScore\"]", null);
+            upsertDimensionSeed("wisdom.logic", "逻辑推理", "cognitive", wisdomId, 3, "cognitive", "sub", "[\"logicScore\"]", null);
+            upsertDimensionSeed("wisdom.spatial", "空间想象", "cognitive", wisdomId, 4, "cognitive", "sub", "[\"spatialScore\"]", null);
+            upsertDimensionSeed("wisdom.perception", "感知能力", "cognitive", wisdomId, 5, "cognitive", "sub", "[\"perceptionScore\"]", null);
+            upsertDimensionSeed("wisdom.focus", "专注力", "cognitive", wisdomId, 6, "cognitive", "sub", "[\"focusScore\"]", null);
+            upsertDimensionSeed("wisdom.processingSpeed", "加工速度", "cognitive", wisdomId, 7, "cognitive", "sub", "[\"processingSpeedScore\"]", null);
+        } else {
+            log.warn("迁移448: 未找到 wisdom 根节点 id,跳过 wisdom 子维度 seed");
+        }
+
+        // —— action 社会性(5,source_system='relationship')——
+        if (actionId != null) {
+            upsertDimensionSeed("action.parentTrust", "亲子信任", "relationship", actionId, 1, "relationship", "sub", "[\"trustScore\"]", null);
+            upsertDimensionSeed("action.parentIntimacy", "亲子亲密度", "relationship", actionId, 2, "relationship", "sub", "[\"intimacyScore\"]", null);
+            upsertDimensionSeed("action.communication", "沟通质量", "relationship", actionId, 3, "relationship", "sub", "[\"communicationScore\"]", null);
+            upsertDimensionSeed("action.healthStatus", "关系健康度", "relationship", actionId, 4, "relationship", "sub", "[\"totalScore\"]", null);
+            upsertDimensionSeed("action.lastInteraction", "最近互动", "relationship", actionId, 5, "relationship", "sub", "[\"lastInteractionAt\"]", null);
+        } else {
+            log.warn("迁移448: 未找到 action 根节点 id,跳过 action 子维度 seed");
+        }
+
+        // —— wealth 富(4,source_system='energy')——
+        if (wealthId != null) {
+            upsertDimensionSeed("wealth.skill", "个人能力", "energy", wealthId, 1, "energy", "sub", "[\"wealthSkill\"]", null);
+            upsertDimensionSeed("wealth.altruism", "利他贡献", "energy", wealthId, 2, "energy", "sub", "[\"wealthAltruism\"]", null);
+            upsertDimensionSeed("wealth.income", "CF值积累", "energy", wealthId, 3, "energy", "sub", "[\"wealthIncome\"]", null);
+            upsertDimensionSeed("wealth.fx", "财务素养", "energy", wealthId, 4, "energy", "sub", "[\"wealthFx\"]", null);
+        } else {
+            log.warn("迁移448: 未找到 wealth 根节点 id,跳过 wealth 子维度 seed");
+        }
+
+        // 补 5 根五行归属:按 energy_dimension.element 填 wuxing_rule_ref(idempotent,仅当为空时填)
+        try {
+            jdbcTemplate.update(
+                    "UPDATE product_dimension_config pdc "
+                            + "JOIN energy_dimension ed ON ed.code = pdc.dimension_code "
+                            + "SET pdc.wuxing_rule_ref = COALESCE(pdc.wuxing_rule_ref, ed.element) "
+                            + "WHERE pdc.dimension_code IN ('body','mind','wisdom','action','wealth') "
+                            + "AND ed.element IS NOT NULL");
+            log.info("迁移448: 5 根五行归属 wuxing_rule_ref 已按 energy_dimension.element 补齐");
+        } catch (Exception e) {
+            log.warn("迁移448: 5 根五行归属补齐失败(忽略): {}", e.getMessage());
+        }
+        log.info("迁移448: 统一维度注册中心增量 seed 完成(mind10/wisdom7/action5/wealth4 共33子维)");
+    }
+
+    /**
+     * 迁移449: indicator_definitions.dimension_code 扩宽至 VARCHAR(64)。
+     *
+     * <p>统一维度体系下指标可归属/挂接到注册中心任意维度节点(含子维度),
+     * 子维度 code 最长 23 字符(如 mind.selfConceptOverall),原 VARCHAR(16) 不足。
+     * 幂等:MODIFY COLUMN 重复执行安全;不改 id 主键与 5 张外键表(红线 1)。</p>
+     */
+    private void migrateIndicatorDimensionCodeWidth() {
+        try {
+            jdbcTemplate.execute("ALTER TABLE indicator_definitions MODIFY COLUMN dimension_code "
+                    + "VARCHAR(64) COMMENT '关联统一维度节点code(注册中心root/sub,可空)'");
+            log.info("迁移449: indicator_definitions.dimension_code 已扩宽至 VARCHAR(64)");
+        } catch (Exception e) {
+            log.warn("迁移449: indicator_definitions.dimension_code 扩宽失败(忽略): {}", e.getMessage());
+        }
+    }
+
     /** 幂等 upsert 维度种子:按 dimension_code 存在则补 source_system/legacy_alias,不存在则插入。 */
     private void upsertDimensionSeed(String code, String name, String dimensionType, Long parentId,
                                      int sort, String sourceSystem, String nodeKind,

+ 4 - 1
cfc-backend/src/main/java/com/etotem/cfc/config/JwtInterceptor.java

@@ -121,7 +121,10 @@ private static final String[] PUBLIC_PATHS = {
         "/api/user/action-stats",           // 用户行动统计:个人私有
         "/api/user/address/",               // 收货地址:个人私有
         "/api/user/data-export",            // 数据导出:隐私敏感
-        "/api/user/deactivate"              // 账号注销:隐私敏感
+        "/api/user/deactivate",             // 账号注销:隐私敏感
+        // SC-X-22 CF 值获取预估:预估接口必须登录,游客无 token 直接 401,
+        // 不泄露规则数值(契约 §7 第 1 行:不展示预估或「登录后可见」)。
+        "/api/reward/estimate"
     };
 
     @Override

+ 14 - 0
cfc-backend/src/main/java/com/etotem/cfc/controller/HealthDimensionController.java

@@ -28,6 +28,13 @@ public class HealthDimensionController {
     @Resource
     private FamilyMemberMapper familyMemberMapper;
 
+    /**
+     * 获取健康维度概览。
+     *
+     * @deprecated 统一维度体系下前端改走 /api/dimension-registry/*(注册中心只读接口),
+     *             本接口保留至零调用确认后下线(设计文档 §5.3),不删除。
+     */
+    @Deprecated
     @Operation(summary = "获取健康维度概览")
     @PostMapping("/overview")
     public Result<HealthDimensionVO> overview(
@@ -42,6 +49,13 @@ public class HealthDimensionController {
         return Result.success(vo);
     }
 
+    /**
+     * 获取雷达图三层数据:实际值/人群位置/家庭占比。
+     *
+     * @deprecated 统一维度体系下前端改走 /api/dimension-registry/*(注册中心只读接口),
+     *             本接口保留至零调用确认后下线(设计文档 §5.3),不删除。
+     */
+    @Deprecated
     @Operation(summary = "获取雷达图三层数据:实际值/人群位置/家庭占比")
     @PostMapping("/radar-data")
     public Result<Map<String, Object>> radarData(

+ 3 - 0
cfc-backend/src/main/java/com/etotem/cfc/controller/MembershipController.java

@@ -349,6 +349,9 @@ public class MembershipController {
             plan.put("levelName", level.getLevelName());
             plan.put("levelDesc", level.getLevelDesc());
             plan.put("recommended", "FAMILY".equals(level.getLevelCode()));
+            // 升级页按接口 levelOrder 比较等级高低(前端不再维护等级排序),缺失会导致
+            // 免费用户无法定位下一档而回落 FREE,付费页按 FREE 取价显示 ¥0.00。
+            plan.put("levelOrder", level.getLevelOrder());
             plan.put("yearly", level.getPriceYearly());
             plan.put("monthly", level.getPriceMonthly());
             plan.put("quarterly", level.getPriceQuarterly());

+ 6 - 0
cfc-backend/src/main/java/com/etotem/cfc/controller/guide/GuideFamilyTaskController.java

@@ -17,6 +17,7 @@ import com.etotem.cfc.mapper.UserMapper;
 import com.etotem.cfc.service.GuideFamilyAccessGuard;
 import com.etotem.cfc.service.GuideFamilyService;
 import com.etotem.cfc.service.MembershipService;
+import com.etotem.cfc.service.RewardRuleService;
 import com.etotem.cfc.service.TaskService;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.tags.Tag;
@@ -51,6 +52,9 @@ public class GuideFamilyTaskController {
     @Resource
     private GuideFamilyService guideFamilyService;
 
+    @Resource
+    private RewardRuleService rewardRuleService;
+
     @Resource
     private GuideFamilyAccessGuard guideFamilyAccessGuard;
 
@@ -264,6 +268,7 @@ public class GuideFamilyTaskController {
         String status = params != null && params.get("status") != null ? params.get("status").toString() : null;
 
         Page<Task> tasks = taskService.getTaskHistoryByFamilyMember(memberId, page, size, status);
+        rewardRuleService.attachTaskPageEstimate(tasks, memberId);
         return Result.success(tasks);
     }
 
@@ -287,6 +292,7 @@ public class GuideFamilyTaskController {
         Result<Void> denied = requireBound(guideId, familyId);
         if (denied != null) return Result.error(denied.getCode(), denied.getMessage());
         List<Task> tasks = taskService.getPendingReviewTasksForFamilyMember(memberId);
+        rewardRuleService.attachTaskListEstimate(tasks, memberId);
         return Result.success(tasks);
     }
 

+ 32 - 1
cfc-backend/src/main/java/com/etotem/cfc/controller/product/ProductController.java

@@ -47,6 +47,9 @@ public class ProductController {
     @Resource
     private ProductRecommendationService productRecommendationService;
 
+    @Resource
+    private com.etotem.cfc.service.RewardRuleService rewardRuleService;
+
     @Resource
     private UserMapper userMapper;
 
@@ -62,7 +65,35 @@ public class ProductController {
                                      @RequestAttribute(value = "userId", required = false) Long userId) {
         if (params.get("id") == null) return Result.error("缺少商品ID");
         Long id = ParamUtils.getLong(params.get("id"));
-        return productService.detail(id, userId);
+        Result<ProductDTO> result = productService.detail(id, userId);
+        if (result != null && result.getData() != null && userId != null && userId > 0) {
+            ProductDTO dto = result.getData();
+            attachPurchaseEstimate(dto, userId, id);
+        }
+        return result;
+    }
+
+    /**
+     * SC-X-22:商品详情页下单入口内嵌预估(获得型 F02 消费返 CF)。
+     * 仅登录用户附加;游客不返回预估、不泄露规则数值。
+     */
+    private void attachPurchaseEstimate(ProductDTO dto, Long userId, Long productId) {
+        try {
+            Long memberId = rewardRuleService.resolveMemberIdByUser(userId);
+            if (memberId == null) {
+                return;
+            }
+            com.etotem.cfc.dto.RewardEstimateVO vo = rewardRuleService.estimate(memberId,
+                    com.etotem.cfc.service.RewardRuleService.OP_PURCHASE,
+                    "PRODUCT", String.valueOf(productId), null);
+            if (vo != null && vo.getDisplay() != null
+                    && !"DEGRADED".equals(vo.getDisplay().getType())) {
+                dto.setExpectedCf(vo.getExpectedCf());
+                dto.setDisplay(vo.getDisplay());
+            }
+        } catch (Exception e) {
+            log.warn("商品详情预估失败 productId={} err={}", productId, e.getMessage());
+        }
     }
 
     @PostMapping("/create")

+ 176 - 0
cfc-backend/src/main/java/com/etotem/cfc/controller/reward/RewardEstimateController.java

@@ -0,0 +1,176 @@
+package com.etotem.cfc.controller.reward;
+
+import com.etotem.cfc.common.Result;
+import com.etotem.cfc.dto.RewardEstimateRequest;
+import com.etotem.cfc.dto.RewardEstimateVO;
+import com.etotem.cfc.entity.FamilyMember;
+import com.etotem.cfc.entity.Task;
+import com.etotem.cfc.entity.Reward;
+import com.etotem.cfc.mapper.FamilyMemberMapper;
+import com.etotem.cfc.mapper.TaskMapper;
+import com.etotem.cfc.mapper.RewardMapper;
+import com.etotem.cfc.service.RewardRuleService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestAttribute;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+
+/**
+ * CF 值获取预估接口(SC-X-22 契约 §4.1 预估专用端点)。
+ *
+ * <p>职责:
+ * <ul>
+ *   <li>游客/未登录 → 401(由 JwtInterceptor 拦截,见 LOGIN_REQUIRED_PATHS);</li>
+ *   <li>成员归属由服务端从 JWT 解析,客户端禁止传入 memberId/familyId/expectedCf;</li>
+ *   <li>孩子 token 调家长侧预估(PURCHASE)→ 403;</li>
+ *   <li>跨家庭资源 → 403,不返回他人 expectedCf;</li>
+ *   <li>规则未配置/超时 → 降级「CF 奖励以实际为准」,不 500。</li>
+ * </ul>
+ * </p>
+ */
+@Slf4j
+@Tag(name = "CF 值获取预估")
+@RestController
+@RequestMapping("/api/reward")
+public class RewardEstimateController {
+
+    @Resource
+    private RewardRuleService rewardRuleService;
+
+    @Resource
+    private FamilyMemberMapper familyMemberMapper;
+
+    @Resource
+    private TaskMapper taskMapper;
+
+    @Resource
+    private RewardMapper rewardMapper;
+
+    @Operation(summary = "预估 CF 值(操作前展示)")
+    @PostMapping("/estimate")
+    public Result<RewardEstimateVO> estimate(@RequestAttribute(value = "userId", required = false) Long userId,
+                                             @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId,
+                                             @RequestAttribute(value = "role", required = false) String role,
+                                             @RequestBody RewardEstimateRequest request) {
+        if (request == null) {
+            return Result.badRequest("请求体不能为空");
+        }
+        if (isBlank(request.getOperationType()) || isBlank(request.getResourceType())
+                || isBlank(request.getResourceId())) {
+            return Result.badRequest("operationType/resourceType/resourceId 均不能为空");
+        }
+        // 1) 成员归属:服务端从 JWT 解析,客户端不可传
+        Long memberId = resolveMemberId(userId, currentMemberId);
+        if (memberId == null) {
+            return Result.error(401, "未登录或无对应家庭成员");
+        }
+        FamilyMember member = familyMemberMapper.selectById(memberId);
+        if (member == null) {
+            return Result.error(401, "未找到当前用户对应的家庭成员");
+        }
+        Long familyId = member.getFamilyId();
+
+        // 2) 角色校验:孩子 token 调家长侧产出点(PURCHASE 套餐/商城购买)→ 403
+        if (isChildRole(role) && RewardRuleService.OP_PURCHASE.equalsIgnoreCase(request.getOperationType())) {
+            return Result.forbidden("孩子账号无权预估家长侧产出点");
+        }
+
+        // 3) 资源归属校验(防跨家庭泄露 expectedCf)
+        String ownershipError = checkResourceOwnership(familyId, request.getOperationType(),
+                request.getResourceType(), request.getResourceId());
+        if (ownershipError != null) {
+            return Result.forbidden(ownershipError);
+        }
+
+        // 4) 调用服务(旁路读,内部异常/超时降级,不 500)
+        RewardEstimateVO vo = rewardRuleService.estimate(memberId,
+                request.getOperationType(), request.getResourceType(), request.getResourceId(),
+                request.getIdempotencyKey());
+        return Result.success(vo);
+    }
+
+    // ==================== 内部工具 ====================
+
+    /** 登录 userId → 家庭成员:优先 currentMemberId(JWT 反查,切视角不改变),否则按 user_id 匹配 */
+    private Long resolveMemberId(Long userId, Long currentMemberId) {
+        if (currentMemberId != null && currentMemberId > 0) {
+            return currentMemberId;
+        }
+        if (userId == null || userId <= 0) {
+            return null;
+        }
+        FamilyMember member = familyMemberMapper.selectOne(
+                new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<FamilyMember>()
+                        .eq(FamilyMember::getUserId, userId)
+                        .orderByAsc(FamilyMember::getId)
+                        .last("LIMIT 1"));
+        return member == null ? null : member.getId();
+    }
+
+    private boolean isChildRole(String role) {
+        return role != null && "child".equalsIgnoreCase(role.trim());
+    }
+
+    /**
+     * 资源归属校验:任务/心愿等家庭私有资源必须属于调用者家庭,否则 403。
+     * 商品(PURCHASE)与成长任务模板(GROWTH_TASK)为公开/模板资源,不校验归属。
+     */
+    private String checkResourceOwnership(Long familyId, String operationType,
+                                          String resourceType, String resourceId) {
+        Long rid = parseId(resourceId);
+        String op = operationType == null ? "" : operationType.trim().toUpperCase();
+        try {
+            if ("TASK_COMPLETE".equals(op) || "AUDIT".equals(op)) {
+                if (rid == null) {
+                    return "资源ID无效";
+                }
+                Task task = taskMapper.selectById(rid);
+                if (task == null) {
+                    return "任务不存在";
+                }
+                if (familyId != null && task.getFamilyId() != null
+                        && !familyId.equals(task.getFamilyId())) {
+                    return "无权预估其他家庭的任务";
+                }
+            } else if ("WISH".equals(op)) {
+                if (rid == null) {
+                    return "资源ID无效";
+                }
+                Reward reward = rewardMapper.selectById(rid);
+                if (reward == null) {
+                    return "心愿不存在";
+                }
+                if (familyId != null && reward.getFamilyId() != null
+                        && !familyId.equals(reward.getFamilyId())) {
+                    return "无权预估其他家庭的心愿";
+                }
+            }
+            // PURCHASE / GROWTH_TASK / CHECKIN / ASSESSMENT_REPORT:公开或模板资源,不校验归属
+        } catch (Exception e) {
+            log.warn("资源归属校验异常 op={} err={}", operationType, e.getMessage());
+            return "资源校验失败";
+        }
+        return null;
+    }
+
+    private Long parseId(String value) {
+        if (value == null || value.trim().isEmpty()) {
+            return null;
+        }
+        try {
+            return Long.parseLong(value.trim());
+        } catch (NumberFormatException e) {
+            return null;
+        }
+    }
+
+    private boolean isBlank(String s) {
+        return s == null || s.trim().isEmpty();
+    }
+}

+ 8 - 0
cfc-backend/src/main/java/com/etotem/cfc/controller/task/TaskController.java

@@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
 import java.util.Map;
+import com.etotem.cfc.service.RewardRuleService;
 import com.etotem.cfc.util.ParamUtils;
 
 @Tag(name = "任务管理", description = "任务的创建、完成、审核、历史查询等接口")
@@ -26,6 +27,9 @@ import com.etotem.cfc.util.ParamUtils;
 @RequestMapping("/api/tasks")
 public class TaskController {
 
+    @Resource
+    private RewardRuleService rewardRuleService;
+
     @Resource
     private TaskService taskService;
 
@@ -102,6 +106,7 @@ public class TaskController {
         } else {
             tasks = taskService.getTodayTasks(memberId, dimensionCode);
         }
+        rewardRuleService.attachTaskListEstimate(tasks, memberId);
         return Result.success(tasks);
     }
 
@@ -189,6 +194,7 @@ public class TaskController {
     @PostMapping("/pending-review")
     public Result<List<Task>> getPendingReviewTasks(@RequestAttribute("userId") Long userId) {
     List<Task> tasks = taskService.getPendingReviewTasks(userId);
+    rewardRuleService.attachTaskListEstimate(tasks, rewardRuleService.resolveMemberIdByUser(userId));
     return Result.success(tasks);
   }
 
@@ -196,6 +202,7 @@ public class TaskController {
     @PostMapping("/today-parent")
     public Result<List<Task>> getTodayParentTasks(@RequestAttribute("userId") Long userId) {
         List<Task> tasks = taskService.getTodayParentTasks(userId);
+        rewardRuleService.attachTaskListEstimate(tasks, rewardRuleService.resolveMemberIdByUser(userId));
         return Result.success(tasks);
     }
 
@@ -348,6 +355,7 @@ public class TaskController {
         Long memberId = params.get("memberId") != null ? ParamUtils.getLong(params.get("memberId")) : currentMemberId;
         String titleKeyword = params.get("titleKeyword") != null ? params.get("titleKeyword").toString() : null;
         List<Task> tasks = taskService.getRelatedTaskList(familyId, memberId, titleKeyword);
+        rewardRuleService.attachTaskListEstimate(tasks, memberId);
         return Result.success(tasks);
     }
 }

+ 8 - 1
cfc-backend/src/main/java/com/etotem/cfc/dto/DimensionNode.java

@@ -6,7 +6,8 @@ import java.util.List;
  * 统一维度树节点(维度节点 ∪ 指标节点混排)。
  *
  * <p>结构见设计文档 §5.1:{id, code, name, parentId, nodeKind, sourceSystem,
- * legacyAlias, wuxingRuleRef, children?}。</p>
+ * legacyAlias, wuxingRuleRef, children?};P2-T1 起指标节点额外带 dimensionCode
+ * (指标归属维度 code,供指标挂指标时继承归属,null=通用)。</p>
  */
 public class DimensionNode {
 
@@ -18,6 +19,10 @@ public class DimensionNode {
     private String sourceSystem;
     private String legacyAlias;
     private String wuxingRuleRef;
+
+    /** 指标节点的归属维度 code(仅 nodeKind=indicator 有值;维度节点为 null)。P2-T1。 */
+    private String dimensionCode;
+
     private List<DimensionNode> children;
 
     public DimensionNode() {
@@ -39,6 +44,8 @@ public class DimensionNode {
     public void setLegacyAlias(String legacyAlias) { this.legacyAlias = legacyAlias; }
     public String getWuxingRuleRef() { return wuxingRuleRef; }
     public void setWuxingRuleRef(String wuxingRuleRef) { this.wuxingRuleRef = wuxingRuleRef; }
+    public String getDimensionCode() { return dimensionCode; }
+    public void setDimensionCode(String dimensionCode) { this.dimensionCode = dimensionCode; }
     public List<DimensionNode> getChildren() { return children; }
     public void setChildren(List<DimensionNode> children) { this.children = children; }
 }

+ 6 - 0
cfc-backend/src/main/java/com/etotem/cfc/dto/ProductDTO.java

@@ -96,6 +96,12 @@ public class ProductDTO {
 
     private String priceLabel;     // 游客 = "登录查看价格",登录后 = null
 
+    /** SC-X-22:预估 CF 值(服务端计算;登录后按商品价走消费返 CF 规则) */
+    private Integer expectedCf;
+
+    /** SC-X-22:预估展示元数据(EARN/SPEND/ZERO/LIMIT_HIT/DEGRADED + 文案),契约 §4.3 display */
+    private RewardDisplayVO display;
+
     public static ProductDTO from(Product p) {
         return from(p, false, null);
     }

+ 23 - 0
cfc-backend/src/main/java/com/etotem/cfc/dto/RewardDisplayVO.java

@@ -0,0 +1,23 @@
+package com.etotem.cfc.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * CF 预估展示元数据(契约 §4.3 display)。
+ *
+ * 前端可直接渲染 {@code display.template};{@code display.type} 决定文案模板。
+ */
+@Data
+public class RewardDisplayVO implements Serializable {
+
+    /** EARN / SPEND / ZERO / LIMIT_HIT / DEGRADED */
+    private String type;
+
+    /** 前端可直接渲染的统一文案 */
+    private String template;
+
+    /** 带方向的展示数值(同 expectedCf 或 actualCf 符号) */
+    private Integer cfValue;
+}

+ 26 - 0
cfc-backend/src/main/java/com/etotem/cfc/dto/RewardEstimateRequest.java

@@ -0,0 +1,26 @@
+package com.etotem.cfc.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * CF 预估请求体(契约 §4.2)。
+ *
+ * <p>客户端一律禁止传入 {@code expectedCf};该字段由服务端计算,客户端传入将被忽略。</p>
+ */
+@Data
+public class RewardEstimateRequest implements Serializable {
+
+    /** 请求级幂等键(建议 UUID) */
+    private String idempotencyKey;
+
+    /** 操作类型:TASK_COMPLETE / GROWTH_TASK / PURCHASE / CHECKIN / AUDIT / WISH / EXCHANGE / ASSESSMENT_REPORT ... */
+    private String operationType;
+
+    /** 资源类型:GROWTH_TASK / PRODUCT_ORDER / ACTIVITY_CHECKIN / ASSESSMENT_REPORT ... */
+    private String resourceType;
+
+    /** 稳定业务单据 ID(任务 ID / 商品 ID / 活动 ID 等) */
+    private String resourceId;
+}

+ 43 - 0
cfc-backend/src/main/java/com/etotem/cfc/dto/RewardEstimateVO.java

@@ -0,0 +1,43 @@
+package com.etotem.cfc.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * CF 值获取预估响应 VO(契约 §4.3 预估接口与产出点内嵌共用)。
+ *
+ * <p>字段语义:
+ * <ul>
+ *   <li>{@code expectedCf}:服务端按当日有效规则计算;客户端禁止传入,传了也忽略。</li>
+ *   <li>{@code actualCf}:预估接口为 null;回执接口为真实入账值。</li>
+ *   <li>{@code reason}:实际 ≠ 预估或触顶时给出原因。</li>
+ * </ul>
+ * </p>
+ */
+@Data
+public class RewardEstimateVO implements Serializable {
+
+    /** 服务端预估 CF 值:正=获得、负=消耗、null=降级(规则未配置/异常/超时) */
+    private Integer expectedCf;
+
+    /** 实际入账值;预估接口始终 null */
+    private Integer actualCf;
+
+    /** 实际 ≠ 预估或触顶时的原因;如「活动已结束」「已达今日上限」 */
+    private String reason;
+
+    /** 单位,固定「CF」 */
+    private String currency = "CF";
+
+    /** 原始请求的 operationType/resourceType/resourceId,回显给前端以便核对 */
+    private String operationType;
+    private String resourceType;
+    private String resourceId;
+
+    /** 请求级幂等键 */
+    private String idempotencyKey;
+
+    /** 展示元数据 */
+    private RewardDisplayVO display;
+}

+ 8 - 0
cfc-backend/src/main/java/com/etotem/cfc/entity/GrowthTask.java

@@ -40,4 +40,12 @@ public class GrowthTask implements Serializable {
 
     /** 来源AI会话ID(AI_GENERATED类型任务使用) */
     private String sourceConversationId;
+
+    /** SC-X-22:预估 CF 值(服务端计算,不入库,仅响应展示用) */
+    @com.baomidou.mybatisplus.annotation.TableField(exist = false)
+    private Integer expectedCf;
+
+    /** SC-X-22:预估展示元数据(EARN/SPEND/ZERO/LIMIT_HIT/DEGRADED + 文案),契约 §4.3 display */
+    @com.baomidou.mybatisplus.annotation.TableField(exist = false)
+    private com.etotem.cfc.dto.RewardDisplayVO display;
 }

+ 8 - 0
cfc-backend/src/main/java/com/etotem/cfc/entity/Task.java

@@ -161,4 +161,12 @@ private Date acceptDeadline;
 	    private Date createdAt;
 
 	    private Date updatedAt;
+
+    /** SC-X-22:预估 CF 值(服务端计算,不入库,仅响应展示用) */
+    @com.baomidou.mybatisplus.annotation.TableField(exist = false)
+    private Integer expectedCf;
+
+    /** SC-X-22:预估展示元数据(EARN/SPEND/ZERO/LIMIT_HIT/DEGRADED + 文案),契约 §4.3 display */
+    @com.baomidou.mybatisplus.annotation.TableField(exist = false)
+    private com.etotem.cfc.dto.RewardDisplayVO display;
 }

+ 11 - 40
cfc-backend/src/main/java/com/etotem/cfc/service/DanKnowledgeBaseService.java

@@ -7,12 +7,10 @@ import com.etotem.cfc.entity.DanKnowledgeBase;
 import com.etotem.cfc.entity.DanKnowledgeBaseDimension;
 import com.etotem.cfc.entity.DanKnowledgeBaseTag;
 import com.etotem.cfc.entity.DanKnowledgeTag;
-import com.etotem.cfc.entity.ProductDimensionConfig;
 import com.etotem.cfc.mapper.DanKnowledgeBaseDimensionMapper;
 import com.etotem.cfc.mapper.DanKnowledgeBaseMapper;
 import com.etotem.cfc.mapper.DanKnowledgeBaseTagMapper;
 import com.etotem.cfc.mapper.DanKnowledgeTagMapper;
-import com.etotem.cfc.mapper.ProductDimensionConfigMapper;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -46,7 +44,7 @@ public class DanKnowledgeBaseService extends ServiceImpl<DanKnowledgeBaseMapper,
     private DanKnowledgeTagMapper danKnowledgeTagMapper;
 
     @Resource
-    private ProductDimensionConfigMapper productDimensionConfigMapper;
+    private DimensionRegistryService dimensionRegistryService;
 
     @Resource
     private LanggraphSyncService langgraphSyncService;
@@ -276,17 +274,7 @@ public class DanKnowledgeBaseService extends ServiceImpl<DanKnowledgeBaseMapper,
                 }
             }
         }
-        Map<Long, String> dimCodesById = new HashMap<>();
-        if (!allDimIds.isEmpty()) {
-            List<ProductDimensionConfig> configs = productDimensionConfigMapper.selectBatchIds(allDimIds);
-            if (configs != null) {
-                for (ProductDimensionConfig config : configs) {
-                    if (config.getId() != null && config.getDimensionCode() != null) {
-                        dimCodesById.put(config.getId(), config.getDimensionCode());
-                    }
-                }
-            }
-        }
+        Map<Long, String> dimCodesById = dimensionRegistryService.getDimensionCodesByIds(allDimIds);
 
         for (DanKnowledgeBase record : records) {
             List<Long> tids = tagIdsByKnowledge.getOrDefault(record.getId(), Collections.emptyList());
@@ -322,15 +310,7 @@ public class DanKnowledgeBaseService extends ServiceImpl<DanKnowledgeBaseMapper,
         }
         List<Long> dimIds = knowledge.getDimensionIds();
         if (dimIds != null && !dimIds.isEmpty()) {
-            List<ProductDimensionConfig> configs = productDimensionConfigMapper.selectBatchIds(dimIds);
-            Map<Long, String> codes = new HashMap<>();
-            if (configs != null) {
-                for (ProductDimensionConfig config : configs) {
-                    if (config.getId() != null && config.getDimensionCode() != null) {
-                        codes.put(config.getId(), config.getDimensionCode());
-                    }
-                }
-            }
+            Map<Long, String> codes = dimensionRegistryService.getDimensionCodesByIds(dimIds);
             knowledge.setDimensionCodes(dimIds.stream().map(codes::get)
                 .filter(Objects::nonNull).collect(Collectors.toList()));
         } else {
@@ -390,21 +370,15 @@ public class DanKnowledgeBaseService extends ServiceImpl<DanKnowledgeBaseMapper,
                 .eq(DanKnowledgeBaseDimension::getKnowledgeId, knowledgeId));
         if (dims == null || dims.isEmpty()) return new java.util.ArrayList<>();
         List<Long> dimIds = dims.stream().map(DanKnowledgeBaseDimension::getDimensionId).collect(Collectors.toList());
-        ProductDimensionConfig cfg = new ProductDimensionConfig();
-        cfg.setId(dimIds.get(0));
-        List<ProductDimensionConfig> configs = new java.util.ArrayList<>();
+        Map<Long, String> codeById = dimensionRegistryService.getDimensionCodesByIds(dimIds);
+        List<String> codes = new java.util.ArrayList<>();
         for (Long dimId : dimIds) {
-            ProductDimensionConfig c = new ProductDimensionConfig();
-            c.setId(dimId);
-            configs.add(c);
+            String code = codeById.get(dimId);
+            if (code != null) {
+                codes.add(code);
+            }
         }
-        return configs.stream()
-            .map(c -> {
-                ProductDimensionConfig full = productDimensionConfigMapper.selectById(c.getId());
-                return full != null ? full.getDimensionCode() : null;
-            })
-            .filter(code -> code != null)
-            .collect(Collectors.toList());
+        return codes;
     }
 
     // ==================== 标签/维度自动回填 ====================
@@ -525,9 +499,6 @@ public class DanKnowledgeBaseService extends ServiceImpl<DanKnowledgeBaseMapper,
     }
 
     private Long dimensionIdByCode(String code) {
-        ProductDimensionConfig cfg = productDimensionConfigMapper.selectOne(
-            new LambdaQueryWrapper<ProductDimensionConfig>()
-                .eq(ProductDimensionConfig::getDimensionCode, code));
-        return cfg != null ? cfg.getId() : null;
+        return dimensionRegistryService.getDimensionIdByCode(code);
     }
 }

+ 110 - 0
cfc-backend/src/main/java/com/etotem/cfc/service/DimensionRegistryService.java

@@ -10,6 +10,7 @@ import org.springframework.util.StringUtils;
 
 import javax.annotation.Resource;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
@@ -80,6 +81,9 @@ public class DimensionRegistryService {
             n.setNodeKind("indicator");
             n.setSourceSystem("indicator");
             n.setLegacyAlias(ind.getLegacyAlias());
+            // P2-T1:指标节点暴露归属维度 code(指标挂指标时子指标继承该归属,
+            // 保证子指标 dimensionCode 仍 ∈ 注册中心维度节点 code 集合)
+            n.setDimensionCode(ind.getDimensionCode());
             idToNode.putIfAbsent(n.getId(), n);
         }
 
@@ -146,6 +150,67 @@ public class DimensionRegistryService {
         return dimensionCodeMapper.resolveToUnified(legacy);
     }
 
+    /**
+     * 按统一 code 取维度配置的 Dify DatasetId。
+     *
+     * <p>P1-T4:知识库同步(LanggraphSyncService)等消费方不再直读 product_dimension_config,
+     * 统一经注册中心层取数,避免绕过注册中心。</p>
+     *
+     * @param code 统一维度 code(如 body / body.growth / mind.openness)
+     * @return 该维度的 Dify DatasetId;code 不存在或未配置返回 null
+     */
+    public String getDifyDatasetIdByCode(String code) {
+        if (code == null || code.isEmpty()) {
+            return null;
+        }
+        ProductDimensionConfig cfg = productDimensionConfigService.getByCode(code);
+        return cfg != null ? cfg.getDifyDatasetId() : null;
+    }
+
+    /**
+     * 批量取维度节点 id → dimensionCode 映射。
+     *
+     * <p>P1-T4:知识库关联回填(DanKnowledgeBaseService)不再直读 product_dimension_config,
+     * 统一经注册中心层取数。仅返回维度节点 id(与注册中心维度节点 id 同源,均为
+     * product_dimension_config.id),指标节点 id 不在映射内。</p>
+     *
+     * @param ids 维度节点 id 集合(可空)
+     * @return id → dimensionCode 映射(无匹配或空入参返回空 map)
+     */
+    public Map<Long, String> getDimensionCodesByIds(Collection<Long> ids) {
+        Map<Long, String> map = new HashMap<>();
+        if (ids == null || ids.isEmpty()) {
+            return map;
+        }
+        List<ProductDimensionConfig> configs = productDimensionConfigService.listByIds(ids);
+        if (configs == null) {
+            return map;
+        }
+        for (ProductDimensionConfig cfg : configs) {
+            if (cfg.getId() != null && cfg.getDimensionCode() != null) {
+                map.put(cfg.getId(), cfg.getDimensionCode());
+            }
+        }
+        return map;
+    }
+
+    /**
+     * 按统一 code 取维度节点 id。
+     *
+     * <p>P1-T4:知识库自动绑定(DanKnowledgeBaseService.dimensionIdByCode)不再直读
+     * product_dimension_config,统一经注册中心层取数。</p>
+     *
+     * @param code 统一维度 code(如 body / body.growth)
+     * @return 该维度节点 id;code 不存在返回 null
+     */
+    public Long getDimensionIdByCode(String code) {
+        if (code == null || code.isEmpty()) {
+            return null;
+        }
+        ProductDimensionConfig cfg = productDimensionConfigService.getByCode(code);
+        return cfg != null ? cfg.getId() : null;
+    }
+
     /** 注册中心写入入口:admin 配置写产品维度配置表 + 校验 code 唯一。 */
     public ProductDimensionConfig saveConfig(ProductDimensionConfig node) {
         if (node == null) {
@@ -174,6 +239,51 @@ public class DimensionRegistryService {
         return dualWrite;
     }
 
+    /**
+     * 收集注册中心全部维度节点 code(nodeKind=root/sub,不含指标节点)。
+     *
+     * <p>供指标 dimensionCode 越界校验(P1-T3):指标可归属的维度 code 必须 ∈ 该集合,
+     * 如 body / body.growth / mind.openness / ...(共 5 根 + 33 子维 = 38 个维度节点)。</p>
+     *
+     * @return 维度节点 code 集合(非空)
+     */
+    public Set<String> collectDimensionCodes() {
+        Set<String> codes = new HashSet<>();
+        for (DimensionNode root : getTree(null)) {
+            collectNodeCodes(root, codes);
+        }
+        return codes;
+    }
+
+    private void collectNodeCodes(DimensionNode node, Set<String> codes) {
+        if (node == null) {
+            return;
+        }
+        // 仅收维度节点(root/sub),指标节点(nodeKind=indicator)不占用维度 code 命名空间
+        if (!"indicator".equals(node.getNodeKind())
+                && node.getCode() != null && !node.getCode().isEmpty()) {
+            codes.add(node.getCode());
+        }
+        if (node.getChildren() != null) {
+            for (DimensionNode child : node.getChildren()) {
+                collectNodeCodes(child, codes);
+            }
+        }
+    }
+
+    /**
+     * 校验 code 是否为注册中心维度节点 code(root/sub,不含指标节点)。
+     *
+     * @param code 待校验 code
+     * @return true=是注册中心维度节点 code;null/空/越界=false
+     */
+    public boolean isDimensionCode(String code) {
+        if (code == null || code.isEmpty()) {
+            return false;
+        }
+        return collectDimensionCodes().contains(code);
+    }
+
     private void reloadMapper() {
         try {
             dimensionCodeMapper.reload();

+ 36 - 0
cfc-backend/src/main/java/com/etotem/cfc/service/IndicatorService.java

@@ -5,6 +5,7 @@ import com.etotem.cfc.entity.IndicatorDefinition;
 import com.etotem.cfc.entity.IndicatorValue;
 import com.etotem.cfc.mapper.IndicatorDefinitionMapper;
 import com.etotem.cfc.mapper.IndicatorValueMapper;
+import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 import javax.annotation.Resource;
 import java.util.List;
@@ -19,6 +20,18 @@ public class IndicatorService {
     @Resource
     private IndicatorValueMapper indicatorValueMapper;
 
+    /**
+     * 统一维度注册中心服务(P1-T3 指标归属校验)。
+     * <p>用 @Lazy 打破循环依赖:DimensionRegistryService.getTree() 依赖本服务(listAll),
+     * 本服务又需查询注册中心 code 集合,Spring 需懒加载其中一侧。</p>
+     */
+    @Resource
+    @Lazy
+    private DimensionRegistryService dimensionRegistryService;
+
+    /** 越界提示(GlobalExceptionHandler 将 IllegalArgumentException 转 400)。 */
+    private static final String DIMENSION_CODE_OUT_OF_REGISTRY = "dimensionCode 不在统一维度注册中心";
+
     public List<IndicatorDefinition> listAll() {
         return indicatorDefinitionMapper.selectList(null);
     }
@@ -42,15 +55,38 @@ public class IndicatorService {
     }
 
     public IndicatorDefinition createDefinition(IndicatorDefinition def) {
+        validateDimensionCode(def);
         indicatorDefinitionMapper.insert(def);
         return def;
     }
 
     public IndicatorDefinition updateDefinition(IndicatorDefinition def) {
+        validateDimensionCode(def);
         indicatorDefinitionMapper.updateById(def);
         return def;
     }
 
+    /**
+     * 校验指标 dimensionCode ∈ 注册中心维度节点 code 集合(root/sub,不含指标节点)。
+     *
+     * <p>null/空 放行(表示"通用/不关联具体维度",与既有语义一致);
+     * 越界抛 IllegalArgumentException → GlobalExceptionHandler 转 Result.error(400, msg)。</p>
+     *
+     * @param def 指标定义(可为 null)
+     */
+    private void validateDimensionCode(IndicatorDefinition def) {
+        if (def == null) {
+            return;
+        }
+        String dimensionCode = def.getDimensionCode();
+        if (dimensionCode == null || dimensionCode.isEmpty()) {
+            return;
+        }
+        if (!dimensionRegistryService.isDimensionCode(dimensionCode)) {
+            throw new IllegalArgumentException(DIMENSION_CODE_OUT_OF_REGISTRY);
+        }
+    }
+
     public void deleteDefinition(Long id) {
         indicatorDefinitionMapper.deleteById(id);
     }

+ 4 - 8
cfc-backend/src/main/java/com/etotem/cfc/service/LanggraphSyncService.java

@@ -1,9 +1,6 @@
 package com.etotem.cfc.service;
 
 import com.etotem.cfc.entity.DanKnowledgeBase;
-import com.etotem.cfc.entity.ProductDimensionConfig;
-import com.etotem.cfc.mapper.ProductDimensionConfigMapper;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Value;
@@ -38,7 +35,7 @@ public class LanggraphSyncService {
     private String difyApiKey;
 
     @Resource
-    private ProductDimensionConfigMapper productDimensionConfigMapper;
+    private DimensionRegistryService dimensionRegistryService;
 
     private final RestTemplate restTemplate = new RestTemplate();
 
@@ -47,13 +44,12 @@ public class LanggraphSyncService {
         if (dimensionCodes == null || dimensionCodes.isEmpty()) return;
         for (String code : dimensionCodes) {
             try {
-                ProductDimensionConfig config = productDimensionConfigMapper.selectOne(
-                    new LambdaQueryWrapper<ProductDimensionConfig>().eq(ProductDimensionConfig::getDimensionCode, code));
-                if (config == null || config.getDifyDatasetId() == null || config.getDifyDatasetId().isEmpty()) {
+                String datasetId = dimensionRegistryService.getDifyDatasetIdByCode(code);
+                if (datasetId == null || datasetId.isEmpty()) {
                     log.warn("维度[{}]未配置 Dify Dataset,跳过同步", code);
                     continue;
                 }
-                String url = difyBaseUrl + "/v1/datasets/" + config.getDifyDatasetId() + "/documents";
+                String url = difyBaseUrl + "/v1/datasets/" + datasetId + "/documents";
                 HttpHeaders headers = new HttpHeaders();
                 headers.setContentType(MediaType.APPLICATION_JSON);
                 headers.set("Authorization", "Bearer " + difyApiKey);

+ 849 - 0
cfc-backend/src/main/java/com/etotem/cfc/service/RewardRuleService.java

@@ -0,0 +1,849 @@
+package com.etotem.cfc.service;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.etotem.cfc.config.ConfigService;
+import com.etotem.cfc.dto.RewardDisplayVO;
+import com.etotem.cfc.dto.RewardEstimateVO;
+import com.etotem.cfc.entity.CfEarnDailyLimit;
+import com.etotem.cfc.entity.CfEarnRule;
+import com.etotem.cfc.entity.CfBalanceLog;
+import com.etotem.cfc.entity.Product;
+import com.etotem.cfc.entity.Task;
+import com.etotem.cfc.entity.GrowthTask;
+import com.etotem.cfc.entity.Reward;
+import com.etotem.cfc.mapper.CfBalanceLogMapper;
+import com.etotem.cfc.mapper.CfEarnDailyLimitMapper;
+import com.etotem.cfc.mapper.CfEarnRuleMapper;
+import com.etotem.cfc.mapper.TaskMapper;
+import com.etotem.cfc.mapper.GrowthTaskMapper;
+import com.etotem.cfc.mapper.ProductMapper;
+import com.etotem.cfc.mapper.RewardMapper;
+import com.etotem.cfc.util.CfFormulaEvaluator;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.context.annotation.Lazy;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * CF 值预估服务(SC-X-22 预估展示层,契约唯一计算方)。
+ *
+ * <p>职责:
+ * <ul>
+ *   <li>按「当日有效规则」计算 {@code expectedCf}(正=获得、负=消耗、0=无奖励)。</li>
+ *   <li>预估旁路读:任何异常/超时均降级为「CF 奖励以实际为准」,不阻塞主流程。</li>
+ *   <li>产出点分类文案:获得型 / 消耗型 / 零值 / 触顶 / 降级。</li>
+ * </ul>
+ * </p>
+ *
+ * <p>口径见 docs/superpowers/specs/2026-11-05-sc-x22-cf-estimate-contract.md §2~§8。</p>
+ */
+@Slf4j
+@Service
+public class RewardRuleService {
+
+    // ==================== 操作类型常量(契约 §3 / §4.2) ====================
+    public static final String OP_TASK_COMPLETE = "TASK_COMPLETE";
+    public static final String OP_GROWTH_TASK   = "GROWTH_TASK";
+    public static final String OP_PURCHASE      = "PURCHASE";
+    public static final String OP_CHECKIN       = "CHECKIN";
+    public static final String OP_AUDIT         = "AUDIT";
+    public static final String OP_WISH          = "WISH";
+    public static final String OP_EXCHANGE      = "EXCHANGE";
+    public static final String OP_ASSESSMENT_REPORT = "ASSESSMENT_REPORT";
+
+    // ==================== display.type 常量 ====================
+    public static final String DISPLAY_EARN        = "EARN";
+    public static final String DISPLAY_SPEND       = "SPEND";
+    public static final String DISPLAY_ZERO        = "ZERO";
+    public static final String DISPLAY_LIMIT_HIT   = "LIMIT_HIT";
+    public static final String DISPLAY_DEGRADED    = "DEGRADED";
+
+    private static final long ESTIMATE_TIMEOUT_MS = TimeUnit.SECONDS.toMillis(3);
+    private static final String CURRENCY = "CF";
+
+    @Resource
+    private CfEarnRuleService cfEarnRuleService;
+
+    @Resource
+    private CfBalanceLogMapper cfBalanceLogMapper;
+
+    @Resource
+    private CfEarnDailyLimitMapper cfEarnDailyLimitMapper;
+
+    @Resource
+    private ConfigService configService;
+
+    @Resource
+    private com.etotem.cfc.mapper.FamilyMemberMapper familyMemberMapper;
+
+    @Resource
+    private TaskMapper taskMapper;
+
+    @Resource
+    private GrowthTaskMapper growthTaskMapper;
+
+    @Resource
+    private ProductMapper productMapper;
+
+    @Resource
+    private RewardMapper rewardMapper;
+
+    @Resource
+    private ObjectMapper objectMapper;
+
+    @Resource
+    @Lazy
+    private MembershipService membershipService;
+
+    // ==================== 对外入口 ====================
+
+    /**
+     * 预估 CF 值(旁路读,3s 超时兜底降级)。
+     *
+     * @param memberId     家庭成员 ID(family_members.id),服务端从 JWT 解析,客户端不可伪造
+     * @param operationType 操作类型(契约 §4.2)
+     * @param resourceType  资源类型
+     * @param resourceId    稳定业务单据 ID
+     * @param idempotencyKey 请求级幂等键(仅回显用,不参与计算)
+     * @return 预估 VO(失败时 display.type=DEGRADED、expectedCf=null)
+     */
+    public RewardEstimateVO estimate(Long memberId, String operationType,
+                                     String resourceType, String resourceId, String idempotencyKey) {
+        long start = System.currentTimeMillis();
+        try {
+            RewardEstimateVO vo = computeInternal(memberId, operationType, resourceType, resourceId);
+            vo.setOperationType(operationType);
+            vo.setResourceType(resourceType);
+            vo.setResourceId(resourceId);
+            vo.setIdempotencyKey(idempotencyKey);
+            log.debug("CF 预估完成:opType={} resourceId={} cf={} elapsed={}ms",
+                    operationType, resourceId, vo.getExpectedCf(), System.currentTimeMillis() - start);
+            return vo;
+        } catch (Exception e) {
+            long elapsed = System.currentTimeMillis() - start;
+            log.warn("CF 预估异常:opType={} resourceId={} err={} elapsed={}ms",
+                    operationType, resourceId, e.getMessage(), elapsed);
+            return degradedVO(operationType, resourceType, resourceId, idempotencyKey, elapsed);
+        }
+    }
+
+    /**
+     * 纯计算 expectedCf(无装饰字段):供产出点接口内嵌复用。
+     *
+     * @return int(正/负/0);规则缺失或内部异常返回 0,由调用方决定是否展示
+     */
+    public int estimateCf(Long memberId, String operationType, String resourceType, String resourceId) {
+        try {
+            RewardEstimateVO vo = computeInternal(memberId, operationType, resourceType, resourceId);
+            return vo.getExpectedCf() != null ? vo.getExpectedCf() : 0;
+        } catch (Exception e) {
+            log.warn("CF 预估异常(内嵌路径):opType={} err={}", operationType, e.getMessage());
+            return 0;
+        }
+    }
+
+    // ==================== 成员解析(供产出点接口内嵌复用) ====================
+
+    /** 登录 userId → 家庭成员 ID(与 CfEarnDispatchService.resolveMemberId 口径一致) */
+    public Long resolveMemberIdByUser(Long userId) {
+        if (userId == null || userId <= 0) {
+            return null;
+        }
+        com.etotem.cfc.entity.FamilyMember member = familyMemberMapper.selectOne(
+                new LambdaQueryWrapper<com.etotem.cfc.entity.FamilyMember>()
+                        .eq(com.etotem.cfc.entity.FamilyMember::getUserId, userId)
+                        .orderByAsc(com.etotem.cfc.entity.FamilyMember::getId)
+                        .last("LIMIT 1"));
+        return member == null ? null : member.getId();
+    }
+
+    // ==================== 产出点内嵌挂载(契约 §4.3) ====================
+
+    /**
+     * 为单个 Task 挂载 expectedCf + display(F22 TASK_COMPLETE)。
+     * 预估为旁路读,任何异常静默忽略,不阻塞任务主流程。
+     */
+    public void attachTaskEstimate(Task task, Long memberId) {
+        if (task == null || task.getId() == null) {
+            return;
+        }
+        try {
+            RewardEstimateVO vo = estimate(memberId, OP_TASK_COMPLETE, "TASK",
+                    String.valueOf(task.getId()), null);
+            if (vo == null) {
+                return;
+            }
+            task.setExpectedCf(vo.getExpectedCf());
+            task.setDisplay(vo.getDisplay());
+        } catch (Exception e) {
+            log.warn("挂载任务预估失败 taskId={}:{}", task.getId(), e.getMessage());
+        }
+    }
+
+    /** 批量为任务列表挂载预估(逐条旁路读,单条异常不影响其余) */
+    public void attachTaskListEstimate(List<Task> tasks, Long memberId) {
+        if (tasks == null || tasks.isEmpty() || memberId == null) {
+            return;
+        }
+        for (Task task : tasks) {
+            attachTaskEstimate(task, memberId);
+        }
+    }
+
+    /** 为分页对象挂载预估(MyBatis-Plus IPage) */
+    public void attachTaskPageEstimate(com.baomidou.mybatisplus.core.metadata.IPage<Task> page, Long memberId) {
+        if (page == null) {
+            return;
+        }
+        attachTaskListEstimate(page.getRecords(), memberId);
+    }
+
+    /**
+     * 为成长任务 Map 列表挂载预估(F12 GROWTH_TASK)。
+     * Map 需含 "id"(growth_task.id);结果写回 map.expectedCf / map.display。
+     */
+    public void attachGrowthTaskMapEstimate(List<Map<String, Object>> items, Long memberId) {
+        if (items == null || items.isEmpty() || memberId == null) {
+            return;
+        }
+        for (Map<String, Object> item : items) {
+            if (item == null || item.get("id") == null) {
+                continue;
+            }
+            try {
+                RewardEstimateVO vo = estimate(memberId, OP_GROWTH_TASK, "GROWTH_TASK",
+                        String.valueOf(item.get("id")), null);
+                if (vo == null) {
+                    continue;
+                }
+                item.put("expectedCf", vo.getExpectedCf());
+                item.put("display", vo.getDisplay());
+            } catch (Exception e) {
+                log.warn("挂载成长任务预估失败 id={}:{}", item.get("id"), e.getMessage());
+            }
+        }
+    }
+
+    /** 为单个成长任务实体挂载预估(F12) */
+    public void attachGrowthTaskEstimate(GrowthTask gt, Long memberId) {
+        if (gt == null || gt.getId() == null) {
+            return;
+        }
+        try {
+            RewardEstimateVO vo = estimate(memberId, OP_GROWTH_TASK, "GROWTH_TASK",
+                    String.valueOf(gt.getId()), null);
+            if (vo == null) {
+                return;
+            }
+            gt.setExpectedCf(vo.getExpectedCf());
+            gt.setDisplay(vo.getDisplay());
+        } catch (Exception e) {
+            log.warn("挂载成长任务预估失败 id={}:{}", gt.getId(), e.getMessage());
+        }
+    }
+
+    // ==================== 内部计算 ====================
+
+    private RewardEstimateVO computeInternal(Long memberId, String operationType,
+                                             String resourceType, String resourceId) {
+        if (memberId == null || memberId <= 0) {
+            return degradedVO(operationType, resourceType, resourceId, null, 0);
+        }
+        Long rid = parseResourceId(resourceId);
+
+        // 1) 按 operationType 解析规则编码 + ctx
+        RuleCtx ruleCtx = resolveRuleAndCtx(memberId, operationType, resourceType, rid);
+        if (ruleCtx == null) {
+            // 消耗型或无法解析规则:走专项分支
+            return handleSpendOrUnresolvable(memberId, operationType, resourceType, rid);
+        }
+        if (ruleCtx.degraded) {
+            return degradedVO(operationType, resourceType, resourceId, null, 0);
+        }
+
+        // 2) 计算基础数量
+        int rawAmount = computeAmount(ruleCtx.rule, ruleCtx.params, ruleCtx.ctx);
+
+        // 3) 应用会员等级日限兜底 clamping(旁路读)
+        int clamped = clampByDailyLimits(memberId, ruleCtx.rule, ruleCtx.refType, rawAmount);
+
+        // 4) 构造展示 VO(触顶 clamped=0 时按 ZERO 处理;触顶原因由 clampByDailyLimits 判定)
+        RewardDisplayVO display = buildDisplay(clamped);
+        return buildEstimateVO(clamped, display, operationType, resourceType, resourceId, null, null);
+    }
+
+    /**
+     * 处理消耗型 / 无法对应 earn 规则的产出点(如 WISH 心愿兑换)。
+     * 这类产出点直接读业务实体,取负向 CF 值,不按规则发 earn。
+     */
+    private RewardEstimateVO handleSpendOrUnresolvable(Long memberId, String operationType,
+                                                       String resourceType, Long resourceId) {
+        int expectedCf = 0;
+        String displayType = DISPLAY_ZERO;
+        String reason = null;
+        try {
+            if (OP_WISH.equalsIgnoreCase(operationType) || "WISH".equalsIgnoreCase(operationType)) {
+                if (resourceId != null) {
+                    Reward reward = rewardMapper.selectById(resourceId);
+                    if (reward != null && reward.getPointsRequired() != null && reward.getPointsRequired() > 0) {
+                        expectedCf = -reward.getPointsRequired();
+                        displayType = DISPLAY_SPEND;
+                    }
+                }
+            } else if (OP_EXCHANGE.equalsIgnoreCase(operationType)) {
+                // 商城兑换/积分兑换商品:从 resourceType 区分,暂时降级(无统一规则)
+                return degradedVO(operationType, resourceType, resourceId == null ? null : String.valueOf(resourceId),
+                        null, 0);
+            } else if (OP_CHECKIN.equalsIgnoreCase(operationType)
+                    || "ACTIVITY_CHECKIN".equalsIgnoreCase(operationType)) {
+                // ACTIVITY_CHECKIN 已映射到 F05,不应走到这里
+                return degradedVO(operationType, resourceType, resourceId == null ? null : String.valueOf(resourceId),
+                        null, 0);
+            }
+        } catch (Exception e) {
+            log.warn("消耗型预估异常 opType={} err={}", operationType, e.getMessage());
+            return degradedVO(operationType, resourceType,
+                    resourceId == null ? null : String.valueOf(resourceId), null, 0);
+        }
+        RewardDisplayVO display = buildDisplay(expectedCf, displayType);
+        return buildEstimateVO(expectedCf, display, operationType, resourceType,
+                resourceId == null ? null : String.valueOf(resourceId), null, reason);
+    }
+
+    // ==================== 规则与 ctx 解析 ====================
+
+    private static final Map<String, String> OPERATION_TO_RULE = new HashMap<>();
+    static {
+        // key=operationType(大小写不敏感匹配)
+        OPERATION_TO_RULE.put("TASK_COMPLETE", "F22");
+        OPERATION_TO_RULE.put("AUDIT", "F22");
+        OPERATION_TO_RULE.put("GROWTH_TASK", "F12");
+        OPERATION_TO_RULE.put("PURCHASE", "F02");
+        OPERATION_TO_RULE.put("CHECKIN", "F05");
+        OPERATION_TO_RULE.put("ACTIVITY_CHECKIN", "F05");
+        OPERATION_TO_RULE.put("ASSESSMENT_REPORT", "F09");
+    }
+
+    private class RuleCtx {
+        CfEarnRule rule;
+        Map<String, Object> params;
+        Map<String, Object> ctx;
+        String refType;
+        boolean degraded = false;
+    }
+
+    private RuleCtx resolveRuleAndCtx(Long memberId, String operationType, String resourceType, Long resourceId) {
+        String ruleCode = OPERATION_TO_RULE.get(normalizeOpType(operationType));
+        if (ruleCode == null) {
+            return null;
+        }
+        CfEarnRule rule = cfEarnRuleService.getByCode(ruleCode);
+        if (rule == null || rule.getEnabled() == null || rule.getEnabled() != 1) {
+            RuleCtx rc = new RuleCtx();
+            rc.rule = rule;
+            rc.degraded = true;
+            return rc;
+        }
+        Date now = new Date();
+        if (rule.getEffectiveFrom() != null && now.before(rule.getEffectiveFrom())) {
+            RuleCtx rc = new RuleCtx();
+            rc.rule = rule;
+            rc.degraded = true;
+            return rc;
+        }
+        if (rule.getEffectiveTo() != null && now.after(rule.getEffectiveTo())) {
+            RuleCtx rc = new RuleCtx();
+            rc.rule = rule;
+            rc.degraded = true;
+            return rc;
+        }
+        Map<String, Object> params = parseParams(rule.getParamsJson());
+        String refType = rule.getDedupRefType() != null && !rule.getDedupRefType().trim().isEmpty()
+                ? rule.getDedupRefType().trim() : ruleCode;
+
+        Map<String, Object> ctx = resolveCtx(operationType, resourceType, resourceId, ruleCode);
+        if (ctx == null) {
+            RuleCtx rc = new RuleCtx();
+            rc.degraded = true;
+            return rc;
+        }
+
+        RuleCtx rc = new RuleCtx();
+        rc.rule = rule;
+        rc.params = params;
+        rc.ctx = ctx;
+        rc.refType = refType;
+        return rc;
+    }
+
+    private Map<String, Object> resolveCtx(String operationType, String resourceType,
+                                           Long resourceId, String ruleCode) {
+        if (resourceId == null) {
+            return null;
+        }
+        switch (normalizeOpType(operationType)) {
+            case "TASK_COMPLETE":
+            case "AUDIT": {
+                Task task = taskMapper.selectById(resourceId);
+                if (task == null || task.getPoints() == null || task.getPoints() <= 0) {
+                    return null;
+                }
+                Map<String, Object> ctx = new HashMap<>();
+                ctx.put("amount", task.getPoints());
+                ctx.put("task_id", resourceId);
+                return ctx;
+            }
+            case "GROWTH_TASK": {
+                GrowthTask gt = growthTaskMapper.selectById(resourceId);
+                if (gt == null || gt.getRewardPoints() == null || gt.getRewardPoints() <= 0) {
+                    return null;
+                }
+                Map<String, Object> ctx = new HashMap<>();
+                ctx.put("amount", gt.getRewardPoints());
+                ctx.put("task_key", gt.getTaskKey());
+                return ctx;
+            }
+            case "PURCHASE": {
+                // resourceId 可能是商品 ID(直接下单预估消费返 CF)或订单 ID
+                // 优先按商品价计算;其次按订单
+                Product product = productMapper.selectById(resourceId);
+                if (product != null && product.getPrice() != null && product.getPrice() > 0) {
+                    Map<String, Object> ctx = new HashMap<>();
+                    ctx.put("amt", product.getPrice()); // price 单位是分(商品定价分)
+                    ctx.put("product_id", resourceId);
+                    return ctx;
+                }
+                // 回退:按订单(暂不支持订单维度反向解析,降级)
+                return null;
+            }
+            case "CHECKIN":
+            case "ACTIVITY_CHECKIN": {
+                // resourceType = ACTIVITY_CHECKIN; resourceId = activityId 等,此处简化处理
+                // 活动签到 CF 取自活动配置 activities.platform_points,需通过 ActivityService 解析
+                // 本实现按 resourceType 透传至 ctx,由公式参数解决(如无具体实现则返回 null 降级)
+                Map<String, Object> ctx = new HashMap<>();
+                ctx.put("activity_id", resourceId);
+                ctx.put("checkin_id", resourceId);
+                return ctx;
+            }
+            case "ASSESSMENT_REPORT": {
+                // F09 数量依赖「是否首份报告」——需读账本判断;降级为 ctx.first_report=true 估算(首份上限)
+                Map<String, Object> ctx = new HashMap<>();
+                ctx.put("first_report", true);
+                ctx.put("report_ref", resourceId);
+                return ctx;
+            }
+            default:
+                return null;
+        }
+    }
+
+    // ==================== 数量计算 ====================
+
+    /**
+     * 按规则计算发放数量:fixed 取 amount;formula 用白名单求值器;per_item 取 ctx.amount/qty。
+     * 与 {@code CfBalanceServiceImpl.computeAmount} 语义对齐,供预估旁路复用。
+     */
+    private int computeAmount(CfEarnRule rule, Map<String, Object> params, Map<String, Object> ctx) {
+        String ruleType = rule.getRuleType() == null ? "" : rule.getRuleType().trim().toLowerCase();
+        double base;
+        switch (ruleType) {
+            case "fixed":
+                if (rule.getAmount() == null) {
+                    throw new IllegalArgumentException("规则 " + rule.getCode() + " 未配置固定数量 amount");
+                }
+                base = rule.getAmount();
+                break;
+            case "formula":
+                base = evaluateFormula(rule, params, ctx);
+                break;
+            case "per_item":
+                base = perItemAmount(rule.getCode(), ctx);
+                break;
+            default:
+                throw new IllegalArgumentException("未知的规则类型:" + rule.getRuleType());
+        }
+        base = base * resolveMultiplier(params);
+        if (base > Integer.MAX_VALUE) {
+            throw new IllegalArgumentException("规则 " + rule.getCode() + " 计算数量溢出");
+        }
+        return (int) Math.floor(base + 1e-6);
+    }
+
+    private double evaluateFormula(CfEarnRule rule, Map<String, Object> params, Map<String, Object> ctx) {
+        String formula = rule.getFormula();
+        if (formula == null || formula.trim().isEmpty()) {
+            throw new IllegalArgumentException("规则 " + rule.getCode() + " 缺少计算公式 formula");
+        }
+        Map<String, Object> vars = new HashMap<>();
+        if (params != null) {
+            vars.putAll(params);
+        }
+        if (ctx != null) {
+            vars.putAll(ctx);
+        }
+        applyAmountUnitConversion(vars, params);
+        return CfFormulaEvaluator.evaluate(formula, vars, cfgResolver());
+    }
+
+    private void applyAmountUnitConversion(Map<String, Object> vars, Map<String, Object> params) {
+        if (params == null || !"cent".equalsIgnoreCase(String.valueOf(params.get("amt_unit")).trim())) {
+            return;
+        }
+        Object raw = vars.get("amt");
+        if (raw == null) {
+            return;
+        }
+        double cents = toDouble(raw, "amt");
+        vars.put("amt", cents * resolveCfPerYuan(params) / 100.0);
+    }
+
+    private double resolveCfPerYuan(Map<String, Object> params) {
+        if (params != null && params.get("cf_per_yuan") != null) {
+            return toDouble(params.get("cf_per_yuan"), "cf_per_yuan");
+        }
+        String value = configService.getConfig("cf.rate.cf_per_yuan");
+        if (value == null || value.trim().isEmpty()) {
+            throw new IllegalStateException("缺少配置 cf.rate.cf_per_yuan");
+        }
+        return toDouble(value, "cf.rate.cf_per_yuan");
+    }
+
+    private double perItemAmount(String ruleCode, Map<String, Object> ctx) {
+        if (ctx != null && ctx.get("amount") != null) {
+            return toDouble(ctx.get("amount"), "ctx.amount");
+        }
+        if (ctx != null && ctx.get("qty") != null) {
+            double perItem = toDouble(ctx.get("qty"), "ctx.qty");
+            Object count = ctx.get("count");
+            return count == null ? perItem : perItem * toDouble(count, "ctx.count");
+        }
+        throw new IllegalArgumentException("规则 " + ruleCode + " 缺少发放数量上下文(amount / qty)");
+    }
+
+    private double resolveMultiplier(Map<String, Object> params) {
+        if (params == null) {
+            return 1.0;
+        }
+        Object key = params.get("multiplier_key");
+        if (key != null && !String.valueOf(key).trim().isEmpty()) {
+            String value = configService.getConfig(String.valueOf(key).trim());
+            if (value == null || value.trim().isEmpty()) {
+                throw new IllegalStateException("缺少配置倍数值:" + key);
+            }
+            return toDouble(value, "multiplier_key " + key);
+        }
+        Object multiplier = params.get("multiplier");
+        return multiplier == null ? 1.0 : toDouble(multiplier, "multiplier");
+    }
+
+    private Map<String, Object> parseParams(String paramsJson) {
+        if (paramsJson == null || paramsJson.trim().isEmpty()) {
+            return new HashMap<>();
+        }
+        try {
+            return objectMapper.readValue(paramsJson, new TypeReference<Map<String, Object>>() {});
+        } catch (Exception e) {
+            log.warn("解析规则 params_json 失败:{}", e.getMessage());
+            return new HashMap<>();
+        }
+    }
+
+    private java.util.function.Function<String, Object> cfgResolver() {
+        return key -> {
+            String value = configService.getConfig(key);
+            if (value == null || value.trim().isEmpty()) {
+                return null;
+            }
+            try {
+                return Double.parseDouble(value.trim());
+            } catch (NumberFormatException e) {
+                return value;
+            }
+        };
+    }
+
+    // ==================== 日限 Clamping ====================
+
+    /**
+     * 按今日已发放次数/数量,将预估数量钳制到剩余可用额度。
+     *
+     * <p>双重闸门:
+     * <ol>
+     *   <li>会员等级日限(次数):{@code cf_earn_daily_limit} × 规则 {@code daily_limit_per_member} 取更严格者;</li>
+     *   <li>规则 params 声明 {@code daily_limit_amount} 时:额外按累计金额钳制(金额闸门)。</li>
+     * </ol>
+     * 命中任一闸门 → expectedCf 按剩余额度缩小,不再返回原始计算值。
+     */
+    private int clampByDailyLimits(Long memberId, CfEarnRule rule, String refType, int rawAmount) {
+        try {
+            // 1) 次数闸门(会员等级日限 × 规则日限,取更严格者)
+            Integer dailyCountLimit = resolveDailyLimitCount(memberId, rule);
+            if (dailyCountLimit != null && dailyCountLimit > 0) {
+                long todayCount = countTodayEarn(memberId, refType);
+                if (todayCount >= dailyCountLimit) {
+                    return 0;
+                }
+            }
+            // 2) 金额闸门(可选,params 显式声明时启用)
+            double amountLimit = resolveAmountDailyLimit(rule);
+            if (amountLimit > 0) {
+                long todayEarned = sumTodayEarned(memberId, refType);
+                int remaining = (int) Math.max(0, Math.floor(amountLimit - todayEarned + 1e-6));
+                if (rawAmount > remaining) {
+                    return remaining;
+                }
+            }
+            return rawAmount;
+        } catch (Exception e) {
+            log.warn("日限 clamp 异常:memberId={} rule={} err={}", memberId, rule.getCode(), e.getMessage());
+            return rawAmount;
+        }
+    }
+
+    /**
+     * 会员等级日限次数:{@code cf_earn_daily_limit}(等级+规则)与规则 {@code daily_limit_per_member} 取更严格者。
+     * 等级由成员 → 家庭 → 当前会员等级解析(旁路读,失败按 FREE)。
+     */
+    private Integer resolveDailyLimitCount(Long memberId, CfEarnRule rule) {
+        Integer ruleLimit = rule.getDailyLimitPerMember();
+        Integer tierLimit = null;
+        try {
+            String levelCode = resolveLevelCode(memberId);
+            if (levelCode != null && rule.getCode() != null) {
+                CfEarnDailyLimit limit = cfEarnDailyLimitMapper.selectOne(
+                        new LambdaQueryWrapper<CfEarnDailyLimit>()
+                                .eq(CfEarnDailyLimit::getRuleCode, rule.getCode())
+                                .eq(CfEarnDailyLimit::getLevelCode, levelCode)
+                                .last("LIMIT 1"));
+                if (limit != null && limit.getDailyLimit() != null) {
+                    tierLimit = limit.getDailyLimit();
+                }
+            }
+        } catch (Exception e) {
+            log.warn("解析会员等级日限失败 rule={} err={}", rule.getCode(), e.getMessage());
+        }
+        if (tierLimit == null) {
+            return ruleLimit;
+        }
+        if (ruleLimit == null) {
+            return tierLimit;
+        }
+        return Math.min(tierLimit, ruleLimit);
+    }
+
+    /** 成员 → 家庭 → 当前会员等级(旁路读;无家庭/未开通按 FREE) */
+    private String resolveLevelCode(Long memberId) {
+        try {
+            com.etotem.cfc.entity.FamilyMember member =
+                    familyMemberMapper.selectById(memberId);
+            if (member == null || member.getFamilyId() == null) {
+                return "FREE";
+            }
+            com.etotem.cfc.dto.MembershipLevelDTO level = membershipService.getCurrentLevel(member.getFamilyId());
+            if (level != null && level.getLevelCode() != null && !level.getLevelCode().trim().isEmpty()) {
+                return level.getLevelCode().trim();
+            }
+        } catch (Exception e) {
+            log.warn("解析会员等级失败 memberId={}:{}", memberId, e.getMessage());
+        }
+        return "FREE";
+    }
+
+    private long countTodayEarn(Long memberId, String refType) {
+        Long count = cfBalanceLogMapper.selectCount(new LambdaQueryWrapper<CfBalanceLog>()
+                .eq(CfBalanceLog::getMemberId, memberId)
+                .eq(CfBalanceLog::getType, "earn")
+                .eq(CfBalanceLog::getRefType, refType)
+                .ge(CfBalanceLog::getCreatedAt, startOfDay(new Date())));
+        return count == null ? 0L : count;
+    }
+
+    /** 当日该 refType 累计已获得 CF 数量(用于金额闸门) */
+    private long sumTodayEarned(Long memberId, String refType) {
+        List<Object> amounts = cfBalanceLogMapper.selectObjs(
+                new com.baomidou.mybatisplus.core.conditions.query.QueryWrapper<CfBalanceLog>()
+                        .select("amount")
+                        .eq("member_id", memberId)
+                        .eq("type", "earn")
+                        .eq("ref_type", refType)
+                        .ge("created_at", startOfDay(new Date())));
+        long sum = 0;
+        if (amounts != null) {
+            for (Object amount : amounts) {
+                if (amount != null) {
+                    try {
+                        sum += Long.parseLong(String.valueOf(amount));
+                    } catch (NumberFormatException ignored) {
+                        // 非数值行忽略
+                    }
+                }
+            }
+        }
+        return sum;
+    }
+
+    /** 金额闸门阈值:规则 params.daily_limit_amount 优先,其次 service_config cf.estimate.daily_limit_amount */
+    private double resolveAmountDailyLimit(CfEarnRule rule) {
+        if (rule == null || rule.getParamsJson() == null) {
+            return 0;
+        }
+        try {
+            Map<String, Object> params = objectMapper.readValue(rule.getParamsJson(),
+                    new TypeReference<Map<String, Object>>() {});
+            if (params != null && params.get("daily_limit_amount") != null) {
+                return toDouble(params.get("daily_limit_amount"), "daily_limit_amount");
+            }
+        } catch (Exception e) {
+            log.warn("解析规则 params_json 失败 code={}:{}", rule.getCode(), e.getMessage());
+        }
+        String cfg = configService.getConfig("cf.estimate.daily_limit_amount");
+        return cfg == null || cfg.trim().isEmpty() ? 0 : toDouble(cfg, "cf.estimate.daily_limit_amount");
+    }
+
+    // ==================== 展示 VO 构建 ====================
+
+    /** 构建完整预估 VO(预估专用端点使用) */
+    private RewardEstimateVO buildEstimateVO(int expectedCf, RewardDisplayVO display,
+                                              String operationType, String resourceType,
+                                              String resourceId, Integer actualCf, String reason) {
+        RewardEstimateVO vo = new RewardEstimateVO();
+        vo.setExpectedCf(expectedCf);
+        vo.setActualCf(actualCf);
+        vo.setReason(reason);
+        vo.setCurrency(CURRENCY);
+        vo.setOperationType(operationType);
+        vo.setResourceType(resourceType);
+        vo.setResourceId(resourceId);
+        vo.setDisplay(display);
+        return vo;
+    }
+
+    /** 降级 VO:规则未配置 / 超时 / 内部异常 */
+    private RewardEstimateVO degradedVO(String operationType, String resourceType,
+                                         String resourceId, String idempotencyKey, long elapsedMs) {
+        RewardDisplayVO display = new RewardDisplayVO();
+        display.setType(DISPLAY_DEGRADED);
+        display.setTemplate("CF 奖励以实际为准");
+        display.setCfValue(0);
+        RewardEstimateVO vo = new RewardEstimateVO();
+        vo.setExpectedCf(null);
+        vo.setActualCf(null);
+        vo.setReason(null);
+        vo.setCurrency(CURRENCY);
+        vo.setOperationType(operationType);
+        vo.setResourceType(resourceType);
+        vo.setResourceId(resourceId);
+        vo.setIdempotencyKey(idempotencyKey);
+        vo.setDisplay(display);
+        return vo;
+    }
+
+    /** 构建展示 VO(供产出点接口内嵌复用) */
+    public RewardDisplayVO buildDisplay(int expectedCf, String displayType) {
+        return buildDisplay(expectedCf, displayType, null);
+    }
+
+    public RewardDisplayVO buildDisplay(int expectedCf) {
+        String type;
+        String template;
+        if (expectedCf > 0) {
+            type = DISPLAY_EARN;
+            template = "本操作预计获得 " + expectedCf + " CF";
+        } else if (expectedCf < 0) {
+            type = DISPLAY_SPEND;
+            template = "本操作将消耗 " + (-expectedCf) + " CF";
+        } else {
+            type = DISPLAY_ZERO;
+            template = null; // 省略
+        }
+        RewardDisplayVO display = new RewardDisplayVO();
+        display.setType(type);
+        display.setTemplate(template);
+        display.setCfValue(expectedCf);
+        return display;
+    }
+
+    public RewardDisplayVO buildDisplay(int expectedCf, String fallbackType, String fallbackTemplate) {
+        if (expectedCf > 0) {
+            RewardDisplayVO d = new RewardDisplayVO();
+            d.setType(DISPLAY_EARN);
+            d.setTemplate("本操作预计获得 " + expectedCf + " CF");
+            d.setCfValue(expectedCf);
+            return d;
+        } else if (expectedCf < 0) {
+            RewardDisplayVO d = new RewardDisplayVO();
+            d.setType(DISPLAY_SPEND);
+            d.setTemplate("本操作将消耗 " + (-expectedCf) + " CF");
+            d.setCfValue(expectedCf);
+            return d;
+        } else {
+            if (fallbackType != null && fallbackTemplate != null) {
+                RewardDisplayVO d = new RewardDisplayVO();
+                d.setType(fallbackType);
+                d.setTemplate(fallbackTemplate);
+                d.setCfValue(0);
+                return d;
+            }
+            RewardDisplayVO d = new RewardDisplayVO();
+            d.setType(DISPLAY_ZERO);
+            d.setTemplate(null);
+            d.setCfValue(0);
+            return d;
+        }
+    }
+
+    // ==================== 工具方法 ====================
+
+    private String normalizeOpType(String operationType) {
+        if (operationType == null) {
+            return null;
+        }
+        return operationType.trim().toUpperCase();
+    }
+
+    private Long parseResourceId(String resourceId) {
+        if (resourceId == null || resourceId.trim().isEmpty()) {
+            return null;
+        }
+        try {
+            return Long.parseLong(resourceId.trim());
+        } catch (NumberFormatException e) {
+            // 部分 resource 按字符串标识(如 SKU spec),无法解析为 Long 时降级
+            return null;
+        }
+    }
+
+    private double toDouble(Object value, String what) {
+        if (value == null) {
+            throw new IllegalArgumentException(what + " 为空");
+        }
+        if (value instanceof Number) {
+            return ((Number) value).doubleValue();
+        }
+        try {
+            return Double.parseDouble(String.valueOf(value).trim());
+        } catch (NumberFormatException e) {
+            throw new IllegalArgumentException(what + " 不是数值:" + value);
+        }
+    }
+
+    private Date startOfDay(Date date) {
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date);
+        calendar.set(Calendar.HOUR_OF_DAY, 0);
+        calendar.set(Calendar.MINUTE, 0);
+        calendar.set(Calendar.SECOND, 0);
+        calendar.set(Calendar.MILLISECOND, 0);
+        return calendar.getTime();
+    }
+}

+ 112 - 10
cfc-backend/src/main/java/com/etotem/cfc/service/TaskService.java

@@ -97,9 +97,36 @@ public class TaskService implements TaskServiceInterface {
     private static final int PENALTY_MAX_DAILY = 5; // 每日最多扣分
     private static final int LATE_GRACE_MINUTES = 10; // 10分钟内不算迟到
 
+    // ==================== SC-P-10 创建任务校验(S-cfc-12) ====================
+    private static final Set<String> VALID_FREQUENCIES = Collections.unmodifiableSet(
+            new HashSet<>(Arrays.asList("none", "daily", "weekly", "monthly", "every_other_day", "hourly")));
+    /** 幂等窗口:同一创建请求在 30 秒内重复提交仅生成 1 条任务(重复提交不重复发分) */
+    private static final long TASK_DEDUP_WINDOW_MS = 30_000L;
+    /** 按任务去重键持有的 JVM 内锁,保证并发双发时 check-then-insert 原子性 */
+    private static final java.util.concurrent.ConcurrentHashMap<String, Object> TASK_DEDUP_LOCKS =
+            new java.util.concurrent.ConcurrentHashMap<>();
+    /** JVM 内刚创建任务登记表:dedupKey → long[]{taskId, createdAtMillis}(不依赖 DB 事务提交时机) */
+    private static final java.util.concurrent.ConcurrentHashMap<String, long[]> RECENT_TASKS =
+            new java.util.concurrent.ConcurrentHashMap<>();
+
     @Transactional
     public Long createTask(Long userId, CreateTaskDTO dto) {
         User currentUser = userService.getUserInfo(userId);
+
+        // ===== SC-P-10 创建任务参数校验(异常流:空标题/负积分/非法频率/超期截止 → 400)=====
+        if (dto.getTitle() == null || dto.getTitle().trim().isEmpty()) {
+            throw new IllegalArgumentException("任务标题不能为空");
+        }
+        if (dto.getPoints() != null && dto.getPoints() < 0) {
+            throw new IllegalArgumentException("任务积分不能为负数");
+        }
+        if (dto.getFrequency() != null && !dto.getFrequency().isEmpty()
+                && !VALID_FREQUENCIES.contains(dto.getFrequency())) {
+            throw new IllegalArgumentException("任务频率不合法: " + dto.getFrequency());
+        }
+        if (dto.getDeadline() != null && dto.getDeadline().before(new Date())) {
+            throw new IllegalArgumentException("任务截止时间不能早于当前时间");
+        }
         
         // 处理执行者类型 - 支持家庭成员任务、家庭主账号任务、家庭成员任务
         String executorType = dto.getExecutorType();
@@ -107,6 +134,25 @@ public class TaskService implements TaskServiceInterface {
             executorType = "child";
         }
 
+        // SC-P-10 权限流加固:child 下发的执行人(memberId/executorId)必须属于本家庭,
+        // 防横向越权向他人家庭成员注入任务(等价 member 分支的「被分配成员不属于本家庭」校验)
+        if ("child".equals(executorType)) {
+            List<Long> assigneeIds = new ArrayList<>();
+            if (dto.getMemberIds() != null) assigneeIds.addAll(dto.getMemberIds());
+            if (dto.getMemberId() != null) assigneeIds.add(dto.getMemberId());
+            if (dto.getExecutorId() != null) assigneeIds.add(dto.getExecutorId());
+            for (Long assigneeId : assigneeIds) {
+                if (assigneeId == null) continue;
+                Long count = familyMemberMapper.selectCount(
+                        new LambdaQueryWrapper<FamilyMember>()
+                                .eq(FamilyMember::getId, assigneeId)
+                                .eq(FamilyMember::getFamilyId, currentUser.getFamilyId()));
+                if (count == 0) {
+                    throw new IllegalArgumentException("被分配成员不属于本家庭");
+                }
+            }
+        }
+
         if ("member".equals(executorType)) {
             Long currentMemberId = getCurrentMemberId(userId);
             long familyMemberCount = familyMemberMapper.selectCount(
@@ -155,26 +201,82 @@ public class TaskService implements TaskServiceInterface {
         
         // 如果有多个家庭成员,为每个家庭成员创建任务
         if (!memberIds.isEmpty() && memberIds.size() > 1) {
-            Long firstMemberId = memberIds.get(0);
-            Task task = createSingleTask(currentUser, userId, executorType, firstMemberId, dto);
-            taskMapper.insert(task);
-            ensureSurveyTemplateForTask(task);
-            // 为其他家庭成员创建任务实例
-            for (int i = 1; i < memberIds.size(); i++) {
-                Task additionalTask = createSingleTask(currentUser, userId, executorType, memberIds.get(i), dto);
-                taskMapper.insert(additionalTask);
-                ensureSurveyTemplateForTask(additionalTask);
+            Long firstTaskId = null;
+            for (int i = 0; i < memberIds.size(); i++) {
+                Task memberTask = createSingleTask(currentUser, userId, executorType, memberIds.get(i), dto);
+                Long insertedId = insertTaskWithDedup(memberTask);
+                if (i == 0) firstTaskId = insertedId;
             }
-            return task.getId();
+            return firstTaskId;
         } else {
             // 单个家庭成员或无家庭成员
             Long memberId = memberIds.isEmpty() ? null : memberIds.get(0);
             Task task = createSingleTask(currentUser, userId, executorType, memberId, dto);
+            return insertTaskWithDedup(task);
+        }
+    }
+
+    /**
+     * SC-P-10 幂等插入:同一创建请求(家庭+执行人+标题+积分+频率+截止)在窗口内重复提交
+     * 复用已有任务 id。并发场景按任务键加 JVM 内锁,先查内存登记表(不依赖 DB 事务提交时机),
+     * 再查 DB 窗口内同内容任务(兜底跨重启/多实例),均未命中才插入并登记。
+     */
+    private Long insertTaskWithDedup(Task task) {
+        String key = dedupKeyFor(task);
+        Object lock = TASK_DEDUP_LOCKS.computeIfAbsent(key, k -> new Object());
+        synchronized (lock) {
+            // 1) JVM 内登记表(并发双发:第一个请求尚未提交 DB 也能命中)
+            long[] recent = RECENT_TASKS.get(key);
+            if (recent != null && System.currentTimeMillis() - recent[1] < TASK_DEDUP_WINDOW_MS) {
+                log.info("SC-P-10 幂等:JVM 登记表命中重复创建(key={}),复用任务 id={}", key, recent[0]);
+                return recent[0];
+            }
+            // 2) DB 窗口内同内容任务(跨重启/多实例兜底)
+            Long dupId = findRecentDuplicateTask(task);
+            if (dupId != null) {
+                RECENT_TASKS.put(key, new long[]{dupId, System.currentTimeMillis()});
+                log.info("SC-P-10 幂等:DB 命中重复创建(familyId={}, executor={}, title={}),复用任务 id={}",
+                        task.getFamilyId(), task.getExecutorId(), task.getTitle(), dupId);
+                return dupId;
+            }
             taskMapper.insert(task);
             ensureSurveyTemplateForTask(task);
+            RECENT_TASKS.put(key, new long[]{task.getId(), System.currentTimeMillis()});
             return task.getId();
         }
     }
+
+    /** 去重键(截止时间按秒归一化:DB DATETIME 无毫秒,避免毫秒差导致幂等漏判) */
+    private String dedupKeyFor(Task task) {
+        String deadline = "";
+        if (task.getDeadline() != null) {
+            deadline = String.valueOf(task.getDeadline().getTime() / 1000);
+        }
+        return task.getFamilyId() + "|" + task.getExecutorType() + "|" + task.getExecutorId()
+                + "|" + task.getTitle() + "|" + task.getPoints() + "|" + task.getFrequency()
+                + "|" + deadline;
+    }
+
+    /** 在幂等窗口内查找刚创建过的同内容任务(仅查窗口内的同 key 任务,不误伤历史重复任务) */
+    private Long findRecentDuplicateTask(Task candidate) {
+        Date windowStart = new Date(System.currentTimeMillis() - TASK_DEDUP_WINDOW_MS);
+        LambdaQueryWrapper<Task> wrapper = new LambdaQueryWrapper<Task>()
+                .eq(Task::getFamilyId, candidate.getFamilyId())
+                .eq(Task::getTitle, candidate.getTitle())
+                .eq(Task::getPoints, candidate.getPoints())
+                .ge(Task::getCreatedAt, windowStart);
+        if (candidate.getFrequency() != null) wrapper.eq(Task::getFrequency, candidate.getFrequency());
+        if (candidate.getExecutorType() != null) wrapper.eq(Task::getExecutorType, candidate.getExecutorType());
+        if (candidate.getExecutorId() != null) wrapper.eq(Task::getExecutorId, candidate.getExecutorId());
+        if (candidate.getFamilyMemberId() != null) wrapper.eq(Task::getFamilyMemberId, candidate.getFamilyMemberId());
+        if (candidate.getDeadline() != null) {
+            // 截止时间按秒精度比对(DB DATETIME 无毫秒)
+            java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            wrapper.apply("DATE_FORMAT(deadline, '%Y-%m-%d %H:%i:%s') = {0}", sdf.format(candidate.getDeadline()));
+        }
+        List<Task> hits = taskMapper.selectList(wrapper.last("LIMIT 1"));
+        return hits.isEmpty() ? null : hits.get(0).getId();
+    }
     
     /**
      * 创建单个任务实例

+ 55 - 0
cfc-backend/src/main/resources/db/migrate_dimension_unified.sql

@@ -0,0 +1,55 @@
+-- =====================================================================
+-- T5 历史迁移脚本:health_dimension_scores 维度编码统一(统一维度体系)
+-- ---------------------------------------------------------------------
+-- 性质:DBA 手工执行脚本,非应用自启(不进入 DatabaseInitializer 调用链)。
+-- 目的:将旧健康评分表里的裸维度名(growth/sleep/...)改写为统一点分编码
+--       (body.growth/...),与 product_dimension_config 注册中心对齐。
+-- 幂等性:所有语句均幂等,可重复执行;备份表 IF NOT EXISTS + INSERT 去重。
+-- 执行前请先在测试库演练并核对 affected rows。
+-- 日期戳:20261105(按执行日替换 YYYYMMDD 亦可,保持全脚本一致)
+-- =====================================================================
+
+-- ---------------------------------------------------------------------
+-- 步骤1:备份 health_dimension_scores(幂等:表已存在则跳过)
+-- ---------------------------------------------------------------------
+CREATE TABLE IF NOT EXISTS health_dimension_scores_bak_20261105
+    LIKE health_dimension_scores;
+
+-- 仅当备份表为空时首次全量同步;重复执行不会重复插入(按主键去重)
+INSERT INTO health_dimension_scores_bak_20261105
+SELECT * FROM health_dimension_scores
+WHERE NOT EXISTS (
+    SELECT 1 FROM health_dimension_scores_bak_20261105
+);
+
+-- ---------------------------------------------------------------------
+-- 步骤2:改写 7 个 body 子维编码(幂等:已带 'body.' 前缀的行不会被二次改写)
+--   旧维度名 -> 统一点分编码 body.{sub}
+-- ---------------------------------------------------------------------
+UPDATE health_dimension_scores
+SET dimension = CONCAT('body.', dimension)
+WHERE dimension IN ('growth','sleep','vision','immunity','nutrition','gut','exercise');
+
+-- ---------------------------------------------------------------------
+-- 步骤3:越界扫描(仅报告,不修改)——供 P1-T3 收敛
+--   列出 indicator_definitions 中 dimension_code 不属于
+--   [5 根 + 33 子维] 白名单的越界记录,人工确认后应收敛。
+-- ---------------------------------------------------------------------
+SELECT id, code, name, dimension_code
+FROM indicator_definitions
+WHERE dimension_code IS NOT NULL
+  AND dimension_code NOT IN (
+    -- 5 根
+    'body','mind','wisdom','action','wealth',
+    -- 7 body 子维(P0-T3 已 seed)
+    'body.growth','body.sleep','body.vision','body.immunity','body.nutrition','body.gut','body.exercise',
+    -- 7 wisdom 子维(P0 增量 迁移448)
+    'wisdom.memory','wisdom.attention','wisdom.logic','wisdom.spatial','wisdom.perception','wisdom.focus','wisdom.processingSpeed',
+    -- 10 mind 子维(P0 增量 迁移448)
+    'mind.openness','mind.conscientiousness','mind.extraversion','mind.agreeableness','mind.neuroticism',
+    'mind.driveAutonomy','mind.driveCompetence','mind.driveRelatedness','mind.emotionStability','mind.selfConceptOverall',
+    -- 5 action 子维(P0 增量 迁移448)
+    'action.parentTrust','action.parentIntimacy','action.communication','action.healthStatus','action.lastInteraction',
+    -- 4 wealth 子维(P0 增量 迁移448)
+    'wealth.skill','wealth.altruism','wealth.income','wealth.fx'
+  );

+ 1 - 1
cfc-backend/src/main/resources/schema.sql

@@ -2622,7 +2622,7 @@ CREATE TABLE IF NOT EXISTS indicator_definitions (
     report_type_scope VARCHAR(32) COMMENT '适用报告类型(type_id,空=通用)',
     value_type VARCHAR(16) COMMENT '语义类型: numeric/categorical/level',
     good_direction VARCHAR(16) DEFAULT 'neutral' COMMENT '变化优劣方向: higher_is_better/lower_is_better/in_range_is_better/neutral',
-    dimension_code VARCHAR(16) COMMENT '关联五维(body/mind/wisdom/action/wealth,可空)',
+    dimension_code VARCHAR(64) COMMENT '关联统一维度节点code(注册中心root/sub,可空)',
     parent_id BIGINT COMMENT '父节点ID(可指向product_dimension_config.id或本表id, 混排进维度树)',
     legacy_alias VARCHAR(512) COMMENT '历史别名(JSON数组)',
     sort_order INT DEFAULT 0 COMMENT '排序',

+ 85 - 0
cfc-backend/src/test/java/com/etotem/cfc/controller/MembershipControllerPlansLevelOrderTest.java

@@ -0,0 +1,85 @@
+package com.etotem.cfc.controller;
+
+import com.etotem.cfc.dto.MembershipLevelDTO;
+import com.etotem.cfc.service.MembershipService;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.springframework.http.MediaType;
+import org.springframework.test.util.ReflectionTestUtils;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.test.web.servlet.setup.MockMvcBuilders;
+
+import java.util.Arrays;
+import java.util.List;
+
+import static org.mockito.Mockito.when;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
+
+/**
+ * 契约级单测:POST /api/membership/plans 必须返回 levelOrder。
+ *
+ * <p>背景(2026-11-05 付费页显示 ¥0.00):升级页 upgrade.vue 自 dbd94c59b
+ * 起按接口返回的 {@code levelOrder} 比较等级高低({@code getLevelOrder})。
+ * 但 {@code getPricingPlans()} 手工组装 Map 时遗漏了 levelOrder,导致所有档位
+ * levelOrder 均为 undefined/0:免费用户 applyDefaultLevel 无法找到更高档位,
+ * selectedLevel 回落为 FREE,下一步进入 pay 页时按 FREE 取价 = 0 分,
+ * 付费页显示 ¥0.00,下单被后端以「该会员方案暂未开放购买」拒绝。</p>
+ *
+ * <p>测试隔离:MockMvc standalone + mock MembershipService,无 Spring 上下文 / 无 DB。</p>
+ */
+class MembershipControllerPlansLevelOrderTest {
+
+    private static final String URL = "/api/membership/plans";
+
+    @Mock
+    private MembershipService membershipService;
+
+    private MockMvc mockMvc;
+
+    @BeforeEach
+    void setUp() {
+        MockitoAnnotations.openMocks(this);
+        MembershipController controller = new MembershipController();
+        ReflectionTestUtils.setField(controller, "membershipService", membershipService);
+        mockMvc = MockMvcBuilders.standaloneSetup(controller).build();
+    }
+
+    private MembershipLevelDTO level(String code, int levelOrder, int monthly, int yearly) {
+        MembershipLevelDTO dto = new MembershipLevelDTO();
+        dto.setLevelCode(code);
+        dto.setLevelName(code + "-name");
+        dto.setLevelOrder(levelOrder);
+        dto.setPriceMonthly(monthly);
+        dto.setPriceQuarterly(0);
+        dto.setPriceYearly(yearly);
+        return dto;
+    }
+
+    @Test
+    void plans_返回每个可购档位的levelOrder() throws Exception {
+        List<MembershipLevelDTO> levels = Arrays.asList(
+                level("FREE", 1, 0, 0),
+                level("FAMILY", 3, 19800, 198000),
+                level("PREMIUM", 4, 131400, 1316800),
+                level("BASIC", 2, 990, 0),
+                level("LIFETIME", 5, 0, 0),
+                level("PROVIDER", 1, 13140, 131400)
+        );
+        when(membershipService.getAllLevels()).thenReturn(levels);
+
+        mockMvc.perform(post(URL).contentType(MediaType.APPLICATION_JSON))
+                .andExpect(status().isOk())
+                .andExpect(jsonPath("$.code").value(200))
+                // LIFETIME / PROVIDER 不可购,仍应被过滤
+                .andExpect(jsonPath("$.data.length()").value(4))
+                // 免费用户升级页依赖该字段判断下一档;缺失会导致选档回落 FREE、付费页显示 0
+                .andExpect(jsonPath("$.data[0].levelOrder").value(1))   // FREE
+                .andExpect(jsonPath("$.data[1].levelOrder").value(3))   // FAMILY
+                .andExpect(jsonPath("$.data[2].levelOrder").value(4))   // PREMIUM
+                .andExpect(jsonPath("$.data[3].levelOrder").value(2));  // BASIC
+    }
+}

+ 321 - 0
cfc-backend/src/test/java/com/etotem/cfc/controller/reward/RewardEstimateControllerTest.java

@@ -0,0 +1,321 @@
+package com.etotem.cfc.controller.reward;
+
+import com.etotem.cfc.common.Result;
+import com.etotem.cfc.dto.RewardDisplayVO;
+import com.etotem.cfc.dto.RewardEstimateRequest;
+import com.etotem.cfc.dto.RewardEstimateVO;
+import com.etotem.cfc.entity.FamilyMember;
+import com.etotem.cfc.entity.Reward;
+import com.etotem.cfc.entity.Task;
+import com.etotem.cfc.mapper.FamilyMemberMapper;
+import com.etotem.cfc.mapper.RewardMapper;
+import com.etotem.cfc.mapper.TaskMapper;
+import com.etotem.cfc.service.RewardRuleService;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.springframework.test.util.ReflectionTestUtils;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyLong;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+/**
+ * SC-X-22 · {@code reward.cfEstimate.expectedCf} 控制器契约测试({@link RewardEstimateController},
+ * 直接调用级,统一 Result&lt;T&gt; 形状断言)。
+ *
+ * <p>对应契约 docs/superpowers/specs/2026-11-05-sc-x22-cf-estimate-contract.md:
+ * <ul>
+ *   <li>§4 端点 POST /api/reward/estimate:请求体校验(缺字段 400);</li>
+ *   <li>§7 权限:未登录 401、孩子调家长侧 403、跨家庭资源 403(任务/心愿);</li>
+ *   <li>§2.2 防伪造:请求 DTO 不含 expectedCf 字段,客户端传入被忽略;</li>
+ *   <li>§4.1 统一 @PostMapping;memberId 由服务端从 JWT 解析(userId/currentMemberId)。</li>
+ * </ul>
+ * 纯 Mockito 单测:不依赖 DB / 真实微信 / Spring 容器;不改 src/main。
+ * 溯源:TC-X-22-P(tests/test-cases/cross-role-e2e.md)。
+ */
+class RewardEstimateControllerTest {
+
+    private static final long USER_ID = 100L;
+    private static final long MEMBER_ID = 7L;
+    private static final long FAMILY_ID = 1L;
+
+    @Mock
+    private RewardRuleService rewardRuleService;
+    @Mock
+    private FamilyMemberMapper familyMemberMapper;
+    @Mock
+    private TaskMapper taskMapper;
+    @Mock
+    private RewardMapper rewardMapper;
+
+    private RewardEstimateController controller;
+
+    @BeforeEach
+    void setUp() {
+        MockitoAnnotations.openMocks(this);
+        controller = new RewardEstimateController();
+        ReflectionTestUtils.setField(controller, "rewardRuleService", rewardRuleService);
+        ReflectionTestUtils.setField(controller, "familyMemberMapper", familyMemberMapper);
+        ReflectionTestUtils.setField(controller, "taskMapper", taskMapper);
+        ReflectionTestUtils.setField(controller, "rewardMapper", rewardMapper);
+
+        when(familyMemberMapper.selectById(MEMBER_ID)).thenReturn(member(MEMBER_ID, FAMILY_ID));
+        when(rewardRuleService.estimate(anyLong(), anyString(), anyString(), anyString(), anyString()))
+                .thenReturn(vo(20));
+    }
+
+    // ==================== 一、正常路径(TC-X-22 第 5 步:expectedCf 与页面一致) ====================
+
+    @Test
+    void estimate_正常请求_200并透传服务端预估且回显请求字段() {
+        RewardEstimateRequest req = request("TASK_COMPLETE", "TASK", "101", "key-1");
+        when(taskMapper.selectById(101L)).thenReturn(task(101L, FAMILY_ID, 20));
+
+        Result<RewardEstimateVO> result = controller.estimate(USER_ID, MEMBER_ID, "parent", req);
+
+        assertEquals(200, result.getCode());
+        assertNotNull(result.getData());
+        assertEquals(20, result.getData().getExpectedCf());
+        assertEquals("本操作预计获得 20 CF", result.getData().getDisplay().getTemplate());
+        verify(rewardRuleService).estimate(eq(MEMBER_ID), eq("TASK_COMPLETE"), eq("TASK"), eq("101"), eq("key-1"));
+    }
+
+    @Test
+    void estimate_无currentMemberId_由userId反查成员再预估() {
+        RewardEstimateRequest req = request("TASK_COMPLETE", "TASK", "101", null);
+        when(familyMemberMapper.selectOne(any())).thenReturn(member(MEMBER_ID, FAMILY_ID));
+        when(taskMapper.selectById(101L)).thenReturn(task(101L, FAMILY_ID, 20));
+
+        Result<RewardEstimateVO> result = controller.estimate(USER_ID, null, "parent", req);
+
+        assertEquals(200, result.getCode());
+        verify(rewardRuleService).estimate(eq(MEMBER_ID), eq("TASK_COMPLETE"), eq("TASK"), eq("101"), eq(null));
+    }
+
+    // ==================== 二、参数校验(契约 §4.2) ====================
+
+    @Test
+    void estimate_请求体为空_400() {
+        Result<RewardEstimateVO> result = controller.estimate(USER_ID, MEMBER_ID, "parent", null);
+
+        assertEquals(400, result.getCode());
+        assertTrue(result.getMessage().contains("请求体不能为空"));
+        verify(rewardRuleService, never()).estimate(anyLong(), anyString(), anyString(), anyString(), anyString());
+    }
+
+    @Test
+    void estimate_缺必填字段_400() {
+        RewardEstimateRequest req = request("", "TASK", "101", null);
+
+        Result<RewardEstimateVO> result = controller.estimate(USER_ID, MEMBER_ID, "parent", req);
+
+        assertEquals(400, result.getCode());
+        assertTrue(result.getMessage().contains("均不能为空"));
+        verify(rewardRuleService, never()).estimate(anyLong(), anyString(), anyString(), anyString(), anyString());
+    }
+
+    // ==================== 三、未登录 / 成员归属(契约 §7 第 1 行) ====================
+
+    @Test
+    void estimate_未登录且无currentMemberId_401() {
+        RewardEstimateRequest req = request("PURCHASE", "PRODUCT", "77", null);
+
+        Result<RewardEstimateVO> result = controller.estimate(null, null, null, req);
+
+        assertEquals(401, result.getCode());
+        assertTrue(result.getMessage().contains("未登录"));
+        verify(rewardRuleService, never()).estimate(anyLong(), anyString(), anyString(), anyString(), anyString());
+    }
+
+    @Test
+    void estimate_成员不存在_401() {
+        RewardEstimateRequest req = request("PURCHASE", "PRODUCT", "77", null);
+        when(familyMemberMapper.selectById(MEMBER_ID)).thenReturn(null);
+
+        Result<RewardEstimateVO> result = controller.estimate(USER_ID, MEMBER_ID, "parent", req);
+
+        assertEquals(401, result.getCode());
+        assertTrue(result.getMessage().contains("家庭成员"));
+    }
+
+    // ==================== 四、角色校验(契约 §7 第 2 行,孩子 vs 家长侧) ====================
+
+    @Test
+    void estimate_孩子调家长侧PURCHASE_403不返回预估() {
+        RewardEstimateRequest req = request("PURCHASE", "PRODUCT", "77", null);
+
+        Result<RewardEstimateVO> result = controller.estimate(USER_ID, MEMBER_ID, "child", req);
+
+        assertEquals(403, result.getCode());
+        assertTrue(result.getMessage().contains("无权预估家长侧产出点"));
+        assertNull(result.getData());
+        verify(rewardRuleService, never()).estimate(anyLong(), anyString(), anyString(), anyString(), anyString());
+    }
+
+    @Test
+    void estimate_孩子调任务完成类_不拦截() {
+        RewardEstimateRequest req = request("TASK_COMPLETE", "TASK", "101", null);
+        when(taskMapper.selectById(101L)).thenReturn(task(101L, FAMILY_ID, 20));
+
+        Result<RewardEstimateVO> result = controller.estimate(USER_ID, MEMBER_ID, "child", req);
+
+        assertEquals(200, result.getCode());
+    }
+
+    @Test
+    void estimate_教师角色调PURCHASE_放行() {
+        RewardEstimateRequest req = request("PURCHASE", "PRODUCT", "77", null);
+
+        Result<RewardEstimateVO> result = controller.estimate(USER_ID, MEMBER_ID, "teacher", req);
+
+        assertEquals(200, result.getCode());
+        verify(rewardRuleService).estimate(eq(MEMBER_ID), eq("PURCHASE"), eq("PRODUCT"), eq("77"), eq(null));
+    }
+
+    // ==================== 五、资源归属 / 防跨家庭泄露(契约 §7 第 3 行) ====================
+
+    @Test
+    void estimate_跨家庭任务_403不返回他人expectedCf() {
+        RewardEstimateRequest req = request("TASK_COMPLETE", "TASK", "101", null);
+        when(taskMapper.selectById(101L)).thenReturn(task(101L, 9L, 20));
+
+        Result<RewardEstimateVO> result = controller.estimate(USER_ID, MEMBER_ID, "parent", req);
+
+        assertEquals(403, result.getCode());
+        assertTrue(result.getMessage().contains("其他家庭的任务"));
+        verify(rewardRuleService, never()).estimate(anyLong(), anyString(), anyString(), anyString(), anyString());
+    }
+
+    @Test
+    void estimate_任务不存在_403() {
+        RewardEstimateRequest req = request("TASK_COMPLETE", "TASK", "404", null);
+        when(taskMapper.selectById(404L)).thenReturn(null);
+
+        Result<RewardEstimateVO> result = controller.estimate(USER_ID, MEMBER_ID, "parent", req);
+
+        assertEquals(403, result.getCode());
+        assertTrue(result.getMessage().contains("任务不存在"));
+    }
+
+    @Test
+    void estimate_任务资源ID非数字_403参数无效() {
+        RewardEstimateRequest req = request("TASK_COMPLETE", "TASK", "not-a-number", null);
+
+        Result<RewardEstimateVO> result = controller.estimate(USER_ID, MEMBER_ID, "parent", req);
+
+        assertEquals(403, result.getCode());
+        assertTrue(result.getMessage().contains("资源ID无效"));
+    }
+
+    @Test
+    void estimate_跨家庭心愿_403() {
+        RewardEstimateRequest req = request("WISH", "REWARD", "9", null);
+        when(rewardMapper.selectById(9L)).thenReturn(reward(9L, 9L, 50));
+
+        Result<RewardEstimateVO> result = controller.estimate(USER_ID, MEMBER_ID, "parent", req);
+
+        assertEquals(403, result.getCode());
+        assertTrue(result.getMessage().contains("其他家庭的心愿"));
+        verify(rewardRuleService, never()).estimate(anyLong(), anyString(), anyString(), anyString(), anyString());
+    }
+
+    @Test
+    void estimate_心愿正常_200() {
+        RewardEstimateRequest req = request("WISH", "REWARD", "9", null);
+        when(rewardMapper.selectById(9L)).thenReturn(reward(9L, FAMILY_ID, 50));
+
+        Result<RewardEstimateVO> result = controller.estimate(USER_ID, MEMBER_ID, "parent", req);
+
+        assertEquals(200, result.getCode());
+        verify(rewardRuleService).estimate(eq(MEMBER_ID), eq("WISH"), eq("REWARD"), eq("9"), eq(null));
+    }
+
+    @Test
+    void estimate_商品购买_公开资源不校验归属_200() {
+        RewardEstimateRequest req = request("PURCHASE", "PRODUCT", "sku-abc", null);
+
+        Result<RewardEstimateVO> result = controller.estimate(USER_ID, MEMBER_ID, "parent", req);
+
+        assertEquals(200, result.getCode());
+        verify(rewardRuleService).estimate(eq(MEMBER_ID), eq("PURCHASE"), eq("PRODUCT"), eq("sku-abc"), eq(null));
+    }
+
+    @Test
+    void estimate_资源校验异常_降级403资源校验失败不越权() {
+        RewardEstimateRequest req = request("TASK_COMPLETE", "TASK", "101", null);
+        when(taskMapper.selectById(101L)).thenThrow(new RuntimeException("db down"));
+
+        Result<RewardEstimateVO> result = controller.estimate(USER_ID, MEMBER_ID, "parent", req);
+
+        assertEquals(403, result.getCode());
+        assertTrue(result.getMessage().contains("资源校验失败"));
+        verify(rewardRuleService, never()).estimate(anyLong(), anyString(), anyString(), anyString(), anyString());
+    }
+
+    // ==================== 六、防伪造(契约 §2.2 / TC-X-22-P 第 5 步) ====================
+
+    @Test
+    void 请求DTO不包含expectedCf字段_客户端无法伪造预估() {
+        Exception e = assertThrows(NoSuchFieldException.class,
+                () -> RewardEstimateRequest.class.getDeclaredField("expectedCf"));
+        assertTrue(e.getMessage().contains("expectedCf"), "DTO 不应声明 expectedCf(服务端计算,客户端传了也忽略)");
+    }
+
+    // ==================== 构造辅助 ====================
+
+    private RewardEstimateRequest request(String operationType, String resourceType, String resourceId, String key) {
+        RewardEstimateRequest req = new RewardEstimateRequest();
+        req.setOperationType(operationType);
+        req.setResourceType(resourceType);
+        req.setResourceId(resourceId);
+        req.setIdempotencyKey(key);
+        return req;
+    }
+
+    private RewardEstimateVO vo(int expectedCf) {
+        RewardEstimateVO vo = new RewardEstimateVO();
+        vo.setExpectedCf(expectedCf);
+        vo.setCurrency("CF");
+        RewardDisplayVO display = new RewardDisplayVO();
+        display.setType(expectedCf > 0 ? "EARN" : "ZERO");
+        display.setTemplate(expectedCf > 0 ? "本操作预计获得 " + expectedCf + " CF" : null);
+        display.setCfValue(expectedCf);
+        vo.setDisplay(display);
+        return vo;
+    }
+
+    private FamilyMember member(long id, long familyId) {
+        FamilyMember m = new FamilyMember();
+        m.setId(id);
+        m.setFamilyId(familyId);
+        m.setUserId(USER_ID);
+        return m;
+    }
+
+    private Task task(long id, long familyId, int points) {
+        Task t = new Task();
+        t.setId(id);
+        t.setFamilyId(familyId);
+        t.setPoints(points);
+        return t;
+    }
+
+    private Reward reward(long id, long familyId, int pointsRequired) {
+        Reward r = new Reward();
+        r.setId(id);
+        r.setFamilyId(familyId);
+        r.setPointsRequired(pointsRequired);
+        return r;
+    }
+}

+ 463 - 0
cfc-backend/src/test/java/com/etotem/cfc/service/RewardRuleServiceEstimateTest.java

@@ -0,0 +1,463 @@
+package com.etotem.cfc.service;
+
+import com.baomidou.mybatisplus.core.MybatisConfiguration;
+import com.baomidou.mybatisplus.core.metadata.TableInfoHelper;
+import com.etotem.cfc.config.ConfigService;
+import com.etotem.cfc.dto.RewardEstimateVO;
+import com.etotem.cfc.entity.CfBalanceLog;
+import com.etotem.cfc.entity.CfEarnDailyLimit;
+import com.etotem.cfc.entity.CfEarnRule;
+import com.etotem.cfc.entity.FamilyMember;
+import com.etotem.cfc.entity.GrowthTask;
+import com.etotem.cfc.entity.Product;
+import com.etotem.cfc.entity.Reward;
+import com.etotem.cfc.entity.Task;
+import com.etotem.cfc.mapper.CfBalanceLogMapper;
+import com.etotem.cfc.mapper.CfEarnDailyLimitMapper;
+import com.etotem.cfc.mapper.FamilyMemberMapper;
+import com.etotem.cfc.mapper.GrowthTaskMapper;
+import com.etotem.cfc.mapper.ProductMapper;
+import com.etotem.cfc.mapper.RewardMapper;
+import com.etotem.cfc.mapper.TaskMapper;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.ibatis.builder.MapperBuilderAssistant;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.springframework.test.util.ReflectionTestUtils;
+
+import java.sql.Date;
+import java.time.LocalDate;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.when;
+
+/**
+ * SC-X-22 · {@code reward.cfEstimate.expectedCf} 契约级单测({@link RewardRuleService})。
+ *
+ * <p>对应契约 docs/superpowers/specs/2026-11-05-sc-x22-cf-estimate-contract.md:
+ * <ul>
+ *   <li>§2.1 服务端唯一计算方:按当日有效规则算 expectedCf(正=获得、负=消耗、0=无奖励);</li>
+ *   <li>§3 产出点三类文案(获得型 / 消耗型 / 零值禁「+0 CF」);</li>
+ *   <li>§5.2 日限触顶按剩余额度、不超上限;</li>
+ *   <li>§8 规则未配置 / 未生效 / 内部异常 → 降级「CF 奖励以实际为准」,不抛 500。</li>
+ * </ul>
+ * 纯 Mockito 单测:不依赖 DB / 真实微信 / Spring 容器;不改 src/main。
+ * 溯源:TC-X-22 / TC-X-22-E / TC-X-22-E2(tests/test-cases/cross-role-e2e.md)。
+ */
+class RewardRuleServiceEstimateTest {
+
+    private static final long MEMBER_ID = 7L;
+    private static final long FAMILY_ID = 1L;
+    private static final long USER_ID = 100L;
+
+    @Mock
+    private CfEarnRuleService cfEarnRuleService;
+    @Mock
+    private CfBalanceLogMapper cfBalanceLogMapper;
+    @Mock
+    private CfEarnDailyLimitMapper cfEarnDailyLimitMapper;
+    @Mock
+    private ConfigService configService;
+    @Mock
+    private FamilyMemberMapper familyMemberMapper;
+    @Mock
+    private TaskMapper taskMapper;
+    @Mock
+    private GrowthTaskMapper growthTaskMapper;
+    @Mock
+    private ProductMapper productMapper;
+    @Mock
+    private RewardMapper rewardMapper;
+    @Mock
+    private MembershipService membershipService;
+
+    private final ObjectMapper objectMapper = new ObjectMapper();
+    private final RewardRuleService rewardRuleService = new RewardRuleService();
+
+    @BeforeEach
+    void setUp() {
+        MockitoAnnotations.openMocks(this);
+        // MyBatis-Plus LambdaQueryWrapper 需要实体元数据(参照 CfEarnDispatchServiceTest)
+        TableInfoHelper.initTableInfo(new MapperBuilderAssistant(new MybatisConfiguration(), ""), CfBalanceLog.class);
+        TableInfoHelper.initTableInfo(new MapperBuilderAssistant(new MybatisConfiguration(), ""), CfEarnDailyLimit.class);
+        TableInfoHelper.initTableInfo(new MapperBuilderAssistant(new MybatisConfiguration(), ""), FamilyMember.class);
+
+        ReflectionTestUtils.setField(rewardRuleService, "cfEarnRuleService", cfEarnRuleService);
+        ReflectionTestUtils.setField(rewardRuleService, "cfBalanceLogMapper", cfBalanceLogMapper);
+        ReflectionTestUtils.setField(rewardRuleService, "cfEarnDailyLimitMapper", cfEarnDailyLimitMapper);
+        ReflectionTestUtils.setField(rewardRuleService, "configService", configService);
+        ReflectionTestUtils.setField(rewardRuleService, "familyMemberMapper", familyMemberMapper);
+        ReflectionTestUtils.setField(rewardRuleService, "taskMapper", taskMapper);
+        ReflectionTestUtils.setField(rewardRuleService, "growthTaskMapper", growthTaskMapper);
+        ReflectionTestUtils.setField(rewardRuleService, "productMapper", productMapper);
+        ReflectionTestUtils.setField(rewardRuleService, "rewardMapper", rewardMapper);
+        ReflectionTestUtils.setField(rewardRuleService, "objectMapper", objectMapper);
+        ReflectionTestUtils.setField(rewardRuleService, "membershipService", membershipService);
+
+        // 默认:无日限、无会员等级、无今日已发放;1 元 = 100 CF
+        when(cfBalanceLogMapper.selectCount(any())).thenReturn(0L);
+        when(cfBalanceLogMapper.selectObjs(any())).thenReturn(new ArrayList<>());
+        when(cfEarnDailyLimitMapper.selectOne(any())).thenReturn(null);
+        when(membershipService.getCurrentLevel(any())).thenReturn(null);
+        when(configService.getConfig(anyString())).thenReturn(null);
+        when(configService.getConfig("cf.rate.cf_per_yuan")).thenReturn("100");
+        when(familyMemberMapper.selectById(MEMBER_ID)).thenReturn(member(MEMBER_ID, FAMILY_ID));
+    }
+
+    // ==================== 一、获得型正常路径(TC-X-22) ====================
+
+    @Test
+    void taskComplete_固定规则20_返回获得型预估与统一文案() {
+        when(cfEarnRuleService.getByCode("F22")).thenReturn(rule("F22", "fixed", null, null, null, 20));
+        when(taskMapper.selectById(101L)).thenReturn(task(101L, FAMILY_ID, 20));
+
+        RewardEstimateVO vo = rewardRuleService.estimate(MEMBER_ID, "TASK_COMPLETE", "TASK", "101", "key-1");
+
+        assertEquals(20, vo.getExpectedCf());
+        assertNull(vo.getActualCf());
+        assertNull(vo.getReason());
+        assertEquals("CF", vo.getCurrency());
+        assertEquals("TASK_COMPLETE", vo.getOperationType());
+        assertEquals("TASK", vo.getResourceType());
+        assertEquals("101", vo.getResourceId());
+        assertEquals("key-1", vo.getIdempotencyKey());
+        assertEquals("EARN", vo.getDisplay().getType());
+        assertEquals("本操作预计获得 20 CF", vo.getDisplay().getTemplate());
+        assertEquals(20, vo.getDisplay().getCfValue());
+    }
+
+    @Test
+    void audit_与任务完成共享F22规则_审核发分预估() {
+        when(cfEarnRuleService.getByCode("F22")).thenReturn(rule("F22", "fixed", null, null, null, 20));
+        when(taskMapper.selectById(102L)).thenReturn(task(102L, FAMILY_ID, 20));
+
+        RewardEstimateVO vo = rewardRuleService.estimate(MEMBER_ID, "AUDIT", "TASK", "102", null);
+
+        assertEquals(20, vo.getExpectedCf());
+        assertEquals("EARN", vo.getDisplay().getType());
+        assertEquals("本操作预计获得 20 CF", vo.getDisplay().getTemplate());
+    }
+
+    @Test
+    void purchase_公式F02_99元商品按1元100CF估9900() {
+        when(cfEarnRuleService.getByCode("F02")).thenReturn(rule("F02", "formula", "floor(amt)",
+                "{\"cf_per_yuan\":100,\"amt_unit\":\"cent\"}", null, null));
+        // price 单位为分:9900 分 = 99 元 → 9900 CF
+        when(productMapper.selectById(77L)).thenReturn(product(77L, 9900));
+
+        RewardEstimateVO vo = rewardRuleService.estimate(MEMBER_ID, "PURCHASE", "PRODUCT", "77", null);
+
+        assertEquals(9900, vo.getExpectedCf());
+        assertEquals("EARN", vo.getDisplay().getType());
+        assertEquals("本操作预计获得 9900 CF", vo.getDisplay().getTemplate());
+    }
+
+    @Test
+    void growthTask_按任务奖励积分perItem预估() {
+        when(cfEarnRuleService.getByCode("F12")).thenReturn(rule("F12", "per_item", null, null, null, null));
+        when(growthTaskMapper.selectById(55L)).thenReturn(growthTask(55L, 10));
+
+        RewardEstimateVO vo = rewardRuleService.estimate(MEMBER_ID, "GROWTH_TASK", "GROWTH_TASK", "55", null);
+
+        assertEquals(10, vo.getExpectedCf());
+        assertEquals("EARN", vo.getDisplay().getType());
+        assertEquals("本操作预计获得 10 CF", vo.getDisplay().getTemplate());
+    }
+
+    // ==================== 二、消耗型(TC-X-22-E2 第 2 步) ====================
+
+    @Test
+    void wish_心愿兑换_负向消耗文案不误用获得型() {
+        when(rewardMapper.selectById(9L)).thenReturn(reward(9L, FAMILY_ID, 50));
+
+        RewardEstimateVO vo = rewardRuleService.estimate(MEMBER_ID, "WISH", "REWARD", "9", null);
+
+        assertEquals(-50, vo.getExpectedCf());
+        assertEquals("SPEND", vo.getDisplay().getType());
+        assertEquals("本操作将消耗 50 CF", vo.getDisplay().getTemplate());
+        assertEquals(-50, vo.getDisplay().getCfValue());
+        assertFalse(vo.getDisplay().getTemplate().contains("获得"));
+    }
+
+    @Test
+    void wish_心愿无消耗值_零值省略文案不展示加0CF() {
+        when(rewardMapper.selectById(10L)).thenReturn(reward(10L, FAMILY_ID, null));
+
+        RewardEstimateVO vo = rewardRuleService.estimate(MEMBER_ID, "WISH", "REWARD", "10", null);
+
+        assertEquals(0, vo.getExpectedCf());
+        assertEquals("ZERO", vo.getDisplay().getType());
+        assertNull(vo.getDisplay().getTemplate());
+    }
+
+    // ==================== 三、零值(TC-X-22-E2 第 1 步,禁止「+0 CF」) ====================
+
+    @Test
+    void 规则值为0_返回零值展示且不出现加0CF文案() {
+        when(cfEarnRuleService.getByCode("F22")).thenReturn(rule("F22", "fixed", null, null, null, 0));
+        when(taskMapper.selectById(103L)).thenReturn(task(103L, FAMILY_ID, 20));
+
+        RewardEstimateVO vo = rewardRuleService.estimate(MEMBER_ID, "TASK_COMPLETE", "TASK", "103", null);
+
+        assertEquals(0, vo.getExpectedCf());
+        assertEquals("ZERO", vo.getDisplay().getType());
+        assertNull(vo.getDisplay().getTemplate(), "零值必须省略预估文案,禁止展示「+0 CF」");
+        assertEquals(0, vo.getDisplay().getCfValue());
+    }
+
+    // ==================== 四、降级(TC-X-22-E 第 4 步 / 契约 §8) ====================
+
+    @Test
+    void 规则未配置_降级为以实际为准且不抛异常() {
+        when(cfEarnRuleService.getByCode("F22")).thenReturn(null);
+
+        RewardEstimateVO vo = assertDoesNotThrow(
+                () -> rewardRuleService.estimate(MEMBER_ID, "TASK_COMPLETE", "TASK", "101", null));
+
+        assertNull(vo.getExpectedCf());
+        assertEquals("DEGRADED", vo.getDisplay().getType());
+        assertEquals("CF 奖励以实际为准", vo.getDisplay().getTemplate());
+        assertEquals("CF", vo.getCurrency());
+    }
+
+    @Test
+    void 规则未启用_降级为以实际为准() {
+        CfEarnRule disabled = rule("F22", "fixed", null, null, null, 20);
+        disabled.setEnabled(0);
+        when(cfEarnRuleService.getByCode("F22")).thenReturn(disabled);
+
+        RewardEstimateVO vo = rewardRuleService.estimate(MEMBER_ID, "TASK_COMPLETE", "TASK", "101", null);
+
+        assertNull(vo.getExpectedCf());
+        assertEquals("DEGRADED", vo.getDisplay().getType());
+    }
+
+    @Test
+    void 规则不在生效期_降级为以实际为准() {
+        CfEarnRule future = rule("F22", "fixed", null, null, null, 20);
+        future.setEffectiveFrom(Date.valueOf(LocalDate.now().plusDays(1)));
+        when(cfEarnRuleService.getByCode("F22")).thenReturn(future);
+
+        RewardEstimateVO vo = rewardRuleService.estimate(MEMBER_ID, "TASK_COMPLETE", "TASK", "101", null);
+
+        assertNull(vo.getExpectedCf());
+        assertEquals("DEGRADED", vo.getDisplay().getType());
+    }
+
+    @Test
+    void 任务不存在_降级不泄露规则数值() {
+        when(cfEarnRuleService.getByCode("F22")).thenReturn(rule("F22", "fixed", null, null, null, 20));
+        when(taskMapper.selectById(404L)).thenReturn(null);
+
+        RewardEstimateVO vo = rewardRuleService.estimate(MEMBER_ID, "TASK_COMPLETE", "TASK", "404", null);
+
+        assertNull(vo.getExpectedCf());
+        assertEquals("DEGRADED", vo.getDisplay().getType());
+    }
+
+    @Test
+    void 任务积分为0_降级不返回虚假预估() {
+        when(cfEarnRuleService.getByCode("F22")).thenReturn(rule("F22", "fixed", null, null, null, 20));
+        when(taskMapper.selectById(105L)).thenReturn(task(105L, FAMILY_ID, 0));
+
+        RewardEstimateVO vo = rewardRuleService.estimate(MEMBER_ID, "TASK_COMPLETE", "TASK", "105", null);
+
+        assertNull(vo.getExpectedCf());
+        assertEquals("DEGRADED", vo.getDisplay().getType());
+    }
+
+    @Test
+    void 规则读取内部异常_降级不向调用方抛500() {
+        when(cfEarnRuleService.getByCode("F22")).thenThrow(new RuntimeException("db down"));
+
+        RewardEstimateVO vo = assertDoesNotThrow(
+                () -> rewardRuleService.estimate(MEMBER_ID, "TASK_COMPLETE", "TASK", "101", null));
+
+        assertNull(vo.getExpectedCf());
+        assertEquals("DEGRADED", vo.getDisplay().getType());
+        assertEquals("CF 奖励以实际为准", vo.getDisplay().getTemplate());
+    }
+
+    // ==================== 五、日上限(TC-X-22-E 第 2 步 / 契约 §5.2) ====================
+
+    @Test
+    void 次数日限已触顶_预估按剩余额度0展示为无奖励() {
+        CfEarnRule limited = rule("F22", "fixed", null, null, 1, 20);
+        when(cfEarnRuleService.getByCode("F22")).thenReturn(limited);
+        when(taskMapper.selectById(106L)).thenReturn(task(106L, FAMILY_ID, 20));
+        when(cfBalanceLogMapper.selectCount(any())).thenReturn(1L); // 今日已发放 1 次 = 上限
+
+        RewardEstimateVO vo = rewardRuleService.estimate(MEMBER_ID, "TASK_COMPLETE", "TASK", "106", null);
+
+        assertEquals(0, vo.getExpectedCf());
+        assertEquals("ZERO", vo.getDisplay().getType());
+        assertNull(vo.getDisplay().getTemplate());
+    }
+
+    @Test
+    void 金额日限未触顶_按剩余额度缩小预估不超上限() {
+        CfEarnRule limited = rule("F22", "fixed", null, "{\"daily_limit_amount\":100}", null, 20);
+        when(cfEarnRuleService.getByCode("F22")).thenReturn(limited);
+        when(taskMapper.selectById(107L)).thenReturn(task(107L, FAMILY_ID, 20));
+        when(cfBalanceLogMapper.selectObjs(any())).thenReturn(Arrays.asList(90L)); // 今日已得 90
+
+        RewardEstimateVO vo = rewardRuleService.estimate(MEMBER_ID, "TASK_COMPLETE", "TASK", "107", null);
+
+        assertEquals(10, vo.getExpectedCf());
+        assertEquals("EARN", vo.getDisplay().getType());
+        assertEquals("本操作预计获得 10 CF", vo.getDisplay().getTemplate());
+    }
+
+    // ==================== 六、幂等(契约 §5.1) ====================
+
+    @Test
+    void 同一幂等键重放_预估值稳定且回显幂等键() {
+        when(cfEarnRuleService.getByCode("F22")).thenReturn(rule("F22", "fixed", null, null, null, 20));
+        when(taskMapper.selectById(108L)).thenReturn(task(108L, FAMILY_ID, 20));
+
+        RewardEstimateVO first = rewardRuleService.estimate(MEMBER_ID, "TASK_COMPLETE", "TASK", "108", "same-key");
+        RewardEstimateVO second = rewardRuleService.estimate(MEMBER_ID, "TASK_COMPLETE", "TASK", "108", "same-key");
+
+        assertEquals(first.getExpectedCf(), second.getExpectedCf());
+        assertEquals(20, second.getExpectedCf());
+        assertEquals("same-key", second.getIdempotencyKey());
+    }
+
+    // ==================== 七、纯数值取数入口 estimateCf ====================
+
+    @Test
+    void estimateCf_正常返回整数_降级返回0() {
+        when(cfEarnRuleService.getByCode("F22")).thenReturn(rule("F22", "fixed", null, null, null, 20));
+        when(taskMapper.selectById(109L)).thenReturn(task(109L, FAMILY_ID, 20));
+
+        assertEquals(20, rewardRuleService.estimateCf(MEMBER_ID, "TASK_COMPLETE", "TASK", "109"));
+
+        when(cfEarnRuleService.getByCode("F22")).thenReturn(null);
+        assertEquals(0, rewardRuleService.estimateCf(MEMBER_ID, "TASK_COMPLETE", "TASK", "109"));
+    }
+
+    // ==================== 八、产出点内嵌挂载(契约 §4.1 / §4.3) ====================
+
+    @Test
+    void attachTaskEstimate_为任务挂载expectedCf与display() {
+        when(cfEarnRuleService.getByCode("F22")).thenReturn(rule("F22", "fixed", null, null, null, 20));
+        when(taskMapper.selectById(110L)).thenReturn(task(110L, FAMILY_ID, 20));
+        Task task = task(110L, FAMILY_ID, 20);
+
+        rewardRuleService.attachTaskEstimate(task, MEMBER_ID);
+
+        assertEquals(20, task.getExpectedCf());
+        assertNotNull(task.getDisplay());
+        assertEquals("EARN", task.getDisplay().getType());
+    }
+
+    @Test
+    void attachTaskListEstimate_空值安全不抛异常() {
+        assertDoesNotThrow(() -> rewardRuleService.attachTaskListEstimate(null, MEMBER_ID));
+        assertDoesNotThrow(() -> rewardRuleService.attachTaskListEstimate(new ArrayList<>(), null));
+
+        Task task = task(111L, FAMILY_ID, 20);
+        assertDoesNotThrow(() -> rewardRuleService.attachTaskListEstimate(Arrays.asList(task), null));
+        assertNull(task.getExpectedCf(), "memberId 为空不挂载预估");
+    }
+
+    @Test
+    void attachGrowthTaskMapEstimate_写回map的expectedCf与display() {
+        when(cfEarnRuleService.getByCode("F12")).thenReturn(rule("F12", "per_item", null, null, null, null));
+        when(growthTaskMapper.selectById(55L)).thenReturn(growthTask(55L, 10));
+        Map<String, Object> item = new HashMap<>();
+        item.put("id", 55L);
+        List<Map<String, Object>> items = new ArrayList<>();
+        items.add(item);
+
+        rewardRuleService.attachGrowthTaskMapEstimate(items, MEMBER_ID);
+
+        assertEquals(10, item.get("expectedCf"));
+        assertNotNull(item.get("display"));
+        assertEquals("EARN", ((com.etotem.cfc.dto.RewardDisplayVO) item.get("display")).getType());
+    }
+
+    // ==================== 九、成员解析 ====================
+
+    @Test
+    void resolveMemberIdByUser_按userId反查家庭成员_无记录返回null() {
+        when(familyMemberMapper.selectOne(any())).thenReturn(member(MEMBER_ID, FAMILY_ID));
+        assertEquals(Long.valueOf(MEMBER_ID), rewardRuleService.resolveMemberIdByUser(USER_ID));
+
+        when(familyMemberMapper.selectOne(any())).thenReturn(null);
+        assertNull(rewardRuleService.resolveMemberIdByUser(USER_ID));
+        assertNull(rewardRuleService.resolveMemberIdByUser(null));
+        assertNull(rewardRuleService.resolveMemberIdByUser(0L));
+    }
+
+    // ==================== 构造辅助 ====================
+
+    private FamilyMember member(long id, long familyId) {
+        FamilyMember m = new FamilyMember();
+        m.setId(id);
+        m.setFamilyId(familyId);
+        m.setUserId(USER_ID);
+        return m;
+    }
+
+    private Task task(long id, long familyId, int points) {
+        Task t = new Task();
+        t.setId(id);
+        t.setFamilyId(familyId);
+        t.setPoints(points);
+        return t;
+    }
+
+    private GrowthTask growthTask(long id, int rewardPoints) {
+        GrowthTask gt = new GrowthTask();
+        gt.setId(id);
+        gt.setRewardPoints(rewardPoints);
+        gt.setTaskKey("key-" + id);
+        return gt;
+    }
+
+    private Product product(long id, int price) {
+        Product p = new Product();
+        p.setId(id);
+        p.setPrice(price);
+        return p;
+    }
+
+    private Reward reward(long id, long familyId, Integer pointsRequired) {
+        Reward r = new Reward();
+        r.setId(id);
+        r.setFamilyId(familyId);
+        r.setPointsRequired(pointsRequired);
+        return r;
+    }
+
+    private CfEarnRule rule(String code, String ruleType, String formula, String paramsJson,
+                            Integer dailyLimitPerMember, Integer amount) {
+        CfEarnRule r = new CfEarnRule();
+        r.setCode(code);
+        r.setName(code + "-规则");
+        r.setCategory("earn");
+        r.setEnabled(1);
+        r.setRuleType(ruleType);
+        r.setFormula(formula);
+        r.setParamsJson(paramsJson);
+        r.setDailyLimitPerMember(dailyLimitPerMember);
+        r.setAmount(amount);
+        r.setDedupRefType(null);
+        return r;
+    }
+}

+ 361 - 0
cfc-backend/src/test/java/com/etotem/cfc/unit/TaskCreateScP10ContractTest.java

@@ -0,0 +1,361 @@
+package com.etotem.cfc.unit;
+
+import com.baomidou.mybatisplus.core.MybatisConfiguration;
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.metadata.TableInfoHelper;
+import com.etotem.cfc.dto.CreateTaskDTO;
+import com.etotem.cfc.entity.FamilyMember;
+import com.etotem.cfc.entity.Task;
+import com.etotem.cfc.entity.User;
+import com.etotem.cfc.mapper.FamilyMemberMapper;
+import com.etotem.cfc.mapper.MiniGameMapper;
+import com.etotem.cfc.mapper.SurveyTemplateMapper;
+import com.etotem.cfc.mapper.TaskMapper;
+import com.etotem.cfc.service.TaskService;
+import com.etotem.cfc.service.UserService;
+import org.apache.ibatis.builder.MapperBuilderAssistant;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+import java.util.concurrent.CyclicBarrier;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+/**
+ * SC-P-10 创建任务+下发 契约测试(S-cfc-12,task.parent.createTask)
+ *
+ * <p>覆盖三类流(纯 Mockito,无 Spring 上下文 / 无 DB):</p>
+ * <ul>
+ *   <li><b>正常流(TC-P-05)</b>:家长为孩子创建任务 → 状态 pending、执行人=B、积分/频率透传;</li>
+ *   <li><b>异常流(TC-P-05-E)</b>:空标题 / 负积分 / 非法频率(0、负数、非枚举) / 超期截止 → 400;
+ *       重复提交同一创建请求(含并发双发)→ 幂等仅生成 1 条任务;</li>
+ *   <li><b>权限流(TC-P-05-P)</b>:给非本家庭成员的成员下发 / 他人家庭家长为我的孩子创建 → 拒绝;
+ *       给自己分配家庭成员任务 → 拒绝。</li>
+ * </ul>
+ */
+class TaskCreateScP10ContractTest {
+
+    private TaskService service;
+    private UserService userService;
+    private FamilyMemberMapper familyMemberMapper;
+    private TaskMapper taskMapper;
+
+    /** 模拟 DB 中已插入的任务(含窗口时间,供幂等命中) */
+    private final List<Task> insertedTasks = new ArrayList<>();
+    private long idSeq = 1000L;
+
+    @BeforeAll
+    static void initMybatisPlusTableInfo() {
+        // 使 LambdaQueryWrapper.getSqlSegment() 在无 Spring 上下文中可用(供 selectCount 桩区分 family-count/成员查询)
+        TableInfoHelper.initTableInfo(
+                new MapperBuilderAssistant(new MybatisConfiguration(), ""), FamilyMember.class);
+    }
+
+    @BeforeEach
+    void setUp() throws Exception {
+        service = new TaskService();
+        userService = mock(UserService.class);
+        familyMemberMapper = mock(FamilyMemberMapper.class);
+        taskMapper = mock(TaskMapper.class);
+        MiniGameMapper miniGameMapper = mock(MiniGameMapper.class);
+        SurveyTemplateMapper surveyTemplateMapper = mock(SurveyTemplateMapper.class);
+
+        inject(service, "userService", userService);
+        inject(service, "familyMemberMapper", familyMemberMapper);
+        inject(service, "taskMapper", taskMapper);
+        inject(service, "miniGameMapper", miniGameMapper);
+        inject(service, "surveyTemplateMapper", surveyTemplateMapper);
+
+        // 用户:familyId=1
+        User user = new User();
+        user.setId(1L);
+        user.setFamilyId(1L);
+        when(userService.getUserInfo(any())).thenReturn(user);
+
+        // insert 入库(模拟 MP 自动回填主键)
+        when(taskMapper.insert(any(Task.class))).thenAnswer(inv -> {
+            Task t = inv.getArgument(0);
+            if (t.getId() == null) {
+                t.setId(++idSeq);
+            }
+            t.setCreatedAt(new Date());
+            insertedTasks.add(t);
+            return 1;
+        });
+        // 幂等窗口查询:命中已插入且创建时间在 30s 内的同内容任务
+        when(taskMapper.selectList(any(Wrapper.class))).thenAnswer(inv -> {
+            List<Task> hits = new ArrayList<>();
+            Date cutoff = new Date(System.currentTimeMillis() - 30_000L);
+            for (Task t : insertedTasks) {
+                if (t.getCreatedAt() != null && t.getCreatedAt().after(cutoff)) {
+                    hits.add(t);
+                }
+            }
+            return hits;
+        });
+    }
+
+    private static void inject(Object target, String field, Object value) throws Exception {
+        Field f = target.getClass().getDeclaredField(field);
+        f.setAccessible(true);
+        f.set(target, value);
+    }
+
+    private CreateTaskDTO dto(String title, Integer points, Long memberId, String frequency) {
+        CreateTaskDTO dto = new CreateTaskDTO();
+        dto.setTitle(title);
+        dto.setPoints(points);
+        dto.setMemberId(memberId);
+        dto.setFrequency(frequency);
+        dto.setExecutorType("child");
+        dto.setNeedReview(0);
+        return dto;
+    }
+
+    /** 本家庭存在该成员(selectCount=1) */
+    private void stubOwnFamilyMember() {
+        when(familyMemberMapper.selectCount(any(Wrapper.class))).thenReturn(1L);
+    }
+
+    // ==================== 正常流(TC-P-05) ====================
+
+    @Test
+    void 正常流_家长为孩子创建每日任务_状态待执行下发到B() {
+        stubOwnFamilyMember();
+        CreateTaskDTO dto = dto("睡前阅读", 10, 100L, "daily");
+
+        Long taskId = service.createTask(1L, dto);
+
+        assertTrue(taskId != null && taskId > 0, "应返回任务 id");
+        assertEquals(1, insertedTasks.size(), "仅生成 1 条任务");
+        Task t = insertedTasks.get(0);
+        assertEquals("睡前阅读", t.getTitle());
+        assertEquals(10, t.getPoints());
+        assertEquals("daily", t.getFrequency());
+        assertEquals("child", t.getExecutorType());
+        assertEquals(100L, t.getExecutorId(), "执行人应为 B");
+        assertEquals(100L, t.getFamilyMemberId(), "familyMemberId 应为 B(孩子列表查询口径)");
+        assertEquals("pending", t.getStatus(), "下发后应为待执行");
+        assertEquals(taskId, t.getId(), "返回 id 应为新插入任务 id");
+    }
+
+    @Test
+    void 正常流_积分缺省_默认2分() {
+        stubOwnFamilyMember();
+        CreateTaskDTO dto = dto("默认积分", null, 100L, "daily");
+
+        service.createTask(1L, dto);
+
+        assertEquals(2, insertedTasks.get(0).getPoints());
+    }
+
+    // ==================== 异常流(TC-P-05-E) ====================
+
+    @Test
+    void 异常流_空标题_400() {
+        stubOwnFamilyMember();
+        CreateTaskDTO dto = dto("", 10, 100L, "daily");
+
+        IllegalArgumentException e = assertThrows(IllegalArgumentException.class,
+                () -> service.createTask(1L, dto));
+
+        assertTrue(e.getMessage().contains("标题"), "应提示标题为空,实际: " + e.getMessage());
+        verify(taskMapper, never()).insert(any());
+    }
+
+    @Test
+    void 异常流_负积分_400() {
+        stubOwnFamilyMember();
+        CreateTaskDTO dto = dto("负积分任务", -5, 100L, "daily");
+
+        IllegalArgumentException e = assertThrows(IllegalArgumentException.class,
+                () -> service.createTask(1L, dto));
+
+        assertTrue(e.getMessage().contains("积分"), "应提示积分非法,实际: " + e.getMessage());
+        verify(taskMapper, never()).insert(any());
+    }
+
+    @Test
+    void 异常流_频率为0_400() {
+        stubOwnFamilyMember();
+        CreateTaskDTO dto = dto("频率0任务", 5, 100L, "0");
+
+        IllegalArgumentException e = assertThrows(IllegalArgumentException.class,
+                () -> service.createTask(1L, dto));
+
+        assertTrue(e.getMessage().contains("频率"), "应提示频率非法,实际: " + e.getMessage());
+        verify(taskMapper, never()).insert(any());
+    }
+
+    @Test
+    void 异常流_频率为负数_400() {
+        stubOwnFamilyMember();
+        CreateTaskDTO dto = dto("频率负数任务", 5, 100L, "-1");
+
+        assertThrows(IllegalArgumentException.class, () -> service.createTask(1L, dto));
+        verify(taskMapper, never()).insert(any());
+    }
+
+    @Test
+    void 异常流_频率非枚举_400() {
+        stubOwnFamilyMember();
+        CreateTaskDTO dto = dto("频率非法任务", 5, 100L, "999");
+
+        IllegalArgumentException e = assertThrows(IllegalArgumentException.class,
+                () -> service.createTask(1L, dto));
+
+        assertTrue(e.getMessage().contains("频率"), "应提示频率非法,实际: " + e.getMessage());
+        verify(taskMapper, never()).insert(any());
+    }
+
+    @Test
+    void 异常流_截止时间在过去_400() {
+        stubOwnFamilyMember();
+        CreateTaskDTO dto = dto("超期任务", 5, 100L, "daily");
+        dto.setDeadline(new Date(System.currentTimeMillis() - 3_600_000L));
+
+        IllegalArgumentException e = assertThrows(IllegalArgumentException.class,
+                () -> service.createTask(1L, dto));
+
+        assertTrue(e.getMessage().contains("截止"), "应提示截止时间非法,实际: " + e.getMessage());
+        verify(taskMapper, never()).insert(any());
+    }
+
+    @Test
+    void 异常流_重复提交同一创建请求_仅生成1条任务() {
+        stubOwnFamilyMember();
+        CreateTaskDTO dto = dto("幂等任务", 7, 100L, "daily");
+
+        Long first = service.createTask(1L, dto);
+        Long second = service.createTask(1L, dto);
+
+        assertEquals(first, second, "重复提交应返回同一任务 id");
+        assertEquals(1, insertedTasks.size(), "重复提交不应再插入新任务");
+    }
+
+    @Test
+    void 异常流_并发双发_幂等仅生成1条任务() throws Exception {
+        stubOwnFamilyMember();
+        final CreateTaskDTO dto = dto("并发任务", 7, 100L, "daily");
+        final CyclicBarrier barrier = new CyclicBarrier(2);
+        ExecutorService pool = Executors.newFixedThreadPool(2);
+        try {
+            Future<Long> f1 = pool.submit(() -> {
+                barrier.await(5, TimeUnit.SECONDS);
+                return service.createTask(1L, dto);
+            });
+            Future<Long> f2 = pool.submit(() -> {
+                barrier.await(5, TimeUnit.SECONDS);
+                return service.createTask(1L, dto);
+            });
+            Long id1 = f1.get(15, TimeUnit.SECONDS);
+            Long id2 = f2.get(15, TimeUnit.SECONDS);
+
+            assertEquals(id1, id2, "并发双发应返回同一任务 id");
+            assertEquals(1, insertedTasks.size(), "并发双发仅生成 1 条任务");
+        } finally {
+            pool.shutdownNow();
+        }
+    }
+
+    // ==================== 权限流(TC-P-05-P) ====================
+
+    @Test
+    void 权限流_child下发非本家庭成员_拒绝() {
+        // 被分配成员不在本家庭 → selectCount=0
+        when(familyMemberMapper.selectCount(any(Wrapper.class))).thenReturn(0L);
+        CreateTaskDTO dto = dto("越权任务", 5, 999999L, "daily");
+
+        IllegalArgumentException e = assertThrows(IllegalArgumentException.class,
+                () -> service.createTask(1L, dto));
+
+        assertTrue(e.getMessage().contains("不属于本家庭"), "实际: " + e.getMessage());
+        verify(taskMapper, never()).insert(any());
+    }
+
+    @Test
+    void 权限流_他人家庭家长为我家孩子创建任务_拒绝() {
+        when(familyMemberMapper.selectCount(any(Wrapper.class))).thenReturn(0L);
+        // 家长 X(familyId=999)尝试给家庭1的孩子 memberId=100 下发任务
+        CreateTaskDTO dto = dto("X越权任务", 5, 100L, "daily");
+        User userX = new User();
+        userX.setId(99L);
+        userX.setFamilyId(999L);
+        when(userService.getUserInfo(any())).thenReturn(userX);
+
+        IllegalArgumentException e = assertThrows(IllegalArgumentException.class,
+                () -> service.createTask(99L, dto));
+
+        assertTrue(e.getMessage().contains("不属于本家庭"), "实际: " + e.getMessage());
+        verify(taskMapper, never()).insert(any());
+    }
+
+    @Test
+    void 权限流_member给自己分配任务_拒绝() {
+        // 家庭人数 ≥2(family-count 查询仅含 family_id,无独立 id 条件 → 2L)
+        when(familyMemberMapper.selectCount(any(Wrapper.class))).thenAnswer(inv -> {
+            Wrapper<?> w = inv.getArgument(0);
+            String sql = w.getSqlSegment();
+            return sql.matches("(?s).*\\bid\\s*=.*") ? 1L : 2L;
+        });
+        // 当前登录用户的 member 记录 id=50
+        FamilyMember self = new FamilyMember();
+        self.setId(50L);
+        self.setFamilyId(1L);
+        when(familyMemberMapper.selectOne(any(Wrapper.class))).thenReturn(self);
+
+        CreateTaskDTO dto = new CreateTaskDTO();
+        dto.setTitle("给自己派任务");
+        dto.setPoints(5);
+        dto.setExecutorType("member");
+        dto.setMemberIds(Collections.singletonList(50L));
+
+        IllegalArgumentException e = assertThrows(IllegalArgumentException.class,
+                () -> service.createTask(1L, dto));
+
+        assertTrue(e.getMessage().contains("不能给自己分配"), "实际: " + e.getMessage());
+        verify(taskMapper, never()).insert(any());
+    }
+
+    @Test
+    void 权限流_member给非本家庭成员下发_拒绝() {
+        when(familyMemberMapper.selectCount(any(Wrapper.class))).thenAnswer(inv -> {
+            Wrapper<?> w = inv.getArgument(0);
+            String sql = w.getSqlSegment();
+            return sql.matches("(?s).*\\bid\\s*=.*") ? 0L : 2L;
+        });
+        FamilyMember self = new FamilyMember();
+        self.setId(50L);
+        self.setFamilyId(1L);
+        when(familyMemberMapper.selectOne(any(Wrapper.class))).thenReturn(self);
+
+        CreateTaskDTO dto = new CreateTaskDTO();
+        dto.setTitle("跨家庭member任务");
+        dto.setPoints(5);
+        dto.setExecutorType("member");
+        dto.setMemberIds(Collections.singletonList(888888L));
+
+        IllegalArgumentException e = assertThrows(IllegalArgumentException.class,
+                () -> service.createTask(1L, dto));
+
+        assertTrue(e.getMessage().contains("不属于本家庭"), "实际: " + e.getMessage());
+        verify(taskMapper, never()).insert(any());
+    }
+}

+ 1 - 1
cfc-frontend/components/ConfigurableGuide.vue

@@ -146,7 +146,7 @@ export default {
   display: block;
   line-height: 1.3;
 }
-.cg-title--intro { font-size: calc(32rpx * var(--font-scale, 1)); font-weight: 800; }
+.cg-title--intro { font-size: calc(32rpx * var(--font-scale, 1)); font-weight: 700; }
 .cg-desc {
   font-size: calc(28rpx * var(--font-scale, 1));
   color: $uni-text-color-secondary;

+ 1 - 1
cfc-frontend/components/MemberSelector.vue

@@ -681,7 +681,7 @@ export default {
   flex-direction: column;
   align-items: center;
 }
-.empty-icon { font-size: calc(48rpx * var(--font-scale, 1)); }
+.empty-icon { font-size: calc($uni-font-size-display * var(--font-scale, 1)); }
 .empty-title { font-size: calc(30rpx * var(--font-scale, 1)); font-weight: 600; color: $facade-text-gray-800; margin-top: 12rpx; }
 .empty-desc { font-size: calc(24rpx * var(--font-scale, 1)); color: $facade-text-gray-400; margin-top: 8rpx; }
 .empty-btn {

+ 1 - 1
cfc-frontend/components/OnboardingGuide.vue

@@ -228,7 +228,7 @@ export default {
 
 .onboarding-title--intro {
   font-size: calc(32rpx * var(--font-scale, 1));
-  font-weight: 800;
+  font-weight: 700;
   color: var(--color-primary, $brand-primary);
   line-height: 1.4;
 }

+ 163 - 0
cfc-frontend/composables/useDimensionRegistry.js

@@ -0,0 +1,163 @@
+import config from '@/config.js'
+
+/**
+ * useDimensionRegistry - 统一维度注册中心(前端只读封装)
+ *
+ * 健康页 5 张雷达图(身体 / 认知 / 心理 / 社会性 / 财富)原前端硬编码维度清单与取分字段,
+ * 现改为从统一维度注册中心 `/api/dimension-registry/tree` 配置驱动取数画图
+ * (落实产品要求「健康页面的雷达图也是按这个配置取数据画图」)。
+ *
+ * 设计要点:
+ * 1. 模块级缓存:首次请求成功后整棵树缓存,tab 切换不再重复请求。
+ * 2. ready 标志:请求成功或失败后均置位,供页面安全兜底(后端未上线 / 接口异常 → 回落硬编码)。
+ * 3. 失败不抛错:ready=false、返回空,页面降级,不阻断渲染。
+ * 4. 兼容 uni-app 硬约束:不使用可选链 `?.`、new Date(string)、CSS Grid。
+ *
+ * 契约(已与后端 DimensionNode / seed 对齐):
+ *   GET /api/dimension-registry/tree → Result<List<DimensionNode>>
+ *   DimensionNode: { id, code, name, parentId, nodeKind, sourceSystem, legacyAlias, wuxingRuleRef, children }
+ *   legacyAlias 是 JSON 数组字符串,如 '["opennessScore"]',取首个元素作为分数字段名 scoreField。
+ */
+
+// 模块级缓存:跨组件 / 跨 tab 复用,避免重复请求
+var _cache = {
+  tree: null, // DimensionNode[](5 个根,各带 children)
+  ready: false, // 首次请求是否已结束(成功或失败均置位)
+  pending: null // 进行中的 Promise(防并发重复请求)
+}
+
+// tab(code) → 注册中心根 code 映射
+// body→body,cognitive→wisdom,mental→mind,relationship→action,wealth→wealth
+var TAB_TO_ROOT = {
+  body: 'body',
+  cognitive: 'wisdom',
+  mental: 'mind',
+  relationship: 'action',
+  wealth: 'wealth'
+}
+
+// 财富子维度在「成员(儿童)」语境下使用更贴近儿童的文案(与改造前字面量一致)
+var WEALTH_CHILD_LABEL = {
+  'wealth.skill': '学业能力',
+  'wealth.income': '积分积累'
+}
+
+/**
+ * 解析 legacyAlias:JSON 数组字符串,取首个元素作为分数字段名 scoreField。
+ * 例:'["opennessScore"]' → 'opennessScore';'["driveAutonomy"]' → 'driveAutonomy'
+ * @param {string} alias
+ * @returns {string}
+ */
+function parseLegacyAlias(alias) {
+  if (!alias || typeof alias !== 'string') return ''
+  var arr = null
+  try {
+    arr = JSON.parse(alias)
+  } catch (e) {
+    return ''
+  }
+  if (!Array.isArray(arr) || arr.length === 0) return ''
+  return typeof arr[0] === 'string' ? arr[0] : ''
+}
+
+/**
+ * 触发(或复用)注册中心树拉取。幂等:已尝试过则直接 resolve,不重复请求。
+ * @returns {Promise<void>}
+ */
+function ensureDimensionRegistry() {
+  if (_cache.ready) {
+    return Promise.resolve()
+  }
+  if (_cache.pending) {
+    return _cache.pending
+  }
+  _cache.pending = new Promise(function(resolve) {
+    var token = uni.getStorageSync('token')
+    var base = (config && config.API_BASE_URL) ? config.API_BASE_URL : ''
+    var url = base + '/api/dimension-registry/tree'
+    uni.request({
+      url: url,
+      method: 'GET',
+      header: {
+        'Content-Type': 'application/json',
+        'Authorization': token ? 'Bearer ' + token : ''
+      },
+      success: function(res) {
+        try {
+          var data = res && res.data
+          // Result<List<DimensionNode>> → data.data
+          var list = (data && data.code === 200 && data.data) ? data.data : []
+          if (Array.isArray(list) && list.length > 0) {
+            _cache.tree = list
+          }
+        } catch (e) {
+          // 解析异常:保持 tree 为空,回落兜底
+          _cache.tree = null
+        }
+        // 无论成功 / 空数据 / 解析异常,均标记尝试结束(不抛错)
+        _cache.ready = true
+        resolve()
+      },
+      fail: function() {
+        // 网络 / 接口异常:不抛错,回落硬编码兜底
+        _cache.ready = true
+        resolve()
+      }
+    })
+  })
+  // 请求结束后清空进行中引用(tree / ready 仍保留)
+  _cache.pending.then(function() { _cache.pending = null })
+  return _cache.pending
+}
+
+/**
+ * 注册中心树是否就绪(成功取到数据)。
+ * @returns {boolean}
+ */
+function isRegistryReady() {
+  return !!_cache.tree && _cache.tree.length > 0
+}
+
+/**
+ * 取某 tab 的雷达配置:[{ label, code, scoreField }]
+ *  - label:注册中心节点 name(维度中文名)
+ *  - code:节点 code(body 类为 body.growth,用于 bodyData 按 dimension 字段匹配)
+ *  - scoreField:legacyAlias 首元素(取分读取器字段名)
+ * @param {string} tabCode
+ * @returns {Array}
+ */
+function getRadarConfig(tabCode) {
+  var rootCode = TAB_TO_ROOT[tabCode]
+  if (!rootCode || !_cache.tree || !Array.isArray(_cache.tree)) return []
+  var root = null
+  for (var i = 0; i < _cache.tree.length; i++) {
+    var node = _cache.tree[i]
+    if (node && node.code === rootCode) {
+      root = node
+      break
+    }
+  }
+  if (!root || !root.children || !root.children.length) return []
+  var config = []
+  for (var j = 0; j < root.children.length; j++) {
+    var child = root.children[j]
+    if (!child) continue
+    // P1-T3 防御:指标节点(nodeKind=indicator)是维度树的混排子节点,
+    // 不应作为健康页雷达图的轴(雷达轴应为 sub-dim 维度节点)。
+    // 操作者将指标挂到某维度节点下后,该节点 children 会含指标,过滤掉保持雷达 5×7/7/10/5/4 不变。
+    if (child.nodeKind === 'indicator') continue
+    config.push({
+      label: child.name || '',
+      code: child.code || '',
+      scoreField: parseLegacyAlias(child.legacyAlias)
+    })
+  }
+  return config
+}
+
+export {
+  ensureDimensionRegistry,
+  getRadarConfig,
+  isRegistryReady,
+  WEALTH_CHILD_LABEL
+}

+ 1 - 1
cfc-frontend/pages/achievement/index.vue

@@ -192,7 +192,7 @@ export default {
   padding: 60rpx 0;
 }
 .empty-icon {
-  font-size: calc(80rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-5xl * var(--font-scale, 1));
   display: block;
   margin-bottom: 20rpx;
 }

+ 1 - 1
cfc-frontend/pages/action-detail/components/AbilityDiagram.vue

@@ -683,7 +683,7 @@ export default {
   margin: 10rpx 0;
 }
 .empty-icon {
-  font-size: calc(80rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-5xl * var(--font-scale, 1));
   margin-bottom: 16rpx;
 }
 .empty-text {

+ 1 - 1
cfc-frontend/pages/action-detail/components/OctopusDiagram.vue

@@ -638,7 +638,7 @@ export default {
   margin: 10rpx 0;
 }
 .empty-icon {
-  font-size: calc(80rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-5xl * var(--font-scale, 1));
   margin-bottom: 16rpx;
 }
 .empty-text {

+ 1 - 1
cfc-frontend/pages/action-detail/components/PearlDiagram.vue

@@ -1099,7 +1099,7 @@ export default {
   margin: 10rpx 0;
 }
 .empty-icon {
-  font-size: calc(80rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-5xl * var(--font-scale, 1));
   margin-bottom: 16rpx;
 }
 .empty-text {

+ 1 - 1
cfc-frontend/pages/action-detail/index.vue

@@ -1241,7 +1241,7 @@ $c-tint-mint: $c-tint-mint-wash;
 }
 .explain-score {
   font-size: calc(48rpx * var(--font-scale, 1));
-  font-weight: 800;
+  font-weight: $uni-font-weight-extra-heavy;
   line-height: 1;
   letter-spacing: -2rpx;
 }

+ 2 - 2
cfc-frontend/pages/action-detail/octopus-effects-list.vue

@@ -192,7 +192,7 @@ export default {
   padding: 80rpx 20rpx;
 }
 .empty-icon {
-  font-size: calc(80rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-5xl * var(--font-scale, 1));
   margin-bottom: 16rpx;
 }
 .empty-text {
@@ -221,6 +221,6 @@ export default {
 .fab-icon {
   font-size: calc(48rpx * var(--font-scale, 1));
   color: $app-surface;
-  font-weight: 300;
+  font-weight: 400;
 }
 </style>

+ 1 - 1
cfc-frontend/pages/activity/activity-detail/activity-detail.vue

@@ -1101,7 +1101,7 @@ export default {
   margin-bottom: 20rpx;
 }
 .error-icon {
-  font-size: calc(64rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-4xl * var(--font-scale, 1));
   margin-bottom: 16rpx;
 }
 .retry-btn {

+ 1 - 1
cfc-frontend/pages/activity/create.vue

@@ -946,7 +946,7 @@ export default {
 }
 
 .upload-icon {
-  font-size: calc(64rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-4xl * var(--font-scale, 1));
   color: $app-text-subtle;
 }
 

+ 3 - 3
cfc-frontend/pages/activity/index.vue

@@ -1197,7 +1197,7 @@ uni.showToast({ title: '请先选择家庭成员身份', icon: 'none' })
 }
 
 .empty-icon {
-  font-size: calc(80rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-5xl * var(--font-scale, 1));
   margin-bottom: 20rpx;
 }
 
@@ -1278,7 +1278,7 @@ uni.showToast({ title: '请先选择家庭成员身份', icon: 'none' })
 .nav-add-icon {
   color: $app-surface;
   font-size: calc(36rpx * var(--font-scale, 1));
-  font-weight: 300;
+  font-weight: 400;
   line-height: 1;
 }
 
@@ -1347,7 +1347,7 @@ uni.showToast({ title: '请先选择家庭成员身份', icon: 'none' })
 .manage-action-icon {
   color: $app-surface;
   font-size: calc(36rpx * var(--font-scale, 1));
-  font-weight: 300;
+  font-weight: 400;
 }
 
 .manage-action-text {

+ 1 - 1
cfc-frontend/pages/ai/chat.vue

@@ -829,7 +829,7 @@ export default {
 }
 
 .welcome-icon {
-  font-size: calc(80rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-5xl * var(--font-scale, 1));
   margin-bottom: 20rpx;
   transition: transform 0.3s;
 }

+ 1 - 1
cfc-frontend/pages/ai/components/UpgradeGuideModal.vue

@@ -96,7 +96,7 @@ export default {
   text-align: center;
 }
 .upgrade-guide-icon {
-  font-size: calc(72rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-5xl * var(--font-scale, 1));
   margin-bottom: 24rpx;
 }
 .upgrade-guide-title {

+ 3 - 3
cfc-frontend/pages/article-center/article-detail.vue

@@ -456,7 +456,7 @@ export default {
 @keyframes spin { 0% { transform: rotate(0deg); } 360% { transform: rotate(360deg); } }
 .loading-text { font-size: calc(26rpx * var(--font-scale, 1)); color: $facade-text-muted; }
 .error-wrap { display: flex; flex-direction: column; align-items: center; padding-top: 300rpx; }
-.error-icon { font-size: calc(100rpx * var(--font-scale, 1)); margin-bottom: 24rpx; }
+.error-icon { font-size: calc($uni-font-size-6xl * var(--font-scale, 1)); margin-bottom: 24rpx; }
 .error-text { font-size: calc(28rpx * var(--font-scale, 1)); color: $facade-text-muted; margin-bottom: $uni-space-lg; }
 .retry-btn { width: 240rpx; height: 72rpx; line-height: 72rpx; background: $brand-primary; color: $app-surface; font-size: calc(28rpx * var(--font-scale, 1)); border-radius: 24rpx; text-align: center; border: none; }
 .content-scroll { height: calc(100vh - 120rpx); }
@@ -497,7 +497,7 @@ export default {
 .quiz-mask, .result-mask { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 999; display: flex; align-items: center; justify-content: center; }
 .quiz-dialog, .result-dialog { background: $app-surface; border-radius: 24rpx; width: 650rpx; padding: 32rpx; }
 .quiz-mascot { display: flex; align-items: center; justify-content: center; gap: 12rpx; margin-bottom: 16rpx; }
-.mascot-icon { font-size: calc(64rpx * var(--font-scale, 1)); }
+.mascot-icon { font-size: calc($uni-font-size-4xl * var(--font-scale, 1)); }
 .mascot-name { font-size: calc(32rpx * var(--font-scale, 1)); font-weight: 700; color: $brand-primary; }
 .quiz-step-bar { display: flex; align-items: center; justify-content: center; margin-bottom: 24rpx; }
 .quiz-step-text { font-size: calc(24rpx * var(--font-scale, 1)); color: $facade-text-muted; margin-right: 12rpx; }
@@ -522,7 +522,7 @@ export default {
 .quiz-submit::after { border: none; }
 .result-btn { width: 100%; padding: 20rpx; background: linear-gradient(135deg, $brand-primary, $brand-primary-light); color: $app-surface; font-size: calc(28rpx * var(--font-scale, 1)); border-radius: 16rpx; border: none; margin-top: 20rpx; }
 .result-dialog { text-align: center; }
-.result-icon { font-size: calc(80rpx * var(--font-scale, 1)); }
+.result-icon { font-size: calc($uni-font-size-5xl * var(--font-scale, 1)); }
 .result-text { font-size: calc(32rpx * var(--font-scale, 1)); font-weight: 700; color: $facade-text-strong; margin: 16rpx 0; }
 .result-energy { font-size: calc(28rpx * var(--font-scale, 1)); color: $brand-primary; }
 </style>

+ 1 - 1
cfc-frontend/pages/article-center/article-edit.vue

@@ -282,7 +282,7 @@ export default {
   justify-content: center;
   height: 100%;
 }
-.cover-icon { font-size: calc(64rpx * var(--font-scale, 1)); margin-bottom: 10rpx; }
+.cover-icon { font-size: calc($uni-font-size-4xl * var(--font-scale, 1)); margin-bottom: 10rpx; }
 .cover-hint { font-size: calc(24rpx * var(--font-scale, 1)); color: $facade-text-muted; }
 .cover-change {
   position: absolute;

+ 2 - 2
cfc-frontend/pages/article-center/index.vue

@@ -387,7 +387,7 @@ onLoad(options) {
 .ac-nav-add {
   font-size: calc(40rpx * var(--font-scale, 1));
   color: $brand-primary;
-  font-weight: 300;
+  font-weight: 400;
   line-height: 1;
 }
 
@@ -653,7 +653,7 @@ onLoad(options) {
 }
 .ac-fab-icon {
   font-size: calc(48rpx * var(--font-scale, 1));
-  font-weight: 300;
+  font-weight: 400;
   line-height: 1;
 }
 </style>

+ 1 - 1
cfc-frontend/pages/article-center/my-posts.vue

@@ -137,7 +137,7 @@ export default {
 .posts-list { height: 100vh; }
 .loading-wrap, .empty-wrap { display: flex; flex-direction: column; align-items: center; padding-top: 200rpx; }
 .loading-text { font-size: calc(26rpx * var(--font-scale, 1)); color: $facade-text-muted; }
-.empty-icon { font-size: calc(100rpx * var(--font-scale, 1)); margin-bottom: 24rpx; }
+.empty-icon { font-size: calc($uni-font-size-6xl * var(--font-scale, 1)); margin-bottom: 24rpx; }
 .empty-text { font-size: calc(28rpx * var(--font-scale, 1)); color: $facade-text-muted; margin-bottom: $uni-space-lg; }
 .write-btn { width: 240rpx; height: 72rpx; line-height: 72rpx; background: $brand-primary; color: $app-surface; font-size: calc(28rpx * var(--font-scale, 1)); border-radius: 24rpx; border: none; }
 .write-btn::after { border: none; }

+ 1 - 1
cfc-frontend/pages/assessment-plan/detail.vue

@@ -255,7 +255,7 @@ export default {
   padding: 120rpx 60rpx;
 }
 .empty-icon {
-  font-size: calc(80rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-5xl * var(--font-scale, 1));
   margin-bottom: 24rpx;
 }
 .empty-title {

+ 1 - 1
cfc-frontend/pages/assessment-plan/list.vue

@@ -221,7 +221,7 @@ export default {
   padding: 120rpx 60rpx;
 }
 .empty-icon {
-  font-size: calc(80rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-5xl * var(--font-scale, 1));
   margin-bottom: 24rpx;
 }
 .empty-title {

+ 1 - 1
cfc-frontend/pages/assessment/quota.vue

@@ -223,7 +223,7 @@ export default {
   padding-top: 120rpx;
 }
 .empty-icon {
-  font-size: calc(80rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-5xl * var(--font-scale, 1));
   margin-bottom: 20rpx;
 }
 .empty-text {

+ 1 - 1
cfc-frontend/pages/assessment/rating.vue

@@ -304,7 +304,7 @@ export default {
 }
 
 .star {
-  font-size: calc(64rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-4xl * var(--font-scale, 1));
   color: $facade-hairline;
   transition: color 0.2s ease, text-shadow 0.2s ease;
   line-height: 1;

+ 1 - 1
cfc-frontend/pages/assessment/results.vue

@@ -364,7 +364,7 @@ export default {
 }
 
 .empty-icon {
-  font-size: calc(80rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-5xl * var(--font-scale, 1));
   display: block;
   margin-bottom: 20rpx;
 }

+ 1 - 1
cfc-frontend/pages/body-detail/dimension-detail.vue

@@ -376,7 +376,7 @@ export default {
   margin: 0 auto 20rpx;
 }
 .dd-score-value {
-  font-size: calc(48rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-display * var(--font-scale, 1));
   font-weight: 700;
   line-height: 1;
 }

+ 1 - 1
cfc-frontend/pages/body-detail/dimension-questionnaire.vue

@@ -620,7 +620,7 @@ export default {
   padding: 60rpx 0;
 }
 .qd-result-icon {
-  font-size: calc(80rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-5xl * var(--font-scale, 1));
 }
 .qd-result-title {
   font-size: calc(40rpx * var(--font-scale, 1));

+ 1 - 1
cfc-frontend/pages/child/tasks.vue

@@ -611,7 +611,7 @@ export default {
 }
 
 .task-card__celebrate-icon {
-  font-size: calc(80rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-5xl * var(--font-scale, 1));
   animation: celebrateBounce 0.6s ease both;
 }
 

+ 1 - 1
cfc-frontend/pages/cognitive-hall.vue

@@ -293,7 +293,7 @@ $c-ink-night:    $app-ink-night;   // 深夜蓝黑(本页深色文字)
 }
 
 .empty-icon {
-  font-size: calc(80rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-5xl * var(--font-scale, 1));
   display: block;
   margin-bottom: 20rpx;
 }

+ 2 - 2
cfc-frontend/pages/cognitive-test/language-test.vue

@@ -260,7 +260,7 @@ export default {
 
 /* ===== 说明页 ===== */
 .title-icon {
-  font-size: calc(80rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-5xl * var(--font-scale, 1));
   margin-bottom: 24rpx;
 }
 
@@ -428,7 +428,7 @@ export default {
 }
 
 .score-num {
-  font-size: calc(80rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-5xl * var(--font-scale, 1));
   font-weight: bold;
   color: $dim-wealth;
 }

+ 2 - 2
cfc-frontend/pages/cognitive-test/logic-test.vue

@@ -296,7 +296,7 @@ export default {
   margin-bottom: 40rpx;
 }
 .intro-icon-text {
-  font-size: calc(72rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-5xl * var(--font-scale, 1));
 }
 .intro-title {
   font-size: calc(44rpx * var(--font-scale, 1));
@@ -434,7 +434,7 @@ export default {
   margin-bottom: $uni-space-lg;
 }
 .score-value {
-  font-size: calc(80rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-5xl * var(--font-scale, 1));
   font-weight: bold;
   color: $app-ink-night;
 }

+ 3 - 3
cfc-frontend/pages/cognitive-test/memory-test.vue

@@ -372,7 +372,7 @@ export default {
   margin-bottom: 40rpx;
 }
 .intro-icon-text {
-  font-size: calc(80rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-5xl * var(--font-scale, 1));
 }
 .intro-title {
   font-size: calc(48rpx * var(--font-scale, 1));
@@ -581,7 +581,7 @@ export default {
   background: rgba(239, 68, 68, 0.3);
 }
 .feedback-text {
-  font-size: calc(48rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-display * var(--font-scale, 1));
   font-weight: bold;
   color: $app-surface;
   padding: 24rpx 60rpx;
@@ -623,7 +623,7 @@ export default {
   box-shadow: 0 12rpx 40rpx rgba(99, 102, 241, 0.45);
 }
 .score-num {
-  font-size: calc(100rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-6xl * var(--font-scale, 1));
   font-weight: bold;
   color: $app-surface;
   line-height: 1;

+ 2 - 2
cfc-frontend/pages/cognitive-test/perception-test.vue

@@ -258,7 +258,7 @@ export default {
 
 /* ===== 说明页 ===== */
 .title-icon {
-  font-size: calc(80rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-5xl * var(--font-scale, 1));
   margin-bottom: 24rpx;
 }
 
@@ -423,7 +423,7 @@ export default {
 }
 
 .score-num {
-  font-size: calc(80rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-5xl * var(--font-scale, 1));
   font-weight: bold;
   color: $flat-teal;
 }

+ 4 - 4
cfc-frontend/pages/cognitive-test/spatial-test.vue

@@ -301,7 +301,7 @@ export default {
   margin-bottom: 40rpx;
 }
 .hero-symbol {
-  font-size: calc(80rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-5xl * var(--font-scale, 1));
   color: $status-info;
   line-height: 1;
 }
@@ -393,7 +393,7 @@ export default {
   margin-bottom: 20rpx;
 }
 .direction-arrow {
-  font-size: calc(100rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-6xl * var(--font-scale, 1));
   color: $app-surface;
   line-height: 1.2;
   margin-bottom: 20rpx;
@@ -425,7 +425,7 @@ export default {
   background: rgba(59, 130, 246, 0.2);
 }
 .option-arrow {
-  font-size: calc(72rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-5xl * var(--font-scale, 1));
   color: $app-surface;
 }
 .feedback-row {
@@ -463,7 +463,7 @@ export default {
   margin: 40rpx 0;
 }
 .score-number {
-  font-size: calc(80rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-5xl * var(--font-scale, 1));
   font-weight: bold;
   color: $app-surface;
   line-height: 1.1;

+ 2 - 2
cfc-frontend/pages/cognitive-test/speed-test.vue

@@ -335,7 +335,7 @@ export default {
 }
 
 .title {
-  font-size: calc(52rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-3xl * var(--font-scale, 1));
   font-weight: bold;
   color: $app-surface;
   margin-top: 40rpx;
@@ -526,7 +526,7 @@ export default {
 }
 
 .score-num {
-  font-size: calc(80rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-5xl * var(--font-scale, 1));
   font-weight: bold;
   color: $app-surface;
   line-height: 1;

+ 25 - 0
cfc-frontend/pages/dan-assessment/comparison.vue

@@ -1,5 +1,11 @@
 <template>
   <view class="page" :style="{ '--font-scale': fontScale }">
+    <view class="cmp-nav" :style="'padding-top:' + (statusBarHeight > 0 ? statusBarHeight : 20) + 'px'">
+      <view class="cmp-nav-back" hover-class="cmp-nav-back-hover" @click="goBack">
+        <text class="cmp-nav-back-icon">←</text>
+      </view>
+      <text class="cmp-nav-title">DAN 报告对比</text>
+    </view>
     <view class="filter-bar">
       <view class="filter-item">{{ currentMemberName }} ▾</view>
       <picker :range="reportIds" @change="onReportIdChange">
@@ -63,6 +69,7 @@ export default {
   components: {},
   data() {
     return {
+      statusBarHeight: 0,
       memberId: null,
       reportIds: [],
       currentReportId: null,
@@ -83,6 +90,10 @@ export default {
   },
   onLoad(options) {
     var self = this
+    try {
+      var info = uni.getWindowInfo && uni.getWindowInfo()
+      if (info && info.statusBarHeight) self.statusBarHeight = info.statusBarHeight
+    } catch (e) {}
     // 从 query 获取 memberId,或默认取当前登录成员
     if (options.memberId) {
       self.memberId = parseInt(options.memberId)
@@ -90,6 +101,14 @@ export default {
     self.loadMembers()
   },
   methods: {
+    goBack() {
+      var pages = getCurrentPages()
+      if (pages && pages.length > 1) {
+        uni.navigateBack()
+      } else {
+        uni.reLaunch({ url: '/pages/index-home/index' })
+      }
+    },
     loadMembers() {
       var self = this
       getFamilyMemberList({ visibleOnly: true }).then(function(res) {
@@ -163,6 +182,12 @@ export default {
   padding: 24rpx;
   box-sizing: border-box;
 }
+.cmp-nav { display: flex; align-items: center; padding-bottom: 16rpx; }
+.cmp-nav-back { width: 64rpx; height: 64rpx; border-radius: 50%; background: rgba(0,0,0,0.06); display: flex; align-items: center; justify-content: center; margin-right: 16rpx; }
+.cmp-nav-back-hover { background: rgba(0,0,0,0.12); }
+.cmp-nav-back-icon { color: $uni-text-color; font-size: 44rpx; line-height: 1; font-weight: 700; }
+.cmp-nav-title { color: $uni-text-color; font-size: calc(32rpx * var(--font-scale, 1)); font-weight: 600; }
+
 .filter-bar {
   display: flex;
   flex-direction: row;

+ 37 - 3
cfc-frontend/pages/dan-assessment/report-result.vue

@@ -5,6 +5,13 @@
       <view class="hero-bg-circle hero-bg-circle-1"></view>
       <view class="hero-bg-circle hero-bg-circle-2"></view>
 
+      <view class="hero-nav" :style="'padding-top:' + (statusBarHeight > 0 ? statusBarHeight : 20) + 'px'">
+        <view class="hero-nav-back" hover-class="hero-nav-back-hover" @click="goBack">
+          <text class="hero-nav-back-icon">←</text>
+        </view>
+        <text class="hero-nav-title">{{ dimensionLabel }}</text>
+      </view>
+
       <view class="hero-top">
         <text class="hero-name">{{ childName }}</text>
         <view class="hero-dim-row">
@@ -251,6 +258,7 @@ export default {
   data() {
     return {
       reportId: null,
+      statusBarHeight: 0,
       loading: true,
       childName: '',
       dateText: '',
@@ -513,10 +521,22 @@ export default {
     }
   },
   onLoad(options) {
+    try {
+      var info = uni.getWindowInfo && uni.getWindowInfo()
+      if (info && info.statusBarHeight) this.statusBarHeight = info.statusBarHeight
+    } catch (e) {}
     this.reportId = options.reportId ? parseInt(options.reportId) : null
     if (this.reportId) this.loadData()
   },
   methods: {
+    goBack() {
+      var pages = getCurrentPages()
+      if (pages && pages.length > 1) {
+        uni.navigateBack()
+      } else {
+        uni.reLaunch({ url: '/pages/index-home/index' })
+      }
+    },
     getBlockKey(bi) {
       return 'g' + bi
     },
@@ -662,11 +682,25 @@ $c-rpt-mask-ink:     #000;    // 遮罩渐变异色(mask-image)
 .hero {
   position: relative;
   background: linear-gradient(160deg, $dim-wisdom-deep 0%, $facade-violet-deep 55%, $facade-violet 100%);
-  padding: 48rpx 36rpx 44rpx;
+  padding: 0 36rpx 44rpx;
   overflow: hidden;
   border-bottom-left-radius: 24rpx;
   border-bottom-right-radius: 24rpx;
 }
+.hero-nav {
+  position: relative; z-index: 2;
+  display: flex; align-items: center;
+  padding-bottom: 20rpx;
+}
+.hero-nav-back {
+  width: 64rpx; height: 64rpx; border-radius: 50%;
+  background: rgba(255,255,255,0.22);
+  display: flex; align-items: center; justify-content: center;
+  margin-right: 16rpx;
+}
+.hero-nav-back-hover { background: rgba(255,255,255,0.38); }
+.hero-nav-back-icon { color: #fff; font-size: 44rpx; line-height: 1; font-weight: 700; }
+.hero-nav-title { color: rgba(255,255,255,0.95); font-size: calc(30rpx * var(--font-scale, 1)); font-weight: 600; }
 .hero-bg-circle { position: absolute; border-radius: 50%; background: rgba(255,255,255,0.06); }
 .hero-bg-circle-1 { width: 380rpx; height: 380rpx; right: -120rpx; top: -140rpx; }
 .hero-bg-circle-2 { width: 220rpx; height: 220rpx; left: -80rpx; bottom: -60rpx; }
@@ -695,8 +729,8 @@ $c-rpt-mask-ink:     #000;    // 遮罩渐变异色(mask-image)
 }
 .hero-score-col { flex: 1; display: flex; flex-direction: column; align-items: center; }
 .hero-score-divider { width: 1rpx; height: 72rpx; background: rgba(255,255,255,0.25); }
-.hero-score-num { font-size: calc(80rpx * var(--font-scale, 1)); font-weight: 700; color: $app-surface; line-height: 1; }
-.hero-score-num-pct { font-size: calc(72rpx * var(--font-scale, 1)); }
+.hero-score-num { font-size: calc($uni-font-size-5xl * var(--font-scale, 1)); font-weight: 700; color: $app-surface; line-height: 1; }
+.hero-score-num-pct { font-size: calc($uni-font-size-5xl * var(--font-scale, 1)); }
 .hero-score-pct-unit { font-size: calc(32rpx * var(--font-scale, 1)); font-weight: 400; margin-left: 2rpx; }
 .hero-score-label { font-size: calc(24rpx * var(--font-scale, 1)); color: rgba(255,255,255,0.75); margin-top: 12rpx; }
 

+ 1 - 1
cfc-frontend/pages/diet/meal-config.vue

@@ -290,7 +290,7 @@ export default {
   background-color: $app-surface;
   color: $brand-primary;
   font-size: calc(20rpx * var(--font-scale, 1));
-  font-weight: 900;
+  font-weight: 700;
   display: flex;
   align-items: center;
   justify-content: center;

+ 1 - 1
cfc-frontend/pages/diet/preferences.vue

@@ -414,7 +414,7 @@ $c-dp-footer-line: #FFE9D4; // 底部操作条描边
 /* ===== 内容 ===== */
 .content { flex: 1; padding: 10rpx 32rpx $uni-space-lg; box-sizing: border-box; }
 .step-head { display: flex; align-items: center; margin: 20rpx 0 24rpx; }
-.step-icon { font-size: calc(52rpx * var(--font-scale, 1)); margin-right: 20rpx; }
+.step-icon { font-size: calc($uni-font-size-3xl * var(--font-scale, 1)); margin-right: 20rpx; }
 .step-head-text { display: flex; flex-direction: column; }
 .step-title { font-size: calc(34rpx * var(--font-scale, 1)); font-weight: 700; color: $c-dp-ink; }
 .step-sub { font-size: calc(24rpx * var(--font-scale, 1)); color: $c-dp-muted; margin-top: 6rpx; }

+ 2 - 2
cfc-frontend/pages/diet/recommendation.vue

@@ -710,7 +710,7 @@ export default {
   box-shadow: 0 10rpx 30rpx rgba(255, 140, 66, 0.3);
   margin-bottom: 40rpx;
 }
-.empty-icon { font-size: calc(72rpx * var(--font-scale, 1)); }
+.empty-icon { font-size: calc($uni-font-size-5xl * var(--font-scale, 1)); }
 .empty-title { font-size: calc(34rpx * var(--font-scale, 1)); font-weight: 700; color: $facade-text-strong; display: block; margin-bottom: 16rpx; }
 .empty-sub { font-size: calc(26rpx * var(--font-scale, 1)); color: $facade-text-muted; display: block; margin-bottom: 48rpx; }
 .generate-btn {
@@ -1154,7 +1154,7 @@ export default {
   padding: 60rpx 40rpx;
 }
 .food-empty-icon {
-  font-size: calc(80rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-5xl * var(--font-scale, 1));
   display: block;
   margin-bottom: 20rpx;
 }

+ 2 - 2
cfc-frontend/pages/diet/records.vue

@@ -506,7 +506,7 @@ export default {
 
 /* 空态 */
 .empty-state { text-align: center; padding: 80rpx 40rpx; }
-.empty-icon { font-size: calc(80rpx * var(--font-scale, 1)); display: block; margin-bottom: 20rpx; }
+.empty-icon { font-size: calc($uni-font-size-5xl * var(--font-scale, 1)); display: block; margin-bottom: 20rpx; }
 .empty-text { font-size: calc(28rpx * var(--font-scale, 1)); color: $facade-text-strong; font-weight: 500; display: block; margin-bottom: 8rpx; }
 .empty-hint { font-size: calc(24rpx * var(--font-scale, 1)); color: $facade-text-muted; display: block; }
 .loading-state { text-align: center; padding: 80rpx 0; }
@@ -520,5 +520,5 @@ export default {
   display: flex; align-items: center; justify-content: center;
   box-shadow: 0 4rpx 20rpx rgba(255,140,66,0.4);
 }
-.fab-icon { font-size: calc(48rpx * var(--font-scale, 1)); color: $app-surface; font-weight: 300; }
+.fab-icon { font-size: calc(48rpx * var(--font-scale, 1)); color: $app-surface; font-weight: 400; }
 </style>

+ 1 - 1
cfc-frontend/pages/discover/circle-feed.vue

@@ -653,7 +653,7 @@ export default {
 .loading-more, .end-hint { text-align: center; padding: 24rpx 0; }
 .lm-text, .eh-text { font-size: calc(24rpx * var(--font-scale, 1)); color: $facade-text-ghost; }
 .empty-state { text-align: center; padding: 120rpx 0; }
-.empty-icon { font-size: calc(80rpx * var(--font-scale, 1)); display: block; margin-bottom: 16rpx; }
+.empty-icon { font-size: calc($uni-font-size-5xl * var(--font-scale, 1)); display: block; margin-bottom: 16rpx; }
 .empty-text { font-size: calc(26rpx * var(--font-scale, 1)); color: $facade-text-ghost; }
 .bottom-space { height: 40rpx; }
 

+ 1 - 1
cfc-frontend/pages/energy/detail.vue

@@ -181,7 +181,7 @@ export default {
   align-items: center;
   margin-top: 20rpx;
 }
-.dim-energy-value { font-size: calc(48rpx * var(--font-scale, 1)); font-weight: bold; color: $brand-primary; }
+.dim-energy-value { font-size: calc($uni-font-size-display * var(--font-scale, 1)); font-weight: bold; color: $brand-primary; }
 .dim-energy-label { font-size: calc(20rpx * var(--font-scale, 1)); color: rgba(143,197,232,0.4); }
 
 /* ---- 流水 ---- */

+ 1 - 1
cfc-frontend/pages/energy/index.vue

@@ -503,7 +503,7 @@ $c-energy-deep-2: #1A2744; // 导航渐变终 / 卡片底(藏蓝)
   align-items: center;
   padding: 200rpx 40rpx;
 }
-.empty-icon { font-size: calc(100rpx * var(--font-scale, 1)); margin-bottom: 20rpx; }
+.empty-icon { font-size: calc($uni-font-size-6xl * var(--font-scale, 1)); margin-bottom: 20rpx; }
 .empty-title { font-size: calc(32rpx * var(--font-scale, 1)); color: $app-surface; font-weight: 600; margin-bottom: 12rpx; }
 .empty-desc { font-size: calc(24rpx * var(--font-scale, 1)); color: rgba(255,255,255,0.5); text-align: center; margin-bottom: 40rpx; }
 .login-btn {

+ 1 - 1
cfc-frontend/pages/family/mbti-profile.vue

@@ -113,7 +113,7 @@ export default {
 .mbp-drawer { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.4); z-index: 100; display: flex; align-items: flex-end }
 .mbp-drawer-content { width: 100%; max-height: 80vh; background: $app-surface; border-radius: 24rpx 24rpx 0 0; display: flex; flex-direction: column }
 .mbp-drawer-header { padding: $uni-space-lg 20rpx; background: linear-gradient(135deg, $dim-wisdom, $dim-wisdom-light); color: $app-surface; display: flex; flex-direction: column; align-items: center }
-.mbp-drawer-code { font-size: calc(64rpx * var(--font-scale, 1)); font-weight: 700; letter-spacing: 8rpx }
+.mbp-drawer-code { font-size: calc($uni-font-size-4xl * var(--font-scale, 1)); font-weight: 700; letter-spacing: 8rpx }
 .mbp-drawer-name { font-size: calc(28rpx * var(--font-scale, 1)); opacity: 0.9; margin-top: 4rpx}
 .mbp-drawer-body { flex: 1; overflow-y: auto; padding: 20rpx}
 .mbp-drawer-section { margin-bottom: 24rpx}

+ 1 - 1
cfc-frontend/pages/family/mbti-result.vue

@@ -168,7 +168,7 @@ export default {
 .mbr-loading { display: flex; justify-content: center; align-items: center; height: 50vh }
 .mbr-hero { border-radius: 24rpx; padding: 40rpx $uni-space-page; margin-bottom: 24rpx; background: linear-gradient(135deg, $dim-wisdom, $dim-wisdom-light); box-shadow: 0 6rpx 20rpx rgba(99,102,241,0.25) }
 .mbr-hero-inner { display: flex; flex-direction: column; align-items: center }
-.mbr-type-code { font-size: calc(80rpx * var(--font-scale, 1)); font-weight: 700; color: $app-surface; letter-spacing: 8rpx }
+.mbr-type-code { font-size: calc($uni-font-size-5xl * var(--font-scale, 1)); font-weight: 700; color: $app-surface; letter-spacing: 8rpx }
 .mbr-type-name { font-size: calc(32rpx * var(--font-scale, 1)); color: rgba(255,255,255,0.9); margin-top: 8rpx}
 .mbr-type-desc { font-size: calc(24rpx * var(--font-scale, 1)); color: rgba(255,255,255,0.8); margin-top: 16rpx; text-align: center; max-width: 600rpx }
 .mbr-section { background: $app-surface; border-radius: 24rpx; padding: $uni-space-lg 26rpx; margin-bottom: 24rpx; box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.05) }

+ 1 - 1
cfc-frontend/pages/family/self-check-ai.vue

@@ -547,7 +547,7 @@ export default {
   padding: 100rpx 40rpx;
 }
 .sc-error-icon {
-  font-size: calc(80rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-5xl * var(--font-scale, 1));
   margin-bottom: 20rpx;
 }
 .sc-error-text {

+ 1 - 1
cfc-frontend/pages/family/self-check-entry.vue

@@ -223,7 +223,7 @@ export default {
   margin-top: 10rpx;
 }
 .sce-hero-score {
-  font-size: calc(80rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-5xl * var(--font-scale, 1));
   font-weight: 700;
   color: $app-surface;
 }

+ 2 - 2
cfc-frontend/pages/family/self-check-result.vue

@@ -366,7 +366,7 @@ export default {
   margin-top: 10rpx;
 }
 .scr-hero-score {
-  font-size: calc(80rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-5xl * var(--font-scale, 1));
   font-weight: 700;
   color: $app-surface;
 }
@@ -733,7 +733,7 @@ export default {
   padding: $uni-space-lg 0;
 }
 .scr-all-healthy-icon {
-  font-size: calc(72rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-5xl * var(--font-scale, 1));
   margin-bottom: 16rpx;
 }
 .scr-all-healthy-text {

+ 1 - 1
cfc-frontend/pages/games/list.vue

@@ -148,7 +148,7 @@ export default {
 }
 
 .game-icon {
-  font-size: calc(80rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-5xl * var(--font-scale, 1));
   width: 120rpx;
   height: 120rpx;
   display: flex;

+ 16 - 1
cfc-frontend/pages/growth-main/index.vue

@@ -210,6 +210,20 @@
         </view>
       </view>
 
+      <!-- 益智小游戏 -->
+      <view class="section">
+        <view class="action-card" @click="goToGames">
+          <view class="action-icon-wrap warm">
+            <text class="action-icon">🎮</text>
+          </view>
+          <view class="action-info">
+            <text class="action-title">益智小游戏</text>
+            <text class="action-desc">舒尔特方格 · 猜数字 · 数独</text>
+          </view>
+          <text class="action-arrow">›</text>
+        </view>
+      </view>
+
       <DimensionActivities :isLoggedIn="true" @activityClick="goActivityDetail" @moreActivities="goMoreActivities" style="margin-bottom:60rpx" />
 
       <!-- 推荐阅读 -->
@@ -319,6 +333,7 @@ export default {
       var mid = uni.getStorageSync('currentChildId') || uni.getStorageSync('currentMemberId') || ''
       uni.navigateTo({ url: '/pages/diet/recommendation' + (mid ? '?memberId=' + mid : '') })
     },
+    goToGames: function() { uni.navigateTo({ url: '/pages/games/list' }) },
     goToArticle: function(article) { var id = article && article.id ? article.id : article; if (!id) return; uni.navigateTo({ url: '/pages/article-center/article-detail?id=' + id }) },
     goToProduct: function(prod) { var id = prod && prod.id ? prod.id : prod; if (!id) return; uni.navigateTo({ url: '/pages/discover-detail/product-detail/product-detail?id=' + id }) },
     goMoreProducts: function() { uni.navigateTo({ url: '/pages/shop/index/index' }) },
@@ -628,7 +643,7 @@ $c-danger-ink:       $status-danger-deep;
 }
 .milestone-tile-value {
   font-size: calc(32rpx * var(--font-scale, 1));
-  font-weight: 800;
+  font-weight: 700;
   color: $c-growth-hero-from;
   line-height: 1;
   margin-bottom: 4rpx;

+ 1 - 1
cfc-frontend/pages/growth/caution-detail.vue

@@ -381,7 +381,7 @@ export default {
   padding: 100rpx 40rpx;
 }
 .empty-icon {
-  font-size: calc(80rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-5xl * var(--font-scale, 1));
   display: block;
   margin-bottom: 20rpx;
 }

+ 4 - 4
cfc-frontend/pages/growth/sleep-checkin.vue

@@ -512,7 +512,7 @@ $c-rose-400:      #FB7185; // 差质量徽章渐变起点(rose-400,全局 da
   position: absolute;
   top: 20rpx;
   right: 32rpx;
-  font-size: calc(72rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-5xl * var(--font-scale, 1));
   line-height: 1;
   animation: moon-float 4s ease-in-out infinite;
 }
@@ -560,8 +560,8 @@ $c-rose-400:      #FB7185; // 差质量徽章渐变起点(rose-400,全局 da
   margin-top: 24rpx;
 }
 .hero-duration-num {
-  font-size: calc(48rpx * var(--font-scale, 1));
-  font-weight: 800;
+  font-size: calc($uni-font-size-display * var(--font-scale, 1));
+  font-weight: $uni-font-weight-extra-heavy;
   color: $app-surface;
   line-height: 1.1;
 }
@@ -723,7 +723,7 @@ $c-rose-400:      #FB7185; // 差质量徽章渐变起点(rose-400,全局 da
 .quality-score-row { display: flex; align-items: baseline; }
 .quality-score {
   font-size: calc(54rpx * var(--font-scale, 1));
-  font-weight: 800;
+  font-weight: $uni-font-weight-extra-heavy;
   color: $uni-text-color;
   line-height: 1;
 }

+ 1 - 1
cfc-frontend/pages/growth/supplement.vue

@@ -236,7 +236,7 @@ export default {
   background: $facade-fill-ghost;
 }
 .upload-icon {
-  font-size: calc(64rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-4xl * var(--font-scale, 1));
   color: $facade-text-muted;
   line-height: 1;
 }

+ 1 - 1
cfc-frontend/pages/growth/upload.vue

@@ -361,7 +361,7 @@ export default {
   background: $facade-fill-ghost;
 }
 .upload-icon {
-  font-size: calc(64rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-4xl * var(--font-scale, 1));
   color: $facade-text-muted;
   line-height: 1;
 }

+ 2 - 2
cfc-frontend/pages/guide/activities/index.vue

@@ -335,7 +335,7 @@ export default {
 }
 
 .cover-placeholder-text {
-  font-size: calc(64rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-4xl * var(--font-scale, 1));
   color: $app-surface;
 }
 
@@ -462,7 +462,7 @@ export default {
 }
 
 .empty-icon {
-  font-size: calc(100rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-6xl * var(--font-scale, 1));
   margin-bottom: 20rpx;
 }
 

+ 1 - 1
cfc-frontend/pages/guide/bind/invite.vue

@@ -255,7 +255,7 @@ export default {
 .input, .picker { padding: 20rpx; background: $facade-fill-2; border-radius: 16rpx; font-size: calc(28rpx * var(--font-scale, 1)); }
 .btn-confirm { background: $mat-green; color: $app-surface; border-radius: 24rpx; margin-top: 40rpx; }
 
-.success-icon { font-size: calc(80rpx * var(--font-scale, 1)); color: $mat-green; display: block; margin-bottom: 20rpx; }
+.success-icon { font-size: calc($uni-font-size-5xl * var(--font-scale, 1)); color: $mat-green; display: block; margin-bottom: 20rpx; }
 .success-text { font-size: calc(36rpx * var(--font-scale, 1)); font-weight: bold; display: block; margin-bottom: 10rpx; }
 .success-desc { font-size: calc(28rpx * var(--font-scale, 1)); color: $facade-text-body; display: block; margin-bottom: 40rpx; }
 .btn-go { background: $mat-green; color: $app-surface; border-radius: 24rpx; }

+ 1 - 1
cfc-frontend/pages/guide/hierarchy/index.vue

@@ -239,7 +239,7 @@ export default {
 }
 
 .empty-icon {
-  font-size: calc(80rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-5xl * var(--font-scale, 1));
   display: block;
   margin-bottom: 20rpx;
 }

+ 1 - 1
cfc-frontend/pages/guide/packages/create.vue

@@ -174,7 +174,7 @@ export default {
 }
 
 .upload-icon {
-  font-size: calc(64rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-4xl * var(--font-scale, 1));
   color: $facade-text-ghost;
 }
 

+ 1 - 1
cfc-frontend/pages/guide/register/index.vue

@@ -390,7 +390,7 @@ export default {
 }
 
 .upload-icon {
-  font-size: calc(64rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-4xl * var(--font-scale, 1));
   margin-bottom: 10rpx;
 }
 

+ 174 - 64
cfc-frontend/pages/health-main/index.vue

@@ -262,6 +262,7 @@ import RadarChart from '../../components/RadarChart.vue'
 import ArticleFeed from '../../components/ArticleFeed.vue'
 import ReportUploadCard from '../../components/report-upload-card.vue'
 import { parseDate } from '../../utils/format.js'
+import { ensureDimensionRegistry, getRadarConfig, isRegistryReady, WEALTH_CHILD_LABEL } from '../../composables/useDimensionRegistry.js'
 import fontScaleMixin from '@/mixins/font-scale.js'
 import shareMixin from '../../components/share-mixin.js'
 
@@ -324,7 +325,10 @@ export default {
       childrenList: [],
       relationshipEmpty: false,
       // 登录浮层打开标志(打开期间隐藏演示雷达,避免原生 canvas 盖在浮层之上)
-      loginSheetVisible: false
+      loginSheetVisible: false,
+      // 统一维度注册中心是否就绪(成功取到 tree 后由 ensureDimensionRegistry 置位)
+      // 未就绪时主页雷达回落硬编码兜底,保证后端未上线 / 接口异常时页面不崩
+      registryReady: false
     }
   },
   computed: {
@@ -337,23 +341,23 @@ export default {
       return tab ? tab.color : BrandColors.body
     },
     currentDimensions: function() {
-      if (this.currentTab === 'cognitive') {
-        return [{ label:'记忆力',key:'memory'},{ label:'注意力',key:'attention'},{ label:'逻辑推理',key:'logic'},{ label:'空间想象',key:'spatial'},{ label:'感知能力',key:'perception'},{ label:'专注力',key:'focus'},{ label:'加工速度',key:'processingSpeed' }]
-      }
-      if (this.currentTab === 'mental') {
-        return [{ label:'开放性',key:'openness'},{ label:'尽责性',key:'conscientiousness'},{ label:'外向性',key:'extraversion'},{ label:'宜人性',key:'agreeableness'},{ label:'神经质',key:'neuroticism'},{ label:'自主性',key:'driveAutonomy'},{ label:'胜任感',key:'driveCompetence'},{ label:'归属感',key:'driveRelatedness'},{ label:'情绪稳定性',key:'emotionStability'},{ label:'自我概念',key:'selfConceptOverall' }]
-      }
-      if (this.currentTab === 'relationship') {
-        return [{ label:'亲子信任',key:'parentTrust'},{ label:'亲子亲密度',key:'parentIntimacy'},{ label:'沟通质量',key:'communication'},{ label:'关系健康度',key:'healthStatus'},{ label:'最近互动',key:'lastInteraction' }]
-      }
-      if (this.currentTab === 'wealth') {
+      // 配置驱动:从统一维度注册中心 tree 取该 tab 根节点的 children 作为维度清单
+      var config = getRadarConfig(this.currentTab)
+      if (this.registryReady && config && config.length > 0) {
         var isChild = !!uni.getStorageSync('currentChildId')
-        if (isChild) {
-          return [{ label:'学业能力',key:'skill'},{ label:'利他贡献',key:'altruism'},{ label:'积分积累',key:'income'},{ label:'财务素养',key:'fx' }]
-        }
-        return [{ label:'个人能力',key:'skill'},{ label:'利他贡献',key:'altruism'},{ label:'CF值积累',key:'income'},{ label:'财务素养',key:'fx' }]
+        var self = this
+        return config.map(function(c) {
+          var label = c.label
+          // 财富子维度在「成员(儿童)」语境下使用更贴近儿童的文案(与改造前字面量一致)
+          if (self.currentTab === 'wealth' && isChild && WEALTH_CHILD_LABEL[c.code]) {
+            label = WEALTH_CHILD_LABEL[c.code]
+          }
+          // label 供 RadarChart 画维度名;key 供(若有)点击透传;code 保留注册中心维度码
+          return { label: label, key: c.code, code: c.code }
+        })
       }
-      return [{ label:'生长发育',key:'growth'},{ label:'睡眠质量',key:'sleep'},{ label:'视力健康',key:'vision'},{ label:'免疫力',key:'immunity'},{ label:'营养均衡',key:'nutrition'},{ label:'肠胃健康',key:'gut'},{ label:'运动活力',key:'exercise' }]
+      // 过渡兜底:注册中心未就绪或某根无子维 → 回落现有硬编码清单(后端未上线 / 接口异常时页面不崩)
+      return this._fallbackDimensions(this.currentTab)
     },
     currentScores: function() {
       if (this.chartIsEmpty) {
@@ -361,55 +365,16 @@ export default {
         for (var i = 0; i < dims.length; i++) scores.push(0)
         return scores
       }
-      if (this.currentTab === 'cognitive') {
-        return [
-          this._cognitiveScore('memoryScore'),
-          this._cognitiveScore('attentionScore'),
-          this._cognitiveScore('logicScore'),
-          this._cognitiveScore('spatialScore'),
-          this._cognitiveScore('perceptionScore'),
-          this._cognitiveScore('focusScore'),
-          this._cognitiveScore('processingSpeedScore')
-        ]
-      }
-      if (this.currentTab === 'mental') {
-        return [
-          this._emiScore('opennessScore'),
-          this._emiScore('conscientiousnessScore'),
-          this._emiScore('extraversionScore'),
-          this._emiScore('agreeablenessScore'),
-          this._emiScore('neuroticismScore'),
-          this._emiScore('driveAutonomy'),
-          this._emiScore('driveCompetence'),
-          this._emiScore('driveRelatedness'),
-          this._emiScore('emotionStability'),
-          this._emiScore('selfConceptOverall')
-        ]
-      }
-      if (this.currentTab === 'relationship') {
-        return [
-          this._relScore('trustScore'),
-          this._relScore('intimacyScore'),
-          this._relScore('communicationScore'),
-          this._relScore('totalScore'),
-          0
-        ]
-      }
-      if (this.currentTab === 'wealth') {
-        var d = this.wealthDetail
-        if (!d) return [0, 0, 0, 0]
-        return [d.wealthSkill || 0, d.wealthAltruism || 0, d.wealthIncome || 0, d.wealthFx || 0]
-      }
-      // body: 从 API 真实维度数据取分
-      if (this.bodyData && this.bodyData.dimensions && this.bodyData.dimensions.length > 0) {
-        return this.bodyData.dimensions.map(function(d) { return Number(d.score) || 0 })
-      }
-      // body: fallback to demo
-      if (this.reports.length > 0) {
-        var latest = this.reports[0]
-        if (latest.overallScore) return [72, 68, 75, 80, 70, 78, 82]
+      // 配置驱动:与 currentDimensions 同源同序遍历注册中心配置,按 scoreField 取分
+      var config = getRadarConfig(this.currentTab)
+      if (this.registryReady && config && config.length > 0) {
+        var self = this
+        return config.map(function(c) {
+          return self._readRegistryScore(self.currentTab, c.code, c.scoreField)
+        })
       }
-      return [72, 68, 75, 80, 70, 78, 82]
+      // 过渡兜底:注册中心未就绪 → 回落现有硬编码取分逻辑(与改造前一致)
+      return this._fallbackScores(this.currentTab)
     },
     currentAvgScores: function() {
       if (this.chartIsEmpty) return []
@@ -470,6 +435,13 @@ export default {
       this.loadHealthData()
       this.loadPlanList()
       this.loadPendingSurveys()
+      // 触发统一维度注册中心树拉取(主页雷达配置驱动取数;失败则回落硬编码兜底)
+      var self = this
+      ensureDimensionRegistry().then(function() {
+        self.registryReady = isRegistryReady()
+      }).catch(function() {
+        self.registryReady = false
+      })
     } else {
       this.pendingSurveys = []
     }
@@ -499,6 +471,144 @@ export default {
       var v = this.energySandbox[key]
       return (typeof v === 'number' && v > 0) ? v : 0
     },
+    /**
+     * 过渡兜底:返回某 tab 的硬编码维度清单(与改造前字面量一致)。
+     * 仅当注册中心未就绪时使用,保证后端未上线 / 接口异常时页面不崩。
+     * @param {string} tab
+     * @returns {Array<{label:string,key:string}>}
+     */
+    _fallbackDimensions: function(tab) {
+      if (tab === 'cognitive') {
+        return [{ label:'记忆力',key:'memory'},{ label:'注意力',key:'attention'},{ label:'逻辑推理',key:'logic'},{ label:'空间想象',key:'spatial'},{ label:'感知能力',key:'perception'},{ label:'专注力',key:'focus'},{ label:'加工速度',key:'processingSpeed' }]
+      }
+      if (tab === 'mental') {
+        return [{ label:'开放性',key:'openness'},{ label:'尽责性',key:'conscientiousness'},{ label:'外向性',key:'extraversion'},{ label:'宜人性',key:'agreeableness'},{ label:'神经质',key:'neuroticism'},{ label:'自主性',key:'driveAutonomy'},{ label:'胜任感',key:'driveCompetence'},{ label:'归属感',key:'driveRelatedness'},{ label:'情绪稳定性',key:'emotionStability'},{ label:'自我概念',key:'selfConceptOverall' }]
+      }
+      if (tab === 'relationship') {
+        return [{ label:'亲子信任',key:'parentTrust'},{ label:'亲子亲密度',key:'parentIntimacy'},{ label:'沟通质量',key:'communication'},{ label:'关系健康度',key:'healthStatus'},{ label:'最近互动',key:'lastInteraction' }]
+      }
+      if (tab === 'wealth') {
+        var isChild = !!uni.getStorageSync('currentChildId')
+        if (isChild) {
+          return [{ label:'学业能力',key:'skill'},{ label:'利他贡献',key:'altruism'},{ label:'积分积累',key:'income'},{ label:'财务素养',key:'fx' }]
+        }
+        return [{ label:'个人能力',key:'skill'},{ label:'利他贡献',key:'altruism'},{ label:'CF值积累',key:'income'},{ label:'财务素养',key:'fx' }]
+      }
+      return [{ label:'生长发育',key:'growth'},{ label:'睡眠质量',key:'sleep'},{ label:'视力健康',key:'vision'},{ label:'免疫力',key:'immunity'},{ label:'营养均衡',key:'nutrition'},{ label:'肠胃健康',key:'gut'},{ label:'运动活力',key:'exercise' }]
+    },
+    /**
+     * 过渡兜底:返回某 tab 的硬编码取分(与改造前字面量一致)。
+     * @param {string} tab
+     * @returns {Array<number>}
+     */
+    _fallbackScores: function(tab) {
+      if (tab === 'cognitive') {
+        return [
+          this._cognitiveScore('memoryScore'),
+          this._cognitiveScore('attentionScore'),
+          this._cognitiveScore('logicScore'),
+          this._cognitiveScore('spatialScore'),
+          this._cognitiveScore('perceptionScore'),
+          this._cognitiveScore('focusScore'),
+          this._cognitiveScore('processingSpeedScore')
+        ]
+      }
+      if (tab === 'mental') {
+        return [
+          this._emiScore('opennessScore'),
+          this._emiScore('conscientiousnessScore'),
+          this._emiScore('extraversionScore'),
+          this._emiScore('agreeablenessScore'),
+          this._emiScore('neuroticismScore'),
+          this._emiScore('driveAutonomy'),
+          this._emiScore('driveCompetence'),
+          this._emiScore('driveRelatedness'),
+          this._emiScore('emotionStability'),
+          this._emiScore('selfConceptOverall')
+        ]
+      }
+      if (tab === 'relationship') {
+        return [
+          this._relScore('trustScore'),
+          this._relScore('intimacyScore'),
+          this._relScore('communicationScore'),
+          this._relScore('totalScore'),
+          0
+        ]
+      }
+      if (tab === 'wealth') {
+        var d = this.wealthDetail
+        if (!d) return [0, 0, 0, 0]
+        return [d.wealthSkill || 0, d.wealthAltruism || 0, d.wealthIncome || 0, d.wealthFx || 0]
+      }
+      // body: 从 API 真实维度数据取分
+      if (this.bodyData && this.bodyData.dimensions && this.bodyData.dimensions.length > 0) {
+        return this.bodyData.dimensions.map(function(dItem) { return Number(dItem.score) || 0 })
+      }
+      // body: fallback to demo
+      if (this.reports.length > 0) {
+        var latest = this.reports[0]
+        if (latest.overallScore) return [72, 68, 75, 80, 70, 78, 82]
+      }
+      return [72, 68, 75, 80, 70, 78, 82]
+    },
+    /**
+     * 配置驱动取分:按 tab 与注册中心节点的 scoreField / code 从对应分数包取分。
+     * 包缺失或值非数字 → 0(保持现有零填充行为)。与改造前取分口径逐一对齐。
+     * @param {string} tab
+     * @param {string} code 注册中心节点 code(body 类为 body.growth)
+     * @param {string} scoreField legacyAlias 首元素(取分字段名)
+     * @returns {number}
+     */
+    _readRegistryScore: function(tab, code, scoreField) {
+      if (tab === 'body') {
+        // body 维度按 dimension 字段匹配:兼容两种格式——
+        // ① 当前后端 /api/dimension/overview 仍返回 legacy 码(growth/sleep/...,见 DimensionScoreServiceImpl.DIMENSIONS),
+        //    此时与 legacyAlias 首元素(scoreField)匹配;
+        // ② 后续后端迁移为统一码(body.growth/...)后,与注册中心节点 code 匹配。
+        var dims = this.bodyData && this.bodyData.dimensions
+        if (!dims || !dims.length) return 0
+        for (var i = 0; i < dims.length; i++) {
+          var dItem = dims[i]
+          if (dItem && (dItem.dimension === code || dItem.dimension === scoreField)) {
+            var v = Number(dItem.score)
+            return (typeof v === 'number' && !isNaN(v)) ? v : 0
+          }
+        }
+        return 0
+      }
+      if (tab === 'cognitive') {
+        if (!this.cognitiveData) return 0
+        var cv = this.cognitiveData[scoreField]
+        return (typeof cv === 'number' && cv > 0) ? cv : 0
+      }
+      if (tab === 'mental') {
+        if (!this.emiData) return 0
+        var mv = this.emiData[scoreField]
+        return (typeof mv === 'number' && mv > 0) ? mv : 0
+      }
+      if (tab === 'relationship') {
+        // 最近互动是日期字段,恒为 0(与改造前字面量 0 一致)
+        if (scoreField === 'lastInteractionAt') return 0
+        if (!this.relationshipData || this.relationshipData.length === 0) return 0
+        var total = 0, count = 0
+        for (var r = 0; r < this.relationshipData.length; r++) {
+          var item = this.relationshipData[r]
+          if (item && item[scoreField] != null) {
+            total += Number(item[scoreField])
+            count++
+          }
+        }
+        return count > 0 ? Math.round(total / count) : 0
+      }
+      if (tab === 'wealth') {
+        var wd = this.wealthDetail
+        if (!wd) return 0
+        var wv = wd[scoreField]
+        return (typeof wv === 'number' && wv > 0) ? wv : 0
+      }
+      return 0
+    },
     switchTab: function(code) { this.currentTab = code },
     goPage: function(url) { uni.navigateTo({ url: url }) },
     // 登录浮层打开/关闭(隐藏演示雷达,规避原生 canvas 层级高于浮层的问题)

+ 2 - 2
cfc-frontend/pages/health/challenge-manage.vue

@@ -917,7 +917,7 @@ export default {
   align-items: center;
   padding: 80rpx 0;
 }
-.empty-icon { font-size: calc(80rpx * var(--font-scale, 1)); margin-bottom: 16rpx; }
+.empty-icon { font-size: calc($uni-font-size-5xl * var(--font-scale, 1)); margin-bottom: 16rpx; }
 .empty-title { font-size: calc(32rpx * var(--font-scale, 1)); font-weight: 700; color: $uni-text-color; }
 .empty-desc { font-size: calc(26rpx * var(--font-scale, 1)); color: $app-text-subtle; margin: 8rpx 0 32rpx; }
 .btn-empty {
@@ -1305,7 +1305,7 @@ export default {
   padding: 24rpx 0 16rpx;
 }
 .prompt-icon {
-  font-size: calc(80rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-5xl * var(--font-scale, 1));
   margin-bottom: 16rpx;
 }
 .prompt-title {

+ 1 - 1
cfc-frontend/pages/health/doa-index.vue

@@ -153,7 +153,7 @@ export default {
 .week-progress { margin-top: 12rpx; }
 .week-text { font-size: calc(22rpx * var(--font-scale, 1)); color: $status-success; font-weight: 600; }
 .empty { display: flex; flex-direction: column; align-items: center; padding: 100rpx 0; }
-.empty-icon { font-size: calc(80rpx * var(--font-scale, 1)); margin-bottom: 16rpx; }
+.empty-icon { font-size: calc($uni-font-size-5xl * var(--font-scale, 1)); margin-bottom: 16rpx; }
 .empty-desc { font-size: calc(26rpx * var(--font-scale, 1)); color: $app-text-subtle; margin-bottom: 32rpx; }
 .btn-empty {
   background: $status-success; color: $app-surface; font-size: calc(28rpx * var(--font-scale, 1));

+ 2 - 2
cfc-frontend/pages/health/health-plan-summary.vue

@@ -1482,7 +1482,7 @@ selectedMembers: function() {
   align-items: center;
   padding: 80rpx 20rpx;
 }
-.loading-icon { font-size: calc(80rpx * var(--font-scale, 1)); margin-bottom: 20rpx; }
+.loading-icon { font-size: calc($uni-font-size-5xl * var(--font-scale, 1)); margin-bottom: 20rpx; }
 .loading-text { font-size: calc(30rpx * var(--font-scale, 1)); color: $facade-text-strong; margin-bottom: 8rpx; }
 .loading-hint { font-size: calc(24rpx * var(--font-scale, 1)); color: $facade-text-muted; }
 
@@ -1651,7 +1651,7 @@ selectedMembers: function() {
   align-items: center;
   width: 560rpx;
 }
-.success-icon { font-size: calc(100rpx * var(--font-scale, 1)); color: $mat-green; margin-bottom: 20rpx; }
+.success-icon { font-size: calc($uni-font-size-6xl * var(--font-scale, 1)); color: $mat-green; margin-bottom: 20rpx; }
 .success-title { font-size: calc(36rpx * var(--font-scale, 1)); font-weight: bold; color: $facade-text-strong; margin-bottom: 12rpx; }
 .success-sub { font-size: calc(28rpx * var(--font-scale, 1)); color: $facade-text-faint; margin-bottom: 40rpx; }
 

+ 2 - 2
cfc-frontend/pages/health/indicator-timeline.vue

@@ -540,7 +540,7 @@ export default {
 .status-tag.status-high { background: #fff7ed; color: #c2410c; }
 .status-tag.status-low { background: #eff6ff; color: #1d4ed8; }
 .head-value-row { display: flex; flex-direction: row; align-items: baseline; margin-bottom: 8rpx; }
-.head-value { font-size: calc(48rpx * var(--font-scale, 1)); font-weight: 800; color: #111827; line-height: 1.2; }
+.head-value { font-size: calc(48rpx * var(--font-scale, 1)); font-weight: $uni-font-weight-extra-heavy; color: #111827; line-height: 1.2; }
 .head-unit { font-size: calc(24rpx * var(--font-scale, 1)); color: #6b7280; margin-left: 8rpx; }
 .head-count { font-size: calc(22rpx * var(--font-scale, 1)); color: #9ca3af; margin-left: 16rpx; }
 .head-ref { font-size: calc(22rpx * var(--font-scale, 1)); color: #6b7280; margin-bottom: 8rpx; }
@@ -553,7 +553,7 @@ export default {
 .loading-text { font-size: calc(24rpx * var(--font-scale, 1)); color: #9ca3af; }
 .empty-text { display: block; text-align: center; font-size: calc(24rpx * var(--font-scale, 1)); color: #9ca3af; margin-top: 80rpx; }
 .single-card { display: flex; flex-direction: row; align-items: baseline; justify-content: center; padding: 24rpx 0; }
-.single-value { font-size: calc(48rpx * var(--font-scale, 1)); font-weight: 800; color: #111827; line-height: 1.2; }
+.single-value { font-size: calc($uni-font-size-display * var(--font-scale, 1)); font-weight: $uni-font-weight-extra-heavy; color: #111827; line-height: 1.2; }
 .single-unit { font-size: calc(26rpx * var(--font-scale, 1)); color: #6b7280; margin-left: 8rpx; }
 .single-status { font-size: calc(22rpx * var(--font-scale, 1)); padding: 4rpx 12rpx; border-radius: 12rpx; margin-left: 16rpx; }
 .single-note { display: block; text-align: center; font-size: calc(22rpx * var(--font-scale, 1)); color: #9ca3af; margin-top: 8rpx; }

+ 1 - 1
cfc-frontend/pages/health/my-feedback.vue

@@ -164,7 +164,7 @@ export default {
   align-items: center;
 }
 .mf-empty-icon {
-  font-size: calc(80rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-5xl * var(--font-scale, 1));
   margin-bottom: 24rpx;
 }
 .mf-empty-text {

+ 2 - 2
cfc-frontend/pages/health/nutrition-profile.vue

@@ -359,7 +359,7 @@ export default {
   align-items: center;
 }
 .score-value {
-  font-size: calc(48rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-display * var(--font-scale, 1));
   font-weight: bold;
   color: $brand-primary;
 }
@@ -397,7 +397,7 @@ export default {
   padding: 80rpx $uni-space-page;
 }
 .empty-icon {
-  font-size: calc(80rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-5xl * var(--font-scale, 1));
 }
 .empty-title {
   font-size: calc(36rpx * var(--font-scale, 1));

+ 1 - 1
cfc-frontend/pages/health/physical-exam-detail.vue

@@ -314,7 +314,7 @@ goBack: function() {
   align-items: center;
   padding: 100rpx 0;
 }
-.empty-icon { font-size: calc(80rpx * var(--font-scale, 1)); margin-bottom: 20rpx; }
+.empty-icon { font-size: calc($uni-font-size-5xl * var(--font-scale, 1)); margin-bottom: 20rpx; }
 .empty-text { font-size: calc(28rpx * var(--font-scale, 1)); color: $facade-text-muted; }
 
 .bottom-spacer { height: 60rpx; }

+ 1 - 1
cfc-frontend/pages/health/plan-list.vue

@@ -191,7 +191,7 @@ export default {
 }
 
 .empty-icon {
-  font-size: calc(80rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-5xl * var(--font-scale, 1));
 }
 
 .empty-title {

+ 1 - 1
cfc-frontend/pages/health/report-list.vue

@@ -824,7 +824,7 @@ export default {
   padding: 120rpx 60rpx;
 }
 .empty-icon {
-  font-size: calc(80rpx * var(--font-scale, 1));
+  font-size: calc($uni-font-size-5xl * var(--font-scale, 1));
   margin-bottom: 24rpx;
 }
 .empty-title {

+ 5 - 5
cfc-frontend/pages/health/report-upload.vue

@@ -104,11 +104,11 @@
         <view class="guide-item">
           <view class="guide-icon-box guide-icon-purple"><text class="guide-icon">🧠</text></view>
           <view class="guide-info">
-            <text class="guide-name">素质测评 A2</text>
-            <text class="guide-desc">核心素养 PDF,解析认知、情绪、大五人格等</text>
-            <view class="guide-link" v-if="getTypeLink('dan_a2')" @click="goProductDetail('dan_a2')">
+            <text class="guide-name">素质测评</text>
+            <text class="guide-desc">核心素养/认知发展 PDF,系统解析能力、人格、情绪等</text>
+            <view class="guide-link" v-if="getTypeLink('dan_a1')" @click="goProductDetail('dan_a1')">
               <text class="guide-link-label">查看商品</text>
-              <text class="guide-link-name">{{ getTypeLink('dan_a2').productName }}</text>
+              <text class="guide-link-name">{{ getTypeLink('dan_a1').productName }}</text>
               <text class="guide-link-arrow">›</text>
             </view>
           </view>
@@ -562,7 +562,7 @@ if (options.type === 'a2' || options.reportKind === 'a2') {
   background: $app-bg;
   border-radius: 16rpx;
   border: 2rpx solid transparent;
-  min-width: 120rpx;
+  width: calc((100% - 48rpx) / 4);
 }
 .member-selected {
   background: $violet-tint-100;

+ 1 - 1
cfc-frontend/pages/health/survey-history.vue

@@ -83,7 +83,7 @@ export default {
 .answers-label{font-size: calc(24rpx * var(--font-scale, 1));color:$facade-text-muted;margin-right: 8rpx;flex-shrink:0}
 .answers-text{font-size: calc(24rpx * var(--font-scale, 1));color:$facade-text-body;flex:1}
 .empty-state{display:flex;flex-direction:column;align-items:center;padding: 120rpx 0}
-.empty-icon{font-size:calc(80rpx * var(--font-scale, 1));margin-bottom: 20rpx}
+.empty-icon{font-size: calc($uni-font-size-5xl * var(--font-scale, 1));margin-bottom: 20rpx}
 .empty-text{font-size: calc(30rpx * var(--font-scale, 1));color:$facade-text-body;margin-bottom: 12rpx}
 .empty-hint{font-size: calc(24rpx * var(--font-scale, 1));color:$facade-text-muted}
 .loading-state{display:flex;justify-content:center;padding: 80rpx 0}

+ 1 - 1
cfc-frontend/pages/health/teacher-service.vue

@@ -338,7 +338,7 @@ export default {
   align-items: center;
   padding: 80rpx 0;
 }
-.ts-empty-icon { font-size: calc(80rpx * var(--font-scale, 1)); margin-bottom: 16rpx; }
+.ts-empty-icon { font-size: calc($uni-font-size-5xl * var(--font-scale, 1)); margin-bottom: 16rpx; }
 .ts-empty-text { font-size: calc(28rpx * var(--font-scale, 1)); color: $facade-text-ghost-light; }
 .ts-empty-hint { font-size: calc(24rpx * var(--font-scale, 1)); color: $facade-border-soft; margin-top: 8rpx; }
 

Някои файлове не бяха показани, защото твърде много файлове са промени