diff --git a/src/components/PublicComponent/PublicComponent.vue b/src/components/PublicComponent/PublicComponent.vue index 9abdd3d..5fcb564 100644 --- a/src/components/PublicComponent/PublicComponent.vue +++ b/src/components/PublicComponent/PublicComponent.vue @@ -27,9 +27,19 @@ const AutoBackNotification = defineAsyncComponent(() => import('@/base/AutoBackN const router = useRouter() const route = useRoute() const store = useRootStore() -const { language, showSearch, showDetail } = storeToRefs(store) -const { checkHandleScreen, showCountDownDialog, title, toIndexTime, toWallpaperTime, isWallpaper, setLogout, resetClickNumber, logout } = - useHandleScreen(handleScreen) +const { language, showSearch, showDetail, mapStatus } = storeToRefs(store) +const { + checkHandleScreen, + showCountDownDialog, + title, + toIndexTime, + toWallpaperTime, + isWallpaper, + setLogout, + resetClickNumber, + logout, + sleepToWallpaper +} = useHandleScreen(handleScreen) //指定时间返回首页时做的操作 function handleScreen() { @@ -54,6 +64,13 @@ onBeforeUnmount(() => { window.removeEventListener('touchend', checkHandleScreen) }) +watch(mapStatus, newVal => { + //当地图加载成功之后自动触发一次屏保弹框以便能进入屏保 + if (newVal) { + sleepToWallpaper() + } +}) + watch(route, to => { if (to.fullPath === '/' || to.fullPath === '/nav') { window?.Map_QM?.startRender() diff --git a/src/composables/useHandleScreen.ts b/src/composables/useHandleScreen.ts index 24cb96e..47beebf 100644 --- a/src/composables/useHandleScreen.ts +++ b/src/composables/useHandleScreen.ts @@ -68,7 +68,7 @@ export const useHandleScreen = (callback: () => void) => { callback() } - //没有屏保的话不允许弹出屏保弹框 TODO:后期由容器通知 + //时间为-1时的话不允许弹出屏保弹框 TODO:后期由容器通知 if (toWallpaperTime.value === -1) { return } @@ -105,6 +105,7 @@ export const useHandleScreen = (callback: () => void) => { logout, checkHandleScreen, resetClickNumber, + sleepToWallpaper, setLogout } }