Pārlūkot izejas kodu

feat:对接农情弹窗数据

wangsisi 1 nedēļu atpakaļ
vecāks
revīzija
82e3cc586f

+ 14 - 5
src/components/pageComponents/ArchivesFarmTimeLine.vue

@@ -13,8 +13,8 @@
                     class="phenology-bar">
                     <div class="phenology-title"
                         :class="{ 'phenology-red': !shouldShowBlue(p), 'phenology-blue': shouldShowBlue(p) }"
-                        v-if="p.reproductiveList[0]?.phenologyName === getNextPhenologyName(idx, 0)">
-                        {{ p.reproductiveList[0]?.phenologyName }}
+                        v-if="shouldShowPhenologyBarTitle(idx)">
+                        {{ p.phenologyName }}
                     </div>
                     <div v-for="(r, rIdx) in Array.isArray(p.reproductiveList) ? p.reproductiveList : []"
                         :key="`reproductive-${uniqueTimestamp}-${idx}-${rIdx}`" class="reproductive-item">
@@ -83,7 +83,7 @@
                                 </div>
                             </div>
                         </div>
-                        <template v-if="r.name === r.phenologyName">
+                        <template v-if="r.name === p.phenologyName">
                             <div class="phenology-name text-blue"
                                 :class="{ 'phenology-red': !shouldShowBlue(p), 'phenology-blue': shouldShowBlue(p) }"
                                 :style="r.phenologyName === getNextPhenologyName(idx, rIdx) ? 'padding: 6px 0;' : ''">
@@ -91,7 +91,7 @@
                             </div>
                         </template>
                         <template v-else>
-                            <template v-if="r.phenologyName === getNextPhenologyName(idx, rIdx)">
+                            <template v-if="p.phenologyName === getNextPhenologyName(idx, rIdx)">
                                 <div class="phenology-name"
                                     :class="{ 'text-red': !shouldShowBlue(p), 'text-blue': shouldShowBlue(p) }">
                                     {{ r.name }}
@@ -106,7 +106,7 @@
                                     'phenology-red': !shouldShowBlue(p),
                                     'phenology-blue': shouldShowBlue(p),
                                 }">
-                                    {{ r.phenologyName }}
+                                    {{ p.phenologyName }}
                                 </div>
                             </template>
                         </template>
@@ -354,6 +354,14 @@ const handleImageClick = (fw) => {
     showImagePopup.value = true;
 };
 
