diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts index 6c04e85..9b4483b 100644 --- a/docs/.vitepress/config.mts +++ b/docs/.vitepress/config.mts @@ -33,7 +33,8 @@ export default withMermaid({ '/Web-Front/': [routers[0]], '/Web-Backend/': [routers[1]], '/DevOps/': [routers[2]], - '/Flutter/': [routers[3]] + '/Flutter/': [routers[3]], + '/Others/': [routers[4]] }, // socialLinks: [ diff --git a/docs/.vitepress/theme/components/ArticleMetadata.vue b/docs/.vitepress/theme/components/ArticleMetadata.vue index 35d7f36..e1b6fb3 100644 --- a/docs/.vitepress/theme/components/ArticleMetadata.vue +++ b/docs/.vitepress/theme/components/ArticleMetadata.vue @@ -16,7 +16,7 @@
- 字数: {{ wordCount }} 字 + 字数: {{ formatNumberUnit(wordCount) }} 字
@@ -28,7 +28,7 @@ + diff --git a/docs/.vitepress/theme/index.ts b/docs/.vitepress/theme/index.ts index d490b5e..20334ed 100644 --- a/docs/.vitepress/theme/index.ts +++ b/docs/.vitepress/theme/index.ts @@ -2,6 +2,7 @@ import DefaultTheme from 'vitepress/theme' import Confetti from "./components/Confetti.vue"; import ArticleMetadata from "./components/ArticleMetadata.vue" import StatsChart from './components/StatsChart.vue' +import MenuList from './components/MenuList.vue' import type { EnhanceAppContext } from 'vitepress' import { onMounted, watch, nextTick } from 'vue' import { useRoute } from 'vitepress' @@ -32,6 +33,7 @@ export default { enhanceApp({ app }: EnhanceAppContext) { app.component("Confetti", Confetti); app.component("StatsChart", StatsChart); + app.component("MenuList", MenuList); app.component("ArticleMetadata", ArticleMetadata); }, }; diff --git a/docs/.vitepress/theme/router/index.ts b/docs/.vitepress/theme/router/index.ts index a179bf5..37f3cdf 100644 --- a/docs/.vitepress/theme/router/index.ts +++ b/docs/.vitepress/theme/router/index.ts @@ -72,5 +72,11 @@ export const routers = [ { text: 'Flutter基础教程', link: '/Flutter/FlutterGuide' }, { text: '实战技巧', link: '/Flutter/Practice' } ] + }, + { + text: '🔄 其他', + items: [ + { text: 'VitePress使用和简介', link: '/Others/VitePress' }, + ] } ]; \ No newline at end of file diff --git a/docs/.vitepress/theme/utils/index.ts b/docs/.vitepress/theme/utils/index.ts index 5bbcfbb..3d18fa9 100644 --- a/docs/.vitepress/theme/utils/index.ts +++ b/docs/.vitepress/theme/utils/index.ts @@ -18,6 +18,30 @@ export const countWord = (data: string)=> { return count } +export const formatNumberUnit = (num: number, fixed = 1) => { + if (typeof num !== 'number') { + num = parseFloat(num); + } + + if (isNaN(num)) return '0'; + + const absNum = Math.abs(num); + let result; + + if (absNum >= 100000000) { + // 亿 + result = (num / 100000000).toFixed(fixed) + '亿'; + } else if (absNum >= 10000) { + // 万 + result = (num / 10000).toFixed(fixed) + '万'; + } else { + result = num.toFixed(0); + } + + // 移除多余的 .0 + return result.replace(/\.0+($|亿|万)/, '$1'); +} + /** * 判断是否为移动端 */ diff --git a/docs/DevOps/index.md b/docs/DevOps/index.md index 3ac8ad5..3bdbe65 100644 --- a/docs/DevOps/index.md +++ b/docs/DevOps/index.md @@ -3,15 +3,8 @@ layout: doc title: DevOps --- -# DevOps - - \ No newline at end of file + \ No newline at end of file diff --git a/docs/Flutter/index.md b/docs/Flutter/index.md index 62fe4c2..b1a930e 100644 --- a/docs/Flutter/index.md +++ b/docs/Flutter/index.md @@ -3,15 +3,8 @@ layout: doc title: Flutter --- -# Flutter - - \ No newline at end of file + \ No newline at end of file diff --git a/docs/Others/VitePress.md b/docs/Others/VitePress.md new file mode 100644 index 0000000..33a2203 --- /dev/null +++ b/docs/Others/VitePress.md @@ -0,0 +1,5 @@ +--- + title: VitePress简介和使用 + date: 2025-12-18 +--- + diff --git a/docs/Others/index.md b/docs/Others/index.md new file mode 100644 index 0000000..efc1b39 --- /dev/null +++ b/docs/Others/index.md @@ -0,0 +1,10 @@ +--- +layout: doc +title: 其他 +--- + + + + \ No newline at end of file diff --git a/docs/Web-Backend/Others/AList.md b/docs/Web-Backend/Others/AList.md index fe42f8d..48b9ddb 100644 --- a/docs/Web-Backend/Others/AList.md +++ b/docs/Web-Backend/Others/AList.md @@ -2,3 +2,73 @@ title: AList简介和使用 date: 2025-12-17 --- + +# 一、简介 +  [AList](https://alistgo.com/zh/)是一个支持多种存储,支持网页浏览和 WebDAV 的文件列表程序,由 gin 和 Solidjs 驱动。 + +# 二、安装 +## 2.1 Docker安装 +```yml +services: + alist: + image: xhofe/alist:v3.41.0 + container_name: alist + restart: unless-stopped + volumes: + - ./data:/opt/alist/data + - /srv:/srv + ports: + - "5244:5244" + environment: + - PUID=0 + - PGID=0 +``` + +  这里的srv为宿主机的系统服务数据目录,添加该映射,可以让Alist能够访问宿主机/srv目录下的本地文件。 + +# 三、挂载 +## 3.1 挂载本地存储 +  打开控制台,选择存储->添加->本地存储,设置挂载路径(自定义,如`/local`),选择根文件夹路径为`/srv`,点击添加。 +  这样就可以将`/local`路径映射到宿主机的`/srv`目录了。 +  可以在宿主机的`/srv`目录中添加文件,查看AList的主页是否可以正确显示。 + +# 四、API +  在线调试地址:[Alist-Public](https://alist-public.apifox.cn/) + +## 4.1 登录 +```JavaScript +const username = '' +const password = '' + +// 1. 登录获取token +const login = await axios.post(`${AListUrl}/api/auth/login`, { + username, + password +}) + +const token = login.data.data.token +``` + +## 4.2 上传文件 +```JavaScript +const data = new FormData() +data.append('file', options.file) + +const filePath = `${AListPath}/${options.file.name}` + +await axios({ + method: 'put', + url: `${AListUrl}/api/fs/form`, + headers: { + Authorization: token, + 'File-Path': filePath + }, + data +}) +``` + +## 4.3 下载文件 +  在AList的文件路径中加上前缀`/p/`。例如文件路径为`/local/Test/test.mp4`,则下载路径为`/p/local/Test/test.mp4`。 +::: tip +以上为相对路径,使用时加上相应的ip和端口号。 +::: \ No newline at end of file diff --git a/docs/Web-Backend/index.md b/docs/Web-Backend/index.md index 3eaa6f4..bc69f13 100644 --- a/docs/Web-Backend/index.md +++ b/docs/Web-Backend/index.md @@ -4,20 +4,8 @@ title: Web后端 description: Web后端开发技术文档,包含数据库、框架、中间件等 --- -# Web 后端开发 - -后端开发技术栈的学习笔记和总结。 - -
-

{{ category.text }}

- -
\ No newline at end of file + \ No newline at end of file diff --git a/docs/Web-Front/index.md b/docs/Web-Front/index.md index 8e11c2f..cb44603 100644 --- a/docs/Web-Front/index.md +++ b/docs/Web-Front/index.md @@ -4,20 +4,8 @@ title: Web前端 description: Web前端开发技术文档 --- -# Web 前端开发 - -前端开发技术栈的学习笔记和总结。 - -
-

{{ category.text }}

- -
\ No newline at end of file + \ No newline at end of file