import Vue from 'vue' import Vuex from 'vuex' Vue.use(Vuex) import tabBar from "@/utils/tabbar.js"; // 引入刚刚创建的tabBar.js const store = new Vuex.Store({ state: { dynamicTabbar: [], // 动态tabbar tabBarList: [], dataType:null,//数据标识权限 }, getters: {}, actions: { changeTabbar({ commit }, role_id) { /* admin 超管 1123598816738675201 客户 1846419477876510721 客服 1839536982874193922 维修负责人 1839537055389515777 维修人员 1839552581620793346 */ // console.log(66666666666,role_id) if(role_id == "1123598816738675201"||role_id == "1846419477876510721"){ commit('updateDatatype', 1) //客户 } if(role_id == "1839536982874193922"){ commit('updateDatatype', 2) //客服 } if(role_id == "1839537055389515777"){ commit('updateDatatype', 3) //维修负责人 } if(role_id == "1839552581620793346"){ commit('updateDatatype', 4) //维修人员 } if (role_id == "1123598816738675201" || role_id == '1846419477876510721' || role_id == '1839537055389515777') { commit('updateTabbar', tabBar.member) uni.switchTab({ url: "/pages/home/index", }); } else { commit('updateTabbar', tabBar.ordinary) uni.switchTab({ url: "/pages/order/tasking", }); } }, changeDatatype({ commit }, type){ commit('updateTabbar', payload) } }, mutations: { updateTabbar(state, list) { uni.setStorageSync('tabBarList', list) // 根据登录时传过来的值,存储对应的tabbarlist state.dynamicTabbar = list }, updateDatatype(state, data){ state.dataType = data } } }) export default store