张文飞 3 년 전
부모
커밋
36926fb575
2개의 변경된 파일22개의 추가작업 그리고 8개의 파일을 삭제
  1. 12 1
      App.vue
  2. 10 7
      pages/homePage/homePage.vue

+ 12 - 1
App.vue

@@ -9,6 +9,7 @@
 				url = encodeURIComponent(url);
 				url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid="+config.appid+"&redirect_uri="+url+"&response_type=code&scope=snsapi_userinfo&state=123&connect_redirect=1#wechat_redirect"
 				window.location.href = url;
+				this.$cache.clear();
 			}
 			this.globalData.BASE_URL = config.BASE_URL;
 		},
@@ -17,7 +18,13 @@
 			let projectId  = this.getQueryString('projectId');
 			this.globalData.projectId = projectId||'';
 			this.globalData.shareToken = shareToken||'';
-			this.regist();
+			let cacheInfo = this.$cache.get('_user_regist');
+			if(cacheInfo){
+				this.globalData.userId = cacheInfo.userId;
+				this.globalData.token = cacheInfo.token;
+			}else{
+				this.regist();
+			}
 			document.body.style.setProperty("background-color",this.globalData.color4);
 		},
 		onHide: function() {
@@ -48,6 +55,10 @@
 						let token = ret.data.single.token;
 						this.globalData.token = token
 					}
+					this.$cache.set("_user_regist",{
+						userId:userId,
+						token:this.globalData.token
+					})
 					uni.$emit('request')
 				}
 			},

+ 10 - 7
pages/homePage/homePage.vue

@@ -381,13 +381,16 @@
 			},
 			// 跳转至效果报表
 			goReportPage() {
-				if(this.userInfo.userId){
-					uni.navigateTo({
-						url: '../reportPage/reportPage'
-					})
-				}else{
-					uni.$emit('unLogin')
-				}
+				// if(this.userInfo.userId){
+				// 	uni.navigateTo({
+				// 		url: '../reportPage/reportPage'
+				// 	})
+				// }else{
+				// 	uni.$emit('unLogin')
+				// }
+				uni.navigateTo({
+					url: '../reportPage/reportPage'
+				})
 			},
 			toShouYiPage() {
 				if(this.userInfo.userId){