|
|
|
@ -1,11 +1,13 @@ |
|
|
|
import { reactive, onMounted, toRefs, computed } from 'vue' |
|
|
|
import { reactive, onMounted, toRefs, computed, watch } from 'vue' |
|
|
|
import { getBackTime } from '@/http/api' |
|
|
|
import { useRouter } from 'vue-router' |
|
|
|
import { useStatistics } from '@/composables/useStatistics' |
|
|
|
import { useStore } from '@/store/root' |
|
|
|
|
|
|
|
export const useHandleScreen = (callback, screenSaveCallback) => { |
|
|
|
const router = useRouter() |
|
|
|
|
|
|
|
const store = useStore() |
|
|
|
const { nativeMethods, mapStatus } = toRefs(store) |
|
|
|
const state = reactive({ |
|
|
|
isWall: false, //当前是回到首页还是回到屏保
|
|
|
|
messageWS: null, |
|
|
|
@ -80,7 +82,11 @@ export const useHandleScreen = (callback, screenSaveCallback) => { |
|
|
|
state.countDownGif = false |
|
|
|
state.isWall = false |
|
|
|
state.countDownToWall = state.times[1] |
|
|
|
screenSaveCallback && screenSaveCallback() |
|
|
|
if (!nativeMethods.value?.hasProgram()) { |
|
|
|
screenSaveCallback && screenSaveCallback() |
|
|
|
} else { |
|
|
|
nativeMethods.value?.goScreenSave() |
|
|
|
} |
|
|
|
resolve() |
|
|
|
} |
|
|
|
}, 1000) |
|
|
|
@ -116,12 +122,21 @@ export const useHandleScreen = (callback, screenSaveCallback) => { |
|
|
|
} |
|
|
|
}, 400) |
|
|
|
} |
|
|
|
|
|
|
|
window.leaveScreenSave = () => { |
|
|
|
checkHandleScreen() |
|
|
|
} |
|
|
|
//初始化相关数据
|
|
|
|
function initMessage() { |
|
|
|
_getBackTime() |
|
|
|
} |
|
|
|
|
|
|
|
watch(mapStatus, newVal => { |
|
|
|
//当地图加载成功之后自动触发一次屏保弹框以便能进入屏保
|
|
|
|
if (newVal) { |
|
|
|
checkHandleScreen() |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
onMounted(initMessage) |
|
|
|
|
|
|
|
return { ...toRefs(state), checkHandleScreen } |
|
|
|
|