App.vue 880 Bytes
<script>
	export default {
		onLaunch: function() {
			uni.onNetworkStatusChange(res => {
			    if(res) {
					plus.nativeUI.toast("当前网络已切换!", {
					align : "center",
					verticalAlign : "center"
					});
				}
			});
			try {
				const value = uni.getStorageSync('userData');
				if (value) {
					setTimeout(()=>{
						plus.navigator.closeSplashscreen()
					},1000)
					uni.switchTab({
						url: "/pages/index/index"
					})
				} else {
					plus.navigator.closeSplashscreen()
					uni.redirectTo({
						url: "/pages/login/login"
					})
				}
			} catch (e) {
				// error
			}
		},
		onShow: function() {
			console.log('App Show');
		},
		onHide: function() {
			console.log('App Hide');
		}
	};
</script>

<style>
	@import "./common/main.css";
	@import "./common/iconfont/iconfont.css";
	@import './js_sdk/popUp-tips/popUpTips/index.scss';
</style>