From 8f73231e26cf2737a0af9d7e2dc41327c3dda066 Mon Sep 17 00:00:00 2001 From: HFO4 <912394456@qq.com> Date: Sat, 30 Nov 2019 15:47:26 +0800 Subject: [PATCH] =?UTF-8?q?Feat:=20=E5=AF=B9=E6=8E=A5=E5=88=A0=E9=99=A4/?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E7=9B=AE=E5=BD=95=E5=AF=B9=E8=B1=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/component/FileManager/Modals.js | 23 ++++++++--------------- src/component/FileManager/Navigator.js | 6 +----- src/middleware/Api.js | 2 +- 3 files changed, 10 insertions(+), 21 deletions(-) diff --git a/src/component/FileManager/Modals.js b/src/component/FileManager/Modals.js index 6cfadfb..c142450 100644 --- a/src/component/FileManager/Modals.js +++ b/src/component/FileManager/Modals.js @@ -10,7 +10,7 @@ import { } from "../../actions/index" import PathSelector from "./PathSelector" import axios from 'axios' - +import API from "../../middleware/Api" import { withStyles, Button, @@ -169,14 +169,12 @@ class ModalsCompoment extends Component { items.push(value.path === "/" ? value.path+value.name:value.path+"/"+value.name); } }); - axios.post('/File/Delete', { - action: 'delete', + API.delete('/object', { data: { items: items, dirs:dirs, - newPath:this.state.selectedPath === "//"?"/":this.state.selectedPath, - }) + }}) .then( (response)=> { - if(response.data.result.success){ + if(response.rawData.code == 0){ this.onClose(); this.props.refreshFileList(); }else{ @@ -290,17 +288,12 @@ class ModalsCompoment extends Component { this.props.toggleSnackbar("top","right","文件夹名称重复","warning"); this.props.setModalsLoading(false); }else{ - axios.post('/File/createFolder', { - action: '"createFolder"', - newPath: (this.props.path === "/"?"":this.props.path)+"/"+this.state.newFolderName, + API.put('/directory', { + path: (this.props.path === "/"?"":this.props.path)+"/"+this.state.newFolderName, }) .then( (response)=> { - if(response.data.result.success){ - this.onClose(); - this.props.refreshFileList(); - }else{ - this.props.toggleSnackbar("top","right",response.data.result.error,"warning"); - } + this.onClose(); + this.props.refreshFileList(); this.props.setModalsLoading(false); }) diff --git a/src/component/FileManager/Navigator.js b/src/component/FileManager/Navigator.js index 193b3dc..07374eb 100644 --- a/src/component/FileManager/Navigator.js +++ b/src/component/FileManager/Navigator.js @@ -184,11 +184,7 @@ class NavigatorCompoment extends Component { var newPath = path!==null?path:this.props.path; var apiURL = this.keywords===null?'/directory':'/File/SearchFile'; newPath = this.keywords===null?newPath:this.keywords; - API.get(apiURL, { - params: { - path: newPath, - } - }) + API.get(apiURL+newPath,) .then( (response)=> { this.props.updateFileList(response.data); this.props.setNavigatorLoadingStatus(false); diff --git a/src/middleware/Api.js b/src/middleware/Api.js index baa4038..77aaa32 100644 --- a/src/middleware/Api.js +++ b/src/middleware/Api.js @@ -13,7 +13,7 @@ instance.interceptors.response.use( function(response) { response.rawData = response.data; response.data = response.data.data; - if (response.rawData.code != 0){ + if (response.rawData.code != 0 && response.rawData.code != 203 ){ // 登录过期 if (response.rawData.code == 401){ Auth.signout();