From 4ca832919612bf2fc4d13b73df135680ac391b24 Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期二, 19 八月 2025 10:49:07 +0800
Subject: [PATCH] 代码初始化

---
 h5/App.vue |   32 ++++++++++++++++----------------
 1 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/h5/App.vue b/h5/App.vue
index 57378c9..0a577c8 100644
--- a/h5/App.vue
+++ b/h5/App.vue
@@ -2,31 +2,31 @@
 	export default {
 		onLaunch: function() {
 			// this.init()
-			var ua = window.navigator.userAgent
-			if(ua.indexOf('MicroMessenger') == -1){ 
-				// 绛変簬-1鏃� 璇存槑涓嶆槸浠庡井淇℃壂鐮佹墦寮�鐨勶紝灏辫烦杞叾瀹冮〉闈�
-				uni.reLaunch({
-					url:'/pages/exception/exception'
-				})
-				return
-			}
+			this.goException()			 
 			this.initRegister()
 		},
 		onShow: function() {
-			 var ua = window.navigator.userAgent
-			 if(ua.indexOf('MicroMessenger') == -1){ 
-			 	// 绛変簬-1鏃� 璇存槑涓嶆槸浠庡井淇℃壂鐮佹墦寮�鐨勶紝灏辫烦杞叾瀹冮〉闈�
-			 	uni.reLaunch({
-			 		url:'/pages/exception/exception'
-			 	})
-			 	return
-			 }
+			//this.goException()			 
 			console.log('App Show')
 		},
 		onHide: function() {
 			console.log('App Hide')
 		},
 		methods: {
+			goException(){
+				try {
+				  const res = wx.getSystemInfoSync() 
+				  if!res.environment  || res.environment !=='wxwork' ){
+					  uni.reLaunch({
+					  	url:'/pages/exception/exception'
+					  })
+				  } 
+				} catch (e) {
+				  uni.reLaunch({
+				  	url:'/pages/exception/exception'
+				  })
+				} 
+			},
 			async initRegister() {
 				let fullURL = window.location.href.substring(0, window.location.href.lastIndexOf('#'))
 				console.log(fullURL)

--
Gitblit v1.9.3