feat: 首页推荐独立置顶区块
- 新增「⭐ 精选推荐」独立区块置顶, 由管理后台首页推荐配置(增删改/排序/启停), 琥珀色主题+橙「荐」徽章 - 「🆕 近期新功能」回归静态清单, 仅展示最新开发功能, 绿色主题+绿「新」徽章 - 推荐为空/接口失败自动隐藏, 不影响页面 CHANGELOG记录
This commit is contained in:
1 parent
2ba520ca95
commit
dd06abe59d
2 files changed
+58
-4
No files matched your search
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. See [standa
|
||||
|
||||
## Version 2026.10.12-it-tools-pro
|
||||
|
||||
### 🏠 首页改版:精选推荐独立置顶
|
||||
- 新增「⭐ 精选推荐」独立区块,置于首页最顶部,由管理后台「首页推荐」配置(增删改/排序/启停),琥珀色主题 + 橙色「荐」徽章,与下方区块明显区分
|
||||
- 「🆕 近期新功能」回归静态清单,仅展示最新开发的功能(新工具上线手动加一条),绿色主题 + 绿色「新」徽章
|
||||
- 推荐为空或接口失败时自动隐藏推荐区块,不影响页面
|
||||
|
||||
|
||||
### 🖱️ 修复:左侧菜单有时点击无反应
|
||||
- 根因:菜单项 RouterLink `<a>` 仅覆盖文字(约 60px),点图标/内边距/箭头等其余区域时,naive-ui 菜单只抛出 `update:value` 事件而未绑定导航 → 点了没反应
|
||||
- 修复:`n-menu` 绑定 `@update:value` 统一 `router.push`,点击菜单项任意位置都能跳转
|
||||
|
||||
+52
-4
@@ -27,17 +27,20 @@ import { config } from '@/config';
|
||||
const toolStore = useToolStore();
|
||||
const { recentTools } = useRecentTools();
|
||||
|
||||
// 首页推荐:优先读管理后台配置(/relay/reco),失败/为空则回退静态清单
|
||||
// 近期新功能:静态清单(新开发功能上线时手动加一条)
|
||||
const newFeatures = ref<any[]>(NEW_FEATURES);
|
||||
|
||||
// 精选推荐:管理后台配置(/relay/reco),独立区块置顶显示;为空则隐藏该区块
|
||||
const recoList = ref<any[]>([]);
|
||||
onMounted(async () => {
|
||||
try {
|
||||
const res = await fetch('/relay/reco');
|
||||
const j = await res.json();
|
||||
if (j.code === 200 && Array.isArray(j.data) && j.data.length) {
|
||||
newFeatures.value = j.data.filter((x: any) => x.path && x.name);
|
||||
if (j.code === 200 && Array.isArray(j.data)) {
|
||||
recoList.value = j.data.filter((x: any) => x.path && x.name && x.enabled !== false);
|
||||
}
|
||||
}
|
||||
catch { /* 保持静态清单 */ }
|
||||
catch { /* 无推荐则隐藏 */ }
|
||||
});
|
||||
|
||||
// map recent paths to tool objects (newest first, cap 8)
|
||||
@@ -69,6 +72,23 @@ function onUpdateFavoriteTools() {
|
||||
|
||||
<template>
|
||||
<div class="pt-50px">
|
||||
<!-- 精选推荐(管理后台配置,置顶独立列表) -->
|
||||
<div v-if="recoList.length" class="nf-block reco-block">
|
||||
<div class="nf-head">
|
||||
<span class="nf-title">⭐ 精选推荐</span>
|
||||
<span class="nf-sub">为您精选的实用工具,管理员持续更新</span>
|
||||
</div>
|
||||
<div class="nf-grid">
|
||||
<RouterLink v-for="f in recoList" :key="f.path" :to="f.path" class="nf-card reco-card">
|
||||
<span class="nf-icon">{{ f.icon }}</span>
|
||||
<span class="nf-body">
|
||||
<span class="nf-name">{{ f.name }} <em class="reco-badge">荐</em></span>
|
||||
<span class="nf-desc">{{ f.desc }}</span>
|
||||
</span>
|
||||
</RouterLink>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 近期新功能 -->
|
||||
<div class="nf-block">
|
||||
<div class="nf-head">
|
||||
@@ -159,6 +179,22 @@ function onUpdateFavoriteTools() {
|
||||
</template>
|
||||
|
||||
<style scoped lang="less">
|
||||
// 精选推荐区块:琥珀色调,与绿色「近期新功能」视觉区分(提高优先级覆盖 .nf-card)
|
||||
.nf-block.reco-block {
|
||||
.nf-title {
|
||||
color: #f0a020;
|
||||
}
|
||||
|
||||
.nf-card.reco-card {
|
||||
border-color: rgba(240, 160, 32, 0.4);
|
||||
background: linear-gradient(120deg, rgba(240, 160, 32, 0.07), rgba(240, 160, 32, 0.02));
|
||||
|
||||
&:hover {
|
||||
border-color: rgba(240, 160, 32, 0.7);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.nf-block {
|
||||
margin-bottom: 20px;
|
||||
|
||||
@@ -228,6 +264,18 @@ function onUpdateFavoriteTools() {
|
||||
margin-left: 4px;
|
||||
vertical-align: 1px;
|
||||
}
|
||||
|
||||
.reco-badge {
|
||||
font-style: normal;
|
||||
font-size: 10px;
|
||||
font-weight: 700;
|
||||
color: #fff;
|
||||
background: #f0a020;
|
||||
border-radius: 4px;
|
||||
padding: 0 5px;
|
||||
margin-left: 4px;
|
||||
vertical-align: 1px;
|
||||
}
|
||||
}
|
||||
|
||||
.nf-desc {
|
||||
|
||||
Reference in new issue
Block a user