init
This commit is contained in:
@@ -0,0 +1,137 @@
|
||||
/**
|
||||
* 扫码支持的类型
|
||||
* 256:Barcode.FORMAT_QR_CODE
|
||||
* 128:Barcode.FORMAT_ITF)
|
||||
* 1:Barcode.FORMAT_CODE_128
|
||||
* 2:Barcode.FORMAT_CODE_39
|
||||
* 4:Barcode.FORMAT_CODE_93
|
||||
* 8:Barcode.FORMAT_CODABAR
|
||||
* 32:Barcode.FORMAT_EAN_13
|
||||
* 64:Barcode.FORMAT_EAN_8)
|
||||
* 512:Barcode.FORMAT_UPC_A
|
||||
* 1024:Barcode.FORMAT_UPC_E
|
||||
* 2048:Barcode.FORMAT_PDF417
|
||||
* 16:Barcode.FORMAT_DATA_MATRIX
|
||||
* 4096:Barcode.FORMAT_AZTEC
|
||||
*/
|
||||
|
||||
export type Formats='256'|'128'|'1'|'2'|'4'|'8'|'32'|'64'|'512'|'1024'|'2048'|'16'|'4096'|'0';
|
||||
|
||||
|
||||
/**
|
||||
* 回调函数参数类型
|
||||
*/
|
||||
|
||||
export type OptionType={
|
||||
textVal?:string,
|
||||
ssid?:string,
|
||||
password?:string,
|
||||
url?:string,
|
||||
phone?:string,
|
||||
proNumber?:string,
|
||||
emailAddress?:string
|
||||
type?:string,
|
||||
scanCodeType?:string
|
||||
}
|
||||
/**
|
||||
* type 二维码内容类型 例如文本text 链接url ....
|
||||
* scanCodeType 识别码为二维码/条形码 1- 二维码 2- 条形码 0- 未知
|
||||
* option 参数内容{
|
||||
textVal?:string, //文本值
|
||||
ssid?:string, //wifi账号
|
||||
password?:string, //wifi密码
|
||||
url?:string, //链接
|
||||
phone?:string, //手机号
|
||||
proNumber?:string //商品编号
|
||||
}
|
||||
* optionArr 当设置了返回所有值,该字段才有值
|
||||
*/
|
||||
export type CallbackValType={
|
||||
type:string,
|
||||
option:OptionType,
|
||||
optionArr?:Array<OptionType>,
|
||||
scanCodeType?:string|null
|
||||
}
|
||||
|
||||
export type ErrorCallbackValType={
|
||||
type:string,
|
||||
msg:string
|
||||
}
|
||||
|
||||
|
||||
type CallBackType=(val:CallbackValType)=>void
|
||||
type ErrorCallBackType=(val:ErrorCallbackValType)=>void
|
||||
type CancelType=()=>void
|
||||
|
||||
/**
|
||||
* 扫码参数配置
|
||||
* showToast 连续扫码场景,识别成功后提示
|
||||
* showToastText 自定义连续扫码场景toast文案
|
||||
* customFailToatText 自定义未识别到二维码提示内容
|
||||
* cameraType 摄像头类型 默认BACK后置摄像头,可选FRONT前置摄像头,如果摄像头只有一个,默认选择可用列表第一个
|
||||
* continuous 开启连续扫码,默认false不开启
|
||||
* continuousDelay 连续扫码间隔时间
|
||||
* autoZoom 开启相机自动缩放,默认不开启,只限非连续扫码模式下使用
|
||||
* showPhotoAlbum 是否显示相册,默认显示
|
||||
* showLamplight 是否显示灯光,默认显示
|
||||
* markeTitle 底部的提示标题
|
||||
* lightOnText 手电筒打开文案
|
||||
* lightOffText 手电筒关闭文案
|
||||
* photoText 相册底部文案
|
||||
* formatsVal 扫码支持的格式类型,默认支持全部(0)
|
||||
* styleFollowIos 页面样式是否跟随IOS端,默认false不跟随
|
||||
* moreQrCodeSelectText 多个二维码选择提示文案
|
||||
* moreQrCodeSelectTextColor 多个二维码选择提示文案颜色
|
||||
* moreQrCodeSelectTextSize 多个二维码选择提示文案大小
|
||||
* firstUseUltraWideCamera 针对IOS 15以上机型使用,优先使用超广角相机识别二维码(注意:非特殊场景一定需要近距离扫码不要配置此参数,以免影响扫码效率)
|
||||
* scanBox //条码扫码模式
|
||||
* scanBoxTitle //中间区域扫码模式标题,只有scanBox为true生效
|
||||
* scanBoxTitleColor //中间区域扫码模式标题颜色,只有scanBox为true生效
|
||||
* scanBoxTitleSize //中间区域扫码模式标题大小,只有scanBox为true生效
|
||||
* scanBoxHeight //中间区域扫码框的高度,只有scanBox为true生效
|
||||
* outputAllCodeData //开启后,直接返回扫码数据,获取返回值内容需要取optionArr字段,默认关闭(只针对全屏扫码且非连续扫码有效)
|
||||
* success 识别成功的回调
|
||||
* error 识别失败回调
|
||||
* cancel 取消回调
|
||||
* ....
|
||||
*/
|
||||
export type InitParamsType={
|
||||
showToast:boolean|null,
|
||||
showToastText:string|null,
|
||||
customFailToatText:string|null,
|
||||
cameraType:string|null,
|
||||
continuous:boolean|null,
|
||||
continuousDelay:number|null,
|
||||
autoZoom:boolean|null,
|
||||
showPhotoAlbum:boolean|null,
|
||||
showLamplight:boolean|null,
|
||||
markeTitle:string|null,
|
||||
lightOnText:string|null,
|
||||
lightOffText:string|null,
|
||||
photoText:string|null,
|
||||
formatsVal?:Formats,
|
||||
styleFollowIos:boolean|null,
|
||||
scanBox:boolean|null,
|
||||
scanBoxTitle:string|null,
|
||||
scanBoxTitleColor:string|null,
|
||||
scanBoxTitleSize:number|null,
|
||||
scanBoxHeight:number|null,
|
||||
success:CallBackType,
|
||||
error:ErrorCallBackType,
|
||||
cancel:CancelType|null,
|
||||
moreQrCodeSelectText:string|null,
|
||||
moreQrCodeSelectTextColor:string|null,
|
||||
moreQrCodeSelectTextSize:number|null,
|
||||
firstUseUltraWideCamera:boolean|null,
|
||||
outputAllCodeData:boolean|null,
|
||||
}
|
||||
|
||||
/**
|
||||
* 权限
|
||||
*/
|
||||
export type Perssion={
|
||||
isPass:boolean,
|
||||
failList?:Array<string>,
|
||||
successList?:Array<string>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user