|
|
@@ -150,19 +150,35 @@
|
|
|
|
|
|
<!-- 开启底部安全区适配 -->
|
|
|
<number-keyboard safe-area-inset-bottom />
|
|
|
+
|
|
|
+ <!-- 异常巡检识别中:右上角固定 loading + 文案 -->
|
|
|
+ <div v-if="showInspectLoading" class="inspect-loading-fixed">
|
|
|
+ <loading type="spinner" color="#fff" size="18px" />
|
|
|
+ <span class="inspect-loading-fixed__text">识别中</span>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 异常巡检成功:全局弹窗,任意页面可显示 -->
|
|
|
+ <tip-popup
|
|
|
+ v-model:show="showInspectSuccessPopup"
|
|
|
+ type="executeSuccess"
|
|
|
+ text="您已上传成功"
|
|
|
+ text2="诊断报告已生成"
|
|
|
+ buttonText="完成"
|
|
|
+ />
|
|
|
</el-config-provider>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { NumberKeyboard } from "vant";
|
|
|
-import { Tabbar, TabbarItem } from "vant";
|
|
|
-import { nextTick, watch, onMounted, ref, computed } from "vue";
|
|
|
+import { NumberKeyboard, Tabbar, TabbarItem, Loading } from "vant";
|
|
|
+import { nextTick, watch, onMounted, onBeforeUnmount, ref, computed } from "vue";
|
|
|
import { useRoute, useRouter } from "vue-router";
|
|
|
import { useStore } from "vuex";
|
|
|
import { NH, NZ, EXPERT } from "@/common/user_role";
|
|
|
import zhCn from "element-plus/es/locale/lang/zh-cn";
|
|
|
import en from "element-plus/es/locale/lang/en";
|
|
|
import { useI18n } from "@/i18n";
|
|
|
+import eventBus from "@/api/eventBus";
|
|
|
+import tipPopup from "@/components/popup/tipPopup.vue";
|
|
|
|
|
|
const { t, locale } = useI18n();
|
|
|
const store = useStore();
|
|
|
@@ -170,6 +186,40 @@ const elementLocale = computed(() => (locale.value === "en" ? en : zhCn));
|
|
|
const route = useRoute();
|
|
|
const router = useRouter();
|
|
|
|
|
|
+/** 与 growthTrack 异常巡检约定:识别中全局悬浮 loading / 成功全局弹窗 */
|
|
|
+const INSPECT_PENDING_KEY = "AGRI_INSPECT_PENDING";
|
|
|
+const INSPECT_PENDING_EVENT = "inspect-upload-pending";
|
|
|
+const INSPECT_DONE_EVENT = "inspect-upload-done";
|
|
|
+const INSPECT_SUCCESS_KEY = "AGRI_INSPECT_UPLOAD_SUCCESS";
|
|
|
+const INSPECT_SUCCESS_EVENT = "inspect-upload-success";
|
|
|
+const showInspectLoading = ref(false);
|
|
|
+const showInspectSuccessPopup = ref(false);
|
|
|
+
|
|
|
+function openInspectLoading() {
|
|
|
+ showInspectLoading.value = true;
|
|
|
+}
|
|
|
+
|
|
|
+function closeInspectLoading() {
|
|
|
+ sessionStorage.removeItem(INSPECT_PENDING_KEY);
|
|
|
+ showInspectLoading.value = false;
|
|
|
+}
|
|
|
+
|
|
|
+function tryShowInspectLoading() {
|
|
|
+ if (sessionStorage.getItem(INSPECT_PENDING_KEY) !== "1") return;
|
|
|
+ openInspectLoading();
|
|
|
+}
|
|
|
+
|
|
|
+function openInspectSuccessPopup() {
|
|
|
+ closeInspectLoading();
|
|
|
+ sessionStorage.removeItem(INSPECT_SUCCESS_KEY);
|
|
|
+ showInspectSuccessPopup.value = true;
|
|
|
+}
|
|
|
+
|
|
|
+function tryShowInspectSuccessPopup() {
|
|
|
+ if (sessionStorage.getItem(INSPECT_SUCCESS_KEY) !== "1") return;
|
|
|
+ openInspectSuccessPopup();
|
|
|
+}
|
|
|
+
|
|
|
// 首页loading加载完才显示底部导航栏
|
|
|
const showTab = ref(false);
|
|
|
// 0: 农户, 1: 专家, 2:农资农服
|
|
|
@@ -221,6 +271,12 @@ watch(
|
|
|
);
|
|
|
|
|
|
onMounted(() => {
|
|
|
+ tryShowInspectLoading();
|
|
|
+ tryShowInspectSuccessPopup();
|
|
|
+ eventBus.on(INSPECT_PENDING_EVENT, openInspectLoading);
|
|
|
+ eventBus.on(INSPECT_DONE_EVENT, closeInspectLoading);
|
|
|
+ eventBus.on(INSPECT_SUCCESS_EVENT, openInspectSuccessPopup);
|
|
|
+
|
|
|
setTimeout(() => {
|
|
|
curRole.value = store.state.app.curRole;
|
|
|
if (route.meta.showTabbar) {
|
|
|
@@ -237,6 +293,12 @@ onMounted(() => {
|
|
|
}, 500);
|
|
|
});
|
|
|
|
|
|
+onBeforeUnmount(() => {
|
|
|
+ eventBus.off(INSPECT_PENDING_EVENT, openInspectLoading);
|
|
|
+ eventBus.off(INSPECT_DONE_EVENT, closeInspectLoading);
|
|
|
+ eventBus.off(INSPECT_SUCCESS_EVENT, openInspectSuccessPopup);
|
|
|
+});
|
|
|
+
|
|
|
watch(
|
|
|
() => route.name,
|
|
|
(newName, oldName) => {
|
|
|
@@ -264,4 +326,30 @@ watch(
|
|
|
pointer-events: all;
|
|
|
z-index: 9999;
|
|
|
}
|
|
|
+
|
|
|
+.inspect-loading-fixed {
|
|
|
+ position: fixed;
|
|
|
+ top: 10px;
|
|
|
+ right: 12px;
|
|
|
+ z-index: 10000;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ gap: 2px;
|
|
|
+ width: 56px;
|
|
|
+ height: 56px;
|
|
|
+ border-radius: 50%;
|
|
|
+ background: #1989fa;
|
|
|
+ box-shadow: 0 4px 12px rgba(25, 137, 250, 0.35);
|
|
|
+ pointer-events: none;
|
|
|
+
|
|
|
+ &__text {
|
|
|
+ font-size: 11px;
|
|
|
+ line-height: 14px;
|
|
|
+ color: #fff;
|
|
|
+ font-weight: 500;
|
|
|
+ white-space: nowrap;
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|