Mr.Shi
2023-08-29 d8d184a00d3581b3a77aa26864a153f0515524e0
minipro_standard/store/index.js
@@ -1,6 +1,6 @@
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的插件机制
@@ -8,7 +8,8 @@
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 构造器选项
@@ -20,7 +21,9 @@
      token: token || null,
      menuButtonWidth: menuButtonWidth || '0',
      statusbarHeight: statusbarHeight || '0',
      navHeight: navHeight || '0',
      navHeight: navHeight || '0',
      // 菜单权限
      Menu: Menu ? Menu : [],
      // 待办数量
      upcomingNum: {
         d: 0,
@@ -47,12 +50,22 @@
      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