From 31e6b27fc0b7fb2ae715efa4287d8f5539f33d78 Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Fri, 27 Oct 2023 15:10:53 +0800
Subject: [PATCH] 角色切换,保存菜单至store

---
 store/index.js |   48 ++++++++++++++++++++++++++++--------------------
 1 files changed, 28 insertions(+), 20 deletions(-)

diff --git a/store/index.js b/store/index.js
index 59a5e73..7b99d17 100644
--- a/store/index.js
+++ b/store/index.js
@@ -48,10 +48,12 @@
 		// 如果version无需保存到本地永久存储,无需lifeData.version方式
 		version: '1.0.0',
 		activeRoleId: "",
-		tabBarList: [],
+		// tabBarList: [],
 		adCodeBase: {},
-		tabbarIndex: uni.getStorageSync("tabbarIndex") || 0,
+		// tabbarIndex: uni.getStorageSync("tabbarIndex") || 0,
 		hasUpdate: false, //true为不可登录,需要更新,false则是最新版
+
+		menu: [],
 	},
 
 	mutations: {
@@ -75,31 +77,37 @@
 			// 保存变量到本地,见顶部函数定义
 			saveLifeData(saveKey, state[saveKey])
 		},
-		// 设置菜单
-		setTabBarList(state, data) {
-			let i = 0
-			if (state.tabBarList.length > 0) {
-				i = state.tabBarList.length
-			}
-			data.forEach(e => {
-				e.i = i
-				i++
-			})
+		// // 设置菜单
+		// setTabBarList(state, data) {
+		// 	let i = 0
+		// 	if (state.tabBarList.length > 0) {
+		// 		i = state.tabBarList.length
+		// 	}
+		// 	data.forEach(e => {
+		// 		e.i = i
+		// 		i++
+		// 	})
 
-			state.tabBarList = data;
-			uni.setStorageSync('tabBarList', data)
-			// console.log(uni.getStorageSync('tabBarList'))
-		},
+		// 	state.tabBarList = data;
+		// 	uni.setStorageSync('tabBarList', data)
+		// 	// console.log(uni.getStorageSync('tabBarList'))
+		// },
 		//设置当前激活的角色
 		setActiveRoleId(state, roleId) {
 			state.activeRoleId = roleId
 			uni.setStorageSync('activeRoleId', roleId)
 		},
-		//设置底部导航栏索引
-		SET_TABBAT_INDEX(state, index) {
-			state.tabbarIndex = index
-			uni.setStorageSync('tabbarIndex', index)
+
+		SET_MENU(state, menuList) {
+			state.menu = menuList
+			uni.setStorageSync('menu', menuList)
 		},
+
+		//设置底部导航栏索引
+		// SET_TABBAT_INDEX(state, index) {
+		// 	state.tabbarIndex = index
+		// 	uni.setStorageSync('tabbarIndex', index)
+		// },
 		SET_HAS_UPDATE(state, val) {
 			state.hasUpdate = val
 			uni.setStorageSync('hasUpdate', val)

--
Gitblit v1.9.3