40 lines
965 B
JavaScript
40 lines
965 B
JavaScript
|
import Vue from "vue";
|
||
|
import Vuex from "vuex";
|
||
|
import tabBar from "../untils/tabBar.js";
|
||
|
|
||
|
Vue.use(Vuex);
|
||
|
|
||
|
let type = "user_supervisors"; // uni.getStorageSync('sale-user-info').isLeader ? 'user_supervisors' : 'user_staff'
|
||
|
|
||
|
const store = new Vuex.Store({
|
||
|
state: {
|
||
|
list: tabBar[type],
|
||
|
doingTotal: 0, // 待办事项总数
|
||
|
},
|
||
|
//对数据的处理
|
||
|
getters: {
|
||
|
tabBarList: (state) => state.list,
|
||
|
doingTotal: (state) => state.doingTotal,
|
||
|
},
|
||
|
mutations: {
|
||
|
//放置mutations方法
|
||
|
leaderType(state, payload) {
|
||
|
let type = payload ? "user_supervisors" : "user_staff";
|
||
|
state.list = tabBar[type].map((item) => {
|
||
|
// if (item.text == "审批") {
|
||
|
// item.badge = "4";
|
||
|
// } else {
|
||
|
// item.badge = null;
|
||
|
// }
|
||
|
return item;
|
||
|
});
|
||
|
},
|
||
|
// 获取待办事项总数
|
||
|
getDoingTotal(state, doingTotal) {
|
||
|
state.doingTotal = doingTotal;
|
||
|
},
|
||
|
},
|
||
|
});
|
||
|
|
||
|
export default store;
|