This commit is contained in:
陆柯 2022-04-04 12:44:25 +08:00
parent 3193632ea7
commit 1ac2a685a3

View File

@ -233,11 +233,10 @@ export default {
// 注意2虽然预设了 resultServer 和 resultCloud = {},但如果后台返回了 null那么 resultServer/resultCloud 也是 null。 // 注意2虽然预设了 resultServer 和 resultCloud = {},但如果后台返回了 null那么 resultServer/resultCloud 也是 null。
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
console.log( console.log(
'%c '+JSON.stringify({startTime:startTime, page:thisRoute}) + '%c '+JSON.stringify({startTime:startTime, page:thisRoute, endTime:new Date().toJSON()}) +
' %c '+ JSON.stringify({ backend, apiWho, apiTodo, apiWhat }) + ' %c '+ JSON.stringify({ backend, apiWho, apiTodo, apiWhat }) +
' %c '+ JSON.stringify(result) + ' %c '+ JSON.stringify(result),
' %c '+ JSON.stringify({endTime:new Date().toJSON()}), 'color:blue', 'background:skyblue', 'background:magenta') // 不知为何,直接用 result 会输出一个奇怪的对象,要主动添加 JSON.stringify 才按照期望输出。
'color:blue', 'background:skyblue', 'background:magenta', 'color:magenta') // 不知为何,直接用 result 会输出一个奇怪的对象,要主动添加 JSON.stringify 才按照期望输出。
} }
return result return result
}, },
@ -279,7 +278,7 @@ export default {
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 })
// 后台 Multer 处理 req.file = { destination, filename, originalname, path, mimetype, size }, // 后台 Multer 处理 req.file = { destination, filename, originalname, path, mimetype, size }, 其中 path 包括了 destination 和 filename 的文件完整路径。
// url 所在方法进一步处理后,通过 uploadFile 存在 data 里返回结果 // url 所在方法进一步处理后,通过 uploadFile 存在 data 里返回结果
uni.hideLoading() uni.hideLoading()
@ -366,7 +365,7 @@ export default {
backend = this.envar?.Backend_Default || wo?.envar?.Backend_Default || this.BACKEND_DEFAULT, backend = this.envar?.Backend_Default || wo?.envar?.Backend_Default || this.BACKEND_DEFAULT,
mediaType = 'image', count = 1, sizeType = ['original', 'compressed'], sourceType = ['album', 'camera'], maxDuration, mediaType = 'image', count = 1, sizeType = ['original', 'compressed'], sourceType = ['album', 'camera'], maxDuration,
url, header = {}, formData = {}, name = 'file', url, header = {}, formData = {}, name = 'file',
}) { } = {}) {
if (backend==='UNICLOUD'){ if (backend==='UNICLOUD'){
const resultCloud = await this.pickupFile2Cloud({mediaType, count, sizeType, sourceType, maxDuration }) const resultCloud = await this.pickupFile2Cloud({mediaType, count, sizeType, sourceType, maxDuration })
return resultCloud return resultCloud