Ver Fonte

fix: 对接报告

lxf há 53 minutos atrás
pai
commit
1b5f979593

+ 5 - 0
src/api/modules/pheno.js

@@ -27,4 +27,9 @@ module.exports = {
         url: config.base_new_url + "questionnaire/fw_task_detail",
         type: "get",
     },
+    // 点位推荐作物
+    getRecommend: {
+        url: config.base_new_url + "crop/recommend_by_point",
+        type: "get",
+    },
 }

BIN
src/assets/img/home/start-icon.png


+ 42 - 29
src/views/old_mini/agri_file/pages/abnormalTrack.vue

@@ -1,7 +1,7 @@
 <template>
     <div class="abnormal-track-page">
         <custom-header
-            :name="pageTitle"
+            name="异常态势巡园要点"
             :isGoBack="!isFromShare"
             :isClose="isFromShare"
             :showClose="false"
@@ -203,9 +203,43 @@ const queryContext = ref({
     crop_type: "",
 });
 
+// ---------- 工具函数 ----------
+function isTruthyFlag(value) {
+    return value === 1 || value === "1" || value === true || value === "true";
+}
+
+function parseMaybeJson(value) {
+    if (value == null || value === "") return null;
+    if (typeof value === "object") return value;
+    try {
+        return JSON.parse(value);
+    } catch {
+        return null;
+    }
+}
+
+/**
+ * 分享链路:dev_login 把整份登录 query 塞进 miniJson,
+ * 真正的页面参数在 miniJson.paramsPage(id / zoneId / fromShare / pageName)
+ */
+function resolvePageParams() {
+    const mini = parseMaybeJson(route.query.miniJson);
+    if (mini) {
+        const page = parseMaybeJson(mini.paramsPage) || {};
+        return { ...mini, ...page };
+    }
+    const paramsPage = parseMaybeJson(route.query.paramsPage);
+    if (paramsPage) {
+        return { ...route.query, ...paramsPage };
+    }
+    return { ...(route.query || {}) };
+}
+
 // ---------- 计算属性 ----------
-const pageTitle = computed(() => route.query.pageName || t("agriFile.patrolAbnormalTitle"));
-const zoneId = computed(() => route.query.zoneId || route.query.id);
+const pageParams = computed(() => resolvePageParams());
+const zoneId = computed(
+    () => pageParams.value.zoneId || pageParams.value.id || "",
+);
 
 const firstInteract = computed(() => interactList.value[0] || null);
 /** interaction_theme */
@@ -227,30 +261,7 @@ const zoneName = computed(() => {
 });
 
 /** 通过分享进入:无返回箭头 */
