htc 5 天之前
父节点
当前提交
7ea6ce925d
共有 3 个文件被更改,包括 20 次插入10 次删除
  1. 9 0
      App.vue
  2. 0 7
      pages/login.vue
  3. 11 3
      pages/my.vue

+ 9 - 0
App.vue

@@ -11,6 +11,15 @@
 		onLaunch: function() {
 		},
 		onShow: function() {
+			if(uni.getStorageSync('userInfo')){
+				uni.reLaunch({
+					url:'/pages/home'
+				})
+			}else{
+				uni.reLaunch({
+					url:'/pages/login'
+				})
+			}
 		},
 		onHide: function() {
 		}

+ 0 - 7
pages/login.vue

@@ -19,13 +19,6 @@
 				agree:false
 			}
 		},
-		onShow: () => {
-			if(uni.getStorageSync('userInfo')){
-				uni.reLaunch({
-					url:'/pages/home'
-				})
-			}
-		},
 		methods:{
 			changeAgree(){
 				this.agree = !this.agree;

+ 11 - 3
pages/my.vue

@@ -70,9 +70,17 @@
 				uni.navigateTo({ url })
 			},
 			exitLogin(){
-				uni.clearStorageSync();
-				uni.reLaunch({
-					url:'/pages/login'
+				uni.showModal({
+					title:'温馨提示',
+					content:'是否确定退出登录?',
+					success: (res) => {
+						if(res.confirm){
+							uni.clearStorageSync();
+							uni.reLaunch({
+								url:'/pages/login'
+							})
+						}
+					}
 				})
 			}
 		}