aslan-h5/src/config/imagePaths.js
2026-07-17 18:23:06 +08:00

30 lines
1.2 KiB
JavaScript

import { protectAssetUrl } from '@/utils/protectedAssets.js'
// Aslan H5 的所有远端页面素材统一从独立目录读取,避免复用其他品牌的同名素材导致页面错版。
export const OSS_REMOTE_BASE_URL = 'https://asset.global-interaction.com/h5/Aslan/'
export const OSS_BASE_URL =
process.env.NODE_ENV === 'development' ? '/oss/h5/Aslan/' : OSS_REMOTE_BASE_URL
function buildAssetUrl(imagePath, filename, extension) {
return `${OSS_BASE_URL}${imagePath}${filename}.${extension}`
}
export const getRawPngUrl = (imagePath, filename) => buildAssetUrl(imagePath, filename, 'png')
export const getRawWebpUrl = (imagePath, filename) => buildAssetUrl(imagePath, filename, 'webp')
export const getRawMp4Url = (imagePath, filename) => buildAssetUrl(imagePath, filename, 'mp4')
export const getPngUrl = (imagePath, filename) => {
return protectAssetUrl(getRawPngUrl(imagePath, filename), imagePath)
}
export const getWebpUrl = (imagePath, filename) => {
return protectAssetUrl(getRawWebpUrl(imagePath, filename), imagePath)
}
export const getMp4Url = (imagePath, filename) => {
return protectAssetUrl(getRawMp4Url(imagePath, filename), imagePath)
}