71 lines
1.5 KiB
TypeScript
71 lines
1.5 KiB
TypeScript
![]() |
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 })
|
|||
|
}
|