14 lines
699 B
TypeScript
14 lines
699 B
TypeScript
import http from './index'
|
|
|
|
export const templateApi = {
|
|
list: (params?: any) => http.get('/templates', { params }),
|
|
get: (id: number) => http.get(`/templates/${id}`),
|
|
upload: (formData: FormData) => http.post('/templates/upload', formData, { headers: { 'Content-Type': 'multipart/form-data' } }),
|
|
saveParagraphs: (id: number, data: any) => http.put(`/templates/${id}/paragraphs`, data),
|
|
delete: (id: number) => http.delete(`/templates/${id}`),
|
|
/** 获取模板的 HTML 预览文档 + 块列表 */
|
|
getPreview: (id: number) => http.get(`/templates/${id}/preview`),
|
|
/** 保存块配置 */
|
|
saveBlocks: (id: number, blocks: any[]) => http.put(`/templates/${id}/blocks`, { blocks }),
|
|
}
|