智慧保安互联网APP
shuishen
2021-08-03 24f17cb2b4db33b79bbd69b5342cf7dc7c2cdd35
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
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://223.82.109.183:2080/api',
        // piAPI: 'http://localhost:82/',
        piAPI: 'http://192.168.0.108:81',
        puserName: '',
        puserID: '',
        puserIphone:'',
        avatar:"../../static/logo.png",
        UserData: {},
        tabbar:[{
                iconPath: "/static/tabbar/index01.png",
                selectedIconPath: "/static/tabbar/index02.png",
                text: '首页',
                pagePath: "/pages/home/home"
            },
            {
                iconPath: "/static/tabbar/article.png",
                selectedIconPath: "/static/tabbar/articleH.png",
                text: '资讯',
                pagePath: "/pages/article/article"
            },
            {
                iconPath: "/static/tabbar/workbench.png",
                selectedIconPath: "/static/tabbar/workbenchH.png",
                text: '工作台',
                count: 2,
                isDot: false,
                pagePath: "/pages/business/business"
            },
            {
                iconPath: "/static/tabbar/my.png",
                selectedIconPath: "/static/tabbar/my-blue.png",
                text: '我的',
                pagePath: "/pages/myself/myself"
            },
        ]
    },
    mutations: mutations,
    actions:actions
})
 
export default store