123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- /*
- * @Author: your name
- * @Date: 2021-10-14 17:17:53
- * @LastEditTime: 2022-02-14 17:19:26
- * @LastEditors: your name
- * @Description: In User Settings Edit
- * @FilePath: \Foshan4A\src\store\modules\app.js
- */
- import Cookies from 'js-cookie'
- const state = {
- sidebar: {
- opened: Cookies.get('sidebarStatus') ? !!+Cookies.get('sidebarStatus') : true,
- withoutAnimation: false
- },
- device: 'desktop',
- dialog: Cookies.get('dialogStatus') === 'true' ? true : false,
- pwdflag: false,
- outflag: false,
- outcheck: false,
- systemSet: Cookies.get('systemSet') != null ? Cookies.get('systemSet') : null,
- errorNum: Cookies.get('errorNum') ? Cookies.get('errorNum') : 0,
- wsData: []
- }
- const mutations = {
- TOGGLE_SIDEBAR: state => {
- state.sidebar.opened = !state.sidebar.opened
- state.sidebar.withoutAnimation = false
- if (state.sidebar.opened) {
- Cookies.set('sidebarStatus', 1)
- } else {
- Cookies.set('sidebarStatus', 0)
- }
- },
- CLOSE_SIDEBAR: (state, withoutAnimation) => {
- Cookies.set('sidebarStatus', 0)
- state.sidebar.opened = false
- state.sidebar.withoutAnimation = withoutAnimation
- },
- TOGGLE_DEVICE: (state, device) => {
- state.device = device
- },
- TOGGLE_DIALOG: (state, dialog) => {
- state.dialog = dialog
- Cookies.set('dialogStatus', dialog)
- },
- TOGGLE_PWDFLAG: (state, pwdflag) => {
- state.pwdflag = pwdflag
- },
- TOGGLE_OUTFLAG: (state, outflag) => {
- state.outflag = outflag
- },
- TOGGLE_OUTCHECK: (state, outcheck) => {
- state.outcheck = outcheck
- },
- SYSTEM_SET: (state, systemSet) => {
- state.systemSet = systemSet
- Cookies.set('systemSet', systemSet)
- },
- ERROR_NUM: (state, systemSet) => {
- state.errorNum = systemSet
- Cookies.set('errorNum', systemSet)
- },
- WS_DATA: (state, data) => {
- state.wsData = data
- },
- }
- const actions = {
- toggleSideBar ({ commit }) {
- commit('TOGGLE_SIDEBAR')
- },
- closeSideBar ({ commit }, { withoutAnimation }) {
- commit('CLOSE_SIDEBAR', withoutAnimation)
- },
- toggleDevice ({ commit }, device) {
- commit('TOGGLE_DEVICE', device)
- },
- toggleDialog ({ commit }, dialog) {
- commit('TOGGLE_DIALOG', dialog)
- },
- togglePwdflag ({ commit }, pwdflag) {
- commit('TOGGLE_PWDFLAG', pwdflag)
- },
- toggleOutflag ({ commit }, outflag) {
- commit('TOGGLE_OUTFLAG', outflag)
- },
- toggleOutcheck ({ commit }, outcheck) {
- commit('TOGGLE_OUTCHECK', outcheck)
- },
- getSystemSet ({ commit }, systemSet) {
- commit('SYSTEM_SET', systemSet)
- },
- getErrorNum ({ commit }, systemSet) {
- commit('ERROR_NUM', systemSet)
- },
- getWsData ({ commit }, data) {
- commit('WS_DATA', data)
- },
- }
- export default {
- namespaced: true,
- state,
- mutations,
- actions
- }
|