<script>
	import {
		mapMutations
	} from 'vuex'
	export default {
		onLaunch: function() {
			console.log('App Launch')
			uni.getSystemInfo({ // 获取当前设备的具体信息
				success: (sysinfo) => {
					console.log('sysinfo', sysinfo);
					this.sysinfo = sysinfo;
					this.$uStore({
						name: 'sysinfo',
						value: sysinfo
					});
				}
			});
		},
		
		onShow: function() {
			// #ifdef APP-PLUS
		   setTimeout(() => { // 被唤醒获取参数 需异步一下
				try {
					const args = plus.runtime.arguments
					if (args && typeof args === 'string') {
						// 只在有URL参数需要处理时才获取插件（从其他应用唤醒时）
						// iOS平台：如果插件不可用，静默跳过，不影响应用运行
						// #ifdef APP-IOS
						try {
							const nativePlugin = uni.requireNativePlugin("UUMbsAgentPlugin-Test")
							if (nativePlugin && typeof nativePlugin.handleOpenURL === 'function') {
								nativePlugin.handleOpenURL(args)
							}
						} catch (pluginError) {
							// iOS平台插件不可用时，静默跳过，不输出错误（避免首页报错）
							// console.warn('iOS native plugin not available:', pluginError)
						}
						// #endif
						
						// #ifdef APP-ANDROID
						try {
							const nativePlugin = uni.requireNativePlugin("ToastPlus") || uni.requireNativePlugin("UUMbsAgentPlugin-Test")
							if (nativePlugin && typeof nativePlugin.handleOpenURL === 'function') {
								nativePlugin.handleOpenURL(args)
							}
						} catch (pluginError) {
							console.warn('Android native plugin error:', pluginError)
						}
						// #endif
					}
				} catch (e) {
					console.error('handleOpenURL error:', e)
				}
			}, 100);
		   // #endif
		},
		onHide: function() {
			// console.log('App Hide')
		},
		onTabItemTap(e) {
			console.log('onTabItemTap----', e)
		},
		data() {
			return {
				sysinfo: {}
			}
		},
		methods: {
			...mapMutations(['$uStore'])
		}
	}
</script>

<style lang="scss">
	@import "uview-ui/index.scss";

	/*每个页面公共css */
	/* #ifndef APP-NVUE */
	uni-page-body {
		height: 100%;
	}

	page {
		font-weight: 400;
		font-size: 24rpx;
		color: #333;
	}

	uni-view {
		box-sizing: border-box;
	}

	::v-deep .uni-scroll-view ::-webkit-scrollbar {
		display: none;
		width: 0;
		height: 0;
		color: transparent;
		background: transparent;
	}

	::v-deep ::-webkit-scrollbar {
		display: none;
		width: 0;
		height: 0;
		color: transparent;
		background: transparent;
	}

	uni-button:after {
		display: none;
	}

	.uni-input-placeholder {
		color: #DBDBDB;
	}

	image {
		display: inline-block;
	}

	view,
	text {
		box-sizing: border-box;
	}

	/* #endif */
</style>
