wujingjing
2024-04-22 f106e4dffb8279cb90726e83e7edd631f4c77699
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { ElMessage } from 'element-plus';
import { GetImageThumbTool } from '/@/api/artImage/artImageTool';
import { MAIN_URL } from '/@/constants';
import type { BankImage } from '/@/projectCom/artImage/bank/image/types';
 
export const getFullFilePath = (url, fileName) => {
    return `${url}/${fileName}`;
};
 
export const getBankImageUrl = (bankImage: BankImage, isRelative = false, baseUrl = MAIN_URL) => {
    const urlArr = bankImage?.StorageHouse ? [bankImage?.StorageHouse, bankImage?.StorageCode] : [bankImage?.StorageCode];
    if (!isRelative) {
        urlArr.unshift(baseUrl);
    }
    const fullPath = urlArr.join('/');
    return fullPath;
};
 
export type FileRecordObj = {
    StorageCode: string;
    StorageHouse: string;
    [key: string]: any;
};
export const getFileUrl = (fileObj: FileRecordObj, isRelative = false, baseUrl = MAIN_URL) => {
    const urlArr = fileObj?.StorageHouse ? [fileObj?.StorageHouse, fileObj?.StorageCode] : [fileObj?.StorageCode];
    if (!isRelative) {
        urlArr.unshift(baseUrl);
    }
    const fullPath = urlArr.join('/');
    return fullPath;
};