2 Commits c74f7802da ... f26f3f37b2

Author SHA1 Message Date
  lxf f26f3f37b2 Merge branch 'farmer' of http://www.sysuimars.cn:3000/feiniao/feiniao-farm-h5 into farmer 1 day ago
  lxf cfd3c82507 fix: 修复长势报告切换bug 1 day ago

+ 1 - 11
src/components/popup/startInteractPopup.vue

@@ -41,7 +41,7 @@
 
 <script setup>
 import { Popup } from "vant";
-import { onActivated, onDeactivated, ref } from "vue";
+import { ref } from "vue";
 import { useRouter } from "vue-router";
 
 const router = useRouter();
@@ -60,22 +60,12 @@ const handleExecuted = () => {
     router.push("/interaction?subjectId=" + localStorage.getItem("selectedFarmId"));
 };
 
-onActivated(() => {
-    // 查询物候期初始化/确认弹窗状态
-    // getPhenologyInitOrConfirmStatus();
-});
-
-onDeactivated(() => {
-    console.log("onDeactivated");
-});
-
 const getPhenologyInitOrConfirmStatus = async () => {
     const { data } = await VE_API.farm_v3.phenologyInitOrConfirmStatus({ subjectId: localStorage.getItem("selectedFarmId") });
     if (!data?.farms ||!data.farms.length) {
         // showValue.value = false;
         return;
     }
-    console.log("getPhenologyInitOrConfirmStatus", data);
     popupData.value = data.farms[0];
     showValue.value = true;
 }

+ 4 - 1
src/views/old_mini/growth_report/index.vue

@@ -6,7 +6,7 @@
         <weather-info ref="weatherInfoRef" from="growth_report" class="weather-info" @weatherExpanded="weatherExpanded"
             @changeGarden="changeGarden" :isGarden="true"></weather-info>
         <div class="report-content-wrap" v-if="hasReport" v-loading="loading" element-loading-background="rgba(0, 0, 0, 0.1)">
-            <swipe class="my-swipe" :loop="false" indicator-color="white" @change="handleSwipeChange">
+            <swipe ref="swipeRef" class="my-swipe" :loop="false" indicator-color="white" @change="handleSwipeChange">
                 <swipe-item v-for="(item, index) in regionsData" :key="index">
                     <div class="report-content has-report" :style="{ minHeight: `calc(100vh - ${tabBarHeight}px)` }">
                         <!-- <img src="@/assets/img/home/qrcode.png" alt="" class="code-icon" /> -->
@@ -168,6 +168,7 @@ const router = useRouter();
 const loading = ref(false);
 const hasReport = ref(false);
 const workItems = ref([]);
+const swipeRef = ref(null);
 
 const paramsPage = ref({});
 const showBindSuccess = ref(false);
@@ -196,6 +197,8 @@ const currentFarmName = ref('');
 const changeGarden = ({ id, name }) => {
     if (!id) return;
     currentFarmName.value = name;
+    swipeRef.value && swipeRef.value.swipeTo(0, {immediate:true});
+    currentIndex.value = 0;
     paramsPage.value = {
         ...(paramsPage.value || {}),
         subjectId: id,

+ 11 - 3
src/views/old_mini/work_detail/index.vue

@@ -11,7 +11,15 @@
                         执行时间已经过去 {{ daysDiff }} 天了
                     </div>
                     <div class="status-sub" v-if="detail?.flowStatus === 3">
-                        距离执行时间还差 {{ daysDiff }} 天
+                        <template v-if="daysDiff > 0">
+                            距离执行时间还差 {{ daysDiff }} 天
+                        </template>
+                        <template v-else-if="daysDiff === 0">
+                            执行时间为今天
+                        </template>
+                        <template v-else>
+                            执行时间已过
+                        </template>
                     </div>
                     <div class="status-sub" v-if="!detail?.flowStatus || detail?.flowStatus === 0">
                         预计触发时间 {{ detail?.executeDate || "--" }}
@@ -260,7 +268,7 @@ const getDetail = () => {
 // 计算距离执行时间的天数差
 const daysDiff = computed(() => {
     if (!detail.value?.executeDate) {
-        return 0;
+        return '--';
     }
 
     const executeDate = new Date(detail.value.executeDate);
@@ -274,7 +282,7 @@ const daysDiff = computed(() => {
     const diffTime = executeDate.getTime() - today.getTime();
     const diffDays = Math.floor(diffTime / (1000 * 60 * 60 * 24));
 
-    return diffDays;
+    return detail.value?.flowStatus === 3 ? diffDays : Math.abs(diffDays);
 });
 
 // 执行方式 Tab 配置