Skip to content

Commit

Permalink
修复用户切换页面时路径过期
Browse files Browse the repository at this point in the history
  • Loading branch information
HFO4 committed Mar 12, 2020
1 parent 73ba75b commit 53aa9ac
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 26 deletions.
10 changes: 5 additions & 5 deletions src/component/Upload/Uploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class UploaderComponent extends Component {
}

fileAdd = (up, files) => {
console.log(files);
let path = window.currntPath ? window.currntPath : this.props.path;
if (
this.props.keywords === null &&
window.location.href
Expand All @@ -70,14 +70,14 @@ class UploaderComponent extends Component {
let source = files.getSource();
if (source.relativePath && source.relativePath !== "") {
files.path = basename(
pathJoin([this.props.path, source.relativePath])
pathJoin([path, source.relativePath])
);
window.pathCache[files.id] = basename(
pathJoin([this.props.path, source.relativePath])
pathJoin([path, source.relativePath])
);
} else {
window.pathCache[files.id] = this.props.path;
files.path = this.props.path;
window.pathCache[files.id] = path;
files.path = path;
}
});
window.fileList["enQueue"](files);
Expand Down
43 changes: 22 additions & 21 deletions src/reducers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const checkSelectedProps = (state)=>{
}

const doNavigate = (path,state)=>{
window.currntPath = path;
return Object.assign({}, state, {
navigator:Object.assign({}, state.navigator, {
path: path
Expand Down Expand Up @@ -92,18 +93,18 @@ const cloudreveApp = (state = [], action) => {
}
return Object.assign({}, state, {
viewUpdate: Object.assign({}, state.viewUpdate, {
contextOpen: action.open,
contextType:action.menuType,
contextOpen: action.open,
contextType:action.menuType,
}),
});
case 'DRAG_AND_DROP':
return Object.assign({}, state, {
explorer: Object.assign({}, state.explorer, {
dndSignal: !state.explorer.dndSignal,
dndTarget:action.target,
dndSource:action.source,
}),
});
return Object.assign({}, state, {
explorer: Object.assign({}, state.explorer, {
dndSignal: !state.explorer.dndSignal,
dndTarget:action.target,
dndSource:action.source,
}),
});
case 'SET_NAVIGATOR_LOADING_STATUE':
return Object.assign({}, state, {
viewUpdate: Object.assign({}, state.viewUpdate, {
Expand All @@ -123,7 +124,7 @@ const cloudreveApp = (state = [], action) => {
switch (state.viewUpdate.sortMethod) {
case "sizePos":
return a.size-b.size;
case "sizeRes":
case "sizeRes":
return b.size-a.size;
case 'namePos':
return a.name.localeCompare(b.name);
Expand All @@ -134,7 +135,7 @@ const cloudreveApp = (state = [], action) => {
case 'timeRev':
return Date.parse(b.date)-Date.parse(a.date);
default:
break;
break;
}
})
// eslint-disable-next-line
Expand Down Expand Up @@ -324,9 +325,9 @@ const cloudreveApp = (state = [], action) => {
}),
});
case 'SET_SITE_CONFIG':
return Object.assign({}, state, {
siteConfig: action.config,
});
return Object.assign({}, state, {
siteConfig: action.config,
});
case 'OPEN_MUSIC_DIALOG':
return Object.assign({}, state, {
viewUpdate: Object.assign({}, state.viewUpdate, {
Expand Down Expand Up @@ -381,7 +382,7 @@ const cloudreveApp = (state = [], action) => {
contextOpen:false,
}),
});
case 'OPEN_COPY_DIALOG':
case 'OPEN_COPY_DIALOG':
return Object.assign({}, state, {
viewUpdate: Object.assign({}, state.viewUpdate, {
modals: Object.assign({}, state.viewUpdate.modals, {
Expand All @@ -400,7 +401,7 @@ const cloudreveApp = (state = [], action) => {
contextOpen:false,
}),
});
case 'CLOSE_ALL_MODALS':
case 'CLOSE_ALL_MODALS':
return Object.assign({}, state, {
viewUpdate: Object.assign({}, state.viewUpdate, {
modals: Object.assign({}, state.viewUpdate.modals, {
Expand Down Expand Up @@ -470,7 +471,7 @@ const cloudreveApp = (state = [], action) => {
selectProps: {
isMultiple:false,
withFolder:false,
withFile:false,
withFile:false,
}
}),
});
Expand All @@ -490,7 +491,7 @@ const cloudreveApp = (state = [], action) => {
selectProps: {
isMultiple:false,
withFolder:false,
withFile:false,
withFile:false,
},
keywords:action.keywords,
}),
Expand Down Expand Up @@ -519,7 +520,7 @@ const cloudreveApp = (state = [], action) => {
default:
return state
}
}
}


export default cloudreveApp

0 comments on commit 53aa9ac

Please sign in to comment.