You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
1.5 KiB
Vue

8 months ago
<script setup>
import { onLaunch, onShow, onHide } from '@dcloudio/uni-app'
import { onBeforeMount } from 'vue'
8 months ago
// #ifdef APP
import checkUpdate from '@/uni_modules/uni-upgrade-center-app/utils/check-update';
8 months ago
import { useSystemStore } from '@/store/system.js';
const systemStore = useSystemStore()
// #endif
import { useUserStore } from '@/store/user.js';
const userStore = useUserStore();
8 months ago
onLaunch(() => {
console.log('App Launch')
// #ifdef APP
const appInfo = uni.getAppBaseInfo()
systemStore.setAppInfo(appInfo)
checkAppUpdate()
8 months ago
// #endif
uni.getNetworkType({
success ({ networkType }) {
console.log('enter network', networkType)
if (networkType === 'none') {
uni.showModal({
title: '提示',
content: '当前无网络,请连接网络',
showCancel: false
})
}
}
})
8 months ago
})
onShow(() => {
console.log('App Show')
})
onHide(() => {
console.log('App Hide')
})
onBeforeMount(() => {
// const userInfo = uni.getStorageSync('uInfo')
const userInfo = userStore.getUserInfo();
if (userInfo) {
userStore.setUserInfo(userInfo)
}
8 months ago
})
// 检查更新
function checkAppUpdate () {
// #ifdef APP
checkUpdate().then(res => {
console.log('检查更新结果:', res)
}).catch(error => {
console.log("检查更新错误:", error)
}).finally(() => {
console.log('检查更新结束')
})
// #endif
}
8 months ago
</script>
<style>
#app {
min-height: 100vh;
background-color: #efeff4;
/* background-color: #000; */
/* height: auto; */
}
</style>