From 0b33a3dcc3a7592c476d992e1b79a3bc837afb25 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期四, 21 八月 2025 13:42:56 +0800
Subject: [PATCH] 优化

---
 small-program/App.vue |   61 ++++++++++++++++++++++++++++--
 1 files changed, 56 insertions(+), 5 deletions(-)

diff --git a/small-program/App.vue b/small-program/App.vue
index 22c1eea..dc84749 100644
--- a/small-program/App.vue
+++ b/small-program/App.vue
@@ -4,23 +4,69 @@
 		computed: {
 			...mapState(['userInfo','openid'])
 		},
-		onLaunch: function() {
+		onLaunch: function() { 
+<<<<<<< HEAD
+=======
+			// console.log(ua)  
+>>>>>>> 71a103d6f5c55136f40535bccf23bc6129e342f7
 			var that = this;
-			console.log(this.userInfo)
-			if (!this.userInfo || JSON.stringify(this.userInfo) == '{}') {
+			if (!this.openid || this.openid =='') {
 				uni.login({
 					provider: 'weixin',
 					success: async function (loginRes) {
 						let { code } = loginRes;
 						let res = await that.$u.api.wxLogin({ code })
-						if (res.code === 200) {
+						if (res && res.code === 200) {
 							that.$store.commit('setToken', res.data.token)
 							that.$store.commit('setOpenid', res.data.openid)
 							that.$store.commit('setUserInfo', res.data.member)
-							that.$isResolve()
+							uni.getLocation({
+								type: 'wgs84',
+								success: (addr) => {
+									that.$store.commit('setPosition', { latitude: addr.latitude, longitude: addr.longitude })
+									that.$isResolve()
+								},
+								fail: (err) => {
+									console.error('鑾峰彇浣嶇疆澶辫触', err);
+									that.$isResolve()
+								}
+							});
+							
 						}
 					}
 				});
+			} else {
+				var that = this
+				let res = this.$u.api.getMemberInfo({}).then(res =>{ 
+					if (res && res.code === 200) { 
+						that.$store.commit('setUserInfo', res.data)
+						uni.getLocation({
+							type: 'wgs84',
+							success: (addr) => {
+								that.$store.commit('setPosition', { latitude: addr.latitude, longitude: addr.longitude })
+								that.$isResolve()
+							},
+							fail: (err) => {
+								console.error('鑾峰彇浣嶇疆澶辫触', err);
+								that.$isResolve()
+							}
+						});
+					} else {
+						that.$store.commit('setToken','')
+						that.$store.commit('setUserInfo',{})
+						uni.getLocation({
+							type: 'wgs84',
+							success: (addr) => {
+								that.$store.commit('setPosition', { latitude: addr.latitude, longitude: addr.longitude })
+								that.$isResolve()
+							},
+							fail: (err) => {
+								console.error('鑾峰彇浣嶇疆澶辫触', err);
+								that.$isResolve()
+							}
+						});
+					}
+				})
 			}
 		},
 		onShow: function() {
@@ -34,4 +80,9 @@
 
 <style lang="scss">
 	@import "uview-ui/index.scss"; 
+	
+	.toast-custom {
+	    width: 500px !important;
+	    font-size: 14px !important;
+	}
 </style>
\ No newline at end of file

--
Gitblit v1.9.3