Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions blog-forum/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
3 changes: 3 additions & 0 deletions blog-forum/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["Vue.volar"]
}
28 changes: 28 additions & 0 deletions blog-forum/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
## 博客论坛系统(Vue 3 + TypeScript + Vite)

### 开发启动

- 安装依赖:`npm install`
- 同时启动前端与 Mock API:`npm run dev`
- 前端:`http://localhost:5173`
- API(json-server,经由 Vite 代理):`/api/*` -> `http://localhost:3001/*`

### 账号

- 预置用户:`admin / admin`

### 主要功能

- 首页:文章列表、搜索、分页
- 登录:Pinia 管理登录态,`localStorage` 持久化
- 文章详情:评论列表、新增评论
- 写文章:Markdown 编辑器(bytemd),登录后可用
- 路由守卫:未登录跳转登录页

### 目录结构(部分)

- `src/api/*`:HTTP 封装与资源 API
- `src/stores/auth.ts`:登录状态
- `src/views/*`:各页面
- `src/router/index.ts`:路由与守卫
- `db.json`:json-server 数据
27 changes: 27 additions & 0 deletions blog-forum/db.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"users": [
{ "id": 1, "username": "admin", "password": "admin", "nickname": "管理员" }
],
"posts": [
{
"id": 1,
"title": "欢迎使用博客论坛",
"content": "这是第一篇示例文章。",
"authorId": 1,
"createdAt": 1727059200000,
"updatedAt": 1727059200000,
"likes": 0,
"tags": ["公告"]
}
],
"comments": [
{
"id": 1,
"postId": 1,
"authorId": 1,
"content": "欢迎来到社区!",
"createdAt": 1727059200000
}
]
}

13 changes: 13 additions & 0 deletions blog-forum/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + Vue + TS</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
Loading