From 0bd87080ae5f03f090146fd9ca961358ac3077a6 Mon Sep 17 00:00:00 2001 From: vapao Date: Mon, 22 Jun 2020 18:30:30 +0800 Subject: [PATCH] =?UTF-8?q?F=20=E4=BF=AE=E5=A4=8D=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=99=A8=E8=AE=BF=E9=97=AE=E6=97=A0=E6=9D=83?= =?UTF-8?q?=E9=99=90=E7=9B=AE=E5=BD=95=E6=97=B6=E8=B7=AF=E5=BE=84=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=94=99=E8=AF=AF=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spug_web/src/pages/ssh/FileManager.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/spug_web/src/pages/ssh/FileManager.js b/spug_web/src/pages/ssh/FileManager.js index c47ff83..5b98624 100644 --- a/spug_web/src/pages/ssh/FileManager.js +++ b/spug_web/src/pages/ssh/FileManager.js @@ -72,7 +72,7 @@ class FileManager extends React.Component { onShow = (visible) => { if (visible) { - this.fetchFiles() + this.fetchFiles(this.state.pwd) } }; @@ -80,19 +80,19 @@ class FileManager extends React.Component { return item.kind === 'd' }; - fetchFiles = () => { + fetchFiles = (pwd) => { this.setState({fetching: true}); - const path = '/' + this.state.pwd.join('/'); + const path = '/' + pwd.join('/'); http.get('/api/file/', {params: {id: this.id, path}}) .then(res => { const objects = lds.orderBy(res, [this._kindSort, 'name'], ['desc', 'asc']); - this.setState({objects}) + this.setState({objects, pwd}) }) .finally(() => this.setState({fetching: false})) }; handleChdir = (name, action) => { - let pwd = this.state.pwd; + let pwd = this.state.pwd.map(x => x); if (action === '1') { pwd.push(name) } else if (action === '2') { @@ -101,7 +101,7 @@ class FileManager extends React.Component { } else { pwd = [] } - this.setState({pwd}, this.fetchFiles); + this.fetchFiles(pwd) }; handleUpload = () => {