diff --git a/components.d.ts b/components.d.ts index 4623e93..faf267b 100644 --- a/components.d.ts +++ b/components.d.ts @@ -33,6 +33,7 @@ declare module 'vue' { NLayoutFooter: typeof import('naive-ui')['NLayoutFooter'] NLayoutHeader: typeof import('naive-ui')['NLayoutHeader'] NLayoutSider: typeof import('naive-ui')['NLayoutSider'] + NLoadingBarProvider: typeof import('naive-ui')['NLoadingBarProvider'] NMenu: typeof import('naive-ui')['NMenu'] NMessageProvider: typeof import('naive-ui')['NMessageProvider'] NModal: typeof import('naive-ui')['NModal'] diff --git a/extra.d.ts b/extra.d.ts index f97b363..2257723 100644 --- a/extra.d.ts +++ b/extra.d.ts @@ -3,4 +3,5 @@ declare module "vue3-video-play"; declare module "vue3-masonry-plus"; declare module "vite"; declare module "vue-devui/tag"; -declare module "es-toolkit"; \ No newline at end of file +declare module "es-toolkit"; +declare module "nprogress"; \ No newline at end of file diff --git a/package.json b/package.json index 108f968..8e57695 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,7 @@ "@vue/tsconfig": "^0.7.0", "naive-ui": "^2.43.2", "npm-run-all2": "^8.0.4", + "nprogress": "^0.2.0", "typescript": "~5.8.0", "vfonts": "^0.0.3", "vite": "^7.0.6", diff --git a/src/App.vue b/src/App.vue index 4f2c539..03d6f6f 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,5 +1,6 @@ diff --git a/src/assets/base.less b/src/assets/base.less index 6014f90..db04536 100644 --- a/src/assets/base.less +++ b/src/assets/base.less @@ -9,4 +9,14 @@ .n-scrollbar-rail__scrollbar { background-color: #f6cbe770 !important; +} + +/* 添加渐变背景色 */ +#nprogress .bar { + background: linear-gradient(to right, #ec66ab, #f78c6c, #7ed6df); +} + +/* 添加平滑过渡效果 */ +#nprogress .bar { + transition: width 0.2s ease-in-out; } \ No newline at end of file diff --git a/src/assets/main.css b/src/assets/main.css index 4d766c2..a9962a8 100644 --- a/src/assets/main.css +++ b/src/assets/main.css @@ -1,3 +1,5 @@ -@import "./base.less"; + @import "qweather-icons/font/qweather-icons.css"; -@import 'md-editor-v3/lib/preview.css'; \ No newline at end of file +@import 'md-editor-v3/lib/preview.css'; +@import "nprogress/nprogress.css"; +@import "./base.less"; \ No newline at end of file diff --git a/src/components/menuH.vue b/src/components/menuH.vue index c3769a2..bbda24a 100644 --- a/src/components/menuH.vue +++ b/src/components/menuH.vue @@ -31,8 +31,7 @@
- -
登录
+ 登录
@@ -51,8 +50,10 @@
{{ userinfo.nickname }}
- -
登录
+ + 登录 +
diff --git a/src/icon/arti.svg b/src/icon/arti.svg index 9e5281e..ff08599 100644 --- a/src/icon/arti.svg +++ b/src/icon/arti.svg @@ -1 +1,4 @@ - \ No newline at end of file + + + + diff --git a/src/icon/download.svg b/src/icon/download.svg index 84a06ff..ff3842f 100644 --- a/src/icon/download.svg +++ b/src/icon/download.svg @@ -2,3 +2,4 @@ + diff --git a/src/icon/tag2.svg b/src/icon/tag2.svg index a6aefbe..d23f2e8 100644 --- a/src/icon/tag2.svg +++ b/src/icon/tag2.svg @@ -1 +1,3 @@ - \ No newline at end of file + + + diff --git a/src/lib/components/LazyImg.vue b/src/lib/components/LazyImg.vue index e3bf4d6..92bec4a 100644 --- a/src/lib/components/LazyImg.vue +++ b/src/lib/components/LazyImg.vue @@ -2,7 +2,7 @@
- + - + 申请友链 @@ -83,13 +83,16 @@
-
+ {{ p.name }} +
{{ p.title }}
- {{ p.name }} -
-
- {{ i }} + +
+
+ {{ i }}
@@ -108,7 +111,7 @@ import siteIcon from '@/icon/plink/site.svg'; import tagIcon from '@/icon/plink/tag.svg'; import urlIcon from '@/icon/plink/uri.svg'; import userIcon from '@/icon/plink/user.svg'; - +import { getDictValue } from '@/util'; definePage({ name: 'plink', @@ -137,18 +140,32 @@ const rules: any = { } const pList = ref([]) const formRef = ref(null) +const tagColorList: any = ref([]) async function getPlinkList() { const res = await $http.plink.getPlinkList() + + const list: Array = [] + // 对res.data.tags进行去重 + res.data.forEach((i: any) => { + const t = getTags(i.tagname) + t.forEach((ii: string) => { + if (!list.includes(ii)) list.push(ii) + }) + }); + + tagColorList.value = list.map((i: string) => { + return { + tag: i, + color: getRandomFromPalette() + } + }) pList.value = res.data - // for (let i = 0; i < 20; i++) { - // pList.value.push(res.data[0]) - // } } function getTags(str: any) { str = str.replaceAll(',', ',') let tags = str.split(',').slice(0, 3) tags.forEach((tag: any, idx: number) => { - tags[idx] = tag.trim().slice(0, 3) + tags[idx] = tag.trim().slice(0, 4) }); return tags } @@ -178,7 +195,23 @@ function submitPut() { }) } +// 生成一个随机的鲜艳颜色,和白色能对比 +function getRandomFromPalette(): string { + const hue = Math.floor(Math.random() * 360); + return hslToHex(hue, 80, 50); +} + +function hslToHex(h: number, s: number, l: number): any { + l /= 100; + const a = s * Math.min(l, 1 - l) / 100; + const f = (n: number) => { + const k = (n + h / 30) % 12; + const color = l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1); + return Math.round(255 * color).toString(16).padStart(2, '0'); + } + return `#${f(0)}${f(8)}${f(4)}`; +} onMounted(() => { boxStyle.value = { height: window.innerHeight - nav.navH - 1 + 'px', @@ -197,11 +230,8 @@ onMounted(() => { 100% { transform: rotate(360deg); } - } - - .zhuan { animation: spin 1.5s linear infinite; } diff --git a/src/views/blog/index.vue b/src/views/blog/index.vue index 2bcc6b2..e5e39ab 100644 --- a/src/views/blog/index.vue +++ b/src/views/blog/index.vue @@ -4,11 +4,13 @@
- {{ i.name }} -
- - {{ i.total || 0 }}篇文章 + class="relative cate flex my-6 py-6 px-8 justify-between text-xl font-bold bg-white shadow rounded cursor-pointer"> +
+ + {{ i.name }} +
+
+ {{ i.total || 0 }}
@@ -36,12 +38,14 @@
{{ item.title }}
{{ item.pro }}
-
- {{ i }} +
+ {{ i }}
-
+
@@ -49,13 +53,14 @@ diff --git a/yarn.lock b/yarn.lock index 6ce263f..4fb31e5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3609,6 +3609,11 @@ npm-run-all2@^8.0.4: shell-quote "^1.7.3" which "^5.0.0" +nprogress@^0.2.0: + version "0.2.0" + resolved "https://registry.npmmirror.com/nprogress/-/nprogress-0.2.0.tgz#cb8f34c53213d895723fcbab907e9422adbcafb1" + integrity sha512-I19aIingLgR1fmhftnbWWO3dXc0hSxqHQHQb3H8m+K3TnEn/iSeTZZOyvKXWqQESMwuUVnatlCnZdLBZZt2VSA== + nth-check@^2.0.1: version "2.1.1" resolved "https://registry.npmmirror.com/nth-check/-/nth-check-2.1.1.tgz#c9eab428effce36cd6b92c924bdb000ef1f1ed1d"