付延余
2023-03-14 78ef511b22e6a16fd85e102333a0c03dda463bd4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
 
// 动态底部tabbar
const userRoleTabbar = {
    first: [{
            pagePath: "pages/tabbar-page/index-tabbar/index-tabbar",
            iconPath: "../../static/tabBar-icon/Gfayun.png",
            selectedIconPath: "../../static/tabBar-icon/Bfayun1.png",
            text: "首页"
        },
        {
            pagePath: "pages/tabbar-page/myPage-tabbar/myPage-tabbar",
            iconPath: "../../static/tabBar-icon/Gmine10.png",
            selectedIconPath: "../../static/tabBar-icon/Bmine57.png",
            text: "我的"
        }
    ],
    second: [{
            pagePath: "pages/tabbar-page/index-tabbar/index-tabbar",
            iconPath: "../../static/tabBar-icon/Ghome.png",
            selectedIconPath: "../../static/tabBar-icon/Bhome.png",
            text: "首页"
        },
        {
            pagePath: "pages/tabbar-page/myPage-tabbar/myPage-tabbar",
            iconPath: "../../static/tabBar-icon/Gmine10.png",
            selectedIconPath: "../../static/tabBar-icon/Bmine57.png",
            text: "我的"
        }
    ]
}
const store = new Vuex.Store({
    state: {
        // 用戶界面判斷
        userInfo: {},
        roleType: null, // 1客户,2货代,3司机
        userTabbar: [] // 用户所在角色底部菜单
    },
    mutations: {
        setUserInfo(state, identity) {
            state.userInfo = userObj[identity]
        },
        // 设置底部栏
        setUserTabbar(state, roleType) {
            state.roleType = roleType
            if (roleType == 1) {
                state.userTabbar = userRoleTabbar.first
                uni.setStorageSync('userTabbar', state.userTabbar)
            } else if (roleType == 2 || roleType == 3) {
                state.userTabbar = userRoleTabbar.second
                uni.setStorageSync('userTabbar', state.userTabbar)
            }
 
 
        }
    }
})
 
export default store