web-view-antd/src/api/infra/bookmark/index.ts

71 lines
1.5 KiB
TypeScript
Raw Normal View History

2025-03-05 17:13:23 +08:00
import { defHttp } from '@/utils/http/axios'
/**
*
*/
export interface BookmarkQueryRespVo {
/** 标识 */
name: string
/** 类型 */
type?: BookmarkType
}
export interface BookmarkGenData {
/** 书签名称(标识) */
name: string
/** 扩展类型 */
extData: PictureExData | TextExData
}
/** 书签需要替换的数据类型(文本,图片,图片(描述)) */
export type BookmarkType = 'TEXT' | 'PICTURE' | 'PICTURE_DESC'
/** 图片提供的data类型下载地址base64文本服务器绝对路径 */
export type PictureProvideDataType = 'DOWNLOAD_URL' | 'BASE64' | 'ABSOLUTE_PATH'
/**
*
*/
interface AbstractExData {
type: BookmarkType
value: string
}
/**
*
*/
export interface PictureExData extends AbstractExData {
width: number
height: number
pictureName: string
dataType: PictureProvideDataType
}
/**
*
*/
export interface TextExData extends AbstractExData {
bold: boolean
italic: boolean
}
/**
*
* @param fileId id
*/
export function getAllBookmarks(fileId: string | number) {
return defHttp.get<BookmarkQueryRespVo[]>({ url: `/infra/word/bookmark/file/${fileId}` })
}
/**
*
* @param fileId id
* @param data
*/
export function getDoBookmarkReplace(fileId: string | number, data: BookmarkGenData) {
return defHttp.get({ url: `/infra/word/bookmark/file/${fileId}/generate`, data })
}