lilei 3 anni fa
parent
commit
5c9095d373
2 ha cambiato i file con 37 aggiunte e 16 eliminazioni
  1. 21 0
      pages/morePage/morePage.vue
  2. 16 16
      pages/personData/personData.vue

+ 21 - 0
pages/morePage/morePage.vue

@@ -59,6 +59,11 @@
 				<u-icon size="36" name="phone"></u-icon> <text>联系汽配商</text>
 			</view>
 		</view>
+		<view class="list-box" v-if="hasLogin">
+			<view class="list-title flex justify_center phone" @click="quitOut">
+				<text>退出登录</text>
+			</view>
+		</view>
 		<!-- 去认证 -->
 		<u-popup v-model="showPopup" mode="center" :border-radius="20" closeable>
 			<view style="background-color: #fff;padding: 1rem;">
@@ -157,6 +162,22 @@
 			},
 			call(){
 				this.callPhone(this.dealerPhone)
+			},
+			quitOut(){
+				let _this = this
+				uni.showModal({
+					title: '提示',
+					content: '确定退出登录吗?',
+					success: (ret) => {
+					  if(ret.confirm){
+						  _this.$store.dispatch('userLogout');
+						  uni.navigateTo({
+						  	 url: '/pages/login/login'
+						  });
+					  }
+					}
+				})
+				
 			}
 		}
 	}

+ 16 - 16
pages/personData/personData.vue

@@ -45,12 +45,9 @@
 			    </view>
 			</view>
 		</view>
-		<view class="bottom-cont" style="color: dodgerblue;" @click="loginOut">
+		<view class="bottom-cont" style="color: dodgerblue;" @click="quitOut">
 			退出登录
 		</view>
-		<uni-popup ref="openModal" type="center">
-			<uni-popup-dialog content="确定退出登录吗?" @confirm="onOk" :title="title"></uni-popup-dialog>
-		</uni-popup>
     </view>
 </template>
 
@@ -118,18 +115,21 @@
 				}
 			});
 		  },
-          loginOut(){
-			  this.$refs.openModal.open()
-		  },
-		  onOk(){
-			this.$refs.openModal.close()
-			this.$store.dispatch('userLogout');
-			setTimeout(function(){
-				  uni.redirectTo({
-					  url: '/pages/login/login'
-				  });
-			},300)
-		  }
+          quitOut(){
+          	let _this = this
+          	uni.showModal({
+          		title: '提示',
+          		content: '确定退出登录吗?',
+          		success: (ret) => {
+          		  if(ret.confirm){
+          			  _this.$store.dispatch('userLogout');
+          			  uni.redirectTo({
+          			  	 url: '/pages/login/login'
+          			  });
+          		  }
+          		}
+          	})
+          }
         },
     }
 </script>