| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- import axios from '../axios/index';
- import fn from '../untils/until';
- const actions = {
- undata_navData(store) {
- //全局侧边栏更新
- axios('/api/menu').then((res) => {
- let deepObjToArray = function(obj) {
- let result = Object.values(obj);
- result.map((v) =>
- fn.isType(v.sub) == 'Object' ? (v.sub = deepObjToArray(v.sub)) : ''
- );
- return result;
- };
- let result = deepObjToArray(res.data);
- store.commit('updataNavgation', result);
- });
- },
- undata_side_navData(store) {
- //侧边栏更新
- let nav = sessionStorage.getItem('navgation');
- if (nav && nav.length == 0) {
- axios('/api/menu').then((res) => {
- let deepObjToArray = function(obj) {
- let result = Object.values(obj);
- result.map((v) =>
- fn.isType(v.sub) == 'Object' ? (v.sub = deepObjToArray(v.sub)) : ''
- );
- return result;
- };
- let result = deepObjToArray(res.data);
- store.commit('updataNavgation', result);
- });
- } else {
- store.commit('updataNavgation', JSON.parse(nav));
- }
- },
- update_notice(store) {
- axios('/api/notice_list_unread/').then((res) => {
- if (res.code == 200) {
- store.commit('updataNoticeNum', res.data.total);
- }
- });
- },
- updata_permission(store, payload) {
- store.commit('updataPermissionData', payload);
- },
- };
- export default actions;
|