he2802 3 лет назад
Родитель
Сommit
7b85576e66
3 измененных файлов с 19 добавлено и 17 удалено
  1. 4 2
      pages/index/index.vue
  2. 14 14
      pages/login/login.vue
  3. 1 1
      pages/wd/index.vue

+ 4 - 2
pages/index/index.vue

@@ -166,6 +166,7 @@ export default {
 			],
 			list1: [],
 			list2: [],
+			isLogin:false
 		};
 	},
 	onPullDownRefresh() {},
@@ -175,9 +176,10 @@ export default {
 		this.bankList();
 	},
 	onShow() {
-		 if(this.$method.isLogin()){
+		if(this.isLogin!=this.$method.isLogin()){
 			this.init()
-		} 
+			this.isLogin = this.$method.isLogin()
+		}
 	},
 	onShareAppMessage(res) {
 		var self = this;

+ 14 - 14
pages/login/login.vue

@@ -71,6 +71,14 @@ export default {
 		if(option.isBack){
 			this.isBack = option.isBack;
 		}
+		/* let that = this;
+		this.from = option.from;
+		uni.login({
+			provider: 'weixin',
+			success: function(loginRes) {
+				that.code = loginRes.code;
+			}
+		}); */
 	},
 	mounted() {},
 	methods: {
@@ -100,8 +108,9 @@ export default {
 							that.$api.getInfo().then(resdata => {
 								if(resdata.data.code == 200){
 									that.$store.state.userInfo = resdata.data.data;
-									if(that.isBack){
-										uni.switchTab({
+									
+									if(!that.isBack){
+										uni.reLaunch({
 											url:'/pages/index/index'
 										})
 									}else{
@@ -158,8 +167,8 @@ export default {
 							that.$api.getInfo().then(resdata => {
 								if(resdata.data.code == 200){
 									that.$store.state.userInfo = resdata.data.data;
-									if(that.isBack){
-										uni.switchTab({
+									if(!that.isBack){
+										uni.reLaunch({
 											url:'/pages/index/index'
 										})
 									}else{
@@ -271,17 +280,8 @@ export default {
 				);
 			}
 		}
-	},
-	onLoad(option) {
-		let that = this;
-		this.from = option.from;
-		uni.login({
-			provider: 'weixin',
-			success: function(loginRes) {
-				that.code = loginRes.code;
-			}
-		});
 	}
+
 };
 </script>
 

+ 1 - 1
pages/wd/index.vue

@@ -125,7 +125,7 @@
 				console.log(343)
 				this.$method.isLogout()
 				this.isLogin = this.$method.isLogin()
-				uni.switchTab({
+				uni.reLaunch({
 					url:'/pages/index/index'
 				})
 			},