From f4dccc921aef866c35f0b74c962507009c8d7bda Mon Sep 17 00:00:00 2001 From: Yqhg8Nt4tuu <35868425+Holldean@users.noreply.github.com> Date: Mon, 11 May 2020 22:25:47 +0800 Subject: [PATCH] feat: Support Rename and Edit Static Files (halo #573) (halo-dev/console#152) * Finish rename function * Finish edit function and fix a bug * Delete a console.log * Change save API url Co-authored-by: Rokita <35868425+Ruukita@users.noreply.github.com> --- src/api/static.js | 29 +++ .../system/developer/tabs/StaticStorage.vue | 165 +++++++++++++++++- 2 files changed, 191 insertions(+), 3 deletions(-) diff --git a/src/api/static.js b/src/api/static.js index 648392059..ae3790645 100644 --- a/src/api/static.js +++ b/src/api/static.js @@ -46,4 +46,33 @@ staticApi.upload = (formData, uploadProgress, cancelToken, basePath) => { }) } +staticApi.rename = (basePath, newName) => { + return service({ + url: `${baseUrl}/rename`, + params: { + basePath: basePath, + newName: newName + }, + method: 'post' + }) +} + +staticApi.getContent = url => { + return service({ + url: `${url}`, + method: 'get' + }) +} + +staticApi.save = (path, content) => { + return service({ + url: `${baseUrl}/files`, + data: { + path: path, + content: content + }, + method: 'put' + }) +} + export default staticApi diff --git a/src/views/system/developer/tabs/StaticStorage.vue b/src/views/system/developer/tabs/StaticStorage.vue index fadfbfacd..b61ed5034 100644 --- a/src/views/system/developer/tabs/StaticStorage.vue +++ b/src/views/system/developer/tabs/StaticStorage.vue @@ -12,7 +12,7 @@ >上传 新建文件夹 @@ -39,7 +39,7 @@ slot-scope="name" > {{ name }} @@ -91,6 +91,23 @@ 删除 + + 重命名 + + + 编辑 + @@ -126,17 +143,78 @@ + + + + + + + + + + + + + + + +