智慧保安互联网APP
zengh
2022-06-21 4efeb31d5b4921d7e851c256009486ad86bc70e2
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
import Vue from 'vue'
import Vuex from 'vuex'
import mutations from './mutations.js'
import actions from './actions.js'
Vue.use(Vuex)
 
let lifeData = {};
 
try {
    // 尝试获取本地是否存在lifeData变量,第一次启动APP时是不存在的
    lifeData = uni.getStorageSync('lifeData');
} catch (e) {
 
}
 
 
const store = new Vuex.Store({
    // 下面这些值仅为示例,使用过程中请删除
    state: {
 
        // 如果上面从本地获取的lifeData对象下有对应的属性,就赋值给state中对应的变量
        userInfo: lifeData.userInfo ? lifeData.userInfo : {
            avatar: '',
            nick_name: '游客',
            tenant_id: '暂无'
        },
        accessToken: lifeData.accessToken ? lifeData.accessToken : '',
        isLogin: lifeData.isLogin ? lifeData.isLogin : false,
        // 如果version无需保存到本地永久存储,无需lifeData.version方式
        version: '1.0.0',
        loging: false,
        message: {
            useName: '过客 ',
        },
        logPath: '',
        piAPI: 'http://61.131.136.25:2080/api',
        // piAPI: 'http://192.168.0.114:81',
        api: 'http://61.131.136.25:2080/api',
        // piAPI: 'http://localhost:83/',
        // piAPI: 'http://192.168.0.115:83',
        puserName: '',
        puserID: '',
        puserIphone: '',
        avatar: "../../static/logo.png",
        UserData: {},
        tabbar: [{
                pagePath: "pages/home/home",
                iconPath: "static/images/tabbar/home.png",
                selectedIconPath: "static/images/tabbar/home_selected.png",
                text: "首页"
            },
            {
                pagePath: "pages/groupChat/groupChat",
                iconPath: "static/images/tabbar/demo.png",
                selectedIconPath: "static/images/tabbar/demo_selected.png",
                text: "聊天"
            },
            {
                pagePath: "pages/manage/manage",
                text: "工作台",
                iconPath: "static/tabbar/workbench.png",
                selectedIconPath: "static/tabbar/workbenchH.png"
            },
            {
                pagePath: "pages/user/center",
                iconPath: "static/images/tabbar/user.png",
                selectedIconPath: "static/images/tabbar/user_selected.png",
                text: "我的"
            }
        ]
    },
    mutations: mutations,
    actions: actions
})
 
export default store