文件的上传: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 = {
// 上传文件
uploadFile: (file) => {

View File

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

View File

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