提交正式官网

This commit is contained in:
parkiss
2026-07-09 14:35:32 +08:00
parent 5efbd6760e
commit e09f0eccda
792 changed files with 91499 additions and 0 deletions
+61
View File
@@ -0,0 +1,61 @@
import request from '@/utils/request'
import type { ICommonPageResponse, ICommonResponse } from '@/types/common'
export type MediaType = 'article' | 'video'
export interface INewsItem {
id: string
locale: 'en' | 'zh'
mediaType: MediaType
title: string
summary: string
thumbnail: string
thumbnailAlt?: string
url?: string
youtubeUrl?: string
tiktokUrl?: string
sortOrder: number
status: 'published' | 'draft'
createdAt: string
updatedAt: string
}
export interface INewsListParams {
page: number
pageSize: number
locale?: '' | 'en' | 'zh'
mediaType?: '' | MediaType
keyword?: string
status?: '' | 'published' | 'draft'
}
export interface INewsInput {
id?: string
locale: 'en' | 'zh'
mediaType: MediaType
title: string
summary: string
thumbnail: string
thumbnailAlt?: string
url?: string
youtubeUrl?: string
tiktokUrl?: string
sortOrder?: number
status?: 'published' | 'draft'
}
export const newsPage = (params?: INewsListParams) => {
return request.get<ICommonPageResponse<INewsItem[]>>('/news', { params })
}
export const createNews = (data: INewsInput) => {
return request.post<ICommonResponse<INewsItem>>('/news', data)
}
export const updateNews = (data: INewsInput & { id: string }) => {
return request.put<ICommonResponse<INewsItem>>('/news', data)
}
export const deleteNews = (ids: string[]) => {
return request.delete<ICommonResponse<unknown>>('/news', { data: ids })
}