zhaoxing
2023-05-11 3a4ec8da75f6f9eaf9571334319388455c61c65b
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'
 
 
Vue.use(Vuex)
 
const store = new Vuex.Store({
    state: {
        userInfo: {},
        token: '',
        config: {
            site_title: ''
        },
        num: 0,
        main_model: {},
        models: [],
        is_loaded: false,
        tabbar: {
            "selectedColor": "#fff",
            "color": "#848597",
            "fontSize": "16",
            "list": [
                {
                    "text": "模型切换",
                    "pagePath": "pages/tab/assistant",
                    "iconPath": "static/tabbar/model.png",
                    "selectedIconPath": "static/tabbar/modeld.png"
                },
                {
                    "text": "我的",
                    "pagePath": "pages/mine/mine",
                    "iconPath": "static/tabbar/mine.png",
                    "selectedIconPath": "static/tabbar/mined.png"
                }
            ]
        }
    },
    mutations: {
        login(state, userInfo) {
            state.userInfo = userInfo;
            state.num = userInfo.num;
            state.token = userInfo.token;
        },
        syncUserInfo(state, userInfo) {
            state.userInfo = userInfo;
            state.num = userInfo.num;
        },
        syncUserNum(state, num) {
            state.num = num;
        },
        useNum(state, num) {
            state.num = state.num - num;
        },
        logout(state) {
            state.userInfo = {}
            state.token = ''
            state.num = 0
        },
        setConfig(state, config) {
            state.config = config.data
            state.main_model = config.main_model
            state.models = config.models
        },
        wxH5SetToken(state, token) {
            state.token = token
        },
        setIndexTabbar(state, page) {
            state.tabbar.list.unshift(page)
        },
        setLoaded(state) {
            state.is_loaded = true
        }
    }
})
 
export default store