Browse Source

feat:修改弹窗显示位置

wangsisi 1 week ago
parent
commit
10ba0c5620

+ 6 - 0
src/components/popup/tipPopup.vue

@@ -8,6 +8,7 @@
         teleport="body"
         :close-on-click-overlay="closeOnClickOverlay"
         @click-overlay="handleClickOverlay"
+        :z-index="zIndex"
     >
         <template v-if="type === 'create'">
             <img class="tip-icon create-icon" src="@/assets/img/home/create-farm-icon.png" alt="" />
@@ -79,6 +80,11 @@ const props = defineProps({
         type: Boolean,
         default: false,
     },
+    // 遮罩层z-index
+    zIndex: {
+        type: Number,
+        default: 2003,
+    },
 });
 
 const emit = defineEmits(["update:show", "confirm", "handleClickOverlay"]);

+ 18 - 16
src/views/old_mini/home/index.vue

@@ -45,12 +45,15 @@
         </div>
         <AgriculturalDynamics />
     </div>
-    <!-- 创建农场弹窗 -->
     <tip-popup
-        v-model:show="showFarmPopup"
-        :type="farmPopupType"
-        :text="farmPopupType === 'create' ? ['您当前还没有农场', '请先创建农场'] : '农场创建成功'"
+        v-model:show="showTipPopup"
+        type="warning"
+        text="请设置"
+        highlightText="种植方案"
+        buttonText="去设置"
         @confirm="handleBtn"
+        :closeOnClickOverlay="false"
+        :zIndex="9999"
     />
 </template>
 
@@ -68,11 +71,18 @@ const tabBarHeight = computed(() => store.state.home.tabBarHeight);
 const router = useRouter();
 const route = useRoute();
 
-const showFarmPopup = ref(false);
-const farmPopupType = ref("create");
+const showTipPopup = ref(false);
+const handleBtn = () => {
+    router.push("/plan?pageType=plant&headerTitle=请设置您的种植方案");
+};
 
-const gardenId = ref(null);
+//判断是否存在可用方案
+async function checkExistsEnabledScheme() {
+    const { data } = await VE_API.home.existsEnabledScheme({containerId:null});
+    console.log(data);
+}
 
+const gardenId = ref(null);
 const isGarden = ref(false);
 const changeGarden = ({ id }) => {
     gardenId.value = id;
@@ -130,20 +140,12 @@ const handleCardClick = (card) => {
     }
 };
 
-const handleBtn = () => {
-    if (farmPopupType.value === "create") {
-        router.push("/create_farm?isReload=true&from=home");
-    }
-};
-
 onActivated(() => {
+    checkExistsEnabledScheme()
     getBannerList();
     isGarden.value = Boolean(localStorage.getItem("isGarden"));
     // 检测是否从创建农场页面成功返回
     if (route.query.showSuccess === "true") {
-        farmPopupType.value = "success";
-        showFarmPopup.value = true;
-
         // 清除URL参数,避免刷新页面时再次显示弹窗
         router.replace({
             path: "/home",

+ 0 - 16
src/views/old_mini/mine/index.vue

@@ -45,16 +45,6 @@
         </div>
         <!-- 角色切换 -->
         <action-sheet :style="{ bottom: 50 + 'px' }" v-model:show="show" :actions="actions" @select="onSelect" />
-        <!-- 问题提醒 -->
-        <tip-popup
-            v-model:show="showTipPopup"
-            type="warning"
-            text="请设置"
-            highlightText="种植方案"
-            buttonText="去设置"
-            @confirm="handleBtn"
-            :closeOnClickOverlay="false"
-        />
     </div>
 </template>
 <script setup>
@@ -64,15 +54,9 @@ import { useStore } from "vuex";
 import wx from "weixin-js-sdk";
 import { ActionSheet } from "vant";
 import { SET_USER_CUR_ROLE } from "@/store/modules/app/type";
-import tipPopup from "@/components/popup/tipPopup.vue";
 const store = useStore();
 const router = useRouter();
 
-const showTipPopup = ref(false);
-const handleBtn = () => {
-    router.push("/plan?pageType=plant&headerTitle=请设置您的种植方案");
-};
-
 // 0: 农户, 1: 专家, 2:农资农服
 const curRole = ref(Number(localStorage.getItem("SET_USER_CUR_ROLE")));
 const roles = ref(JSON.parse(store.state.app.roles));

+ 3 - 1
src/views/old_mini/monitor/subPages/plan.vue

@@ -1,6 +1,6 @@
 <template>
     <div class="plan-page">
-        <custom-header :name="pageType === 'plant' ? '种植方案' : '农事规划'" isGoBack @goback="goback"></custom-header>
+        <custom-header :name="headerTitle" isGoBack @goback="goback" :isClose="route.query.headerTitle?true:false"></custom-header>
         <div class="plan-content">
             <div class="plan-content-header" v-if="pageType === 'plant'">
                 <el-select
@@ -184,9 +184,11 @@ const hasPlanPermission = computed(() => {
 });
 
 const pageType = ref("");
+const headerTitle = ref("");
 
 onMounted(() => {
     pageType.value = route.query.pageType || "";
+    headerTitle.value = route.query.headerTitle || (pageType.value === "plant" ? "种植方案" : "农事规划");
     if (!pageType.value) {
         getFarmWorkPlanForPhenology();
     } else {