zhgdyun/src/store/module/sideMenu.js

30 lines
814 B
JavaScript
Raw Normal View History

2022-06-08 14:51:11 +08:00
import { getstorage } from '@/assets/js/api/file.js'
export default {
state: {
isFolder: sessionStorage.getItem("isFolder"), // 左侧栏是否折叠0不折叠1折叠
storageValue: 0, // 已使用存储容量
storageMaxValue: Math.pow(1024, 3) * 100 // 最大存储容量100GB
},
mutations: {
changeIsFolder(state, data) {
sessionStorage.setItem("isFolder", data);
state.isFolder = data;
},
setStorageValue(state, data) {
state.storageValue = data;
}
},
actions: {
showStorage(context) {
return getstorage().then(res => {
if (res.success) {
context.commit('setStorageValue', res.data ? Number(res.data.storageSize) : 0)
} else {
this.$message.error(res.errorMessage)
}
});
}
}
}