|
@@ -1,18 +1,24 @@
|
|
import { baseUrl, tenantId, apiPath } from '@/utils/config'
|
|
import { baseUrl, tenantId, apiPath } from '@/utils/config'
|
|
|
|
|
|
|
|
+const uploadApi = {
|
|
|
|
+ file: '/menduner/system/file/upload',
|
|
|
|
+ img: '/infra/file/upload'
|
|
|
|
+}
|
|
|
|
+
|
|
// 文件上传
|
|
// 文件上传
|
|
-export const uploadFile = (file) => {
|
|
|
|
|
|
+export const uploadFile = (file, type = 'file') => {
|
|
uni.showLoading({
|
|
uni.showLoading({
|
|
title: '上传中'
|
|
title: '上传中'
|
|
})
|
|
})
|
|
return new Promise((resolve, reject) => {
|
|
return new Promise((resolve, reject) => {
|
|
uni.uploadFile({
|
|
uni.uploadFile({
|
|
- url: baseUrl + apiPath + '/menduner/system/file/upload',
|
|
|
|
|
|
+ url: baseUrl + apiPath + uploadApi[type],
|
|
filePath: file,
|
|
filePath: file,
|
|
name: 'file',
|
|
name: 'file',
|
|
header: {
|
|
header: {
|
|
Accept: '*/*',
|
|
Accept: '*/*',
|
|
'tenant-id': tenantId,
|
|
'tenant-id': tenantId,
|
|
|
|
+ 'Authorization': 'Bearer ' + uni.getStorageSync('token')
|
|
},
|
|
},
|
|
success: (uploadFileRes) => {
|
|
success: (uploadFileRes) => {
|
|
let result = JSON.parse(uploadFileRes.data)
|
|
let result = JSON.parse(uploadFileRes.data)
|