refactor(frontend): Rework home layout and user interactions
This commit is contained in:
@@ -376,7 +376,7 @@ const mockHandlers: Record<string, (url: string, options: any) => Promise<any>>
|
||||
'GET /comment/public/list': async (_url: string, options: any) => {
|
||||
await delay()
|
||||
const params = options.params || {}
|
||||
let comments = mockComments.filter(c => c.videoId === params.videoId)
|
||||
const comments = mockComments.filter(c => c.videoId === params.videoId)
|
||||
if (params.sortBy === 'hot') {
|
||||
comments.sort((a, b) => b.likeCount - a.likeCount)
|
||||
} else {
|
||||
@@ -526,7 +526,7 @@ const mockHandlers: Record<string, (url: string, options: any) => Promise<any>>
|
||||
// 匹配 Mock 处理器
|
||||
function matchHandler(url: string, method: string): ((url: string, options: any) => Promise<any>) | null {
|
||||
// 标准化 URL(移除查询参数和 /api 前缀)
|
||||
let normalizedUrl = url.replace(/^\/api/, '').split('?')[0]
|
||||
const normalizedUrl = url.replace(/^\/api/, '').split('?')[0]
|
||||
|
||||
// 构建匹配模式
|
||||
const patterns = Object.keys(mockHandlers)
|
||||
|
||||
Reference in New Issue
Block a user