web-view-antd/src/api/infra/bookmark/index.ts
2025-03-05 17:13:23 +08:00

71 lines
1.5 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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 })
}