ui库和web端产品库合并版本(还需修复细节)

This commit is contained in:
2022-11-29 18:27:14 +08:00
parent 5e4bd93238
commit 8bf6c57668
151 changed files with 28267 additions and 49 deletions

View File

@@ -0,0 +1,24 @@
import {Loading} from "element-ui"
export class UploadAdapter {
constructor(loader, instance, action, params) {
this.instance = instance
this.action = action
this.loader = loader
this.params = params
}
async upload() {
const formData = new FormData()
formData.append('file', await this.loader.file)
const loading = Loading.service({})
return this.instance.post(this.action, formData, {...this.params, returnError: true}).then(res => {
if (res?.data) {
return res.data.map(m => m.split(";")?.[0])
} else return this.loader.status = "aborted" && Promise.reject()
}).finally(() => loading.close())
}
abort() {
}
}