Browse Source

fix: 弹窗流程

lxf 1 week ago
parent
commit
64c6723245

BIN
src/assets/img/home/right.png


+ 62 - 38
src/components/detailDialog.vue

@@ -66,7 +66,7 @@
 
             <div class="bottom-btn">
                 <div class="btn-item secondary-btn">咨询专家</div>
-                <div class="btn-item primary-btn">触发农事</div>
+                <div class="btn-item primary-btn" @click="triggerClick">触发农事</div>
             </div>
             <div class="close-btn" v-show="dialogData.isBtn" @click.stop="winDialogVisible=false">
                     <!-- <el-icon size="32" color="#fff"><CircleCloseFilled /></el-icon> -->
@@ -84,27 +84,39 @@
             </div>
         </template>
     </el-dialog>
+
+    
+    <Popup v-model:show="noShow" class="no-popup">
+        <div class="right-icon">
+            <img class="right-img" src="@/assets/img/home/right.png" alt="">
+        </div>
+        <div class="no-popup-title">
+            <span>农事已触发成功</span>
+            <div class="no-popup-title-sub">您可以在 农场监测-农事任务 看到农事状态</div>
+        </div>
+        <div class="no-popup-btn" @click="noShow = false">我知道了</div>
+    </Popup>
 </template>
 <script setup>
-import { onActivated, onDeactivated, onMounted, ref } from "vue";
+import { ref } from "vue";
 import eventBus from "@/api/eventBus";
 import wx from "weixin-js-sdk";
+import { Popup } from "vant";
 import { useRoute, useRouter } from "vue-router";
 
-const props = defineProps({
-    initReload: {
-        type: Boolean,
-        default: false
-    }
-})
-
 const winDialogVisible = ref(false);
+const noShow = ref(false);
 
 const route = useRoute();
 const router = useRouter();
 const sampleId = route.query.sampleId
 const farmId = route.query.farmId;
 
+const triggerClick = () => {
+    winDialogVisible.value = false;
+    noShow.value = true;
+}
+
 const dialogData = ref({
         targetId: "part2",
         title: "梢期防虫",
@@ -280,29 +292,17 @@ const dialogData = ref({
 const currentCard = ref({});
 const showDialog = (pageParams) => {
     // dialogData.value = pageParams.card;
-    currentCard.value = {
-        activeIndex: pageParams.activeIndex,
-        farmWorkName: dialogData.value.farmWorkName,
-        farmId: farmId,
-        sampleId: sampleId,
-    };
-    settingData()
+    // currentCard.value = {
+    //     activeIndex: pageParams.activeIndex,
+    //     farmWorkName: dialogData.value.farmWorkName,
+    //     farmId: farmId,
+    //     sampleId: sampleId,
+    // };
+    // settingData()
     winDialogVisible.value = true;
 };
 
-onMounted(() => {
-    if (props.initReload) {
-        eventBus.on("detailDialog:showDialog", showDialog); 
-    }
-})
-
-onActivated(()=>{
-    eventBus.on("detailDialog:showDialog", showDialog); 
-})
-
-onDeactivated(()=>{
-    eventBus.off("detailDialog:showDialog", showDialog);
-})
+defineExpose({showDialog})
 
 //邀请专家诊断
 const toPage = () =>{
@@ -315,9 +315,6 @@ const handleAct = () =>{
     eventBus.emit("uploadUopup:show",{gardenIdVal:dialogData.value.farmId,orderIdVal:dialogData.value.orderId,textVal:dialogData.value.consequenceText});
 }
 
-// 弹窗关闭
-eventBus.on("detailDialog:toCloseDialog", closeDialog);
-
 
 const pesticideFertilizers = ref([])
 const settingData = () => {
@@ -331,14 +328,8 @@ function flattenDomains(data) {
 
 function closeDialog() {
     winDialogVisible.value = false
-    eventBus.emit("detailDialog:closeDialog")
 }
 
-const toShare = () => {
-    wx.miniProgram.navigateTo({
-        url: `/pages/subPages/share_page/index?pageParams=${JSON.stringify(currentCard.value)}&type=album`,
-    });
-}
 </script>
 
 <style lang="scss" scoped>
@@ -513,6 +504,39 @@ const toShare = () => {
         text-align: center;
     }
 }
+
+
+.no-popup {
+    width: 300px;
+    border-radius: 14px;
+    padding: 28px 15px 20px;
+    box-sizing: border-box;
+    .right-icon {
+        text-align: center;
+        padding-bottom: 12px;
+        .right-img {
+            width: 68px;
+        }
+    }
+    .no-popup-title {
+        font-size: 24px;
+        font-weight: 500;
+        text-align: center;
+        .no-popup-title-sub{
+            font-size: 14px;
+            margin-top: 8px;
+        }
+    }
+    .no-popup-btn {
+        background-color: #2199F8;
+        padding: 8px;
+        border-radius: 20px;
+        color: #fff;
+        font-size: 16px;
+        margin-top: 32px;
+        text-align: center;
+    }
+}
 </style>
 
 <style lang="scss">

+ 6 - 1
src/views/old_mini/home/components/problemReminder.vue

@@ -34,10 +34,13 @@
         </div>
         <div class="no-popup-btn" @click="noShow = false">我知道了</div>
     </Popup>
+        <!-- 农事信息弹窗 -->
+    <detail-dialog ref="detailDialogRef"></detail-dialog>
 </template>
 <script setup>
 import { Popup } from "vant";
 import { ref } from "vue";
+import detailDialog from "@/components/detailDialog.vue"
 
 const show = ref(true);
 const noShow = ref(false);
@@ -46,8 +49,10 @@ const noClick = () => {
     noShow.value = true;
 }
 const yesClick = () => {
-    console.log("yesClick");
+    show.value = false;
+    detailDialogRef.value.showDialog()
 }
+const detailDialogRef = ref(null)
 </script>
 <style lang="scss" scoped>
 .problem-reminder-popup {

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

@@ -34,10 +34,8 @@
             :style="{ zIndex: zIndex }"
             @heightChange="heightChange"
         ></home-floating-panel>
-        <!-- 农事信息弹窗 -->
-        <detail-dialog></detail-dialog>
         <!-- 问题提醒 -->
-        <!-- <problem-reminder></problem-reminder> -->
+        <problem-reminder></problem-reminder>
     </div>
 </template>
 
@@ -47,7 +45,6 @@ import { onMounted, computed, ref } from "vue";
 import { useStore } from "vuex";
 import { useRouter } from "vue-router";
 import weatherInfo from "@/components/weatherInfo.vue";
-import detailDialog from "@/components/detailDialog.vue"
 import homeFloatingPanel from "./components/homeFloatingPanel.vue";
 import problemReminder from "./components/problemReminder.vue";
 const router = useRouter();