Files
ks-app-employment-service/utilCa/imageUrl.js

19 lines
650 B
JavaScript
Raw Normal View History

// 公共图片基地址
const BASE_IMAGE_URL = 'https://51xuanxiao.oss-cn-hangzhou.aliyuncs.com/Resource/xcx_sygh';
/**
* 图片地址拼接方法
* @param {string} path - 图片路径相对于基地址的路径
* @param {string} [process] - OSS图片处理参数例如'image/resize,m_fixed,w_348/quality,q_80'
* @returns {string} 完整的图片URL
*/
export function ossImageUrl(path, process) {
// 如果有处理参数,拼接处理参数
if (process) {
return `${BASE_IMAGE_URL}/${path}?x-oss-process=${process}`;
}
// 没有处理参数时,直接返回原始路径
return `${BASE_IMAGE_URL}/${path}`;
}