From e8b8c6418c393341da52f66ed47d735fa8f41ea3 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 23 七月 2024 15:53:33 +0800 Subject: [PATCH] 2024-07-23 --- src/api/index.js | 22 +++++++++++++++++++++- src/tabviews/zshare/actionList/normalbutton/index.jsx | 24 ++++++++++++++++-------- 2 files changed, 37 insertions(+), 9 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index 36dd8e7..0dca831 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -160,7 +160,27 @@ /** * @description 鐩存帴璇锋眰 */ - directRequest (params) { + directRequest (params, script, position) { + if (script) { + try { + // eslint-disable-next-line + let func = new Function('axios', 'Api', 'param', 'position', 'systemType', 'notification', script) + let promise = func(axios, this, params, position, window.GLOB.systemType, notification) + + if (promise instanceof Promise) { + return promise + } + } catch (e) { + console.warn(e) + } + + return Promise.resolve({ + status: false, + message: '鑷畾涔夎剼鏈墽琛岄敊璇�', + ErrCode: 'E' + }) + } + return axios(params) } diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx index 9c00d6e..b1555d2 100644 --- a/src/tabviews/zshare/actionList/normalbutton/index.jsx +++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx @@ -1386,7 +1386,21 @@ method: btn.method || 'post' } - if (btn.cross === 'true') { + if (btn.ContentType) { + _params.headers = { + 'Content-Type': btn.ContentType + } + } + + if (btn.$outerScript) { + if (JSON.stringify(param) !== '{}') { + if (btn.stringify === 'qs') { + _params.data = qs.stringify(param) + } else { + _params.data = param + } + } + } else if (btn.cross === 'true') { if (JSON.stringify(param) !== '{}') { if (btn.stringify === 'qs') { _params.data = qs.stringify(param) @@ -1420,13 +1434,7 @@ _params.method = 'post' } - if (btn.ContentType) { - _params.headers = { - 'Content-Type': btn.ContentType - } - } - - Api.directRequest(_params).then(res => { + Api.directRequest(_params, btn.$outerScript, 'outer').then(res => { if (typeof(res) !== 'object') { let error = '鏈煡鐨勮繑鍥炵粨鏋滐紒' -- Gitblit v1.8.0