const PROJECT_NAME = 'minghe';
const PACKAGE_NAME = '';

// const websocket = 'ws://localhost:8080/oa/api/ws/{userId}';

export function getUrl(type) {
    let protocol = document.location.protocol,//网络协议
        host = document.location.host;//域名+端口号

    let base_url = `${protocol}//${host}/${PROJECT_NAME}/${PACKAGE_NAME}`,
    // let base_url = `${protocol}//${host}/${PACKAGE_NAME}`,
        websocket_url = `wss://huaihai-tech.com/api/ws/`; //与后端一致
        // websocket_url = `ws://localhost:8080/oa/api/ws/`; //与后端一致

    //console.log('基础路径: ',base_url);
    // console.log('Socket路径: ',websocket_url);


    switch (type) {
        case 'base' :
            return base_url;
        case 'websocket' :
            return websocket_url;
        // return websocket;
        default :
            return base_url;
    }
}

export function getUploadFilePath(path) {
    return path ? getUrl() + path : "";
}