Browse Source

注销账号方法及清除缓存登录

lizaixun 4 years ago
parent
commit
392d42e0e2
2 changed files with 22 additions and 8 deletions
  1. 2 4
      components/login/Login.vue
  2. 20 4
      pages/mine/Mine.vue

+ 2 - 4
components/login/Login.vue

@@ -15,7 +15,7 @@
 				<a @tap="changeType('phone')">手机验证码登录</a>
 				<a style="float: right;color:#77A8E6;" @tap="goToIndex()">游客身份登录</a>
 			</view>
-			<button class="cu-btn bg-red lg" @tap="falseLogin" :disabled="usernameLoginDisabled" type="" :style="{ 'height': buttonHeight}">登录</button>
+			<button class="cu-btn bg-red lg" @tap="login" :disabled="usernameLoginDisabled" type="" :style="{ 'height': buttonHeight}">登录</button>
 			<view class="bottomWord" :style="{ 'font-size': bottomWordFontSize,'margin-top':bottomWordMarginTop}">
 				点击登录,即代表已阅读并同意<a href="#">隐私政策</a>和<a href="#">用户协议</a>
 			</view>
@@ -40,8 +40,6 @@
 				点击登录,即代表已阅读并同意<a href="#">隐私政策</a>和<a href="#">用户协议</a>
 			</view>
 		</view>
-		
-		
 	</view>
 </template>
 
@@ -229,6 +227,7 @@ export default {
 				success: function(res) {
 					console.log(res.data);
 					if (res.data.code == 200) {
+						_this.setUsernamePassword();
 						_this.loginFalg = true;
 						_this.getUser();
 					} else {
@@ -352,7 +351,6 @@ export default {
 		},
 		noLogin: function() {
 			let _this = this;
-
 			uni.request({
 				url: 'http://49.4.78.143:8081/admin/appLogin?username=abc&password=123',
 				data: {},

+ 20 - 4
pages/mine/Mine.vue

@@ -26,6 +26,9 @@
 		<div class="plusDrawer" @tap="hideModal">
 			<plusDrawer ref="plusDrawer"></plusDrawer>
 		</div>
+		<view>
+			<button class="cu-btn bg-red lg" @tap="falseLogin" type="" :style="{ 'height': buttonHeight}">注销账号</button>
+		</view>
 	</view>
 </template>
 
@@ -44,6 +47,7 @@
 				badge: 22,
 				inconList:["form","favor","question","edit"],
 				modalName:null,
+				buttonHeight:'',
 				address: '宁夏新能源公司',
 				drawerList: [{
 						"name": "首页"
@@ -114,9 +118,6 @@
 				uni.getStorageSync('windpowerstationName');
 				return uni.getStorageSync('windpowerstationName');
 			},
-			openDrawer: function() {
-				this.$refs.drawer.openDrawer(250, this.drawerList, this.inconList);
-			},
 			showModal(e) {
 				this.modalName = e.currentTarget.dataset.target;
 				this.$refs.plusDrawer.showModal(this.plusDrawerList, this.modalName);
@@ -125,6 +126,16 @@
 				this.modalName = null;
 				this.$refs.plusDrawer.hideModal(this.modalName);
 			},
+			falseLogin: function() {
+				this.removeUsernamePassword();
+				uni.navigateTo({
+				    url: '/components/login/Login'
+				});
+			},
+			removeUsernamePassword: function() {
+				uni.removeStorageSync('gyeeusername');
+				uni.removeStorageSync('gyeepassword');
+			},
 		}
 	};
 </script>
@@ -203,5 +214,10 @@
 		text-align: center;
 		margin-left: 18px;
 	}
-	
+	.cu-btn {
+		width: 80%;
+		height: 40px;
+		margin-left: 10%;
+		margin-top: 25px;
+	}
 </style>