+// 顶部物候标题:相邻两段 phenologyName 相同时只显示一次(保留第一段)
+const shouldShowPhenologyBarTitle = (idx) => {
+    const list = phenologyList.value;
+    if (!list?.length || idx < 0 || idx >= list.length) return false;
+    if (idx === 0) return true;
+    return list[idx]?.phenologyName !== list[idx - 1]?.phenologyName;
+};
+
 // 获取下一个reproductive-item的phenologyName
 const getNextPhenologyName = (currentPhenologyIdx, currentReproductiveIdx) => {
     const currentPhenology = phenologyList.value[currentPhenologyIdx];
@@ -652,6 +660,7 @@ const getFarmWorkPlan = () => {
                                 id: it.id ?? it.phenologyId ?? it.name ?? `${it.progress}-${it.progress2}`,
                                 progress: Number(it.progress) || 0, // 起点 %
                                 progress2: Number(it.progress2) || 0, // 终点 %
+                                phenologyName: it.phenologyName,
                                 startDate: it.startDate,
                                 startTimeMs: safeParseDate(
                                     it.startDate || it.beginDate || it.startTime || it.start || it.start_at

+ 1 - 1
src/components/popup/agriExecutePopup.vue

@@ -21,7 +21,7 @@
             <div class="popup-title">{{ popupData.title }}</div>
 
             <!-- 异常信息区域 -->
-            <div class="abnormal-info">
+            <div class="abnormal-info" v-if="popupData.abnormalText">
                 {{ popupData.abnormalText }}
             </div>
 

+ 55 - 47
src/views/old_mini/agri_record/index.vue

@@ -4,14 +4,8 @@
         <!-- 天气遮罩 -->
         <div class="weather-mask" v-show="isExpanded" @click="handleMaskClick"></div>
         <!-- 天气 -->
-        <weather-info
-            ref="weatherInfoRef"
-            class="weather-info"
-            @weatherExpanded="weatherExpanded"
-            @changeGarden="changeGarden"
-            :isGarden="true"
-            :gardenId="defaultGardenId"
-        ></weather-info>
+        <weather-info ref="weatherInfoRef" class="weather-info" @weatherExpanded="weatherExpanded"
+            @changeGarden="changeGarden" :isGarden="true" :gardenId="defaultGardenId"></weather-info>
         <!-- 作物档案 -->
         <div class="archives-time-line">
             <div class="archives-time-line-header">
@@ -20,37 +14,32 @@
             </div>
             <!-- 品种选择 -->
             <div class="variety-tabs" v-if="varietyTabs.length > 0">
-                <div
-                    v-for="(v, index) in varietyTabs"
-                    :key="index"
-                    class="variety-tab"
-                    :class="{ 'variety-tab--active': activeVariety === index }"
-                    @click="handleVarietyClick(v,index)"
-                >
+                <div v-for="(v, index) in varietyTabs" :key="index" class="variety-tab"
+                    :class="{ 'variety-tab--active': activeVariety === index }" @click="handleVarietyClick(v, index)">
                     {{ v.regionName }}
                 </div>
             </div>
-            <!-- <template v-if="true">
+            <template v-if="!varietyTabs.length">
                 <div class="lock-img" @click="handleLockClick">
                     <img src="@/assets/img/home/lock-blue.png" alt="" class="lock-img-item" />
-                    <div class="lock-text">解锁某某某某某,解锁某某某某某</div>
+                    <div class="lock-text">
+                        专属数字农场,种好卖好
+                        <div>点击解锁一键溯源增产</div>
+                    </div>
+
+                    <div class="lock-btn">点击解锁</div>
                 </div>
                 <img class="example-img" src="@/assets/img/monitor/example.png" alt="">
-            </template> -->
+            </template>
             <div class="archives-time-line-content">
-                <archives-farm-time-line :farmId="farmIdData" :containerId="containerData" pageType="agri_record"></archives-farm-time-line>
+                <archives-farm-time-line :farmId="farmIdData" :containerId="containerData"
+                    pageType="agri_record"></archives-farm-time-line>
             </div>
         </div>
     </div>
 
-    <tip-popup
-        v-model:show="showFarmPopup"
-        type="success"
-        text="农场领取成功"
-        :overlay-style="{ 'backdrop-filter': 'blur(4px)' }"
-        :closeOnClickOverlay="false"
-        :zIndex="9999"
-    />
+    <tip-popup v-model:show="showFarmPopup" type="success" text="农场领取成功"
+        :overlay-style="{ 'backdrop-filter': 'blur(4px)' }" :closeOnClickOverlay="false" :zIndex="9999" />
 </template>
 
 <script setup>
@@ -65,17 +54,17 @@ import tipPopup from "@/components/popup/tipPopup.vue";
 import { ElMessage, ElMessageBox } from "element-plus";
 import ArchivesFarmTimeLine from "@/components/pageComponents/ArchivesFarmTimeLine.vue";
 
-const handleFarmInfoClick = () =>{
-    const query = {
-        askInfo: { title: "农场认领", content: "是否分享该链接给好友" },
-        shareText: "邀您参与农情互动,获取专家精准指导",
-        targetUrl: `home`,
-        paramsPage: JSON.stringify({isFarmer:true}),
-        imageUrl: 'https://birdseye-img.sysuimars.com/birdseye-look-mini/share-lz-bg.png',
-    };
-    wx.miniProgram.navigateTo({
-        url: `/pages/subPages/share_page/index?pageParams=${JSON.stringify(query)}&type=sharePage`,
-    });
+const handleFarmInfoClick = () => {
+    // const query = {
+    //     askInfo: { title: "农场认领", content: "是否分享该链接给好友" },
+    //     shareText: "邀您参与农情互动,获取专家精准指导",
+    //     targetUrl: `home`,
+    //     paramsPage: JSON.stringify({isFarmer:true}),
+    //     imageUrl: 'https://birdseye-img.sysuimars.com/birdseye-look-mini/share-lz-bg.png',
+    // };
+    // wx.miniProgram.navigateTo({
+    //     url: `/pages/subPages/share_page/index?pageParams=${JSON.stringify(query)}&type=sharePage`,
+    // });
 }
 
 // 品种选择(作物档案内)- 根据主体ID动态获取分区列表
@@ -91,17 +80,17 @@ const getVarietyTabs = async () => {
             subjectId: gardenId.value,
         });
         varietyTabs.value = res.data || []
-        if(varietyTabs.value.length > 0) {
-            handleVarietyClick(varietyTabs.value[0],0)
+        if (varietyTabs.value.length > 0) {
+            handleVarietyClick(varietyTabs.value[0], 0)
         }
     } catch (error) {
         console.error("获取主体分区列表失败:", error);
     }
 };
 
-const farmIdData= ref(null);
+const farmIdData = ref(null);
 const containerData = ref(null);
-const handleVarietyClick = (tab,index) => {
+const handleVarietyClick = (tab, index) => {
     activeVariety.value = index;
     farmIdData.value = tab.farmId;
     containerData.value = tab.containerId;
@@ -343,6 +332,7 @@ const changeGarden = ({ id }) => {
     padding: 13px 10px;
     box-sizing: border-box;
     background: linear-gradient(180deg, #f9f9f9 0%, #f0f8ff 31.47%, #f9f9f9 46.81%, #f9f9f9 69.38%, #f9f9f9 100%);
+
     .weather-mask {
         position: fixed;
         top: 0;
@@ -352,8 +342,10 @@ const changeGarden = ({ id }) => {
         background-color: rgba(0, 0, 0, 0.52);
         z-index: 11;
     }
+
     .lock-img {
         position: fixed;
+        z-index: 10;
         top: 50%;
         left: 50%;
         transform: translate(-50%, -20%);
@@ -369,37 +361,52 @@ const changeGarden = ({ id }) => {
         }
 
         .lock-text {
-            font-size: 16px;
+            font-size: 14px;
             color: #000;
-            padding: 0 24px;
-            height: 34px;
-            line-height: 34px;
+            padding: 5px 64px;
+            line-height: 21px;
             background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, #FFFFFF 50%, rgba(255, 255, 255, 0) 100%);
         }
+
+        .lock-btn {
+            width: 140px;
+            height: 40px;
+            line-height: 40px;
+            text-align: center;
+            background: linear-gradient(180deg, #76C3FF 0%, #2199F8 100%);
+            border-radius: 25px;
+            color: #fff;
+            font-size: 16px;
+        }
     }
 
-    .example-img{
+    .example-img {
         width: 100%;
         height: 100%;
         object-fit: contain;
     }
+
     .weather-info {
         width: calc(100% - 20px);
         position: absolute;
         z-index: 12;
     }
+
     .archives-time-line {
         position: relative;
         margin-top: 96px;
         height: calc(100% - 90px);
+
         .archives-time-line-header {
             display: flex;
             align-items: center;
             justify-content: space-between;
+
             .line-title {
                 position: relative;
                 padding-left: 14px;
                 font-size: 16px;
+
                 &::before {
                     content: "";
                     position: absolute;
@@ -413,6 +420,7 @@ const changeGarden = ({ id }) => {
                 }
             }
         }
+
         .variety-tabs {
             display: flex;
             align-items: center;

+ 11 - 5
src/views/old_mini/interactionList/index.vue

@@ -123,7 +123,7 @@
                     </div>
                 </div>
 
-                <div class="invite-btn">邀请农情互动</div>
+                <div class="invite-btn" v-if="item.imagePaths.length === 0">邀请农情互动</div>
             </div>
 
             <!-- 比例信息(已上传状态显示) -->
@@ -476,8 +476,7 @@ const showExample = (item, index, options = {}) => {
 const loadData = async () => {
     loading.value = true;
     try {
-        const { data } = await VE_API.home.listTriggeredByFarm({ farmId: 98156,interactionTypeId:'' })
-        // const { data } = await VE_API.home.listTriggeredByFarm({ farmId: localStorage.getItem("selectedFarmId"),interactionTypeId:'' })
+        const { data } = await VE_API.home.listTriggeredByFarm({ farmId: query.value.farmId,regionId:query.value.regionId,interactionTypeId:query.value.interactionTypeId })
         listData.value = data.map(item => {
             // question 按 || 切割成数组,用于循环渲染
             const questionStr = item.question != null ? String(item.question) : '';
@@ -534,7 +533,7 @@ const handleConfirm = async (item, isConfirm) => {
         }
     }
     const parmas = {
-        farmId: localStorage.getItem("selectedFarmId"),
+        farmId: query.value.farmId,
         imagePaths: item.imagePaths.concat(uploadData.value),
         isUploadPhoto: item.imagePaths.concat(uploadData.value).length > 0 ? true : false,
         rangeWkt: sessionStorage.getItem("drawRegionPolygonData") || '',
@@ -576,7 +575,7 @@ const handleConfirmUpload = async () => {
     const answerVals = (item.answerValues || []).slice(0, len);
     const parmas = {
         interactionId: item.id,
-        farmId: localStorage.getItem("selectedFarmId"),
+        farmId: query.value.farmId,
         imagePaths: uploadData.value,
         rangeWkt: sessionStorage.getItem("drawRegionPolygonData") || '',
         replyText: item.replyText,
@@ -663,6 +662,13 @@ const onCopyWechatId = () => {
 const oldUser = ref(false);
 // 页面从勾画页返回时,如果组件被 keep-alive 缓存,则会触发 onActivated,在此再做一次回显
 onActivated(() => {
+    if(!localStorage.getItem('showUploadTipsPopup')) {
+        showUploadTipsPopup.value = true;
+        setTimeout(() => {
+            showUploadTipsPopup.value = false;
+            localStorage.setItem('showUploadTipsPopup', true);
+        }, 3000);
+    }
     // 初始化加载
     getFarmList();
     // 加载数据

+ 26 - 11
src/views/old_mini/monitor/index.vue

@@ -27,13 +27,18 @@
                     {{ v.regionName }}
                 </div>
             </div>
-            <!-- <template v-if="!hasReport">
+            <template v-if="!varietyTabs.length">
                 <div class="lock-img" @click="handleLockClick">
                     <img src="@/assets/img/home/lock-blue.png" alt="" class="lock-img-item" />
-                    <div class="lock-text">解锁某某某某某,解锁某某某某某</div>
+                    <div class="lock-text">
+                        专属数字农场,种好卖好
+                        <div>点击解锁一键溯源增产</div>
+                    </div>
+
+                    <div class="lock-btn">点击解锁</div>
                 </div>
                 <img class="example-img" src="@/assets/img/monitor/example.png" alt="">
-            </template> -->
+            </template>
             <div class="archives-time-line-content">
                 <div class="report-box" v-if="hasReport">
                     <div class="box-content">
@@ -131,14 +136,13 @@ const showAgriExecutePopup = ref(false); // 农事执行弹窗
 const agriExecuteData = ref({});
 const handleAgriExecuted = () => {
     showAgriExecutePopup.value = false;
-    // router.push("/interaction_list?expertMiniUserId=81881&oldUser=true");
     handleClosePopup();
-    router.push("/interaction_list?expertMiniUserId=81881");
+    router.push(`/interaction_list?farmId=${farmIdData.value}&regionId=${regionData.value}&interactionTypeId=${expertInfo.value.interactionTypeId}`);
 };
 
 const expertInfo = ref({});
 const checkHasUnrepliedTriggeredInteraction = async () => {
-    const { data } = await VE_API.home.hasUnrepliedTriggeredInteraction({ farmId: localStorage.getItem("selectedFarmId") });
+    const { data } = await VE_API.home.hasUnrepliedTriggeredInteraction({ subjectId: gardenId.value });
     if (data && data.id != null) {
         expertInfo.value = data;
         agriExecuteData.value = {
@@ -335,6 +339,7 @@ const getReport = () => {
 
     .lock-img {
         position: fixed;
+        z-index: 10;
         top: 50%;
         left: 50%;
         transform: translate(-50%, -20%);
@@ -350,16 +355,26 @@ const getReport = () => {
         }
 
         .lock-text {
-            font-size: 16px;
+            font-size: 14px;
             color: #000;
-            padding: 0 24px;
-            height: 34px;
-            line-height: 34px;
+            padding: 5px 64px;
+            line-height: 21px;
             background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, #FFFFFF 50%, rgba(255, 255, 255, 0) 100%);
         }
+
+        .lock-btn {
+            width: 140px;
+            height: 40px;
+            line-height: 40px;
+            text-align: center;
+            background: linear-gradient(180deg, #76C3FF 0%, #2199F8 100%);
+            border-radius: 25px;
+            color: #fff;
+            font-size: 16px;
+        }
     }
 
-    .example-img{
+    .example-img {
         width: 100%;
         height: 100%;
         object-fit: contain;