吉安感知网项目-前端
罗广辉
2026-02-26 80988323d104db2fec305408746e90845063897d
feat: 电量无限制保活
2 files modified
5 ■■■■■ changed files
uniapps/work-app/src/App.vue 3 ●●●● patch | view | raw | blame | history
uniapps/work-app/src/hooks/useGlobalWS.js 2 ●●●●● patch | view | raw | blame | history
uniapps/work-app/src/App.vue
@@ -33,7 +33,6 @@
allowFloat()
// #endif
useGlobalWS()
onShow(async () => {
@@ -60,7 +59,7 @@
    // #ifdef APP-PLUS
    keepAliveStart()
    // 请求用户允许忽略电池优化(重要:用于保活)
    setTimeout(requestIgnoreBatteryOptimization, 120000)
    setTimeout(requestIgnoreBatteryOptimization, 10000)
    // #endif
}
uniapps/work-app/src/hooks/useGlobalWS.js
@@ -1,6 +1,7 @@
import { useUserStore } from "@/store/index.js";
import useAppStore from "../store/modules/app/index.js";
import websocketService from "@/utils/websocket.js";
import { openDialog, allowFloat, getBatteryCapacity } from '@/uni_modules/lgh-dialog'
export function useGlobalWS() {
    const userStore = useUserStore();
@@ -36,6 +37,7 @@
        type: 'incoming'
      };
            openDialog()
      // 转义参数以便在URL中传递
      const encodedParams = encodeURIComponent(JSON.stringify(callParams));