From f5b09b8581e5e8f14e42e2802edd592d3984be65 Mon Sep 17 00:00:00 2001 From: "96607667.zh" Date: Tue, 8 Feb 2022 17:52:35 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E6=B7=BB=E5=8A=A0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E8=BF=9B=E5=BA=A6=E6=9D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mayfly_go_web/src/common/Api.ts | 4 +- mayfly_go_web/src/common/request.ts | 10 +-- .../src/views/ops/machine/FileManage.vue | 68 +++++++++++++++---- mayfly_go_web/src/views/ops/machine/api.ts | 2 +- 4 files changed, 64 insertions(+), 20 deletions(-) diff --git a/mayfly_go_web/src/common/Api.ts b/mayfly_go_web/src/common/Api.ts index 3a7fc83e..4c46a8df 100644 --- a/mayfly_go_web/src/common/Api.ts +++ b/mayfly_go_web/src/common/Api.ts @@ -48,8 +48,8 @@ class Api { * 操作该权限,即请求对应的url * @param {Object} param 请求该权限的参数 */ - request(param: any = null): Promise { - return request.send(this, param); + request(param: any = null, options: any = null): Promise { + return request.send(this, param, options); } /** diff --git a/mayfly_go_web/src/common/request.ts b/mayfly_go_web/src/common/request.ts index 9441563d..a08a1b5c 100755 --- a/mayfly_go_web/src/common/request.ts +++ b/mayfly_go_web/src/common/request.ts @@ -99,7 +99,7 @@ service.interceptors.response.use( * @param {Object} uri uri * @param {Object} params 参数 */ -function request(method: string, url: string, params: any, headers: any): Promise { +function request(method: string, url: string, params: any, headers: any, options: any): Promise { if (!url) throw new Error('请求url不能为空'); // 简单判断该url是否是restful风格 @@ -109,6 +109,7 @@ function request(method: string, url: string, params: any, headers: any): Promis const query: any = { method, url: url, + ...options }; if (headers) { query.headers = headers @@ -121,7 +122,6 @@ function request(method: string, url: string, params: any, headers: any): Promis } else { query.params = params; } - return service.request(query).then(res => res) .catch(e => { // 如果返回的code不为成功,则会返回对应的错误msg,则直接统一通知即可 @@ -137,8 +137,8 @@ function request(method: string, url: string, params: any, headers: any): Promis * @param api Api实例 * @param params 请求参数 */ -function send(api: Api, params: any): Promise { - return request(api.method, api.url, params, null); +function send(api: Api, params: any, options: any): Promise { + return request(api.method, api.url, params, null, options); } /** @@ -147,7 +147,7 @@ function send(api: Api, params: any): Promise { * @param params 请求参数 */ function sendWithHeaders(api: Api, params: any, headers: any): Promise { - return request(api.method, api.url, params, headers); + return request(api.method, api.url, params, headers, null); } function getApiUrl(url: string) { diff --git a/mayfly_go_web/src/views/ops/machine/FileManage.vue b/mayfly_go_web/src/views/ops/machine/FileManage.vue index 0157f582..9314f707 100755 --- a/mayfly_go_web/src/views/ops/machine/FileManage.vue +++ b/mayfly_go_web/src/views/ops/machine/FileManage.vue @@ -51,10 +51,17 @@
+