<template> <view class='stat-page'> <view class='start-btn' @click='start'></view> </view> </template> <script> import { ininIndex, initIndexGoods, initH5Setting, initAPPSetting } from '@/utils/index' export default { async onLoad() { // 监听网络变化,如果 uni.onNetworkStatusChange(async (res) => { if (res.isConnected) { await ininIndex() await initIndexGoods() await initH5Setting() await initAPPSetting() } }) // 首页配置 await ininIndex() await initIndexGoods() // APP配置和H5配置 await initH5Setting() await initAPPSetting() this.init() }, //设置页面全屏 onShow() { // #ifdef APP-PLUS plus.navigator.setFullscreen(true);//隐藏手机顶部状态栏 plus.navigator.hideSystemNavigation();//隐藏手机底部导航按键 // #endif }, //监听页面卸载事件 如果不加这句,会导致跳转到别的页面后也是全屏 onUnload() { // #ifdef APP-PLUS plus.navigator.setFullscreen(false);//显示手机顶部状态栏 plus.navigator.showSystemNavigation();//显示手机底部导航按键 // #endif }, methods: { init() { try { if (!uni.getStorageSync('m-agreement') && uni.getSystemInfoSync().platform === 'ios') { this.Go('uni:/pages/agreement/index') } } catch (err) { console.log(err) } }, // 点击跳转到首页 start() { uni.getNetworkType({ success: async function (res) { if (res.networkType !== 'none') { uni.setStorageSync('appStart', true) uni.switchTab({ url: "/pages/index/index" }) } else { uni.showModal({ title: "系统提示", content: "当前设备无网络或网络弱,请检查网络状态", success: function (res) { if (res.confirm) { plus.runtime.restart(); } else if (res.cancel) { if (uni.getSystemInfoSync().platform === 'ios') { plus.ios.import('UIApplication').sharedApplication().performSelector('exit'); } else { plus.runtime.quit(); } } } }) } }, }) } } } </script> <style src="./index.less" lang="less" scoped></style>