吉安感知网项目-前端
罗广辉
2026-02-10 d81b425672a8b9c95f46f5712c3e001f97f4b8cb
uniapps/work-app/src/App.vue
@@ -4,7 +4,7 @@
import { useGlobalWS } from '@/hooks/useGlobalWS.js'
// #ifdef APP-PLUS
import { keepAliveStart, requestIgnoreBatteryOptimization } from '@/uni_modules/keep-app'
import { openDialog,closeDialog } from '@/uni_modules/lgh-dialog'
import { openDialog, allowFloat,getBatteryCapacity } from '@/uni_modules/lgh-dialog'
// #endif
const appStore = useAppStore()
@@ -12,34 +12,25 @@
const locationStore = useLocationStore()
// #ifdef APP-PLUS
// import { getBatteryCapacity } from '@/uni_modules/lgh-getbatteryinfo'
// console.log('电池电量:', getBatteryCapacity())
// const currentKey = ref(1)
// function testKeep() {
//    setInterval(() => {
//       currentKey.value = currentKey.value + 1
//       const val = '保活服务验证:' + currentKey.value
//       console.log(val)
//       uni.showToast({ title: val, icon: 'none' })
//    }, 1000)
// }
// testKeep()
// 开启悬浮窗
allowFloat()
// 假设五秒后来电
setTimeout(() => {
   openDialog()
}, 5000)
// #endif
const currentKey = ref(1)
function tests() {
   setInterval(() => {
      currentKey.value = currentKey.value + 1
      const val = '保活服务验证:' + currentKey.value
      console.log(val)
      uni.showToast({ title: val, icon: 'none' })
   }, 1000)
}
function popUpInterface() {
  uni.showToast({ title: '弹框', icon: 'none' })
   openDialog()
}
setTimeout(() => {
   popUpInterface()
},10000)
setTimeout(() => {
   closeDialog()
},20000)
tests()
useGlobalWS()
onShow(async () => {