From 8f4575c87bb68c0df622b03ba7da9532486a1597 Mon Sep 17 00:00:00 2001 From: Luk Lu Date: Sun, 8 Oct 2023 16:20:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=AF=8F=E6=AC=A1=20callBase=20=E6=97=B6?= =?UTF-8?q?=E4=BC=A0=E5=85=A5=20=5FclientInfo=20=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- unitool.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/unitool.js b/unitool.js index f80ca2f..a09a8cc 100644 --- a/unitool.js +++ b/unitool.js @@ -168,6 +168,9 @@ export default { const thisRoute = getCurrentPages()?.pop?.()?.route || 'VueApp' // 立刻保存 route,因为在调用后台后,可能已切换到了其他页面。 const startTime = new Date().toJSON() let url = undefined + let { uniPlatform, deviceType, osName } = uni.getSystemInfoSync() + apiWhat._clientInfo = { uniPlatform, deviceType, osName } + apiWhat._passtoken = uni.getStorageSync('_passtoken') let result = {} if (baseType === 'UNICLOUD_OBJECT') { const uniObj = uniCloud.importObject(apiWho) @@ -183,7 +186,6 @@ export default { data: { apiTodo, apiWhat, - _passtoken: uni.getStorageSync('_passtoken'), // uniIdToken // uniCloud自动getStorageSync('uni_id_token')并传递为 uniIdToken;也可自行组装传入 uniIdToken }, }) @@ -208,8 +210,8 @@ export default { url = this.make_server_url(`${apiVersion}/${apiWho}/${apiTodo}`) let [error, { statusCode, header, errMsg, data: resultServer = {} } = {}] = await uni.request({ method: httpMethod, - url: url, - data: { ...apiWhat, _passtoken: uni.getStorageSync('_passtoken') }, + url, + data: apiWhat, timeout, }) if (error) {