| | |
| | | import Vue from 'vue'
|
| | | import Vuex from 'vuex' |
| | | import { pageCount } from '@/util/api/index.js'
|
| | | import { pageCount, getTreeList } from '@/util/api/index.js'
|
| | |
|
| | | Vue.use(Vuex) // vue的插件机制
|
| | |
|
| | |
| | | const statusbarHeight = uni.getStorageSync('statusbarHeight');
|
| | | const menuButtonWidth = uni.getStorageSync('menuButtonWidth');
|
| | | const token = uni.getStorageSync('token');
|
| | | const userInfo = uni.getStorageSync('userInfo'); |
| | | const userInfo = uni.getStorageSync('userInfo');
|
| | | const Menu = uni.getStorageSync('MenuList'); |
| | |
|
| | |
|
| | | // Vuex.Store 构造器选项
|
| | |
| | | token: token || null,
|
| | | menuButtonWidth: menuButtonWidth || '0',
|
| | | statusbarHeight: statusbarHeight || '0',
|
| | | navHeight: navHeight || '0', |
| | | navHeight: navHeight || '0',
|
| | | // 菜单权限
|
| | | Menu: Menu ? Menu : [], |
| | | // 待办数量 |
| | | upcomingNum: { |
| | | d: 0, |
| | |
| | | SETNUM(state, val) { |
| | | state.upcomingNum.d = val.d |
| | | state.upcomingNum.y = val.y |
| | | },
|
| | | SETMENU (state, data) {
|
| | | state.Menu = data
|
| | | uni.setStorageSync('MenuList', JSON.stringify(data));
|
| | | }
|
| | | },
|
| | | actions: {
|
| | | // 向后端获取菜单栏权限
|
| | | async getMenuList (content, type) {
|
| | | let res = await getTreeList({ type: type })
|
| | | if (res.code === 200) {
|
| | | content.commit('SETMENU', res.data)
|
| | | }
|
| | | },
|
| | | // 获取状态高度
|
| | | getHeight(context) { |
| | | |
| | | getHeight(context) {
|
| | | let res = uni.getMenuButtonBoundingClientRect()
|
| | | let status = uni.getSystemInfoSync()
|
| | | let menuButtonWidth = res.width
|