添加内容管理模块,包括分类管理、标签管理和Banner管理功能,新增相关API和前端页面。

This commit is contained in:
wangjie52
2025-07-21 19:07:42 +08:00
parent 028ccf4408
commit 081d46029e
9 changed files with 1260 additions and 1 deletions

View File

@@ -0,0 +1,34 @@
/**
* 图片工具类
*/
/**
* 获取图片完整URL
* @param {string} imagePath 图片路径
* @returns {string} 完整的图片URL
*/
export function getImageUrl(imagePath) {
if (!imagePath) {
return '';
}
// 如果已经是完整URL直接返回
if (imagePath.startsWith('http://') || imagePath.startsWith('https://')) {
return imagePath;
}
// 使用项目的API前缀配置
const baseApi = process.env.VUE_APP_BASE_API || '/dev-api';
return baseApi + imagePath;
}
/**
* 获取图片完整URL带默认图片
* @param {string} imagePath 图片路径
* @param {string} defaultImage 默认图片路径
* @returns {string} 完整的图片URL
*/
export function getImageUrlWithDefault(imagePath, defaultImage = '') {
const url = getImageUrl(imagePath);
return url || defaultImage;
}