✨ 文件的上传:100%
parent
bc6ac22ce2
commit
b53bfd468c
|
@ -1,5 +1,3 @@
|
|||
import request2 from '@/sheep/request2';
|
||||
|
||||
const FileApi = {
|
||||
// 上传文件
|
||||
uploadFile: (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;
|
||||
});
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<!-- 文件上传,基于 upload-file 和 upload-image 实现 -->
|
||||
<template>
|
||||
<view class="uni-file-picker">
|
||||
<view v-if="title" class="uni-file-picker__header">
|
||||
|
|
Loading…
Reference in New Issue