一、已完成: 1.完成文件列表的展示、预览、删除、下载(多文件、多目录打包下载) 2.文件、文件夹的上传,大文件、多文件上传、断点续传(在另一台电脑的浏览器可以继续) 二、待完成: * 移动复制文件和文件夹(可拖动) * 文件和文件夹的分享,可设置连接时效 * 文件的收藏和打标签(方便筛选) * 适配手机界面
49 lines
1.0 KiB
JavaScript
49 lines
1.0 KiB
JavaScript
import Cookies from 'js-cookie'
|
|
|
|
const state = {
|
|
sidebar: {
|
|
opened: Cookies.get('sidebarStatus') ? !!+Cookies.get('sidebarStatus') : true,
|
|
withoutAnimation: false
|
|
},
|
|
device: 'desktop'
|
|
}
|
|
|
|
const mutations = {
|
|
TOGGLE_SIDEBAR: state => {
|
|
state.sidebar.opened = !state.sidebar.opened
|
|
state.sidebar.withoutAnimation = false
|
|
if (state.sidebar.opened) {
|
|
Cookies.set('sidebarStatus', 1)
|
|
} else {
|
|
Cookies.set('sidebarStatus', 0)
|
|
}
|
|
},
|
|
CLOSE_SIDEBAR: (state, withoutAnimation) => {
|
|
Cookies.set('sidebarStatus', 0)
|
|
state.sidebar.opened = false
|
|
state.sidebar.withoutAnimation = withoutAnimation
|
|
},
|
|
TOGGLE_DEVICE: (state, device) => {
|
|
state.device = device
|
|
}
|
|
}
|
|
|
|
const actions = {
|
|
toggleSideBar({ commit }) {
|
|
commit('TOGGLE_SIDEBAR')
|
|
},
|
|
closeSideBar({ commit }, { withoutAnimation }) {
|
|
commit('CLOSE_SIDEBAR', withoutAnimation)
|
|
},
|
|
toggleDevice({ commit }, device) {
|
|
commit('TOGGLE_DEVICE', device)
|
|
}
|
|
}
|
|
|
|
export default {
|
|
namespaced: true,
|
|
state,
|
|
mutations,
|
|
actions
|
|
}
|