62 lines
1.7 KiB
Vue
62 lines
1.7 KiB
Vue
<script setup lang="ts">
|
|
import jxMOdal from '@/components/dialog/dialogUtil'
|
|
import { onLaunch, onShow } from '@dcloudio/uni-app'
|
|
import App from './App'
|
|
import globalAlert from '@/components/globalAlert/globalAlert'
|
|
import useGlobalFunc from './composables/useGlobalFunc'
|
|
// import { isOpenNotice } from './utils/android_ios'
|
|
import { getStorage, setStorage } from './utils/storage'
|
|
import { store } from "@/store";
|
|
const {
|
|
appKeepAlive, // 应用保活
|
|
listenMsg, // 监听消息
|
|
} = App()
|
|
const { watchVersion } = useGlobalFunc() // 监听版本
|
|
|
|
// 三端通用
|
|
const {
|
|
SystemInfo, //获取本机设备信息
|
|
onNetWorkStatusChange, // 监听网络状态
|
|
onPrinterChange, // 监听打印机状态
|
|
} = App()
|
|
|
|
// 进入应用
|
|
onLaunch(() => {
|
|
SystemInfo() // 获取本机设备信息
|
|
uni['jxAlert'] = jxMOdal.alert // 全局挂载 jxMOdal
|
|
uni['jxConfirm'] = jxMOdal.confirm // 全局挂载 jxMOdal
|
|
onNetWorkStatusChange() // 监听网络状态
|
|
onPrinterChange() // 监听打印机状态
|
|
appKeepAlive() // 应用保活
|
|
listenMsg() // 监听消息穿透
|
|
uni['globalAlert'] = globalAlert // 挂载全局可覆盖tabar弹窗
|
|
plus.device.setWakelock(true) // 打开程序后一直保持唤醒状态(常亮)
|
|
watchVersion((isUpdate: boolean) => {
|
|
// 检查是否更新版本
|
|
if (isUpdate) {
|
|
uni.globalAlert({
|
|
data: {
|
|
type: 3,
|
|
},
|
|
})
|
|
}
|
|
})
|
|
|
|
// 初始化平台
|
|
if (!getStorage('terrace')) setStorage('terrace', 'jxcs')
|
|
store.dispatch('serveInfo/get_services')
|
|
})
|
|
|
|
// 应用进入前台
|
|
onShow(() => {
|
|
// 清除角标
|
|
plus.runtime.setBadgeNumber(0)
|
|
})
|
|
</script>
|
|
<style>
|
|
@import './static/font/iconfont.css';
|
|
page {
|
|
background-color: #efefef;
|
|
}
|
|
</style>
|