send _passtoken when uploading file to backend server

This commit is contained in:
陆柯 2023-05-27 21:13:16 +08:00
parent 3fc655dc0a
commit d6d4873a66

View File

@ -268,6 +268,7 @@ export default {
formData[key] = JSON.stringify(formData[key]) formData[key] = JSON.stringify(formData[key])
} }
// 在 Fileloader/fileloader.js 里,已经不再依赖 _passtoken而且 header 在被 nginx 或 cloudflare (没搞清楚是谁干的)代理之后也被过滤掉了,因此不再使用这一句: header._passtoken = uni.getStorageSync('_passtoken') // 在 Fileloader/fileloader.js 里,已经不再依赖 _passtoken而且 header 在被 nginx 或 cloudflare (没搞清楚是谁干的)代理之后也被过滤掉了,因此不再使用这一句: header._passtoken = uni.getStorageSync('_passtoken')
formData[_passtoken] = uni.getStorageSync('_passtoken') // 20230527 加回这一句,让后台可以根据验证用户来决定怎样处理文件。
uni.showLoading() uni.showLoading()
let [errorUpload, { data, statusCode } = {}] = await uni.uploadFile({ url: this.makeServerUrl(url), filePath, name, header, formData }) 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) { next_focus (currentFocus, focusList) {
focusList = focusList || getCurrentPages?.pop()?.focusList focusList = focusList || getCurrentPages()?.pop()?.focusList
if (focusList) { if (focusList) {
for (let n in focusList) { for (let n in focusList) {
focusList[n] = false focusList[n] = false
@ -591,7 +592,7 @@ export default {
uni.hideToast() uni.hideToast()
wo.tt.showToast({ wo.tt.showToast({
type: wo.c2t.GREEN, 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)}`,
}) })
}, },
}) })