qingyiay
2023-05-16 72935b2a35765bcc3622561bb06f2eccd64caf83
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
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/home.png',
            selectedIconPath: '../../static/tabBar-icon/homeblue.png',
            text: '首页'
        },
        {
            pagePath: 'pages/customer-page/customer-my/faYunstatistics/faYunstatistics',
            iconPath: '../../static/tabBar-icon/statistics.png',
            selectedIconPath: '../../static/tabBar-icon/statisticsactive.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/home.png',
            selectedIconPath: '../../static/tabBar-icon/homeblue.png',
            text: '首页'
        },
        {
            pagePath: 'pages/customer-page/customer-my/faYunstatistics/faYunstatistics',
            iconPath: '../../static/tabBar-icon/statistics.png',
            selectedIconPath: '../../static/tabBar-icon/statisticsactive.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: [], // 用户所在角色底部菜单,
        // 称重时的重量
        globalweigh: 0,
        // 消息推送
        globalmessage: '',
        // 全局weihousecode
        globalweighHouseCode: '',
        // 全局红外状态
        globalinfraredStatus: false,
        // 司机修改个人信息
        globaluserInfo: {
            phone: '',
            name: '',
            username: '',
            type: 3,
            idCard: '',
            carNo: '',
            carImg: '',
            drivingImg: '',
            axleNum: '',
            weight: '',
            userId: ''
        },
        globalisconnect: false,
        globalisUploadimg: false
    },
    mutations: {
        lengthchange(state, payload) {
            state.fleetDriverDataLength = payload
        },
        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)
            }
        },
        // 改变重量
        changeWeigh(state, payload) {
            state.globalweigh = payload
            console.log(state.globalweigh, '全局重量改变了')
        },
        // 消息推送
        pushMessage(state, payload) {
            state.globalmessage = payload
        },
        // 改变weighHouseCode
        changeweighHouseCode(state, payload) {
            state.globalweighHouseCode = payload
            console.log(state.globalweighHouseCode, 'globalweighHouseCode改变了')
        },
        // 改变红外状态
        changeinfraredStatus(state, payload) {
            state.globalinfraredStatus = payload
        },
        changeuserInfo(state, payload) {
            state.globaluserInfo = payload
        },
        // 改版全局websocket状态
        changeisconnect(state, payload) {
            state.globalisconnect = payload
        },
        changeisUploadimg(state, payload) {
            state.globalisUploadimg = payload
        }
    }
})
 
export default store