| | |
| | | /*
|
| | | * @Date: 2019-11-26 00:59:58
|
| | | * @LastEditors: Sneed
|
| | | * @LastEditTime: 2024-01-07 22:57:26
|
| | | * @FilePath: /belleson-frontend/Users/mache/Documents/demo/mdc/src/store/modules/app.js
|
| | | */
|
| | | import Cookies from 'js-cookie'
|
| | |
|
| | | import { getPlanList} from '@/api/MdcApi'
|
| | | const app = {
|
| | | state: {
|
| | | sidebar: {
|
| | | opened: !+Cookies.get('sidebarStatus'),
|
| | | withoutAnimation: false
|
| | | },
|
| | | device: 'desktop',
|
| | | mainHeight: 0,
|
| | | mainWidth: 0
|
| | | |
| | | },
|
| | | mutations: {
|
| | | TOGGLE_SIDEBAR: state => {
|
| | | if (state.sidebar.opened) {
|
| | | Cookies.set('sidebarStatus', 1)
|
| | | } else {
|
| | | Cookies.set('sidebarStatus', 0)
|
| | | }
|
| | | state.sidebar.opened = !state.sidebar.opened
|
| | | state.sidebar.withoutAnimation = false
|
| | | // 左侧菜单栏宽度变化后 重新计算右侧内容区域宽度
|
| | | let dif = 0
|
| | | if (state.device === 'desktop') {
|
| | | dif = state.sidebar.opened ? 180 : 36
|
| | | } else {
|
| | | dif = 0
|
| | | }
|
| | | state.mainWidth = window.innerWidth - dif
|
| | | },
|
| | | CLOSE_SIDEBAR: (state, withoutAnimation) => {
|
| | | Cookies.set('sidebarStatus', 1)
|
| | | state.sidebar.opened = false
|
| | | state.sidebar.withoutAnimation = withoutAnimation
|
| | | },
|
| | | TOGGLE_DEVICE: (state, device) => {
|
| | | state.device = device
|
| | | state.mainHeight = window.innerHeight - 50
|
| | | // 页面尺寸变化后(页面初始化时) 计算右侧内容区域宽度
|
| | | let dif = 0
|
| | | if (state.device === 'desktop') {
|
| | | dif = state.sidebar.opened ? 180 : 36
|
| | | } else {
|
| | | dif = 0
|
| | | }
|
| | | state.mainWidth = window.innerWidth - dif
|
| | | }
|
| | | |
| | | },
|
| | | actions: {
|
| | | ToggleSideBar: ({ commit }) => {
|
| | | commit('TOGGLE_SIDEBAR')
|
| | | },
|
| | | CloseSideBar({ commit }, { withoutAnimation }) {
|
| | | commit('CLOSE_SIDEBAR', withoutAnimation)
|
| | | },
|
| | | ToggleDevice({ commit }, device) {
|
| | | commit('TOGGLE_DEVICE', device)
|
| | | }
|
| | | |
| | | }
|
| | | }
|
| | |
|