文件的上传:100%

pull/36/MERGE
YunaiV 2024-01-05 22:26:01 +08:00
parent bc6ac22ce2
commit b53bfd468c
3 changed files with 4 additions and 5 deletions

View File

@ -1,5 +1,3 @@
import request2 from '@/sheep/request2';
const FileApi = { const FileApi = {
// 上传文件 // 上传文件
uploadFile: (file) => { uploadFile: (file) => {

View File

@ -1,5 +1,5 @@
'use strict'; 'use strict';
import sheep from '@/sheep'; import FileApi from '@/sheep/api/infra/file';
const ERR_MSG_OK = 'chooseAndUploadFile:ok'; const ERR_MSG_OK = 'chooseAndUploadFile:ok';
const ERR_MSG_FAIL = 'chooseAndUploadFile:fail'; const ERR_MSG_FAIL = 'chooseAndUploadFile:fail';
@ -190,8 +190,8 @@ function uploadFiles(choosePromise, { onChooseFile, onUploadProgress }) {
}) })
.then(async (files) => { .then(async (files) => {
for (let file of files.tempFiles) { for (let file of files.tempFiles) {
let { path } = await sheep.$api.app.upload(file.path, 'ugc'); const { data } = await FileApi.uploadFile(file.path);
file.url = path; file.url = data;
} }
return files; return files;
}); });

View File

@ -1,3 +1,4 @@
<!-- 文件上传基于 upload-file upload-image 实现 -->
<template> <template>
<view class="uni-file-picker"> <view class="uni-file-picker">
<view v-if="title" class="uni-file-picker__header"> <view v-if="title" class="uni-file-picker__header">