From d6d4873a66c802717a8b49272bdad270ee5f4bb2 Mon Sep 17 00:00:00 2001 From: Luk Lu Date: Sat, 27 May 2023 21:13:16 +0800 Subject: [PATCH] send _passtoken when uploading file to backend server --- unitool.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/unitool.js b/unitool.js index 5ae783b..eb50cb4 100644 --- a/unitool.js +++ b/unitool.js @@ -268,6 +268,7 @@ export default { formData[key] = JSON.stringify(formData[key]) } // 在 Fileloader/fileloader.js 里,已经不再依赖 _passtoken,而且 header 在被 nginx 或 cloudflare (没搞清楚是谁干的)代理之后也被过滤掉了,因此不再使用这一句: header._passtoken = uni.getStorageSync('_passtoken') + formData[_passtoken] = uni.getStorageSync('_passtoken') // 20230527 加回这一句,让后台可以根据验证用户来决定怎样处理文件。 uni.showLoading() let [errorUpload, { data, statusCode } = {}] = await uni.uploadFile({ url: this.makeServerUrl(url), filePath, name, header, formData }) @@ -573,7 +574,7 @@ export default { }, next_focus (currentFocus, focusList) { - focusList = focusList || getCurrentPages?.pop()?.focusList + focusList = focusList || getCurrentPages()?.pop()?.focusList if (focusList) { for (let n in focusList) { focusList[n] = false @@ -591,7 +592,7 @@ export default { uni.hideToast() wo.tt.showToast({ type: wo.c2t.GREEN, - title: `${wo.ll({ zhCN: '已成功拷贝到剪贴板', enUS: 'Successfully copied to clipboard ' })}\n${String(text).substring(0, toastLength)}`, + title: `${wo.ll({ zhCN: '已成功拷贝', enUS: 'Successfully copied' })}\n${String(text).substring(0, toastLength)}`, }) }, })