Pārlūkot izejas kodu

app上架-新增注销账号功能

linbl 1 mēnesi atpakaļ
vecāks
revīzija
bc1ccffb5e
1 mainītis faili ar 26 papildinājumiem un 1 dzēšanām
  1. 26 1
      pages/personal/personal.vue

+ 26 - 1
pages/personal/personal.vue

@@ -81,6 +81,7 @@
 				</view>
 			</view>
 			<button class="btn exit" @click="exitLogin()">退出登录</button>
+			<button class="btn exit" @click="cancelAccount()">注销账号</button>
 		</view>
 		<view class="version">版本号:{{version}}</view>
 	</view>
@@ -201,6 +202,30 @@
 						}
 					}
 				});
+			},
+			cancelAccount() {
+				let param = {
+					id: this.getUser().id
+				};
+				uni.showModal({
+					title: '提示',
+					content: '确定注销账号?',
+					success: res => {
+						if (res.confirm) {
+							uni.removeStorageSync('token');
+							uni.removeStorageSync('info');
+							uni.removeStorageSync('menu');
+							uni.redirectTo({
+								url: '/pages/login/login'
+							});
+							this.http.request({
+								url: '/sp-admin/app/AppUser/delete',
+								data: param,
+								success: res => {}
+							});
+						}
+					}
+				});
 			}
 		}
 	};
@@ -278,4 +303,4 @@
 		bottom: 70px;
 		color: #888484;
 	}
-</style>
+</style>