| | |
| | | import { useAppStore, useUserStore, useLocationStore } from '@/store' |
| | | import { useGlobalWS } from '@/hooks/useGlobalWS.js' |
| | | // #ifdef APP-PLUS |
| | | import { keepAliveStart } from '@/uni_modules/keep-app' |
| | | import { keepAliveStart, requestIgnoreBatteryOptimization } from '@/uni_modules/keep-app' |
| | | // #endif |
| | | |
| | | const appStore = useAppStore() |
| | |
| | | const locationStore = useLocationStore() |
| | | |
| | | // #ifdef APP-PLUS |
| | | import { getBatteryCapacity } from '@/uni_modules/lgh-getbatteryinfo' |
| | | console.log('电池电量:', getBatteryCapacity()) |
| | | // import { getBatteryCapacity } from '@/uni_modules/lgh-getbatteryinfo' |
| | | // console.log('电池电量:', getBatteryCapacity()) |
| | | // #endif |
| | | |
| | | const valuetest = ref(1) |
| | |
| | | setInterval(() => { |
| | | valuetest.value = valuetest.value + 1 |
| | | console.log('valuetest.value:', valuetest.value) |
| | | |
| | | uni.showToast({title: valuetest.value, icon: 'none'}); |
| | | uni.showToast({ title: valuetest.value, icon: 'none' }) |
| | | }, 1000) |
| | | } |
| | | |
| | | tests() |
| | | useGlobalWS() |
| | | |
| | | onShow(async () => { |
| | |
| | | } |
| | | } |
| | | }) |
| | | tests() |
| | | |
| | | onHide(() => { |
| | | console.log('App Hide') |
| | |
| | | appStore.initSystemInfo() |
| | | // #ifdef APP-PLUS |
| | | keepAliveStart() |
| | | // 请求用户允许忽略电池优化(重要:用于保活) |
| | | setTimeout(() => { |
| | | requestIgnoreBatteryOptimization() |
| | | }, 2000) |
| | | // #endif |
| | | if (!userStore.userInfo) { |
| | | //不存在则跳转至登录页 |