移除未使用的依赖和组件,优化博客列表和详情页样式,调整菜单项和颜色配置

This commit is contained in:
2026-01-01 10:20:49 +08:00
parent d36526b368
commit a9d3854a55
13 changed files with 94 additions and 3074 deletions

2
components.d.ts vendored
View File

@ -17,7 +17,6 @@ declare module 'vue' {
Mask: typeof import('./src/components/mask.vue')['default']
MenuH: typeof import('./src/components/menuH.vue')['default']
NAvatar: typeof import('naive-ui')['NAvatar']
NBackTop: typeof import('naive-ui')['NBackTop']
NButton: typeof import('naive-ui')['NButton']
NCard: typeof import('naive-ui')['NCard']
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
@ -39,7 +38,6 @@ declare module 'vue' {
NModal: typeof import('naive-ui')['NModal']
NModalProvider: typeof import('naive-ui')['NModalProvider']
NScrollbar: typeof import('naive-ui')['NScrollbar']
NScrollBar: typeof import('naive-ui')['NScrollBar']
NSelect: typeof import('naive-ui')['NSelect']
NTabPane: typeof import('naive-ui')['NTabPane']
NTabs: typeof import('naive-ui')['NTabs']

View File

@ -15,18 +15,12 @@
},
"dependencies": {
"@imengyu/vue3-context-menu": "^1.5.2",
"@kangc/v-md-editor": "^2.3.18",
"@markdown-next/parser": "^0.0.2-alpha",
"@markdown-next/vue": "^0.0.2-alpha",
"@meting/core": "^1.5.13",
"@unocss/reset": "^66.3.3",
"aplayer": "^1.10.1",
"axios": "^1.11.0",
"es-toolkit": "^1.39.8",
"highlight.js": "^11.11.1",
"juejin-markdown-themes": "^1.34.0",
"less": "^4.4.0",
"markdown-exit": "^1.0.0-beta.6",
"md-editor-v3": "^6.3.0",
"pinia": "^3.0.3",
"qweather-icons": "^1.7.0",
@ -34,13 +28,10 @@
"unplugin-auto-import": "^19.3.0",
"unplugin-vue-components": "^28.8.0",
"unplugin-vue-router": "^0.15.0",
"v-infinite-scroll": "^1.0.4",
"vite-svg-loader": "^5.1.0",
"vue": "^3.6.0-alpha.2",
"vue-markdown": "^2.2.4",
"vue-router": "^4.5.1",
"vue3-cookies": "^1.0.6",
"vue3-video-play": "^1.3.2"
"vue3-cookies": "^1.0.6"
},
"devDependencies": {
"@tsconfig/node22": "^22.0.2",

View File

@ -4,7 +4,7 @@
<!-- <div class="dt-card mt-10 bg-white"> -->
<template #header>
<div class="flex items-center">
<icon-time class="w-5 mr-2"></icon-time>
<icon-time class="w-5 mr-2 text-primary"></icon-time>
时间日期
</div>
</template>
@ -24,7 +24,7 @@
<n-card embedded class="mt-4 shadow">
<template #header>
<div class="flex items-center">
<icon-news class="w-5 mr-2"></icon-news>
<icon-news class="w-5 mr-2 text-primary"></icon-news>
百度新闻
</div>
</template>
@ -54,7 +54,7 @@
<n-card embedded class="mt-4 shadow">
<template #header>
<div class="flex items-center">
<icon-date class="w-5 mr-2"></icon-date>
<icon-date class="w-5 mr-2 h-[20px]" ></icon-date>
农历节气
<div class="ml-12 text-[#ec66ab] font-500">{{ jq.yearTips }} {{ jq.lunarCalendar }}</div>
</div>

View File

@ -124,16 +124,16 @@ const menuOptions = ref([
key: "blog",
icon: () => h(artiSvg)
},
{
label: () => h(RouterLink, { to: '/widget', class: 'flex items-center justify-center' }, { default: () => '工具' }),
key: "widget",
icon: () => h(downSvg)
},
{
label: () => h(RouterLink, { to: '/apps', class: 'flex items-center justify-center' }, { default: () => '软件' }),
key: "apps",
icon: () => h(settingSvg)
},
// {
// label: () => h(RouterLink, { to: '/widget', class: 'flex items-center justify-center' }, { default: () => '工具' }),
// key: "widget",
// icon: () => h(downSvg)
// },
// {
// label: () => h(RouterLink, { to: '/apps', class: 'flex items-center justify-center' }, { default: () => '软件' }),
// key: "apps",
// icon: () => h(settingSvg)
// },
{
label: () => h(RouterLink, { to: '/plink', class: 'flex items-center justify-center' }, { default: () => '友链' }),
key: "plink",

1
src/icon/author.svg Normal file
View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1767228361426" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9819" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M789.504 890.368H319.488c-18.432 0-33.28 14.848-33.28 33.28s14.848 33.28 33.28 33.28h470.016c18.432 0 33.28-14.848 33.28-33.28s-14.848-33.28-33.28-33.28z" fill="#ec66ab" p-id="9820"></path><path d="M731.648 392.192c68.096-118.272 79.36-283.136 79.872-289.792 1.024-12.288-5.632-24.576-16.384-30.72-10.752-6.144-24.064-6.144-34.816 0.512-24.576 15.872-241.152 156.16-287.744 235.52-68.096 114.688-235.52 420.864-237.056 423.936-1.536 2.56-2.048 5.12-3.072 7.68l-91.648 158.72c-9.216 15.872-3.584 36.352 12.288 45.568 5.12 3.072 10.752 4.608 16.384 4.608 11.264 0 22.528-6.144 28.672-16.896L291.84 769.536c58.368-39.936 371.2-258.048 439.808-377.344z m-201.728-51.2c23.04-39.424 122.368-115.2 206.336-173.056-9.216 54.272-27.648 130.56-61.952 190.976-39.936 68.608-190.976 189.952-310.272 278.016 54.272-98.816 126.464-229.376 165.888-295.936z" fill="#ec66ab" p-id="9821"></path></svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -1,3 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6">
<path stroke-linecap="round" stroke-linejoin="round" d="M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0v-7.5A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5m-9-6h.008v.008H12v-.008ZM12 15h.008v.008H12V15Zm0 2.25h.008v.008H12v-.008ZM9.75 15h.008v.008H9.75V15Zm0 2.25h.008v.008H9.75v-.008ZM7.5 15h.008v.008H7.5V15Zm0 2.25h.008v.008H7.5v-.008Zm6.75-4.5h.008v.008h-.008v-.008Zm0 2.25h.008v.008h-.008V15Zm0 2.25h.008v.008h-.008v-.008Zm2.25-4.5h.008v.008H16.5v-.008Zm0 2.25h.008v.008H16.5V15Z" />
</svg>
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1767228343993" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8778" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M810.666667 170.666667h-134.4V149.333333c0-12.8-8.533333-21.333333-21.333334-21.333333h-42.666666c-12.8 0-21.333333 8.533333-21.333334 21.333333v21.333334h-170.666666V149.333333c0-12.8-8.533333-21.333333-21.333334-21.333333h-42.666666c-12.8 0-21.333333 8.533333-21.333334 21.333333v21.333334H213.333333c-46.933333 0-85.333333 38.4-85.333333 85.333333v554.666667c0 46.933333 38.4 85.333333 85.333333 85.333333h597.333334c46.933333 0 85.333333-38.4 85.333333-85.333333V256c0-46.933333-38.4-85.333333-85.333333-85.333333z m0 597.333333c0 23.466667-19.2 42.666667-42.666667 42.666667H256c-23.466667 0-42.666667-19.2-42.666667-42.666667V469.333333c0-23.466667 19.2-42.666667 42.666667-42.666666h512c23.466667 0 42.666667 19.2 42.666667 42.666666v298.666667z m0-448c0 12.8-8.533333 21.333333-21.333334 21.333333H234.666667c-12.8 0-21.333333-8.533333-21.333334-21.333333v-42.666667c0-12.8 8.533333-21.333333 21.333334-21.333333h100.266666v21.333333c0 12.8 8.533333 21.333333 21.333334 21.333334h42.666666c12.8 0 21.333333-8.533333 21.333334-21.333334v-21.333333h170.666666v21.333333c0 12.8 8.533333 21.333333 21.333334 21.333334h42.666666c12.8 0 21.333333-8.533333 21.333334-21.333334v-21.333333H789.333333c12.8 0 21.333333 8.533333 21.333334 21.333333v42.666667z" fill="#ec66ab" p-id="8779"></path><path d="M298.666667 503.466667h42.666666c12.8 0 21.333333 10.666667 21.333334 21.333333v42.666667c0 12.8-10.666667 21.333333-21.333334 21.333333h-42.666666c-12.8 0-21.333333-10.666667-21.333334-21.333333v-42.666667c0-10.666667 10.666667-21.333333 21.333334-21.333333z" fill="#ec66ab" p-id="8780"></path><path d="M298.666667 648.533333h42.666666c12.8 0 21.333333 10.666667 21.333334 21.333334v42.666666c0 12.8-10.666667 21.333333-21.333334 21.333334h-42.666666c-12.8 0-21.333333-10.666667-21.333334-21.333334v-42.666666c0-10.666667 10.666667-21.333333 21.333334-21.333334zM426.666667 503.466667h42.666666c12.8 0 21.333333 10.666667 21.333334 21.333333v42.666667c0 12.8-10.666667 21.333333-21.333334 21.333333h-42.666666c-12.8 0-21.333333-10.666667-21.333334-21.333333v-42.666667c0-10.666667 10.666667-21.333333 21.333334-21.333333z" fill="#ec66ab" p-id="8781"></path><path d="M554.666667 503.466667h42.666666c12.8 0 21.333333 10.666667 21.333334 21.333333v42.666667c0 12.8-10.666667 21.333333-21.333334 21.333333h-42.666666c-12.8 0-21.333333-10.666667-21.333334-21.333333v-42.666667c0-10.666667 10.666667-21.333333 21.333334-21.333333z" fill="#ec66ab" p-id="8782"></path><path d="M682.666667 503.466667h42.666666c12.8 0 21.333333 10.666667 21.333334 21.333333v42.666667c0 12.8-10.666667 21.333333-21.333334 21.333333h-42.666666c-12.8 0-21.333333-10.666667-21.333334-21.333333v-42.666667c0-10.666667 10.666667-21.333333 21.333334-21.333333z" fill="#ec66ab" p-id="8783"></path><path d="M426.666667 648.533333h42.666666c12.8 0 21.333333 10.666667 21.333334 21.333334v42.666666c0 12.8-10.666667 21.333333-21.333334 21.333334h-42.666666c-12.8 0-21.333333-10.666667-21.333334-21.333334v-42.666666c0-10.666667 10.666667-21.333333 21.333334-21.333334z" fill="#ec66ab" p-id="8784"></path><path d="M554.666667 648.533333h42.666666c12.8 0 21.333333 10.666667 21.333334 21.333334v42.666666c0 12.8-10.666667 21.333333-21.333334 21.333334h-42.666666c-12.8 0-21.333333-10.666667-21.333334-21.333334v-42.666666c0-10.666667 10.666667-21.333333 21.333334-21.333334z" fill="#ec66ab" p-id="8785"></path><path d="M682.666667 648.533333h42.666666c12.8 0 21.333333 10.666667 21.333334 21.333334v42.666666c0 12.8-10.666667 21.333333-21.333334 21.333334h-42.666666c-12.8 0-21.333333-10.666667-21.333334-21.333334v-42.666666c0-10.666667 10.666667-21.333333 21.333334-21.333334z" fill="#ec66ab" p-id="8786"></path></svg>

Before

Width:  |  Height:  |  Size: 754 B

After

Width:  |  Height:  |  Size: 3.9 KiB

1
src/icon/pen.svg Normal file
View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1767229323466" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="11396" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M531.4 114.8L414.1 365l97.9 70.1L627.2 512l87.2-68.3L826 313.4z" fill="#ec66ab" p-id="11397"></path><path d="M831 282.1L565.1 98.7c-10.7-7.4-24.1-9.6-36.7-5.9-12.6 3.7-22.7 12.7-27.8 24.7L381.8 399.6c-4.3 10.1-10.9 19.2-19.3 26.2l-87 73.2c-28.7 24.2-44.9 60.9-43.2 98.4l9.2 209.4-37.6 54.4c-11.7 2.2-22.4 10.2-27.3 23.1-4.8 12.6-1.7 27.5 7.6 37.2 6.6 6.9 14.9 10.4 23.2 11.2v0.3h448.4v-51.5H252.4l31.4-45.5 199-65.7c35.6-11.8 64.3-39.9 76.7-75.4L597 587.6c3.6-10.3 9.7-19.7 17.6-27.3l221.6-211.2c9.5-9 14.3-21.7 13.3-34.7-1-13.1-7.8-24.8-18.5-32.3zM548.4 570.6L510.9 678c-7.1 20.4-23.7 36.7-44.2 43.5l-134.4 44.4 131.8-191c11.7-2.2 22.4-10.2 27.3-23.1 4.8-12.6 1.7-27.5-7.6-37.2-16.5-17.3-43.5-14.4-56.3 4.2-5.6 8.2-7.4 17.8-5.8 26.9l-131.8 191-6.2-141.4c-0.9-21.6 8.4-42.8 24.9-56.8l87-73.2c14.6-12.3 26.2-28 33.6-45.6l4.8-11.5 151.5 108.7-6.5 6.2c-13.7 13.1-24.3 29.5-30.6 47.5z m75.1-89.9L454.6 359.5l89.6-212.7 249.2 172-169.9 161.9z" fill="#ec66ab" p-id="11398"></path></svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

1
src/icon/tag2.svg Normal file
View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1767231816303" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="12438" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M788.48 629.418667c0-17.066667-5.802667-31.744-17.749333-44.714667L421.205333 235.861333c-12.288-12.288-29.354667-22.869333-49.834667-31.744-21.162667-8.874667-39.936-12.970667-57.002667-12.970667L110.933333 191.146667c-17.066667 0-31.744 6.485333-44.032 18.773333-12.288 12.288-18.773333 26.965333-18.773333 44.032l0 202.752c0 17.066667 4.096 36.522667 12.970667 57.002667 8.874667 21.162667 18.773333 37.546667 31.744 49.834667l349.525333 349.525333c12.288 12.288 26.965333 17.749333 44.032 17.749333 17.066667 0 31.744-5.802667 44.714667-17.749333l239.616-239.616C781.994667 661.162667 788.48 646.485333 788.48 629.418667L788.48 629.418667 788.48 629.418667zM248.490667 392.192c-12.288 12.288-26.965333 18.090667-44.032 18.090667-17.066667 0-31.744-5.802667-44.032-18.090667-12.288-12.288-18.090667-26.965333-18.090667-44.032 0-17.066667 5.802667-31.744 18.090667-44.032 12.288-12.288 26.965333-18.090667 44.032-18.090667 17.066667 0 31.744 5.802667 44.032 18.090667C260.778667 316.416 266.24 331.093333 266.24 348.16 267.264 365.568 260.778667 379.904 248.490667 392.192L248.490667 392.192 248.490667 392.192zM958.122667 584.362667 608.597333 235.861333c-12.288-12.288-29.354667-22.869333-49.834667-31.744C537.6 195.242667 518.826667 191.146667 501.76 191.146667l-109.909333 0c17.066667 0 36.522667 4.096 57.002667 12.970667 21.162667 8.874667 37.546667 18.773333 49.834667 31.744l349.525333 348.501333c12.288 12.970667 18.090667 27.648 18.090667 44.714667s-5.802667 31.744-18.090667 44.032l-229.034667 229.717333c9.898667 9.898667 18.773333 17.066667 25.941333 21.845333 7.168 4.778667 17.066667 6.485333 28.672 6.485333 17.066667 0 31.744-5.802667 44.714667-18.090667l239.616-240.298667c12.288-12.288 17.749333-26.965333 17.749333-44.032S970.069333 597.674667 958.122667 584.362667L958.122667 584.362667 958.122667 584.362667zM958.122667 584.362667" fill="#a7415d" p-id="12439"></path></svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -7,20 +7,10 @@ import 'vue-devui/tag/style.css';
import App from "./App.vue";
import router from "./router";
// 自定义主题配置 - 设置主色和二级色\
import backTop from '@/components/backTop.vue';
import 'md-editor-v3/lib/style.css';
import "vfonts/FiraCode.css";
import Tag from 'vue-devui/tag';
// import VMdPreview from '@kangc/v-md-editor/lib/preview';
// import '@kangc/v-md-editor/lib/style/preview.css';
// import githubTheme from '@kangc/v-md-editor/lib/theme/github.js';
// import '@kangc/v-md-editor/lib/theme/style/github.css';
// // highlightjs
// // import hljs from 'highlight.js';
// VMdPreview.use(githubTheme, {
// // Hljs: hljs,
// });
const app = createApp(App);
@ -34,4 +24,5 @@ for (const key in icon) {
// console.log(key, icon[key]);
app.component("icon-" + key, icon[key] as any);
}
app.mount("#app");
app.component("back-top", backTop);
app.mount("#app");

View File

@ -8,19 +8,19 @@
</div>
<div ref="" class="w-[85%]">
<div class="w-full px-1/20 rounded-md">
<div class="text-center text-xl text-bold text-black` mt-10">{{ blogData.title }}</div>
<div class="text-center text-[40px] text-[700] text-black` mt-10">{{ blogData.title }}</div>
<div class="flex flex-wrap gap-4 justify-center mt-4">
<div v-for="item in tags" :key="item.tid" class="flex items-center gap-1 text-primary cursor-pointer">
<n-icon><icon-tag /></n-icon>
{{ item }}
</div>
</div>
<div class="flex gap-2 justify-end mb-2">
<div class="flex gap-2 justify-end mt-4">
<em class="text-primary">
{{ blogData.nickname }}</em>
<em class="time">{{ formatTime(blogData.updated_at, "YYYY年MM月DD日hh时") }}</em>
</div>
<MdPreview ref="mdp" class="md relative !bg-[#FDFBFB]" :editorId="blogData.aid" previewTheme="github"
<MdPreview ref="mdp" class="md relative !bg-[#FDFBFB]" :editorId="blogData.aid" previewTheme="default"
:modelValue="markdown" codeTheme="kimbie" />
</div>
</div>
@ -29,7 +29,7 @@
</template>
<script setup lang="ts">
import backTop from '@/components/backTop.vue';
import { formatTime } from '@/util';
import type { ExposeParam } from 'md-editor-v3';
import { MdCatalog, MdPreview } from 'md-editor-v3';

View File

@ -1,15 +1,38 @@
<template>
<div class="article-page w-full">
<h1>文章页</h1>
<div class="blog-list">
<div v-for="item in blogList" :key="item.aid" class="blog-item">
<div @click="$router.push(`/blog/${item.aid}`)" class="blog-title">{{ item.title }}</div>
<div class="article-page w-full flex" :style="boxStyle">
<div class="w-1/4 shadow">
</div>
<div class="blog-list w-3/4 pl-16">
<div v-for="item in blogList" :key="item.aid" class="rounded-lg p-4 w-3/4 my-8 shadow cursor-pointer"
@click="$router.push(`/blog/${item.aid}`)">
<div class="flex justify-right gap-4 mb-2 text-gray-600">
<em class="flex items-center gap-1 text-sm">
<n-icon><icon-date/></n-icon>
{{ formatTime(item.updated_at, 'YYYY年MM月DD日') }}
</em>
<em class="flex items-center gap-1 text-sm">
<n-icon><icon-pen /></n-icon>
{{ getSize(item.cont) }}
</em>
<em class="flex items-center gap-1 text-sm ">
<n-icon><icon-author /></n-icon>
{{ item.nickname }}</em>
</div>
<div class="text-xl text-bold text-primary mb-2">{{ item.title }}</div>
<div class="text-sm text-gray-500 mb-4 line-clamp-3">{{ item.pro }}</div>
<div class="flex gap-4">
<div v-for="i in getTags(item.tags)" :key="i.tid" class="flex items-center gap-1 text-deepp cursor-pointer">
<icon-tag2 class="w-4 h-4 !text-deepp" />{{ i }}
</div>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { formatTime } from '@/util'
definePage({
name: 'blog',
meta: {
@ -17,14 +40,34 @@ definePage({
}
})
const blogList = ref<any[]>([])
const boxStyle = ref({})
const nav: any = $store.nav.useNavStore()
async function getBlogList() {
const res = await $http.blog.getBlogList()
console.log('>>> --> getBlogList --> res:', res.data)
blogList.value = res.data
}
// 计算markdown的文字数量
function getSize(str: string) {
const reg = /[\u0000-\u0009\u000B-\u001F\u007F-\u009F\u00AD\u0600-\u0604\u070F\u17B4\u17B5\u200B-\u200D\u3000]/g;
return str.replace(reg, '').length;
}
function getTags(str: any) {
str = str.replaceAll('', ',')
let tags = str.split(',').slice(0, 5)
tags.forEach((tag:any,idx:number) => {
tags[idx] = tag.trim().slice(0, 3)
});
return tags
}
onMounted(() => {
boxStyle.value = {
height: `calc(100vh - ${nav.navH + 1}px)`,
}
getBlogList()
})
</script>

View File

@ -5,6 +5,7 @@ export default defineConfig({
theme: {
colors: {
primary: "#ec66ab",
deepp: "#a7415d"
},
},
});

3045
yarn.lock

File diff suppressed because it is too large Load Diff