zhgdyun/src/store/module/sideMenu.js
2022-06-08 14:51:11 +08:00

30 lines
814 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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)
}
});
}
}
}