吉安感知网项目-前端
shuishen
2026-02-03 89380e6260a75d1d3b94de687ebcc2f50d50659d
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
/*
 * @Author: shuishen 1109946754@qq.com
 * @Date: 2025-03-31 10:39:40
 * @LastEditors: shuishen 1109946754@qq.com
 * @LastEditTime: 2025-04-03 12:01:58
 * @FilePath: \mobile-web-view\src\store\modules\common.js
 * @Description:
 *
 * Copyright (c) 2025 by shuishen, All Rights Reserved.
 */
import { setStore, getStore, removeStore } from 'utils/store'
import website from '@/config/website'
 
const common = {
    state: {
        language: getStore({ name: 'language' }) || 'zh-cn',
        isCollapse: false,
        isFullScren: false,
        isMenu: true,
        isSearch: false,
        isRefresh: true,
        mqttState: null, // mqtt 实例
        clientId: null, // 客户端ID实例
        isLock: getStore({ name: 'isLock' }),
        colorName: getStore({ name: 'colorName' }) || '#2C77F1',
        themeName: getStore({ name: 'themeName' }) || 'theme-go',
        lockPasswd: getStore({ name: 'lockPasswd' }) || '',
        website: website,
        setting: website.setting,
        // 地图设置
        mapSetting: {
            mode: 17, // 0为标准地图, 1为卫星地图
            roadLine: true,
            visual: '3D',
            isDark: false,
        },
        // 不知道谁写的,状态写反了
        isHideBottomIcon: true,
        isShowTopMachineNest: true,//显示头部查询条件
        showTopAreaTree: true,//显示行政区划
        todosData: [], //待办事项
        liveResolution:{width:0,height:0},//当前无人机直播分辨率
        downloadProgress:{
            dpsjzx: 100, //大屏数据中心
            dplsrwxq: 100, //大屏历史任务详情
        },
        deviceUpdateKey: 0, //设备刷新key
        jobUpdateKey: 0, //任务刷新key
        lastHeight: 0, // 获取最后一点高度
        uniPlatform: 'h5',//uni平台
    },
    mutations: {
        setUniPlatform(state, data) {
            state.uniPlatform = data
        },
        deviceUpdateKeyAdd(state, data) {
            state.deviceUpdateKey = state.deviceUpdateKey + 1
        },
        jobUpdateKeyAdd(state, data) {
            state.jobUpdateKey = state.jobUpdateKey + 1
        },
        setDownloadProgress(state, data) {
            state.downloadProgress = data
        },
        setLiveResolution(state, data) {
            state.liveResolution = data
        },
        setTodosData(state, data) {
            state.todosData = data
        },
        setShowTopAreaTree (state, data) {
            state.showTopAreaTree = data
        },
        setShowTopMachineNest (state, data) {
            state.isShowTopMachineNest = data
        },
        setHideBottomIcon(state, data) {
            state.isHideBottomIcon = data
        },
 
        SET_MQTT_STATE(state, mqttState) {
            state.mqttState = mqttState
        },
        SET_CLIENT_ID(state, id) {
            state.clientId = id
        },
        SET_LANGUAGE: (state, language) => {
            state.language = language
            setStore({
                name: 'language',
                content: state.language,
            })
        },
        SET_COLLAPSE: state => {
            state.isCollapse = !state.isCollapse
        },
        SET_IS_MENU: (state, menu) => {
            state.isMenu = menu
        },
        SET_IS_REFRESH: (state, refresh) => {
            state.isRefresh = refresh
        },
        SET_IS_SEARCH: (state, search) => {
            state.isSearch = search
        },
        SET_FULLSCREN: state => {
            state.isFullScren = !state.isFullScren
        },
        SET_LOCK: state => {
            state.isLock = true
            setStore({
                name: 'isLock',
                content: state.isLock,
                type: 'session',
            })
        },
        SET_COLOR_NAME: (state, colorName) => {
            state.colorName = colorName
            setStore({
                name: 'colorName',
                content: state.colorName,
            })
        },
        SET_THEME_NAME: (state, themeName) => {
            state.themeName = themeName
            setStore({
                name: 'themeName',
                content: state.themeName,
            })
        },
        SET_LOCK_PASSWD: (state, lockPasswd) => {
            state.lockPasswd = lockPasswd
            setStore({
                name: 'lockPasswd',
                content: state.lockPasswd,
                type: 'session',
            })
        },
        CLEAR_LOCK: state => {
            state.isLock = false
            state.lockPasswd = ''
            removeStore({
                name: 'lockPasswd',
                type: 'session',
            })
            removeStore({
                name: 'isLock',
                type: 'session',
            })
        },
    },
}
export default common