Browse Source

pc跳转问题

jwyu 2 years ago
parent
commit
e90f2b919d
1 changed files with 22 additions and 20 deletions
  1. 22 20
      App.vue

+ 22 - 20
App.vue

@@ -4,29 +4,31 @@
 		onLaunch: function(options) {
 			this.$store.dispatch('getUserInfo')
 			this.$store.dispatch('getTabBar')
+			const ENV=uni.getAccountInfoSync().miniProgram
+    		console.log('当前版本',ENV);
+			uni.getSystemInfo({
+				success: function (res) {
+					console.log('宽度:',res.windowWidth);
+					console.log('设备:',res.platform);
+					if (res.windowWidth > 600||['windows','mac'].includes(res.platform)) {
+						const params=options.query//此处的query就是在pc分享钩子函数中拼接的参数
+						let paramsStr=`xcxPath=${decodeURIComponent(options.path)}`
+						for(const key in params){
+							paramsStr=`${paramsStr}&${key}=${params[key]}`
+						}
+						console.log('进入pc');
+						uni.reLaunch({
+							url: `/pages/pc?${paramsStr}`,
+						});
+					}
+				},
+				fail:function(res){
+				}
+			})
 		},
 		onShow: function(options) {
-			// console.log('App Show:',options)
+			console.log('App Show')
 			hasUpdate()
-			// uni.getSystemInfo({
-			// 	success: function (res) {
-			// 		console.log('宽度:',res.windowWidth);
-			// 		console.log('设备:',res.platform);
-			// 		if (res.windowWidth > 600||['windows','mac'].includes(res.platform)) {
-			// 			const params=options.query//此处的query就是在pc分享钩子函数中拼接的参数
-			// 			let paramsStr=`xcxPath=${decodeURIComponent(options.path)}`
-			// 			for(const key in params){
-			// 				paramsStr=`${paramsStr}&${key}=${params[key]}`
-			// 			}
-			// 			console.log('进入pc');
-			// 			uni.reLaunch({
-			// 				url: `/pages/pc?${paramsStr}`,
-			// 			});
-			// 		}
-			// 	},
-			// 	fail:function(res){
-			// 	}
-			// })
 		},
 		onHide: function() {
 			console.log('App Hide')