shuishen
2024-01-19 4f8f5e5375b82a5ebc1f67f389b934b3b757f062
src/store/modules/common.js
@@ -1,20 +1,25 @@
import {
  setStore,
  getStore,
  removeStore
} from '@/util/store'
import website from '@/config/website'
/*
 * @Author: shuishen 1109946754@qq.com
 * @Date: 2023-12-14 17:10:00
 * @LastEditors: shuishen 1109946754@qq.com
 * @LastEditTime: 2024-01-19 16:43:29
 * @FilePath: \jczz_web\src\store\modules\common.js
 * @Description:
 *
 * Copyright (c) 2024 by shuishen, All Rights Reserved.
 */
import { setStore, getStore, removeStore } from "@/util/store";
import website from "@/config/website";
const common = {
  state: {
    language: getStore({name: 'language'}) || 'zh',
    language: getStore({ name: "language" }) || "zh",
    isCollapse: false,
    isFullScren: false,
    isMenu: true,
    isShade: false,
    screen: -1,
    isLock: getStore({name: 'isLock'}) || false,
    isLock: getStore({ name: "isLock" }) || false,
    showTag: true,
    showDebug: true,
    showCollapse: true,
@@ -24,18 +29,18 @@
    showTheme: true,
    showMenu: true,
    showColor: true,
    colorName: getStore({name: 'colorName'}) || '#409EFF',
    themeName: 'theme-white',
    lockPasswd: getStore({name: 'lockPasswd'}) || '',
    colorName: getStore({ name: "colorName" }) || "#409EFF",
    themeName: "theme-white",
    lockPasswd: getStore({ name: "lockPasswd" }) || "",
    website: website,
  },
  mutations: {
    SET_LANGUAGE: (state, language) => {
      state.language = language
      state.language = language;
      setStore({
        name: 'language',
        content: state.language
      })
        name: "language",
        content: state.language,
      });
    },
    SET_SHADE: (state, active) => {
      state.isShade = active;
@@ -52,10 +57,10 @@
    SET_LOCK: (state) => {
      state.isLock = true;
      setStore({
        name: 'isLock',
        name: "isLock",
        content: state.isLock,
        type: 'session'
      })
        type: "session",
      });
    },
    SET_SCREEN: (state, screen) => {
      state.screen = screen;
@@ -63,37 +68,37 @@
    SET_COLOR_NAME: (state, colorName) => {
      state.colorName = colorName;
      setStore({
        name: 'colorName',
        name: "colorName",
        content: state.colorName,
      })
      });
    },
    SET_THEME_NAME: (state, themeName) => {
      state.themeName = themeName;
      setStore({
        name: 'themeName',
        name: "themeName",
        content: state.themeName,
      })
      });
    },
    SET_LOCK_PASSWD: (state, lockPasswd) => {
      state.lockPasswd = lockPasswd;
      setStore({
        name: 'lockPasswd',
        name: "lockPasswd",
        content: state.lockPasswd,
        type: 'session'
      })
        type: "session",
      });
    },
    CLEAR_LOCK: (state) => {
      state.isLock = false;
      state.lockPasswd = '';
      state.lockPasswd = "";
      removeStore({
        name: 'lockPasswd',
        type: 'session'
        name: "lockPasswd",
        type: "session",
      });
      removeStore({
        name: 'isLock',
        type: 'session'
        name: "isLock",
        type: "session",
      });
    },
  }
}
export default common
  },
};
export default common;