parent
953bfbbeec
commit
d8eb096919
@ -1,2 +1,3 @@ |
||||
export * from '@/api/path/project.api' |
||||
export * from '@/api/path/system.api' |
||||
export * from '@/api/path/system.api' |
||||
export * from '@/api/path/infra.api' |
||||
|
@ -0,0 +1,13 @@ |
||||
import { http } from '@/api/http' |
||||
import { httpErrorHandle } from '@/utils' |
||||
import { RequestHttpEnum, ModuleTypeEnum, ContentTypeEnum } from '@/enums/httpEnum' |
||||
|
||||
// * 上传文件
|
||||
export const uploadFile = async (data: object) => { |
||||
try { |
||||
const res = await http(RequestHttpEnum.POST)<string>(`${ModuleTypeEnum.INFRA}/file/upload`, data, ContentTypeEnum.FORM_DATA) |
||||
return res |
||||
} catch { |
||||
httpErrorHandle() |
||||
} |
||||
} |
@ -1,23 +1,8 @@ |
||||
import { useSystemStore } from '@/store/modules/systemStore/systemStore' |
||||
import { SystemStoreEnum } from '@/store/modules/systemStore/systemStore.d' |
||||
import { ResultEnum } from '@/enums/httpEnum' |
||||
import { ossUrlApi } from '@/api/path' |
||||
|
||||
|
||||
// * 初始化
|
||||
export const useSystemInit = async () => { |
||||
const systemStore = useSystemStore() |
||||
|
||||
// 获取 OSS 信息的 url 地址,用来拼接展示图片的地址
|
||||
const getOssUrl = async () => { |
||||
const res = await ossUrlApi({}) |
||||
if (res && res.code === ResultEnum.SUCCESS) { |
||||
systemStore.setItem(SystemStoreEnum.FETCH_INFO, { |
||||
OSSUrl: res.data?.bucketURL |
||||
}) |
||||
} |
||||
} |
||||
|
||||
// 执行
|
||||
getOssUrl() |
||||
} |
||||
// TODO 芋艿:看看这里后续要不要拿下 URL 上的 token
|
||||
} |
||||
|
Loading…
Reference in new issue