feat: 重构前端项目结构并添加新功能

重构项目目录结构,将组件和服务模块化
添加Element Plus UI库并集成到项目中
实现文章、留言和分类的类型定义
新增工具函数模块包括日期格式化和字符串处理
重写路由配置并添加全局路由守卫
优化页面布局和响应式设计
新增服务层封装API请求
完善文章详情页和相关文章推荐功能
This commit is contained in:
qingfeng1121
2025-10-12 14:24:20 +08:00
parent 07d3159b08
commit b8362e7835
22 changed files with 2673 additions and 453 deletions

79
src/types/index.ts Normal file
View File

@@ -0,0 +1,79 @@
// 项目中使用的类型定义
/**
* 文章类型接口
*/
export interface Article {
id: number
title: string
content: string
author: string
createTime: string
updateTime: string
categoryId: number
categoryName?: string
tags?: string
views?: number
commentCount?: number
articleid?: string
publishedAt?: string
mg?: string
}
/**
* 留言类型接口
*/
export interface Message {
id: number
content: string
nickname: string
email: string
articleId?: number
parentId?: number
createdAt: string
replies?: Message[]
time?: string
}
/**
* 分类类型接口
*/
export interface Category {
id: number
name: string
description?: string
articleCount?: number
}
/**
* API响应接口
*/
export interface ApiResponse<T = any> {
success: boolean
code: number
message?: string
data?: T
total?: number
}
/**
* 分页参数接口
*/
export interface PaginationParams {
page?: number
size?: number
keyword?: string
[key: string]: any
}
/**
* 用户信息接口
*/
export interface User {
id?: number
username?: string
email?: string
avatar?: string
role?: string
token?: string
}