From fbdc9fd53ce80d89b70184db67258f7b3b3a2ebb Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Fri, 27 Oct 2023 14:51:58 +0800
Subject: [PATCH] 登录、切换角色

---
 pages/user/center.vue |   58 +++++++++++++++++++++++++++++++++++++---------------------
 1 files changed, 37 insertions(+), 21 deletions(-)

diff --git a/pages/user/center.vue b/pages/user/center.vue
index d1d33e7..7d90422 100644
--- a/pages/user/center.vue
+++ b/pages/user/center.vue
@@ -1,32 +1,29 @@
 <template>
 	<view class="container">
-		<u-navbar  height="48" bgColor="#5887f9" :autoBack="false" safeAreaInsetTop placeholder>
+		<u-navbar height="48" bgColor="#5887f9" :autoBack="false" safeAreaInsetTop placeholder>
 			<view slot="left">
 				<u--text color="#ffffff" text="基层智治" size="18" />
 			</view>
 		</u-navbar>
-		
+
 		<view class="main">
 			<view class="main-bg">
-				
+
 			</view>
-			
-			
+
+
 			<view class="main-cell">
 				<view class="cell-content">
 					<u-cell-group :border="false">
-						<u-cell :isLink="true" 
-						v-for="(item, index) in cellGroupData" :icon="item.icon" :title="item.title" 
-						:url="item.url"
-						:key="index"  :border="false"
-						></u-cell>
+						<u-cell @click="navigator(item)" v-for="(item, index) in cellGroupData" :icon="item.icon"
+							:title="item.title" :key="index" :border="false"></u-cell>
 					</u-cell-group>
 				</view>
 			</view>
-			
+
 		</view>
 
-		<tabBar @change='change' :currentTab="0-0" :tabList="tabList"></tabBar>
+		<tabBar @change='change' :currentTab="1"></tabBar>
 	</view>
 </template>
 
@@ -40,9 +37,7 @@
 
 		data() {
 			return {
-				tabList: uni.getStorageSync("tabBarList") || [],
-				cellGroupData: [
-					{
+				cellGroupData: [{
 						title: '我的家人',
 						icon: 'account-fill',
 						url: ''
@@ -65,11 +60,32 @@
 				]
 			}
 		},
+		onShow() {
+			uni.hideTabBar()
+		},
 
 		methods: {
 			change(index) {
 				let url = index
 				this.$u.func.globalNavigator(url, "switchTab")
+			},
+
+			navigator(item) {
+
+				if (item.title == '退出登录') {
+					this.logOut()
+				} else {
+					this.$u.func.globalNavigator(item.url)
+				}
+
+			},
+
+			logOut() {
+				uni.setStorageSync("responIndex", 0)
+				uni.clearStorageSync()
+				uni.reLaunch({
+					url: "/pages/login/login-account"
+				})
 			},
 		}
 	}
@@ -79,31 +95,31 @@
 	.container {
 		width: 100%;
 		height: 100%;
-		
+
 		display: flex;
 		flex-direction: column;
 		background: #F9F9FA;
-		
+
 		.main {
 			position: relative;
 			height: 0;
 			flex: 1;
 			overflow-y: auto;
-			
+
 			.main-bg {
 				height: 36%;
 				background: royalblue;
 			}
-			
+
 			.main-cell {
 				position: absolute;
 				top: 34%;
 				width: 100%;
 				height: 66%;
-				border-radius: 10rpx 10rpx 0 0 ;
+				border-radius: 10rpx 10rpx 0 0;
 				z-index: 11;
 				background: #fff;
-				
+
 				.cell-content {
 					margin-top: 240rpx;
 				}

--
Gitblit v1.9.3