<script>
	import initApp from "@/util/router.js";
	export default {
		onLaunch: function() {
			console.log('App Launch');
			uni.downloadFile({
			    url: '/cffpUpdate/__UNI__65C4CDC.wgt',  
			    success: (downloadResult) => {  
			        if (downloadResult.statusCode === 200) {  
			            plus.runtime.install(downloadResult.tempFilePath, {  
			                force: true  
			            }, function() {  
			                console.log('install success...');  
			                plus.runtime.restart();  
			            }, function(e) {  
			                console.error('install fail...');  
			            });  
			        }
			    }  
			});  
			// uni.getSystemInfo({
			// 	success:(systemInfo)=> {
			// 		uni.request({
			// 		    url: '/api/appVersion/checkIsUpdate',  
			// 			method:'POST',
			// 		    data: {  
			// 		        appType: 1,  
			// 		        version: systemInfo.appVersion,
			// 				systemType:systemInfo.osName.toLowerCase() === 'ios' ? 2 : 1
			// 		    },  
			// 		    success: (result) => {  
			// 		        const data = result.data.data['appVersionInfo'];  
			// 		        if (data.isForceUpdate && data.wgtUrl) {  
			// 		            uni.downloadFile({  
			// 		                url: data.wgtUrl,  
			// 		                success: (downloadResult) => {  
			// 		                    if (downloadResult.statusCode === 200) {  
			// 		                        plus.runtime.install(downloadResult.tempFilePath, {  
			// 		                            force: true  
			// 		                        }, function() {  
			// 		                            console.log('install success...');  
			// 		                            plus.runtime.restart();  
			// 		                        }, function(e) {  
			// 		                            console.error('install fail...');  
			// 		                        });  
			// 		                    }  
			// 		                }  
			// 		            });  
			// 		        }  
			// 		    }  
			// 		}); 
			// 	}
			// })
			initApp()
			// this.checkArguments();
			// plus.globalEvent.addEventListener('newintent', e => {
			// 　　this.checkArguments(); // 检测启动参数
			// 　});
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		},
		methods:{
			checkArguments() {
			            console.log('runtime.launcher: ' + plus.runtime.launcher);
			            // 判断APP打开方式 miniProgram为微信小程序打开
			            // if (plus.runtime.launcher == 'miniProgram') {
			                // plus.runtime.argumrnts为打开时APP传的值(<wx-open-launch-app>中的extinfo),可以传字符串通过符号截取判断类型
			                console.log(plus.runtime.arguments);
			                if (plus.runtime.arguments) {
			　　　　　　　　　　　　//我截取了字符串,判断是商品并且根据ID跳转到商品详情页
			                    var str = plus.runtime.arguments;
			                    var arr = str.split('/');
			                    var id = arr[1];
			                    if (arr[0] == 'goods') {
			　　　　　　　　　　　　　　//跳转到商品详情页,注意pages前面的"/"不要忘记,否则会造成无法跳转。使用navigateTo跳转到页面会有返回按钮,点击返回到首页
			                        uni.switchTab({
			                            url: 'pages/index/index'
			                        });
			                    }
			                }
			            // }
			        }
		}
	}
</script>

<style>
	@import "@/static/font/iconfont.css"; 
	/*每个页面公共css */
	@font-face {
		font-family: 'iconfont';
		src:url('data:application/x-font-woff2;charset=utf-8;base64,[encoded data, 13736 characters]')
	}
	.iconfont{
	    font-family:"iconfont" !important;
	    font-size:16px;
		font-style:normal;
	    -webkit-font-smoothing: antialiased;
	    -webkit-text-stroke-width: 0.2px;
	    -moz-osx-font-smoothing: grayscale;
	}
	image{
		width: 100%!important;
	}
	.container{
		background-color: #FBFBFB;
	}
	.uni-popup .uni-popup__wrapper{
		margin: 30rpx!important;
	}
	.richTextContent img{
		width: 100% !important;
	}
	.popupContainer .uni-popup .uni-popup__wrapper{
		width: 80%;
		border-radius: 20rpx;
	}
	.container uni-slider{
		margin: 0;
	}
	.container uni-slider .uni-slider-value{
		text-align: right;
	}
	.noListTip{
		text-align: center;
		margin-top: 10%;
		color: #999;
	}
	.container uni-slider .uni-slider-value{
		width: 5ch;
	}
	.btn{
		background: #3671F4;
		color: #fff;
		width: 60%;
		margin: 0 auto;
		height: 80rpx;
		line-height: 80rpx;
		text-align: center;
		border-radius: 40rpx;
		position: absolute;
		bottom: 0;
		left: 0;
		right: 0;
	}
	.uni-calendar-item--extra{
		white-space: nowrap !important;
	}
	.zuojiantou{
		display: inline-block;
		transform: rotate(180deg)!important;
		font-size: 30rpx;
		z-index: 1;
		position: absolute;
		left: 20rpx;
		width: 50rpx;
		height: 50rpx;
		text-align: center;
		line-height: 50rpx;
	}
</style>
