| 1234567891011121314151617181920212223242526272829303132 |
- const DEFAULT_ASSET_BASE_URL = 'https://transcend.ringzle.com/web/assets'
- const DEFAULT_PROFILE_IMAGE_BASE_URL = 'https://transcend.ringzle.com/xiaozhi-app/profile'
- const IMAGE_PATH = '/images/'
- function getAssetBaseUrl(env = process.env) {
- return String(env.VUE_APP_ASSET_BASE_URL || DEFAULT_ASSET_BASE_URL).replace(/\/+$/, '')
- }
- function imageUrl(filename, env = process.env) {
- const normalizedFilename = String(filename || '').replace(/^\/+/, '')
- return `${getAssetBaseUrl(env)}${IMAGE_PATH}${encodeURIComponent(normalizedFilename)}`
- }
- function htmlUrl(filename, env = process.env) {
- const normalizedFilename = String(filename || '').replace(/^\/+/, '')
- return `${getAssetBaseUrl(env)}/html/${encodeURIComponent(normalizedFilename)}`
- }
- function getProfileImageUrl(filename, env = process.env) {
- const normalizedFilename = String(filename || '').replace(/^\/+/, '')
- const baseUrl = String(env.VUE_APP_PROFILE_IMAGE_BASE_URL || DEFAULT_PROFILE_IMAGE_BASE_URL).replace(/\/+$/, '')
- return `${baseUrl}/${normalizedFilename}`
- }
- module.exports = {
- DEFAULT_ASSET_BASE_URL,
- DEFAULT_PROFILE_IMAGE_BASE_URL,
- getAssetBaseUrl,
- getProfileImageUrl,
- htmlUrl,
- imageUrl
- }
|