diff --git a/src/assets/SvgIcons/activityManagement.svg b/src/assets/SvgIcons/activityManagement.svg new file mode 100644 index 0000000..89ec77a --- /dev/null +++ b/src/assets/SvgIcons/activityManagement.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/assets/SvgIcons/现金管理.svg b/src/assets/SvgIcons/cashManagement.svg similarity index 100% rename from src/assets/SvgIcons/现金管理.svg rename to src/assets/SvgIcons/cashManagement.svg diff --git a/src/assets/SvgIcons/channelManagement.svg b/src/assets/SvgIcons/channelManagement.svg new file mode 100644 index 0000000..3a4c7e7 --- /dev/null +++ b/src/assets/SvgIcons/channelManagement.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/src/assets/SvgIcons/金币管理.svg b/src/assets/SvgIcons/goldManagement.svg similarity index 100% rename from src/assets/SvgIcons/金币管理.svg rename to src/assets/SvgIcons/goldManagement.svg diff --git a/src/assets/SvgIcons/permissionManagement.svg b/src/assets/SvgIcons/permissionManagement.svg new file mode 100644 index 0000000..053a5ce --- /dev/null +++ b/src/assets/SvgIcons/permissionManagement.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/src/assets/SvgIcons/工作台.svg b/src/assets/SvgIcons/workbench.svg similarity index 100% rename from src/assets/SvgIcons/工作台.svg rename to src/assets/SvgIcons/workbench.svg diff --git a/src/views/home.vue b/src/views/home.vue index 5910196..68928c7 100644 --- a/src/views/home.vue +++ b/src/views/home.vue @@ -13,14 +13,31 @@ import SettingsIcon from '@/assets/blue.png'; // 使用import.meta.glob导入所有SVG图标(修复版本) const icons = import.meta.glob('@/assets/SvgIcons/*.svg', { eager: true }) +// import from '@/assets/SvgIcons/workbench.svg' +// import from '@/assets/SvgIcons/activity.png' +// import from '@/assets/SvgIcons/activity.png' +// import from '@/assets/SvgIcons/activity.png' +// import from '@/assets/SvgIcons/activity.png' + + +const menuNameMap = { + '工作台': 'workbench', + '金币管理': 'goldManagement', + '现金管理': 'cashManagement', + '活动管理': 'activityManagement', + '频道管理': 'channelManagement', + '权限管理': 'permissionManagement', +} + // 创建获取图标路径的函数(修复版本) const getIconPath = (menuName) => { - + const englishName = menuNameMap[menuName] || menuName; + // 构建可能的key格式 const possibleKeys = [ - `@/assets/SvgIcons/${menuName}.svg`, - `./SvgIcons/${menuName}.svg`, - `/src/assets/SvgIcons/${menuName}.svg` + `@/assets/SvgIcons/${englishName}.svg`, + `./SvgIcons/${englishName}.svg`, + `/src/assets/SvgIcons/${englishName}.svg` ] // 在icons对象中查找对应的图标 @@ -68,11 +85,6 @@ const refreshData = async () => { // --------------------------------------- - - - - - // 存储接口返回的菜单数据 const menuList = ref([]) @@ -110,9 +122,6 @@ function findBestMatch(menuList, path) { return bestMatch || path // fallback 到当前路径 } - - - // 响应式高亮菜单 const activeMenu = computed(() => { return findBestMatch(menuList.value, route.path)