shish 6 лет назад
Родитель
Сommit
03372dbcc9
1 измененных файлов с 12 добавлено и 11 удалено
  1. 12 11
      mall/src/mixins/globalMixins.js

+ 12 - 11
mall/src/mixins/globalMixins.js

@@ -35,15 +35,18 @@ export default {
 		uni.setStorageSync('currentQuery', JSON.stringify(option))
 
 		// #ifdef MP-WEIXIN
-		//检查小程序的登录态是否有效 checkSession
-        uni.checkSession({  
-            success(){  
-                console.log('checkSession success')
-            },  
-            fail(){  
-				uni.removeStorageSync('token');
-            }  
-		})
+		//线上检查小程序的登录态是否有效 checkSession
+		//checkSession开发环境无效,在真机调试有效
+		if (process.env.NODE_ENV == "production") {
+			uni.checkSession({
+				success() {
+					console.log('checkSession success')
+				},
+				fail() {
+					uni.removeStorageSync('token');
+				}
+			})
+		}
 		// #endif
 
 		// 登录
@@ -64,13 +67,11 @@ export default {
 			})
 			// #endif
 			// #ifdef MP-WEIXIN
-			console.log('执行这里。。。111')
 			wxLoginFn().then(res => {
 				if (this.init) {
 					this.init()
 				}
 			})
-
 			// #endif
 		}