19 lines
650 B
JavaScript
19 lines
650 B
JavaScript
|
|
// 公共图片基地址
|
|||
|
|
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}`;
|
|||
|
|
}
|