# 高拍仪拍照 takePicture
● 接口函数
zwexplorer.PaperMaterialCamera.takePicture
● 接口说明
使用高拍仪拍照,返回 base64 图片信息或者 pdf 文件
● Typescript 类型参考
// 返回数据类型
type ResBody = {
resultCode: number, resultMessage: string, data: []
}
// 请求参数类型
type ReqBody = {
dataType?: 'img'|'pdf',
maxNum?:number
oneTake?:boolean,
useSwitch?:boolean,
useRotate?:boolean
}
zwexplorer.PaperMaterialCamera.takePicture(data: ReqBody, callback?: (res: ResBody)=>void): Promise<ResBody>
● 参数说明
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
data | Object | 是 | 请求对象 |
data.oneTake | Boolean | 否 | 是否拍一张照片直接返回并关闭,默认否 |
data.dataType | String | 否 | 值为'img' 或'pdf',返回的数据格式,默认为 img |
data.maxNum | Number | 否 | 每次调用接口最多能拍的图片保存张数,默认为无限张数 |
data.useSwitch | Boolean | 否 | 是否打开切换摄像头按钮,默认否 |
data.useRotate | Boolean | 否 | 是否打开旋转按钮,默认否 |
● 返回数据
参数 | 类型 | 必然存在 | 说明 |
---|---|---|---|
res.resultCode | Number | 是 | 状态码,0 为正常,其它为异常 [状态码参考] |
res.data | Array | string | 是 | 返回 img 的拍照模式时返回 string[],pdf 的拍照模式时返回 string |
res.resultMessage | String | 否 | 接口消息 |
● 示例
zwexplorer.PaperMaterialCamera.takePicture({}, (res) => {
// 返回数据
});