-const isFromShare = computed(() => {
-    if (isTruthyFlag(route.query.fromShare)) return true;
-    const paramsPage = parseMaybeJson(route.query.paramsPage);
-    if (isTruthyFlag(paramsPage?.fromShare)) return true;
-    const miniJson = parseMaybeJson(route.query.miniJson);
-    if (isTruthyFlag(miniJson?.fromShare)) return true;
-    if (isTruthyFlag(parseMaybeJson(miniJson?.paramsPage)?.fromShare)) return true;
-    return false;
-});
-
-// ---------- 工具函数 ----------
-function isTruthyFlag(value) {
-    return value === 1 || value === "1" || value === true || value === "true";
-}
-
-function parseMaybeJson(value) {
-    if (value == null || value === "") return null;
-    if (typeof value === "object") return value;
-    try {
-        return JSON.parse(value);
-    } catch {
-        return null;
-    }
-}
+const isFromShare = computed(() => isTruthyFlag(pageParams.value?.fromShare));
 
 function getSelectedFarm() {
     try {
@@ -406,10 +417,12 @@ const handleShare = () => {
         shareText: theme.value || "速长窗口不追肥?后期发育慢人一步,直接掉队!",
         targetUrl: "abnormal_track",
         paramsPage: JSON.stringify({
-            id: route.query.id,
+            id: pageParams.value.id || zoneId.value,
             zoneId: zoneId.value,
             fromShare: 1,
-            ...(route.query.pageName ? { pageName: route.query.pageName } : {}),
+            ...(pageParams.value.pageName
+                ? { pageName: pageParams.value.pageName }
+                : {}),
         }),
         imageUrl: "https://birdseye-img.sysuimars.com/farm-h5/abnormal_cover.png",
     };

+ 441 - 376
src/views/old_mini/agri_file/pages/diagnosisReport.vue

@@ -1,112 +1,136 @@
 <template>
-    <div
-        class="diagnosis-report-page"
-        v-loading="loading"
-        element-loading-background="rgba(15, 15, 15, 0.55)"
-    >
-        <div v-if="reportGenerating" class="report-progress">
-            <div class="report-progress__content">
-                <div>
-                    <el-progress
-                        :percentage="progressPercent"
-                        :stroke-width="15"
-                        :duration="30"
-                        status="warning"
-                        striped
-                        striped-flow
-                    />
-                </div>
-                <div class="report-progress__desc">
-                    依据您的定位和作物品类,
-                    <div>正在生成专属报告,预计耗时2分钟...</div>
-            </div>
-            </div>
-        </div>
-        <template v-else>
-        <div class="diagnosis-header">
-            <div class="diagnosis-header__title-row">
-                <div class="diagnosis-header__title">
-                    <div>一份报告</div>
-                    <div>看懂你的农场</div>
-                </div>
-                <!-- <img class="diagnosis-header__icon" src="@/assets/img/report/star.png" alt="" /> -->
-            </div>
-            <div class="diagnosis-header__desc">{{ headerDesc }}</div>
-            <!-- <div class="diagnosis-header__base">{{ headerBase }}</div> -->
-        </div>
-        <div class="diagnosis-content">
-            <div class="variety-bar">
-                <div class="variety-bar__tags">
-                    <div v-for="item in varietyList" :key="item.id" class="variety-bar__tag"
-                        :class="{ active: item.id === activeVarietyId }" @click="activeVarietyId = item.id">
-                        {{ item.name }}
+    <div class="diagnosis-report-page" v-loading="loading" element-loading-background="rgba(15, 15, 15, 0.55)">
+        <div class="page-content">
+            <div v-if="reportGenerating" class="report-progress">
+                <div class="report-progress__content">
+                    <div>
+                        <el-progress :percentage="progressPercent" :stroke-width="15" :duration="30" status="warning"
+                            striped striped-flow />
+                    </div>
+                    <div class="report-progress__desc">
+                        依据您的定位和作物品类,
+                        <div>正在生成专属报告,预计耗时2分钟...</div>
                     </div>
                 </div>
-                <!-- <div class="variety-bar__add">
-                    <el-icon>
-                        <Plus />
-                    </el-icon>
-                    <span>新增品种</span>
-                </div> -->
             </div>
-            <div class="base-data">
-                <div class="base-data__title">
-                    <!-- <img class="base-data__icon" src="@/assets/img/report/base-icon.png" alt="" /> -->
-                     <span class="title-dot"></span>
-                    <span>基本信息</span>
+            <template v-else>
+                <div class="diagnosis-header">
+                    <div class="diagnosis-header__title-row">
+                        <div class="diagnosis-header__title">
+                            <div>一份报告</div>
+                            <div>看懂你的农场</div>
+                        </div>
+                        <!-- <img class="diagnosis-header__icon" src="@/assets/img/report/star.png" alt="" /> -->
+                    </div>
+                    <div class="diagnosis-header__desc">{{ headerDesc }}</div>
+                    <!-- <div class="diagnosis-header__base">{{ headerBase }}</div> -->
                 </div>
-                <div class="base-data__body">
-                    <div v-if="!loading && !baseInfoList.length" class="base-data__empty">暂无基本信息</div>
-                    <div v-for="item in baseInfoList" :key="item.key" class="base-info-item">
-                        <div class="base-info-item__row">
-                            <span class="base-info-item__label">{{ item.label }}</span>
-                            <span class="base-info-item__value">{{ item.value }}</span>
-                            <!-- <span v-if="item.actionInline" class="base-info-action"
-                                @click="handleBaseAction(item.actionInline.key)">
-                                {{ item.actionInline.text }}
-                                <el-icon><Edit /></el-icon>
-                            </span> -->
+                <div class="diagnosis-content">
+                    <div class="variety-bar">
+                        <div class="variety-bar__tags">
+                            <div
+                                v-for="item in zoneList"
+                                :key="item.zone_id"
+                                class="variety-bar__tag"
+                                :class="{ active: String(item.zone_id) === String(selectedZoneId) }"
+                                @click="handleSelectZone(item)"
+                            >
+                                {{ item.zone_name }}
+                            </div>
                         </div>
-                        <!-- <div v-if="item.actionBlock" class="base-info-action base-info-action--block"
-                            @click="handleBaseAction(item.actionBlock.key)">
-                            {{ item.actionBlock.text }}
-                            <el-icon><Edit /></el-icon>
+                        <!-- <div class="variety-bar__add">
+                        <el-icon>
+                            <Plus />
+                        </el-icon>
+                        <span>新增品种</span>
+                    </div> -->
+                    </div>
+                    <div class="base-data">
+                        <!-- <div class="base-data__title">
+                            <span class="title-dot"></span>
+                            <span>基本信息</span>
                         </div> -->
+                        <div class="base-data__body">
+                            <div v-if="!loading && !baseInfoList.length" class="base-data__empty">暂无基本信息</div>
+                            <div v-for="item in baseInfoList" :key="item.key" class="base-info-item">
+                                <div class="base-info-item__row">
+                                    <span class="base-info-item__label">{{ item.label }}</span>
+                                    <span class="base-info-item__value">{{ item.value }}</span>
+                                    <!-- <span v-if="item.actionInline" class="base-info-action"
+                                    @click="handleBaseAction(item.actionInline.key)">
+                                    {{ item.actionInline.text }}
+                                    <el-icon><Edit /></el-icon>
+                                </span> -->
+                                </div>
+                                <!-- <div v-if="item.actionBlock" class="base-info-action base-info-action--block"
+                                @click="handleBaseAction(item.actionBlock.key)">
+                                {{ item.actionBlock.text }}
+                                <el-icon><Edit /></el-icon>
+                            </div> -->
+                            </div>
+                        </div>
                     </div>
-                </div>
-            </div>
-            <div class="report-module">
-                <div class="report-tabs">
-                    <div
-                        v-for="tab in reportTabs"
-                        :key="tab.key"
-                        class="report-tabs__item"
-                        :class="{ active: tab.key === activeReportTab }"
-                        @click="activeReportTab = tab.key"
-                    >
-                        <img class="report-tabs__icon" :src="tab.icon" alt="" />
-                        <span class="report-tabs__label">{{ tab.label }}</span>
+                    <div class="report-module">
+                        <div class="report-tabs">
+                            <div v-for="tab in reportTabs" :key="tab.key" class="report-tabs__item"
+                                :class="{ active: tab.key === activeReportTab }" @click="activeReportTab = tab.key">
+                                {{ tab.label }}
+                            </div>
+                        </div>
+                        <div class="report-panel">
+                            <template v-if="activeModule">
+                                <div v-if="activeModule.lead" class="core-card">
+                                    <div class="core-card__head">
+                                        <img class="core-card__star" src="@/assets/img/home/start-icon.png" alt="" />
+                                        <span>核心结论</span>
+                                    </div>
+                                    <div class="core-card__body">{{ activeModule.lead }}</div>
+                                </div>
+
+                                <div v-for="(block, bi) in activeModule.blocks" :key="`${block.no}-${bi}`"
+                                    class="point-block" :class="`point-block--s${bi % 3}`">
+                                    <div class="point-block__head">
+                                        <span class="point-block__no">{{ block.no }}</span>
+                                        <span class="point-block__title">{{ block.title }}</span>
+                                    </div>
+                                    <div v-if="block.sub?.length" class="point-block__card">
+                                        <div v-for="(sub, si) in block.sub" :key="`${bi}-${si}`" class="point-sub">
+                                            <!-- 样式 0:金色描边标签 -->
+                                            <template v-if="bi % 3 === 0">
+                                                <span class="point-sub__badge">{{ sub.title }}</span>
+                                                <div class="point-sub__text">{{ sub.text }}</div>
+                                            </template>
+                                            <!-- 样式 1:纯白标题 -->
+                                            <template v-else-if="bi % 3 === 1">
+                                                <div class="point-sub__plain">{{ sub.title }}</div>
+                                                <div class="point-sub__text">{{ sub.text }}</div>
+                                            </template>
+                                            <!-- 样式 2:图标 + 标题 -->
+                                            <template v-else>
+                                                <div class="point-sub__icon-row">
+                                                    <span class="point-sub__icon">
+                                                        <el-icon>
+                                                            <List />
+                                                        </el-icon>
+                                                    </span>
+                                                    <span class="point-sub__icon-title">{{ sub.title }}</span>
+                                                </div>
+                                                <div class="point-sub__text">{{ sub.text }}</div>
+                                            </template>
+                                        </div>
+                                    </div>
+                                </div>
+                            </template>
+                            <div v-else class="report-panel__empty">暂无报告内容</div>
+                        </div>
                     </div>
                 </div>
-                <div class="report-panel">
-                    <div class="report-panel__title">{{ activeReportTabMeta.label }}</div>
-                    <div
-                        v-if="activeReportHtml"
-                        class="report-panel__body"
-                        v-html="activeReportHtml"
-                    ></div>
-                    <div v-else class="report-panel__empty">暂无报告内容</div>
-                </div>
-            </div>
+            </template>
         </div>
-        </template>
 
         <adjustPhenologyPopup ref="adjustPhenologyPopupRef" @confirm="handlePhenologyConfirm" />
-        <restingDatePopup
-            ref="restingDatePopupRef"
-            @confirm="handleRestingDateConfirm"
-            @switchGrowing="handleSwitchGrowing"
-        />
+        <restingDatePopup ref="restingDatePopupRef" @confirm="handleRestingDateConfirm"
+            @switchGrowing="handleSwitchGrowing" />
         <editPlantPointPopup ref="editPlantPointPopupRef" @confirm="handlePlantPointConfirm" />
         <!-- 暂无农场时不弹「完善农场信息」,逻辑保留备用
         <complete-farm-info-popup
@@ -125,16 +149,11 @@ import { computed, onActivated, onDeactivated, onBeforeUnmount, ref } from "vue"
 import { useRouter } from "vue-router";
 // import { useStore } from "vuex";
 import { ElMessage } from "element-plus";
-import { Plus, Edit } from "@element-plus/icons-vue";
+import { Plus, Edit, List } from "@element-plus/icons-vue";
 import adjustPhenologyPopup from "../components/adjustPhenologyPopup.vue";
 import restingDatePopup from "../components/restingDatePopup.vue";
 import editPlantPointPopup from "../components/editPlantPointPopup.vue";
 // import completeFarmInfoPopup from "@/components/popup/completeFarmInfoPopup.vue";
-import tab1Icon from "@/assets/img/report/tab-1.png";
-import tab2Icon from "@/assets/img/report/tab-2.png";
-import tab3Icon from "@/assets/img/report/tab-3.png";
-import tab4Icon from "@/assets/img/report/tab-4.png";
-import tab5Icon from "@/assets/img/report/tab-5.png";
 // import completeFarmPopupImage from "@/assets/img/common/empty-bg-3.png";
 import restorePlantingPopup from "@/components/popup/restorePlantingPopup.vue";
 
@@ -161,45 +180,36 @@ const NO_FARM_CROP = "PAD";
 /** 无定位时的默认点位(与录入页一致) */
 const DEFAULT_POINT = "POINT(113.6142086995688 23.585836479509055)";
 
-/** module1_basic 字段标签 → 基本信息展示项(labels 含接口原文别名) */
-const BASE_FIELD_META = [
-    { key: "crop", labels: ["作物品种", "种植作物"], label: "种植作物:", actionInline: { key: "changeVariety", text: "更改品种" } },
-    // { key: "trait", labels: ["品种特质", "品种优势"], label: "品种特质:" },
-    { key: "phenology", labels: ["物候信息", "物候期"], label: "物候信息:", actionInline: { key: "adjustPhenology", text: "调整物候" } },
-    { key: "soil", labels: ["土壤条件"], label: "土壤条件:", actionBlock: { key: "soilSense", text: "土壤感知" } },
-    { key: "terrain", labels: ["地形条件"], label: "地形条件:", actionInline: { key: "editLocation", text: "修改定位" } },
+/** 报告分模块:tab 文案取自各 module JSON 的 tab 字段 */
+const MODULE_DEFS = [
+    { key: "weather", field: "module2_weather", fallbackLabel: "关键物候风险" },
+    { key: "pest", field: "module3_pest", fallbackLabel: "病虫害风险" },
+    { key: "input", field: "module5_input", fallbackLabel: "建议必要投入" },
+    { key: "quality", field: "module4_quality", fallbackLabel: "潜力品质分析" },
 ];
 
-/** Tab key → report/check 返回字段 */
-const REPORT_TAB_FIELD = {
-    weather: "module2_weather",
-    pest: "module3_pest",
-    quality: "module4_quality",
-    input: "module5_input",
-    manage: "module6_management",
+/** rows.label → 基本信息展示 */
+const BASE_ROW_LABEL_MAP = {
+    物候信息: { key: "phenology", label: "物候信息" },
+    物候期: { key: "phenology", label: "物候信息" },
+    土壤条件: { key: "soil", label: "土壤条件" },
+    地形条件: { key: "terrain", label: "地形条件" },
 };
 
-const reportTabs = [
-    { key: "weather", label: "气象风险", icon: tab1Icon },
-    { key: "pest", label: "病虫风险", icon: tab2Icon },
-    { key: "quality", label: "品质潜力", icon: tab3Icon },
-    { key: "input", label: "必要投入", icon: tab4Icon },
-    { key: "manage", label: "农事管理", icon: tab5Icon },
-];
-
 // ---------------------------------------------------------------------------
 // 页面状态
 // ---------------------------------------------------------------------------
 const loading = ref(false); // 接口尚未返回:只转圈,不带文字
 const reportGenerating = ref(false); // exists=0:模拟进度条,并继续轮询
 const progressPercent = ref(10);
-const varietyList = ref([]);
-const activeVarietyId = ref(null);
+/** 分区列表(getZones) */
+const zoneList = ref([]);
+const selectedZoneId = ref(null);
 const headerDesc = ref("");
 const headerBase = ref("");
 const baseInfoList = ref([]);
-/** 各 Tab 对应的 markdown 原文 */
-const moduleMarkdownMap = ref({});
+/** key → 解析后的模块对象 { id, tab, lead, blocks } */
+const moduleMap = ref({});
 const activeReportTab = ref("weather");
 const adjustPhenologyPopupRef = ref(null);
 const restingDatePopupRef = ref(null);
@@ -218,15 +228,18 @@ let viewToken = 0;
 // ---------------------------------------------------------------------------
 // 计算属性
 // ---------------------------------------------------------------------------
-const activeReportTabMeta = computed(
-    () => reportTabs.find((tab) => tab.key === activeReportTab.value) || reportTabs[0]
+const reportTabs = computed(() =>
+    MODULE_DEFS.map((def) => {
+        const mod = moduleMap.value[def.key];
+        if (!mod) return null;
+        return {
+            key: def.key,
+            label: mod.tab || def.fallbackLabel,
+        };
+    }).filter(Boolean),
 );
 
-const activeReportHtml = computed(() => {
-    const field = REPORT_TAB_FIELD[activeReportTab.value];
-    const md = moduleMarkdownMap.value[field] || "";
-    return md ? markdownToHtml(md) : "";
-});
+const activeModule = computed(() => moduleMap.value[activeReportTab.value] || null);
 
 // ---------------------------------------------------------------------------
 // 工具函数
@@ -251,12 +264,6 @@ function markDiagnosisPopupShown(farmId, zoneId) {
     localStorage.setItem(key, "1");
 }
 
-function hasFarmZone(farm = {}) {
-    const farmId = farm.farm_id ?? farm.id;
-    const zoneId = farm.zone_id ?? farm.zoneId;
-    return farmId != null && farmId !== "" && zoneId != null && zoneId !== "";
-}
-
 /** 无农场报告用点位:优先用户定位 */
 function getPointText() {
     return localStorage.getItem("MINI_USER_LOCATION_POINT") || DEFAULT_POINT;
@@ -269,141 +276,84 @@ function pickLatlonReport(res) {
     return null;
 }
 
-/** 解析 module1_basic:兼容 `**标签**:` 与纯文本 `标签:`(内容可跨行) */
-function parseBasicSections(markdown = "") {
-    const text = String(markdown).replace(/\r\n/g, "\n").trim();
-    if (!text) return {};
-
-    const collect = (re) => {
-        const matches = [...text.matchAll(re)];
-        if (!matches.length) return null;
-        const sections = {};
-        matches.forEach((match, index) => {
-            const label = String(match[1] || "").trim();
-            const start = match.index + match[0].length;
-            const end = index + 1 < matches.length ? matches[index + 1].index : text.length;
-            if (label) sections[label] = text.slice(start, end).trim();
-        });
-        return sections;
-    };
-
-    // 1) markdown:**作物品种**:xxx
-    const mdSections = collect(/\*\*([^*]+)\*\*[::]\s*/g);
-    if (mdSections) return mdSections;
-
-    // 2) 纯文本:作物品种:xxx(按已知标签切分,避免正文里的冒号误伤)
-    const knownLabels = [...new Set(BASE_FIELD_META.flatMap((meta) => meta.labels))];
-    const escaped = knownLabels
-        .map((label) => label.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"))
-        .join("|");
-    if (!escaped) return {};
-    return collect(new RegExp(`(?:^|\\n)(${escaped})[::]\\s*`, "g")) || {};
+/** 模块字段可能是 JSON 字符串或对象 */
+function parseModuleJson(raw) {
+    if (raw == null || raw === "") return null;
+    if (typeof raw === "object") return raw;
+    try {
+        return JSON.parse(raw);
+    } catch {
+        return null;
+    }
 }
 
-function findSectionValue(sections, labels) {
-    for (const label of labels) {
-        if (sections[label]) return sections[label];
-    }
-    return "";
+function normalizeModule(raw) {
+    const data = parseModuleJson(raw);
+    if (!data || typeof data !== "object") return null;
+    const blocks = Array.isArray(data.blocks)
+        ? data.blocks.map((block) => ({
+            no: block?.no || "",
+            title: block?.title || "",
+            text: block?.text || "",
+            sub: Array.isArray(block?.sub)
+                ? block.sub.map((item) => ({
+                    title: item?.title || "",
+                    text: item?.text || "",
+                }))
+                : [],
+        }))
+        : [];
+    return {
+        id: data.id || "",
+        tab: data.tab || "",
+        lead: data.lead || "",
+        blocks,
+    };
 }
 
-function buildBaseInfoList(sections, report = {}) {
-    return BASE_FIELD_META.map((meta) => {
-        let value = findSectionValue(sections, meta.labels);
-        // 种植作物兜底:接口顶层 crop / variety
-        if (!value && meta.key === "crop") {
-            const crop = report.crop || "";
-            const variety = report.variety || "";
-            value = [crop, variety].filter(Boolean).join("-");
-        }
-        return {
+function buildBaseInfoList(basic, report = {}) {
+    const list = [];
+    const crop = report.crop || "";
+    const variety = basic?.variety || report.variety || "";
+    const cropValue = [crop, variety].filter(Boolean).join("-");
+    list.push({
+        key: "crop",
+        label: "种植作物",
+        value: cropValue || "—",
+    });
+    const rows = Array.isArray(basic?.rows) ? basic.rows : [];
+    rows.forEach((row, index) => {
+        const labelText = String(row?.label || "").trim();
+        const meta = BASE_ROW_LABEL_MAP[labelText] || {
+            key: `row-${index}`,
+            label: labelText ? `${labelText}:` : "信息:",
+        };
+        list.push({
             key: meta.key,
             label: meta.label,
-            value: value || "—",
-            actionInline: meta.actionInline,
-            actionBlock: meta.actionBlock,
-        };
+            value: row?.text || "—",
+        });
     });
+    return list;
 }
 
-/** 轻量 markdown → HTML(标题 / 粗体 / 列表) */
-function markdownToHtml(markdown = "") {
-    const escapeHtml = (str) =>
-        String(str)
-            .replace(/&/g, "&amp;")
-            .replace(/</g, "&lt;")
-            .replace(/>/g, "&gt;");
-
-    const lines = String(markdown).replace(/\r\n/g, "\n").split("\n");
-    const html = [];
-    let inList = false;
-
-    const flushList = () => {
-        if (!inList) return;
-        html.push("</ul>");
-        inList = false;
-    };
+function applyReportData(report, farm) {
+    const region = report.region || farm.rawAddress || farm.farm_address || farm.city || "";
+    const farmName = farm.farm_name || farm.name || "";
+    headerDesc.value = region ? `${region}的${farmName || "飞鸟智慧农业"}` : "飞鸟智慧农业";
 
-    const inline = (str) =>
-        escapeHtml(str).replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>");
+    const basic = parseModuleJson(report.module1_basic) || {};
+    baseInfoList.value = buildBaseInfoList(basic, report);
 
-    lines.forEach((raw) => {
-        const line = raw.trimEnd();
-        const trimmed = line.trim();
-        if (!trimmed) {
-            flushList();
-            return;
-        }
-        if (/^###\s+/.test(trimmed)) {
-            flushList();
-            html.push(`<h4>${inline(trimmed.replace(/^###\s+/, ""))}</h4>`);
-            return;
-        }
-        if (/^##\s+/.test(trimmed)) {
-            flushList();
-            html.push(`<h3>${inline(trimmed.replace(/^##\s+/, ""))}</h3>`);
-            return;
-        }
-        if (/^#\s+/.test(trimmed)) {
-            flushList();
-            html.push(`<h2>${inline(trimmed.replace(/^#\s+/, ""))}</h2>`);
-            return;
-        }
-        if (/^[-*]\s+/.test(trimmed)) {
-            if (!inList) {
-                html.push("<ul>");
-                inList = true;
-            }
-            html.push(`<li>${inline(trimmed.replace(/^[-*]\s+/, ""))}</li>`);
-            return;
-        }
-        flushList();
-        html.push(`<p>${inline(trimmed)}</p>`);
+    const nextModules = {};
+    MODULE_DEFS.forEach((def) => {
+        const mod = normalizeModule(report[def.field]);
+        if (mod) nextModules[def.key] = mod;
     });
-    flushList();
-    return html.join("");
-}
+    moduleMap.value = nextModules;
 
-function applyReportData(report, farm) {
-    const region = report.region || farm.rawAddress || farm.farm_address || farm.city || "";
-    const farmName = farm.farm_name || farm.name || "";
-    headerDesc.value = region ? `${region}的${farmName || '飞鸟智慧农业'}` : "飞鸟智慧农业";
-    // headerBase.value = farmName || "我的基地";
-
-    const cropName = report.variety || report.crop || farm.variety_name || farm.categoryLabel || "作物";
-    varietyList.value = [{ id: report.id || 1, name: cropName }];
-    activeVarietyId.value = varietyList.value[0].id;
-
-    const sections = parseBasicSections(report.module1_basic || "");
-    baseInfoList.value = buildBaseInfoList(sections, report);
-
-    moduleMarkdownMap.value = {
-        module2_weather: report.module2_weather || "",
-        module3_pest: report.module3_pest || "",
-        module4_quality: report.module4_quality || "",
-        module5_input: report.module5_input || "",
-        module6_management: report.module6_management || "",
-    };
+    const firstTab = MODULE_DEFS.find((def) => nextModules[def.key]);
+    activeReportTab.value = firstTab?.key || "weather";
 }
 
 function resetReportView(farm = {}) {
@@ -411,10 +361,30 @@ function resetReportView(farm = {}) {
         ? `${farm.rawAddress || farm.farm_address || farm.city}的飞鸟智慧农业`
         : "飞鸟智慧农业";
     headerBase.value = farm.farm_name || farm.name || "我的基地";
-    varietyList.value = [];
-    activeVarietyId.value = null;
     baseInfoList.value = [];
-    moduleMarkdownMap.value = {};
+    moduleMap.value = {};
+}
+
+/** 拉取分区;优先沿用当前选中 / 农场缓存分区 */
+async function fetchZoneList(farmId) {
+    if (farmId == null || farmId === "") {
+        zoneList.value = [];
+        selectedZoneId.value = null;
+        return;
+    }
+    try {
+        const res = await VE_API.questionnaire.getZones({ farm_id: farmId });
+        const zones = Array.isArray(res?.data?.zones) ? res.data.zones : [];
+        zoneList.value = zones;
+        const farm = getSelectedFarm();
+        const prefer = selectedZoneId.value ?? farm.zone_id ?? farm.zoneId;
+        const matched = zones.find((z) => String(z.zone_id) === String(prefer));
+        selectedZoneId.value = (matched || zones[0])?.zone_id ?? null;
+    } catch (e) {
+        console.warn("[diagnosisReport] getZones failed", e);
+        zoneList.value = [];
+        selectedZoneId.value = null;
+    }
 }
 
 // ---------------------------------------------------------------------------
@@ -637,7 +607,7 @@ async function fetchLatlonReport(token) {
 
 async function fetchFarmReport(farm, token) {
     const farmId = farm.farm_id ?? farm.id;
-    const zoneId = farm.zone_id ?? farm.zoneId;
+    const zoneId = selectedZoneId.value ?? farm.zone_id ?? farm.zoneId;
 
     loading.value = true;
     try {
@@ -678,16 +648,40 @@ async function fetchDiagnosisReport() {
     reportGenerating.value = false;
     loading.value = true;
 
-    if (!hasFarmZone(farm)) {
+    const farmId = farm.farm_id ?? farm.id;
+    if (farmId == null || farmId === "") {
+        zoneList.value = [];
+        selectedZoneId.value = null;
         await fetchLatlonReport(token);
         return;
     }
+
+    await fetchZoneList(farmId);
+    if (token !== viewToken) return;
+    if (selectedZoneId.value == null || selectedZoneId.value === "") {
+        resetReportView(farm);
+        loading.value = false;
+        return;
+    }
     await fetchFarmReport(farm, token);
 }
 
 // ---------------------------------------------------------------------------
 // 事件处理 / 生命周期
 // ---------------------------------------------------------------------------
+/** 切换分区后按新 zone_id 重拉报告 */
+const handleSelectZone = (zone) => {
+    if (!zone || String(zone.zone_id) === String(selectedZoneId.value)) return;
+    selectedZoneId.value = zone.zone_id;
+    viewToken += 1;
+    const token = viewToken;
+    stopReportPolling();
+    saveProgressSnapshot();
+    stopProgressTimer();
+    reportGenerating.value = false;
+    fetchFarmReport(getSelectedFarm(), token);
+};
+
 const handleBaseAction = (key) => {
     if (key === "adjustPhenology") {
         adjustPhenologyPopupRef.value?.open();
@@ -751,10 +745,26 @@ onBeforeUnmount(() => {
     height: calc(100vh - 50px);
     overflow: auto;
     -webkit-overflow-scrolling: touch;
-    background: #0a0a0a url("@/assets/img/agricultural/report-bg.png") no-repeat top center;
-    background-size: 100% 250px;
     box-sizing: border-box;
     padding-bottom: 20px;
+    background: #060300;
+    position: relative;
+
+    &::before {
+        content: "";
+        height: 250px;
+        width: 100%;
+        position: absolute;
+        top: 0;
+        left: 0;
+        background: #0a0a0a url("@/assets/img/agricultural/report-bg.png") no-repeat top center;
+        background-size: 100% 250px;
+    }
+
+    .page-content {
+        position: relative;
+        z-index: 2;
+    }
 
     ::v-deep {
         .el-loading-spinner .path {
@@ -782,9 +792,11 @@ onBeforeUnmount(() => {
             color: #ffd489;
         }
     }
+
     .report-progress__content {
         width: 100%;
     }
+
     .report-progress__desc {
         margin-top: 16px;
         font-size: 16px;
@@ -845,16 +857,14 @@ onBeforeUnmount(() => {
     }
 
     .diagnosis-content {
-        padding: 0 12px;
+        padding: 12px 12px;
+        background: #060300;
+        background: linear-gradient(180deg, rgba(6, 3, 0, 0.1) 0%, rgba(6, 3, 0, 0.8) 2%, #060300 100%);
 
         .variety-bar {
             display: flex;
             align-items: center;
-            justify-content: space-between;
-            padding: 10px;
-            background: linear-gradient(180deg, #1a191d 0%, #121216 100%);
-            border: 1px solid rgba(255, 255, 255, 0.1);
-            border-radius: 8px;
+            // justify-content: space-between;
 
             &__tags {
                 display: flex;
@@ -864,14 +874,18 @@ onBeforeUnmount(() => {
             }
 
             &__tag {
-                padding: 5px 16px;
-                border-radius: 4px;
+                padding: 5px 14px;
+                border-radius: 30px;
                 background: rgba(255, 255, 255, 0.05);
                 color: rgba(255, 255, 255, 0.5);
+                border: 1px solid rgba(255, 255, 255, 0.12);
 
                 &.active {
-                    background: linear-gradient(90deg, #ffebc9 0%, #ffca6d 100%);
-                    color: #1a1408;
+                    background: rgba(255, 255, 255, 0.1);
+                    // background: linear-gradient(90deg, #ffebc9 0%, #ffca6d 100%);
+                    color: rgba(255, 255, 255, 1);
+                    border-color: rgba(255, 255, 255, 0.4);
+                    font-weight: 500;
                 }
             }
 
@@ -902,6 +916,7 @@ onBeforeUnmount(() => {
                 gap: 6px;
                 font-size: 17px;
                 color: #fff;
+
                 .title-dot {
                     width: 2px;
                     height: 16px;
@@ -917,7 +932,6 @@ onBeforeUnmount(() => {
             }
 
             &__body {
-                margin-top: 8px;
 
                 .base-data__empty {
                     padding: 20px 0;
@@ -935,11 +949,20 @@ onBeforeUnmount(() => {
                     }
 
                     &__label {
-                        color: rgba(255, 255, 255, 0.45);
+                        display: inline-block;
+                        padding: 1px 6px;
+                        background: rgba(204, 204, 204, 0.1);
+                        border: 1px solid rgba(255, 255, 255, 0.16);
+                        border-radius: 4px;
+                        height: 19px;
+                        line-height: 22px;
+                        margin-right: 10px;
+                        color: rgba(225, 225, 225, 1);
                     }
 
                     &__value {
-                        color: rgba(255, 255, 255, 0.88);
+                        color: rgba(255, 255, 255, 0.8);
+                        line-height: 24px;
                     }
                 }
 
@@ -972,81 +995,41 @@ onBeforeUnmount(() => {
 
         .report-tabs {
             display: flex;
-            align-items: stretch;
-            gap: 8px;
+            align-items: center;
+            gap: 4px;
+            padding: 4px;
             overflow-x: auto;
             -webkit-overflow-scrolling: touch;
             scrollbar-width: none;
+            border-radius: 12px;
+            background: rgba(255, 255, 255, 0.06);
+            border: 1px solid rgba(255, 255, 255, 0.08);
 
             &::-webkit-scrollbar {
                 display: none;
             }
 
             &__item {
-                flex: 0 0 calc((100% - 24px) / 4);
-                display: flex;
-                flex-direction: column;
-                align-items: center;
-                justify-content: center;
-                gap: 4px;
-                min-height: 64px;
-                padding: 8px 4px;
-                box-sizing: border-box;
+                flex: 0 0 auto;
+                padding: 8px 12px;
                 border-radius: 8px;
-                border: 1px solid rgba(255, 255, 255, 0.1);
-                // background: rgba(255, 255, 255, 0.05);
-                background: rgb(22 22 22);
-                color: rgba(255, 255, 255, 0.5);
-                font-size: 12px;
+                font-size: 13px;
+                line-height: 18px;
+                white-space: nowrap;
+                color: rgba(255, 255, 255, 0.45);
+                cursor: pointer;
 
                 &.active {
-                    border-color: transparent;
-                    background: linear-gradient(180deg, #ffebc9 0%, #ffca6d 100%);
-                    color: #1a1408;
-
-                    .report-tabs__icon {
-                        filter: brightness(0);
-                        opacity: 1;
-                    }
+                    background: rgba(255, 255, 255, 0.12);
+                    color: #fff;
+                    font-weight: 500;
                 }
             }
-
-            &__icon {
-                width: 22px;
-                height: 22px;
-                filter: grayscale(1);
-                opacity: 0.55;
-            }
         }
 
         .report-panel {
-            margin-top: 10px;
-            padding: 16px 14px 18px;
-            background: linear-gradient(180deg, #1a191d 0%, #121216 100%);
-            border: 1px solid rgba(255, 255, 255, 0.1);
-            border-radius: 12px;
-
-            &__title {
-                position: relative;
-                display: inline-block;
-                font-size: 18px;
-                font-weight: 600;
-                color: #fff;
-                line-height: 1.3;
-                z-index: 1;
-
-                &::after {
-                    content: "";
-                    position: absolute;
-                    left: 0;
-                    bottom: 1px;
-                    width: 36px;
-                    height: 8px;
-                    border-radius: 8px;
-                    background: linear-gradient(90deg, rgba(255, 212, 137, 0.85) 0%, rgba(255, 212, 137, 0.15) 100%);
-                    z-index: -1;
-                }
-            }
+            margin-top: 12px;
+            padding-bottom: 8px;
 
             &__empty {
                 margin-top: 14px;
@@ -1055,52 +1038,134 @@ onBeforeUnmount(() => {
                 color: rgba(255, 255, 255, 0.45);
                 font-size: 13px;
             }
+        }
+
+        .core-card {
+            padding: 14px;
+            border-radius: 12px;
+            background: linear-gradient(90.51deg, #1A191D 0%, rgba(76, 68, 53, 0.4) 102.25%);
+
+            border: 1px solid rgba(255, 212, 137, 0.24);
+
+            &__head {
+                display: flex;
+                align-items: center;
+                gap: 6px;
+                font-size: 15px;
+                font-weight: 600;
+                color: #ffd489;
+            }
+
+            &__star {
+                width: 11px;
+                // height: 16px;
+            }
 
             &__body {
-                margin-top: 12px;
-                color: rgba(255, 255, 255, 0.75);
+                margin-top: 10px;
                 font-size: 14px;
-                line-height: 1.7;
+                line-height: 22px;
+                color: rgba(255, 255, 255, 0.88);
                 word-break: break-word;
+            }
+        }
 
-                :deep(h2) {
-                    margin: 0 0 10px;
-                    font-size: 16px;
-                    font-weight: 600;
-                    color: #ffd489;
-                }
+        .point-block {
+            margin-top: 18px;
 
-                :deep(h3) {
-                    margin: 14px 0 8px;
-                    font-size: 15px;
-                    font-weight: 600;
-                    color: #fff;
-                }
+            &__head {
+                display: flex;
+                align-items: baseline;
+                gap: 8px;
+                margin-bottom: 10px;
+            }
 
-                :deep(h4) {
-                    margin: 12px 0 6px;
-                    font-size: 14px;
-                    font-weight: 600;
-                    color: rgba(255, 255, 255, 0.85);
-                }
+            &__no {
+                flex-shrink: 0;
+                font-size: 16px;
+                font-weight: 600;
+                color: #ffd489;
+                font-variant-numeric: tabular-nums;
+            }
 
-                :deep(p) {
-                    margin: 0 0 8px;
-                }
+            &__title {
+                font-size: 16px;
+                line-height: 22px;
+                color: #fff;
+            }
 
-                :deep(ul) {
-                    margin: 0 0 10px;
-                    padding-left: 18px;
-                }
+            // 样式 0:整行标题金色
+            &--s0 &__title {
+                color: #ffd489;
+            }
 
-                :deep(li) {
-                    margin-bottom: 4px;
-                }
+            &__card {
+                padding: 14px;
+                border-radius: 12px;
+                background: rgba(255, 255, 255, 0.05);
+                border: 1px solid rgba(255, 255, 255, 0.1);
+            }
+        }
 
-                :deep(strong) {
-                    font-weight: 600;
-                    color: #ffd489;
-                }
+        .point-sub {
+            &+& {
+                margin-top: 12px;
+                padding-top: 12px;
+                border-top: 1px solid rgba(255, 255, 255, 0.08);
+            }
+
+            &__badge {
+                display: inline-flex;
+                align-items: center;
+                padding: 2px 8px;
+                border-radius: 4px;
+                border: 1px solid rgba(255, 212, 137, 0.55);
+                font-size: 12px;
+                line-height: 18px;
+                color: #ffd489;
+            }
+
+            &__plain {
+                font-size: 15px;
+                font-weight: 600;
+                line-height: 22px;
+                color: #fff;
+            }
+
+            &__icon-row {
+                display: flex;
+                align-items: flex-start;
+                gap: 8px;
+            }
+
+            &__icon {
+                flex-shrink: 0;
+                width: 28px;
+                height: 28px;
+                border-radius: 6px;
+                border: 1px solid rgba(255, 212, 137, 0.55);
+                display: inline-flex;
+                align-items: center;
+                justify-content: center;
+                color: #ffd489;
+                font-size: 14px;
+            }
+
+            &__icon-title {
+                flex: 1;
+                font-size: 15px;
+                font-weight: 600;
+                line-height: 22px;
+                color: #fff;
+                padding-top: 3px;
+            }
+
+            &__text {
+                margin-top: 8px;
+                font-size: 13px;
+                line-height: 20px;
+                color: rgba(255, 255, 255, 0.55);
+                word-break: break-word;
             }
         }
     }

+ 57 - 34
src/views/old_mini/agri_file/pages/growthTrack.vue

@@ -1,13 +1,18 @@
 <template>
     <div class="growth-track-page">
         <custom-header
-            :name="pageTitle"
+            name="物候跟踪巡园要点"
             :isGoBack="!isFromShare"
             :isClose="isFromShare"
             :showClose="false"
             @goback="handleBack"
         />
-        <div class="growth-track-body">
+        <div
+            class="growth-track-body"
+            v-loading="loading"
+            element-loading-background="rgba(15, 15, 15, 0.55)"
+            element-loading-text="加载中..."
+        >
             <div class="growth-hero">
                 <div class="growth-hero__share" @click="handleShare">
                     <Icon name="share" color="rgba(255,255,255,0.85)" />
@@ -158,6 +163,7 @@ const DEFAULT_GUIDE_IMAGE = require("@/assets/img/agricultural/patrol-guide.png"
 const UPLOAD_GUIDE_STORAGE_KEY = "GROWTH_TRACK_UPLOAD_GUIDE";
 
 // ---------- 页面状态 ----------
+const loading = ref(false);
 const interactTasks = ref([]);
 const currentTaskIndex = ref(0);
 const selectedOptionId = ref(null);
@@ -167,20 +173,46 @@ const showLeavePopup = ref(false);
 const needDraw = ref(true); // status≠1 时需先勾画种植范围
 const uploadGuideVisible = ref(false);
 
+// ---------- 工具函数 ----------
+function isTruthyFlag(value) {
+    return value === 1 || value === "1" || value === true || value === "true";
+}
+
+function parseMaybeJson(value) {
+    if (value == null || value === "") return null;
+    if (typeof value === "object") return value;
+    try {
+        return JSON.parse(value);
+    } catch {
+        return null;
+    }
+}
+
+/**
+ * 分享链路:dev_login 把整份登录 query 塞进 miniJson,
+ * 真正的页面参数在 miniJson.paramsPage(id / zoneId / fromShare / pageName)
+ */
+function resolvePageParams() {
+    const mini = parseMaybeJson(route.query.miniJson);
+    if (mini) {
+        const page = parseMaybeJson(mini.paramsPage) || {};
+        return { ...mini, ...page };
+    }
+    const paramsPage = parseMaybeJson(route.query.paramsPage);
+    if (paramsPage) {
+        return { ...route.query, ...paramsPage };
+    }
+    return { ...(route.query || {}) };
+}
+
 // ---------- 计算属性 ----------
-const pageTitle = computed(() => route.query.pageName || t("agriFile.patrolGrowthTitle"));
-const id = computed(() => route.query.id);
+const pageParams = computed(() => resolvePageParams());
+const id = computed(
+    () => pageParams.value.zoneId || pageParams.value.id || "",
+);
 
 /** 通过分享进入:无返回箭头 */
-const isFromShare = computed(() => {
-    if (isTruthyFlag(route.query.fromShare)) return true;
-    const paramsPage = parseMaybeJson(route.query.paramsPage);
-    if (isTruthyFlag(paramsPage?.fromShare)) return true;
-    const miniJson = parseMaybeJson(route.query.miniJson);
-    if (isTruthyFlag(miniJson?.fromShare)) return true;
-    if (isTruthyFlag(parseMaybeJson(miniJson?.paramsPage)?.fromShare)) return true;
-    return false;
-});
+const isFromShare = computed(() => isTruthyFlag(pageParams.value?.fromShare));
 
 const currentTask = computed(() => interactTasks.value[currentTaskIndex.value] || null);
 const currentContent = computed(() => currentTask.value?.interact_content || {});
@@ -218,21 +250,6 @@ const interactOptions = computed(() => {
     }));
 });
 
-// ---------- 工具函数 ----------
-function isTruthyFlag(value) {
-    return value === 1 || value === "1" || value === true || value === "true";
-}
-
-function parseMaybeJson(value) {
-    if (value == null || value === "") return null;
-    if (typeof value === "object") return value;
-    try {
-        return JSON.parse(value);
-    } catch {
-        return null;
-    }
-}
-
 function resolveImageUrl(path) {
     if (!path) return "";
     const text = String(path).trim();
@@ -258,12 +275,13 @@ const applyTaskIndex = (index) => {
 };
 
 const fetchInternalInteractTasks = async () => {
-    const { zoneId } = await resolvePairedFarmZone(id.value);
-    if (zoneId == null || zoneId === "") {
-        interactTasks.value = [];
-        return;
-    }
+    loading.value = true;
     try {
+        const { zoneId } = await resolvePairedFarmZone(id.value);
+        if (zoneId == null || zoneId === "") {
+            interactTasks.value = [];
+            return;
+        }
         const res = await VE_API.questionnaire.getInternalInteractTasks({ zone_id: zoneId });
         const tasks = res?.data?.interact_tasks;
         interactTasks.value = Array.isArray(tasks) ? tasks : [];
@@ -271,6 +289,8 @@ const fetchInternalInteractTasks = async () => {
     } catch (e) {
         console.warn("[growthTrack] getInternalInteractTasks failed", e);
         interactTasks.value = [];
+    } finally {
+        loading.value = false;
     }
 };
 
@@ -302,8 +322,11 @@ const handleShare = () => {
         targetUrl: "growth_track",
         paramsPage: JSON.stringify({
             id: id.value,
+            zoneId: id.value,
             fromShare: 1,
-            ...(route.query.pageName ? { pageName: route.query.pageName } : {}),
+            ...(pageParams.value.pageName
+                ? { pageName: pageParams.value.pageName }
+                : {}),
         }),
         imageUrl: "https://birdseye-img.sysuimars.com/farm-h5/growth_cover.png",
     };

+ 42 - 29
src/views/old_mini/agri_file/pages/soilRootTrack.vue

@@ -1,7 +1,7 @@
 <template>
     <div class="soil-root-track-page">
         <custom-header
-            :name="pageTitle"
+            name="土壤根系感知"
             :isGoBack="!isFromShare"
             :isClose="isFromShare"
             :showClose="false"
@@ -303,9 +303,43 @@ const queryContext = ref({
     crop_type: "",
 });
 
+// ---------- 工具函数 ----------
+function isTruthyFlag(value) {
+    return value === 1 || value === "1" || value === true || value === "true";
+}
+
+function parseMaybeJson(value) {
+    if (value == null || value === "") return null;
+    if (typeof value === "object") return value;
+    try {
+        return JSON.parse(value);
+    } catch {
+        return null;
+    }
+}
+
+/**
+ * 分享链路:dev_login 把整份登录 query 塞进 miniJson,
+ * 真正的页面参数在 miniJson.paramsPage(id / zoneId / fromShare / pageName)
+ */
+function resolvePageParams() {
+    const mini = parseMaybeJson(route.query.miniJson);
+    if (mini) {
+        const page = parseMaybeJson(mini.paramsPage) || {};
+        return { ...mini, ...page };
+    }
+    const paramsPage = parseMaybeJson(route.query.paramsPage);
+    if (paramsPage) {
+        return { ...route.query, ...paramsPage };
+    }
+    return { ...(route.query || {}) };
+}
+
 // ---------- 计算属性 ----------
-const pageTitle = computed(() => route.query.pageName || t("agriFile.patrolSoilTitle"));
-const zoneId = computed(() => route.query.zoneId || route.query.id);
+const pageParams = computed(() => resolvePageParams());
+const zoneId = computed(
+    () => pageParams.value.zoneId || pageParams.value.id || "",
+);
 
 const firstInteract = computed(() => interactList.value[0] || null);
 /** interaction_theme */
@@ -327,30 +361,7 @@ const zoneName = computed(() => {
 });
 
 /** 通过分享进入:无返回箭头 */
-const isFromShare = computed(() => {
-    if (isTruthyFlag(route.query.fromShare)) return true;
-    const paramsPage = parseMaybeJson(route.query.paramsPage);
-    if (isTruthyFlag(paramsPage?.fromShare)) return true;
-    const miniJson = parseMaybeJson(route.query.miniJson);
-    if (isTruthyFlag(miniJson?.fromShare)) return true;
-    if (isTruthyFlag(parseMaybeJson(miniJson?.paramsPage)?.fromShare)) return true;
-    return false;
-});
-
-// ---------- 工具函数 ----------
-function isTruthyFlag(value) {
-    return value === 1 || value === "1" || value === true || value === "true";
-}
-
-function parseMaybeJson(value) {
-    if (value == null || value === "") return null;
-    if (typeof value === "object") return value;
-    try {
-        return JSON.parse(value);
-    } catch {
-        return null;
-    }
-}
+const isFromShare = computed(() => isTruthyFlag(pageParams.value?.fromShare));
 
 function getSelectedFarm() {
     try {
@@ -511,10 +522,12 @@ const handleShare = () => {
         shareText: theme.value || "土壤根系巡园要点",
         targetUrl: "soil_root_track",
         paramsPage: JSON.stringify({
-            id: route.query.id,
+            id: pageParams.value.id || zoneId.value,
             zoneId: zoneId.value,
             fromShare: 1,
-            ...(route.query.pageName ? { pageName: route.query.pageName } : {}),
+            ...(pageParams.value.pageName
+                ? { pageName: pageParams.value.pageName }
+                : {}),
         }),
         imageUrl: "https://birdseye-img.sysuimars.com/farm-h5/growth_cover.png",
     };

+ 1 - 1
src/views/old_mini/entry_information/components/baInformation.vue

@@ -27,7 +27,7 @@
             </div>
 
             <div class="map-card">
-                <div class="map-card__map" ref="previewMapRef"></div>
+                <div class="map-card__map" @click.stop="goSelectLocation" ref="previewMapRef"></div>
                 <div class="map-card__locate" @click.stop="handleRelocate">
                     <img class="locate-crosshair__icon" src="@/assets/img/home/current.png" alt="">
                 </div>

+ 56 - 5
src/views/old_mini/entry_information/components/selectCategory.vue

@@ -271,6 +271,7 @@ function flattenCropsFromData(data) {
     return list;
 }
 
+/** 推荐接口无结果时:优势作物 / 可用作物兜底前 N 个 */
 function buildInitialDisplayCrops(list) {
     const allowed = list.filter(isCropAllowed);
     const advantage = allowed
@@ -280,6 +281,39 @@ function buildInitialDisplayCrops(list) {
     return base.slice(0, DEFAULT_CROP_VISIBLE);
 }
 
+/** 点位推荐作物 → 页面品类结构;优先复用全量列表里的完整字段 */
+function mapRecommendToCrop(item, list) {
+    if (item?.crop_id == null) return null;
+    const found = (list || []).find((c) => String(c.id) === String(item.crop_id));
+    if (found) return found;
+    const firstCrop = item.crop_type || "";
+    return {
+        id: item.crop_id,
+        name: item.crop_name || "",
+        code: item.crop_code || "",
+        is_use: "1",
+        isAdvantage: true,
+        advantageRank: item.rank,
+        groupName: item.crop_type || "",
+        firstCrop,
+        majorKey: FIRST_CROP_KEY_MAP[firstCrop] || firstCrop,
+        majorLabel: firstCrop ? `${firstCrop}类` : "",
+    };
+}
+
+async function fetchRecommendCrops() {
+    const point = getResidentPoint();
+    try {
+        const res = await VE_API.pheno.getRecommend({ point_text: point });
+        if (res.code === 200 && Array.isArray(res.data?.crops)) {
+            return res.data.crops;
+        }
+    } catch {
+        // 推荐失败走本地兜底
+    }
+    return [];
+}
+
 /** 将某品类置顶到展示列表并选中 */
 function promoteCropToFront(crop) {
     if (!crop) return;
@@ -498,7 +532,10 @@ async function fetchVarietiesByCrop(cropId, { selectFirst = true } = {}) {
 async function fetchCrops() {
     loading.value = true;
     try {
-        const countyCode = await resolveCountyCode();
+        const [countyCode, recommendRaw] = await Promise.all([
+            resolveCountyCode(),
+            fetchRecommendCrops(),
+        ]);
         const res = await VE_API.entry.getCrops({ county_code: countyCode });
         if (res.code !== 200) {
             allCrops.value = [];
@@ -519,8 +556,20 @@ async function fetchCrops() {
         }
 
         const list = flattenCropsFromData(data);
+        // 顶部 3 个 chip:点位推荐;失败则回退优势/可用作物
+        const recommendMapped = recommendRaw
+            .map((item) => mapRecommendToCrop(item, list))
+            .filter(Boolean)
+            .slice(0, DEFAULT_CROP_VISIBLE);
+        recommendMapped.forEach((crop) => {
+            if (!list.some((c) => String(c.id) === String(crop.id))) {
+                list.push(crop);
+            }
+        });
         allCrops.value = list;
-        let initial = buildInitialDisplayCrops(list);
+        const initial = recommendMapped.length
+            ? recommendMapped
+            : buildInitialDisplayCrops(list);
 
         const cached = readJson(SESSION_KEY);
         const cachedList = Array.isArray(cached) ? cached : [];
@@ -725,8 +774,10 @@ function pickFarmZoneIds(data) {
         data.default_zone_id ??
         data.zones?.[0]?.zone_id ??
         data.zones?.[0]?.id;
+    const county_address = data.county_address || "";
     if (farmId == null || farmId === "" || zoneId == null || zoneId === "") return null;
-    return { farm_id: farmId, zone_id: zoneId };
+    
+    return { farm_id: farmId, zone_id: zoneId, county_address: county_address };
 }
 
 function triggerReportApis(res, crop) {
@@ -736,12 +787,12 @@ function triggerReportApis(res, crop) {
         console.warn("generate_6module skipped: addFarmInfo 未返回 farm_id/zone_id", res);
         return;
     }
-    const meta = readJson(CROP_META_KEY) || {};
+    // const meta = readJson(CROP_META_KEY) || {};
     VE_API.report
         .generate6Module({
             farm_id: ids.farm_id,
             zone_id: ids.zone_id,
-            region: meta.city || meta.county || "",
+            region: ids.county_address || "",
             crop: crop?.name || "",
         })
         .catch(() => {});

+ 1 - 1
src/views/old_mini/entry_information_service/components/serviceLocation.vue

@@ -3,7 +3,7 @@
         <div class="service-location__content">
             <div class="page-header">
                 <div class="page-title">你们从哪里出发服务?</div>
-                <div class="page-subtitle">已自动定位,拖动地图可微调</div>
+                <div class="page-subtitle">已自动定位到你附近,点击地图可修改点位</div>
             </div>
 
             <div class="map-card">

+ 3 - 3
src/views/old_mini/growth_report/index.vue

@@ -346,8 +346,8 @@ function buildInteractCards(data = {}, ctx = {}) {
         pushOptionsCard("pheno", data.pheno, periodIcon);
     }
 
-    // 2. 异常:结论标题 + 描述 + 立即巡园
-    if (data.abnormal) {
+    // 2. 异常:结论标题 + 描述 + 立即巡园;is_answered=1 已答则不展示
+    if (data.abnormal && Number(data.abnormal.is_answered) !== 1) {
         const section = data.abnormal;
         const title = section.title || section.interaction_title || "";
         const desc =
@@ -370,7 +370,7 @@ function buildInteractCards(data = {}, ctx = {}) {
     }
 
     // 3. 土壤根系:问题 + 选项;is_answered=1 已答则不展示
-    if (Number(data.soil_root?.is_answered) !== 1) {
+    if (data.soil_root && Number(data.soil_root.is_answered) !== 1) {
         pushOptionsCard("soil_root", data.soil_root, soilIcon);
     }
     return cards;