<script lang="uts">
	let firstBackTime = 0
	let timer = 0;
	
	export default {
		onLaunch: function () {
			console.log('App Launch')
			uni.setStorageSync("notify_key", "0")
		},
		onShow: function () {
			console.log('App Show')
		},
		onHide: function () {
			console.log('App Hide')
			// this.startTimer();
		},
		// #ifdef APP-ANDROID
		onLastPageBackPress: function () {
			console.log('App LastPageBackPress')
			// #ifdef APP-ANDROID
				UTSAndroid.getUniActivity()?.moveTaskToBack(true)
			// #endif
			
			// #ifdef APP-HARMONY
				UTSHarmony.getUIAbilityContext().moveAbilityToBackground()
			// #endif
			// if (firstBackTime == 0) {
			// 	uni.showToast({
			// 		title: '再按一次退出应用',
			// 		position: 'bottom',
			// 	})
			// 	firstBackTime = Date.now()
			// 	setTimeout(() => {
			// 		firstBackTime = 0
			// 	}, 2000)
			// } else if (Date.now() - firstBackTime < 2000) {
			// 	firstBackTime = Date.now()
			// 	uni.exit()
			// }
		},
		// #endif
		onExit: function () {
			console.log('App Exit')
		},
		methods:{
			startTimer() {
			  console.log("==========")
			  timer = setInterval(() => {
				console.log('定时器运行');
				// 这里写你的定时任务
			  }, 10000); // 每1000毫秒运行一次
			},
			stopTimer() {
			  if (timer > 0) {
				clearInterval(timer);
				timer = 0;
			  }
			}
		}
	}
</script>

<style lang="scss">
	@import './static/css/form.scss';
	/*每个页面公共css */
	
	/* 布局 */
	.uni-row {
		flex-direction: row;
	}

	.uni-column {
		flex-direction: column;
	}
	
	/* 文字颜色 */
	.text-primary {
		color: #333333;
	}
	
	.text-secondary {
		color: #666666;
	}
	
	.text-placeholder {
		color: #999999;
	}
	
	/* 背景色 */
	.bg-white {
		background-color: #ffffff;
	}
	
	.bg-gray {
		background-color: #f5f5f5;
	}
	
	/* 间距 */
	.padding-sm {
		padding: 15rpx;
	}
	
	.padding-md {
		padding: 20rpx;
	}
	
	.padding-lg {
		padding: 30rpx;
	}
	
	.margin-sm {
		margin: 15rpx;
	}
	
	.margin-md {
		margin: 20rpx;
	}
	
	.margin-lg {
		margin: 30rpx;
	}
	
	/* 圆角 */
	.radius-sm {
		border-radius: 4rpx;
	}
	
	.radius-md {
		border-radius: 8rpx;
	}
	
	.radius-lg {
		border-radius: 12rpx;
	}
</style>

<style>
	/* #ifdef APP-HARMONY */
	/* 鸿蒙平台全局样式 */
	.l-input__placeholder {
		font-weight: 400 !important;
		font-size: 28rpx !important;
		color: #999999 !important;
	}

	.l-textarea__placeholder {
		font-weight: 400 !important;
		font-size: 28rpx !important;
		color: #999999 !important;
	}

	.l-input__control {
		font-weight: 400 !important;
		font-size: 28rpx !important;
		color: #131415 !important;
	}

	.l-textarea__control {
		font-weight: 400 !important;
		font-size: 28rpx !important;
		color: #131415 !important;
	}

	.uni-input-input {
		font-weight: 400 !important;
		font-size: 28rpx !important;
		color: #131415 !important;
	}

	.uni-textarea-textarea {
		font-weight: 400 !important;
		font-size: 28rpx !important;
		color: #131415 !important;
	}

	.uni-input-placeholder,
	.uni-textarea-placeholder {
		font-weight: 400 !important;
		font-size: 28rpx !important;
		color: #999999 !important;
	}

	/* #endif */
</style>