init
@@ -0,0 +1,252 @@
|
||||
## 1.15.0(2026-03-08)
|
||||
补充文档说明
|
||||
## 1.14.9(2026-01-27)
|
||||
* 识别结果回调参数增加识别码类型字段scanCodeType返回
|
||||
## 1.14.8(2026-01-21)
|
||||
* 更新安卓端部分依赖版本到1.4,解决上架Google商店要求16k导致上架失败的问题
|
||||
## 1.14.7(2026-01-13)
|
||||
* 优化IOS端关闭扫码页逻辑
|
||||
## 1.14.6(2026-01-12)
|
||||
* iOS端识别不到二维码Toast弹窗支持根据内容自适应
|
||||
## 1.14.5(2026-01-12)
|
||||
* 相册图片识别-增加自定义未识别到二维码提示内容
|
||||
## 1.14.4(2026-01-04)
|
||||
* IOS端支持配置直接返回数据(包括多个码结果)
|
||||
## 1.14.3(2025-12-31)
|
||||
* 安卓端支持配置直接返回数据(包括多个码结果)
|
||||
## 1.14.2(2025-12-30)
|
||||
* IOS端调整对焦模式为优先自动对焦
|
||||
* 已知问题优化
|
||||
## 1.14.1(2025-12-22)
|
||||
* 修复uniapp项目云打包报错的问题
|
||||
## 1.14.0(2025-12-21)
|
||||
### 重要更新
|
||||
* 将参数中的扫码格式设置类型由number调整为string,为了更灵活的配置多种格式扫码
|
||||
* 连续扫码场景支持间隔时间动态控制,参照用例
|
||||
* 连续扫码场景增加暂停扫码控制,适配更多的业务场景
|
||||
* 安卓端修复在连续扫码中可能出现回调两次的问题
|
||||
## 1.13.1(2025-12-19)
|
||||
* 消除控制台报解析器已关闭的错误
|
||||
* 补充文档说明
|
||||
## 1.13.0(2025-12-18)
|
||||
* 苹果端针对iPhone15及以上机型,需要近距离扫码特定场景增加参数配置
|
||||
## 1.12.9(2025-12-17)
|
||||
* 修复IOS端偶发性回调两次的问题
|
||||
* IOS端增加对页面多次调用的拦截操作
|
||||
## 1.12.8(2025-12-17)
|
||||
* 修复安卓端相册识别后数据类型转换错误的问题
|
||||
## 1.12.7(2025-12-17)
|
||||
* IOS端补充product类型条码的返回字段,与安卓保持一致
|
||||
## 1.12.6(2025-12-17)
|
||||
* 修复部分条码返回值不准确的问题
|
||||
## 1.12.5(2025-12-15)
|
||||
* 移除安卓端的调试信息
|
||||
## 1.12.4(2025-12-15)
|
||||
* 安卓端修复计算值丢失精度的问题
|
||||
## 1.12.3(2025-12-15)
|
||||
* 适配小米澎湃系统识别多码时预览图不全屏问题
|
||||
## 1.12.2(2025-12-15)
|
||||
* 针对安卓小米机型调试
|
||||
## 1.12.1(2025-12-15)
|
||||
* 适配安卓小米澎湃系统某些机型识别到多个二维码,预览图没有覆盖屏幕的问题
|
||||
## 1.12.0(2025-12-15)
|
||||
* 针对安卓小米澎湃系统调试
|
||||
## 1.11.9(2025-12-15)
|
||||
* 增加调试信息
|
||||
## 1.11.8(2025-12-15)
|
||||
* 安卓端针对小米机型调试
|
||||
## 1.11.7(2025-12-14)
|
||||
* 增加调试log
|
||||
## 1.11.6(2025-12-14)
|
||||
* 安卓端优化识别到多个二维码结果,预览图没有铺满屏幕的情况
|
||||
* 增加识别到多个二维码结果,底部提示文案的内容、颜色、字号大小自定义配置
|
||||
## 1.11.5(2025-12-10)
|
||||
* 针对iPhone15优化测试
|
||||
## 1.11.4(2025-12-09)
|
||||
* 安卓端优化中间区域扫码模式,四拐角样式绘制适配屏幕大小
|
||||
## 1.11.3(2025-12-09)
|
||||
* 修复IOS端云打包错误的问题
|
||||
## 1.11.2(2025-12-09)
|
||||
* IOS端增加log打印测试
|
||||
## 1.11.1(2025-12-08)
|
||||
* IOS端增加超广角对焦模式触发主动对焦处理
|
||||
* 安卓端优化多码识别结果标记处理
|
||||
## 1.11.0(2025-12-06)
|
||||
* 修改安卓端扫码模式默认为全屏模式
|
||||
## 1.10.9(2025-12-04)
|
||||
* IOS端优化,解决某些机型识别成功后扫码页面未完全关闭的问题
|
||||
## 1.10.8(2025-12-04)
|
||||
* 修复安卓端聚焦模糊的问题
|
||||
* 优化安卓端条码的识别效率
|
||||
## 1.10.7(2025-11-26)
|
||||
* 安卓端sdk支持最低版本改为默认为21
|
||||
## 1.10.6(2025-11-26)
|
||||
* 安卓端增加多点自动对焦,提升识别效率
|
||||
## 1.10.5(2025-11-24)
|
||||
* 优化安卓端单码识别速度
|
||||
* IOS端新增侧滑关闭扫码页功能
|
||||
## 1.10.4(2025-11-23)
|
||||
* 优化IOS端多码识别
|
||||
## 1.10.3(2025-11-21)
|
||||
* 补充鸿蒙端字段声明
|
||||
## 1.10.2(2025-11-18)
|
||||
* 优化iOS端近距离扫码
|
||||
## 1.10.1(2025-11-18)
|
||||
* IOS端增加log信息打印
|
||||
## 1.10.0(2025-11-17)
|
||||
* 修复安卓端相册二维码识别问题
|
||||
## 1.9.9(2025-11-15)
|
||||
* 优化IOS端多码识别
|
||||
## 1.9.8(2025-11-15)
|
||||
* 优化IOS端近距离无法识别条码的问题
|
||||
* IOS端新增scanbox高度自定义配置
|
||||
## 1.9.7(2025-11-13)
|
||||
* 安卓端支持设置scanbox模式扫码框的高度自定义配置
|
||||
## 1.9.6(2025-11-12)
|
||||
* 完善IOS端scanbox模式扫码逻辑
|
||||
## 1.9.5(2025-11-11)
|
||||
* 补充IOS端scanbox扫码模式UI
|
||||
## 1.9.4(2025-11-11)
|
||||
* 优化入参处理逻辑
|
||||
* 补充中间扫码模式文档说明
|
||||
## 1.9.3(2025-11-08)
|
||||
* IOS端支持扫码格式设置
|
||||
* IOS端细节优化
|
||||
## 1.9.2(2025-11-08)
|
||||
* 细节优化
|
||||
## 1.9.1(2025-10-26)
|
||||
* 兼容鸿蒙端扫码
|
||||
* 注意:鸿蒙使用的是官方默认扫码界面,不能自定义界面内容,只能单码识别,不支持连续扫码
|
||||
## 1.9.0(2025-10-25)
|
||||
* 增加连续扫码场景,toast提示内容自定义配置
|
||||
## 1.8.9(2025-10-24)
|
||||
*升级安卓谷歌扫码依赖到17.3.0版本
|
||||
*最低支持版本提到26
|
||||
## 1.8.8(2025-09-24)
|
||||
IOS端补充主动关闭扫码页面的方法
|
||||
## 1.8.7(2025-09-23)
|
||||
修复uniapp项目打包失败的问题
|
||||
## 1.8.6(2025-09-22)
|
||||
优化主动关闭扫码页方法判断,兼容uniapp端V2项目
|
||||
## 1.8.5(2025-09-19)
|
||||
安卓端增加主动关闭扫码页的方法
|
||||
## 1.8.4(2025-09-19)
|
||||
移除无用代码
|
||||
## 1.8.3(2025-09-18)
|
||||
调整web目录文件后缀
|
||||
## 1.8.2(2025-09-18)
|
||||
新增web平台目录
|
||||
## 1.8.1(2025-08-06)
|
||||
更新安卓端依赖到最新版本
|
||||
## 1.8.0(2025-05-24)
|
||||
安卓端
|
||||
fix: 修复由1.7.9版本引起的识别多个二维码后,左上角叉不能关闭的bug
|
||||
|
||||
Feat-重要更新: 1. 安卓新增跟随IOS界面样式配置选项
|
||||
|
||||
2. 新增二维码识别中自动缩放相机功能配置
|
||||
## 1.7.9(2025-05-22)
|
||||
修复安卓端灯光切换的需要点两次的bug
|
||||
## 1.7.8(2025-05-22)
|
||||
重要:安卓端支持手动聚焦缩放功能
|
||||
## 1.7.7(2025-05-21)
|
||||
调整灯光文案自定义字段,由原来的一个变为两个,可参考用例
|
||||
## 1.7.6(2025-05-21)
|
||||
适配新的二维码制式
|
||||
## 1.7.5(2025-05-13)
|
||||
移除无用代码
|
||||
## 1.7.4(2025-05-10)
|
||||
feat(重要):IOS端增加手动对焦、自动曝光功能
|
||||
## 1.7.3(2025-04-29)
|
||||
调整文案宽度自适应
|
||||
## 1.7.2(2025-04-28)
|
||||
适配文案动态修改
|
||||
## 1.7.1(2025-04-28)
|
||||
增加相册、手电筒文案自定义
|
||||
## 1.7.0(2025-04-23)
|
||||
1.IOS端增加灯光功能
|
||||
2.适配灯光功能动态配置
|
||||
## 1.6.5(2025-04-22)
|
||||
修复关闭扫码页,顶部出现扫描线条的bug
|
||||
## 1.6.4(2025-04-22)
|
||||
1.IOS端增加相册入口动态配置
|
||||
2.IOS端在连续扫码情况下,增加toast提示配置
|
||||
## 1.6.3(2025-04-21)
|
||||
1.修复IOS无法关闭页面的bug
|
||||
2.IOS端增加底部文案动态配置
|
||||
## 1.6.2(2025-04-21)
|
||||
修复IOS关闭扫码页失败的问题
|
||||
## 1.6.1(2025-04-21)
|
||||
平板设备增加打印信息
|
||||
## 1.6.0(2025-04-21)
|
||||
安卓 端增加测试log打印
|
||||
## 1.5.9(2025-04-21)
|
||||
IOS端增加识别成功音效
|
||||
## 1.5.8(2025-04-20)
|
||||
重要:IOS端增加多码识别
|
||||
## 1.5.7(2025-04-13)
|
||||
1、增加用户取消扫码回调方法
|
||||
2、移除平台目录下的类型声明,统一使用interface文件,升级后需注意调整代码
|
||||
## 1.5.6(2025-04-10)
|
||||
IOS端修复草料二维码识别失败的问题
|
||||
## 1.5.5(2025-03-22)
|
||||
iOS端启动扫码预览逻辑优化
|
||||
## 1.5.4(2025-03-15)
|
||||
ios更新:增加相册二维码识别
|
||||
## 1.5.3(2025-03-14)
|
||||
开启源码授权
|
||||
## 1.5.2(2025-02-27)
|
||||
ios端增加连续扫码
|
||||
## 1.5.1(2025-02-25)
|
||||
修复iOS扫码窗口关闭,返回按钮未移除的问题
|
||||
## 1.5.0(2025-02-24)
|
||||
增加iOS端的支持
|
||||
## 1.4.0(2025-02-19)
|
||||
增加连续扫码识别成功toast提示
|
||||
## 1.3.9(2025-02-11)
|
||||
修复识别多个二维码成功后,摄像头预览未正常关闭的问题
|
||||
## 1.3.8(2025-01-14)
|
||||
适配邮件二维码识别
|
||||
## 1.3.7(2025-01-10)
|
||||
增加ISBN二维码识别
|
||||
## 1.3.6(2024-12-30)
|
||||
开启摄像头信息打印
|
||||
## 1.3.5(2024-12-18)
|
||||
细节优化
|
||||
## 1.3.4(2024-12-17)
|
||||
增加相册、灯光显示动态控制
|
||||
## 1.3.3(2024-12-17)
|
||||
针对不同机型优化摄像头打开模式
|
||||
## 1.3.2(2024-12-16)
|
||||
增加前后摄像头切换功能
|
||||
## 1.3.1(2024-12-16)
|
||||
解决开启连续扫码,回调函数只触发一次的问题
|
||||
## 1.3(2024-12-14)
|
||||
增加连续扫码参数配置
|
||||
## 1.2.5(2024-10-28)
|
||||
移除无用代码
|
||||
## 1.2.4(2024-10-28)
|
||||
修复由工具4.31版本引起的颜色设置失效问题,注意:调整了多色的传值类型,可参照下列文档说明
|
||||
## 1.2.3(2024-10-27)
|
||||
修复工具4.31引起的OptionType未引入的错误
|
||||
## 1.2.2(2024-10-25)
|
||||
移除调试代码
|
||||
## 1.2.1(2024-10-25)
|
||||
优化图像解析分辨率逻辑
|
||||
## 1.2.0(2024-10-19)
|
||||
1.优化识别到二维码标记的UI样式
|
||||
2.增加超时未识别到二维码回调error函数
|
||||
3.二维码解析细节优化
|
||||
## 1.1.1(2024-10-07)
|
||||
增加物料二维码内容正常读取返回
|
||||
## 1.1.0(2024-09-29)
|
||||
适配uniapp项目扫码
|
||||
## 1.0.3(2024-08-13)
|
||||
更新使用文档
|
||||
## 1.0.2(2024-08-13)
|
||||
优化
|
||||
## 1.0.1(2024-04-18)
|
||||
1.增加返回参数类型
|
||||
2.修改返回值的格式
|
||||
## 1.0.0(2024-04-10)
|
||||
初始化
|
||||
@@ -0,0 +1 @@
|
||||
¯^ ³<Ì¥ƒH1D@¥E^Ÿ*sÙ žèNˆû"T¸>üin%Ø%nz*�Ÿ·ÀíJe›”(�¥JKÂÈ[Ôc%ù[xBZqϧ¹�o[¶³¸Ko“>;É
|
||||
@@ -0,0 +1,120 @@
|
||||
{
|
||||
"id": "xwq-mlkit-scan-code",
|
||||
"displayName": "(兼容IOS、安卓、鸿蒙)二维码、条码识别,mlkit扫码插件(毫秒级识别效率,支持多码识别,连续扫码)",
|
||||
"version": "1.15.0",
|
||||
"description": "扫码插件,支持识别二维码、条码、多个二维码,连续扫码、相册图片识别、手动聚焦缩放功能、相机自动缩放",
|
||||
"keywords": [
|
||||
"扫码",
|
||||
"",
|
||||
"条码",
|
||||
"",
|
||||
"二维码",
|
||||
"",
|
||||
"谷歌扫码",
|
||||
"连续扫码"
|
||||
],
|
||||
"repository": "",
|
||||
"engines": {
|
||||
"HBuilderX": "^4.57",
|
||||
"uni-app": "^4.66",
|
||||
"uni-app-x": "^4.66"
|
||||
},
|
||||
"dcloudext": {
|
||||
"type": "uts",
|
||||
"sale": {
|
||||
"regular": {
|
||||
"price": "50.00"
|
||||
},
|
||||
"sourcecode": {
|
||||
"price": "398.00"
|
||||
}
|
||||
},
|
||||
"contact": {
|
||||
"qq": ""
|
||||
},
|
||||
"declaration": {
|
||||
"ads": "无",
|
||||
"data": "无",
|
||||
"permissions": "相机、相册"
|
||||
},
|
||||
"npmurl": "",
|
||||
"darkmode": "x",
|
||||
"i18n": "x",
|
||||
"widescreen": "x"
|
||||
},
|
||||
"uni_modules": {
|
||||
"dependencies": [],
|
||||
"encrypt": [],
|
||||
"platforms": {
|
||||
"cloud": {
|
||||
"tcb": "√",
|
||||
"aliyun": "√",
|
||||
"alipay": "√"
|
||||
},
|
||||
"client": {
|
||||
"uni-app": {
|
||||
"vue": {
|
||||
"vue2": "√",
|
||||
"vue3": "√"
|
||||
},
|
||||
"web": {
|
||||
"safari": "-",
|
||||
"chrome": "-"
|
||||
},
|
||||
"app": {
|
||||
"vue": "-",
|
||||
"nvue": "-",
|
||||
"android": {
|
||||
"extVersion": "",
|
||||
"minVersion": "21"
|
||||
},
|
||||
"ios": {
|
||||
"extVersion": "",
|
||||
"minVersion": "15"
|
||||
},
|
||||
"harmony": "-"
|
||||
},
|
||||
"mp": {
|
||||
"weixin": "-",
|
||||
"alipay": "-",
|
||||
"toutiao": "-",
|
||||
"baidu": "-",
|
||||
"kuaishou": "-",
|
||||
"jd": "-",
|
||||
"harmony": "-",
|
||||
"qq": "-",
|
||||
"lark": "-",
|
||||
"xhs": "-"
|
||||
},
|
||||
"quickapp": {
|
||||
"huawei": "-",
|
||||
"union": "-"
|
||||
}
|
||||
},
|
||||
"uni-app-x": {
|
||||
"web": {
|
||||
"safari": "-",
|
||||
"chrome": "-"
|
||||
},
|
||||
"app": {
|
||||
"android": {
|
||||
"extVersion": "",
|
||||
"minVersion": "21"
|
||||
},
|
||||
"ios": {
|
||||
"extVersion": "",
|
||||
"minVersion": "15"
|
||||
},
|
||||
"harmony": {
|
||||
"extVersion": "",
|
||||
"minVersion": "11"
|
||||
}
|
||||
},
|
||||
"mp": {
|
||||
"weixin": "-"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,373 @@
|
||||
# 插件使用说明文档
|
||||
|
||||
<font size="5" color="#f00">注意!</font>
|
||||
|
||||
<font size="3" color="#f00">插件需要打自定义基座运行!</font>
|
||||
|
||||
<font size="3" color="#f00">插件需要打自定义基座运行!</font>
|
||||
|
||||
<font size="3" color="#f00">插件需要打自定义基座运行!</font>
|
||||
|
||||
#### 插件说明
|
||||
```
|
||||
本插件是封装了谷歌mlkit条码识别功能,支持多种条码类型扫码,
|
||||
识别速度和准确率杠杠的,可以支持多个二维码识别,识别成功会有提示音和震动效果,类似wx扫码。
|
||||
```
|
||||
|
||||
<font size="3" color="#f00">IOS端注意!,不支持摄像头切换,用法参考后面的用例(扫码插件支持的ios版本是>=15.5)</font>
|
||||
|
||||
<font size="3" color="#f00">鸿蒙端注意:鸿蒙使用的是官方默认扫码界面UI,不支持自定义界面内容,只能单码识别,不支持连续扫码</font>
|
||||
|
||||
#### 扫码类型:支持文本、链接、电话、邮件、WIFI等通用类型条码
|
||||
```
|
||||
type CodeType = 'text'| 'url'| 'wifi'| 'phone'| 'sms'
|
||||
| 'email'
|
||||
| 'contact'
|
||||
| 'geo'
|
||||
| 'calendar'
|
||||
| 'driverLicense'
|
||||
| 'isbn'
|
||||
| 'product';
|
||||
```
|
||||
#### 支持扫码格式列表,默认支持全部格式,可以设置单个或多个扫码格式类型,不设置默认是0,支持全部扫码格式
|
||||
------------------
|
||||
|
||||
* 1----->FORMAT_CODE_128
|
||||
* 2----->FORMAT_CODE_39
|
||||
* 4----->FORMAT_CODE_93
|
||||
* 8----->FORMAT_CODABAR
|
||||
* 32---->FORMAT_EAN_13
|
||||
* 64---->FORMAT_EAN_8)
|
||||
* 128--> FORMAT_ITF) 二维码
|
||||
* 256--> FORMAT_QR_CODE 二维码
|
||||
* 512--->FORMAT_UPC_A
|
||||
* 1024-->FORMAT_UPC_E
|
||||
* 2048-->FORMAT_PDF417
|
||||
* 16---->FORMAT_DATA_MATRIX
|
||||
* 4096-->FORMAT_AZTEC
|
||||
|
||||
--------------
|
||||
* 参数说明
|
||||
|
||||
| 属性 | 类型 | 默认值 | 必填 | 描述 |
|
||||
|-- |-- |-- |-- |-- |
|
||||
|cameraType |string |BACK |N |开启前置摄像头,不设置默认使用后置摄像头,当设备只有一个摄像头,该设置无效,会自动取可用列表的摄像头 |
|
||||
|continuous |boolean |false |N |设为true即可开启连续扫码,默认不开启 |
|
||||
|continuousDelay |number |800 |N |连续扫码场景,间隔时间 |
|
||||
|autoZoom |boolean |false |N |开启相机自动缩放,默认不开启,只限非连续扫码模式下使用 |
|
||||
|styleFollowIos |boolean |true |N |页面样式是否跟随IOS端,默认true全屏模式 |
|
||||
|showLamplight |boolean |true |N |隐藏/显示灯光操作,默认显示 |
|
||||
|showPhotoAlbum |boolean |true |N |隐藏/显示相册操作,默认显示 |
|
||||
|scanBox |boolean |false |N |中间区域扫码模式,默认关闭,(注意:如果开启此模式,styleFollowIos必须配置且为false) |
|
||||
|scanBoxTitle |string |'将码放入取景框,即可自动扫描' |N |中间区域扫码模式标题,只有scanBox为true生效 |
|
||||
|scanBoxTitleColor |string |'#ffffff' |N |中间区域扫码模式标题颜色,只有scanBox为true生效 |
|
||||
|scanBoxTitleSize |number |16 |N |中间区域扫码模式标题大小,只有scanBox为true生效 |
|
||||
|scanBoxHeight |number |540 |N |中间区域扫码框的高度,只有scanBox为true生效 |
|
||||
|formatsVal |string |'0' |N |设置扫码的制式,默认为'0',支持全部制式 |
|
||||
|markeTitle |string |'#ffffff' |N |设置扫码页底部识别中的提示文字 |
|
||||
|showToast |boolean |false |N |二维码识别成功显示toast(只针对连续扫码生效) |
|
||||
|showToastText |string |'自定义扫码成功提示' |N |设置连续扫码场景成功提示语 |
|
||||
|lightOnText |string |'灯光打开' |N |自定义打开灯光文案 |
|
||||
|lightOffText |string |'灯光关闭' |N |自定义关闭灯光文案 |
|
||||
|photoText |string |'自定义相册文字' |N |相册底部文案(只针对安卓不跟随IOS端界面样式有效) |
|
||||
|moreQrCodeSelectText |string |'识别到多个二维码,请选择一个打开' |N |多个二维码选择提示文案 |
|
||||
|moreQrCodeSelectTextColor |string |'#ffffff' |N |多个二维码选择提示文案颜色 |
|
||||
|moreQrCodeSelectTextSize |number |16 |N |多个二维码选择提示文案大小 |
|
||||
|outputAllCodeData |boolean |false |N |开启后,直接返回扫码数据,获取返回值内容需要取optionArr字段,默认关闭(只针对全屏扫码且非连续扫码有效) |
|
||||
|customFailToatText|string|未识别到二维码|N|未识别到二维码时提示内容|
|
||||
|
||||
#### 识别成功回调参数说明
|
||||
```html
|
||||
CallbackValType:{
|
||||
type --- 识别码内容类型 例如文本-text 链接-url 商品-product
|
||||
option ----{
|
||||
textVal?:string ------- 文本值
|
||||
url?:string --------- 链接
|
||||
phone?:string -------- 手机号
|
||||
proNumber?:string ----- 商品编号
|
||||
}
|
||||
optionArr ---- 当初始化配置outputAllCodeData设置为true时,该字段才有值,内容字段和option字段一致
|
||||
scanCodeType ----- 识别码为二维码/条形码 1- 二维码 2- 条形码 0- 未知 (当outputAllCodeData设置为true时,该字段会包含在optionArr的每个子项中)
|
||||
}
|
||||
```
|
||||
|
||||
------------
|
||||
#### 页面调用插件方式
|
||||
|
||||
|
||||
|
||||
* uniapp的使用方式
|
||||
|
||||
```html
|
||||
|
||||
<template>
|
||||
<view>
|
||||
<button @click="openScan">打开扫码</button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {openCamera,closeCamera,setContinuousScanStatus} from '@/uni_modules/xwq-mlkit-scan-code';
|
||||
export default {
|
||||
methods: {
|
||||
openScan(){
|
||||
openCamera({
|
||||
cameraType:"FRONT",//开启前置摄像头,不设置默认使用后置摄像头,当设备只有一个摄像头,该设置无效,会自动取可用列表的摄像头
|
||||
continuous:true,//设为true即可开启连续扫码,默认不开启
|
||||
continuousDelay:2000,//连续扫码间隔时间
|
||||
autoZoom:true,//开启相机自动缩放,默认不开启,只限非连续扫码模式下使用
|
||||
styleFollowIos:false, //页面样式是否跟随IOS端,默认false不跟随
|
||||
showLamplight:false,//隐藏灯光操作,默认显示
|
||||
showPhotoAlbum:false,//隐藏相册操作,默认显示
|
||||
scanBox:true, //中间区域扫码模式 (注意:如果开启此模式,styleFollowIos必须配置且为false)
|
||||
scanBoxTitle:'将码放入取景框,即可自动扫描',//中间区域扫码模式标题,只有scanBox为true生效
|
||||
scanBoxTitleColor:"#ff0000",//中间区域扫码模式标题颜色,只有scanBox为true生效
|
||||
scanBoxTitleSize:16,//中间区域扫码模式标题大小,只有scanBox为true生效
|
||||
scanBoxHeight:200, //中间区域扫码框的高度,只有scanBox为true生效
|
||||
formatsVal:'32,128,256', //扫码格式
|
||||
markeTitle:'', //扫码页底部提示文字
|
||||
showToast:false,//二维码识别成功显示toast(只针对连续扫码生效)
|
||||
showToastText:"自定义扫码成功提示",//连续扫码场景提示语
|
||||
customFailToatText:"自定义未识别到二维码信息", //未识别到二维码时提示内容
|
||||
lightOnText:'灯光打开',//自定义打开灯光文案
|
||||
lightOffText:'灯光关闭',//自定义关闭灯光文案
|
||||
photoText: "自定义相册文字",//相册底部文案
|
||||
moreQrCodeSelectText:"当前识别到多个二维码,请选择一个", //多个二维码选择提示文案
|
||||
moreQrCodeSelectTextColor:"#ff0000", //多个二维码选择提示文案颜色
|
||||
moreQrCodeSelectTextSize:18, //多个二维码选择提示文案大小
|
||||
outputAllCodeData:false, //开启后,直接返回扫码数据,获取返回值内容需要取optionArr字段,默认关闭(只针对全屏扫码且非连续扫码有效)
|
||||
success:(val)=>{
|
||||
console.log('扫码结果回调===',val)
|
||||
// 返回参数增加scanCodeType 识别码类型 1- 二维码 2- 条形码 0- 未知
|
||||
//暂停扫码(针对连续扫码场景生效)
|
||||
// setContinuousScanStatus(true)
|
||||
|
||||
// if(val.optionArr!=null&&val.optionArr!.length>0){
|
||||
// val.optionArr?.forEach(item=>{
|
||||
// result.value.push(item.textVal ?? '');
|
||||
// })
|
||||
// }else{
|
||||
// result.value.push(val.option.textVal ?? '');
|
||||
// }
|
||||
|
||||
// setTimeout(()=>{
|
||||
//接口识别后,继续扫码
|
||||
// setContinuousScanStatus(false)
|
||||
// },5000)
|
||||
},
|
||||
error:(val) => {
|
||||
console.log('识别失败===', val);
|
||||
uni.showToast({
|
||||
title:"没有识别到二维码"
|
||||
})
|
||||
},
|
||||
cancel:()=>{
|
||||
console.log('取消扫码')
|
||||
}
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
```
|
||||
|
||||
* uniappX的使用方式
|
||||
|
||||
```html
|
||||
|
||||
<template>
|
||||
<view>
|
||||
<button @click="openScan">打开扫码</button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script lang='uts'>
|
||||
import {openCamera,closeCamera,setContinuousScanStatus} from '@/uni_modules/xwq-mlkit-scan-code';
|
||||
import { InitParamsType, CallbackValType,ErrorCallbackValType } from '@/uni_modules/xwq-mlkit-scan-code/utssdk/interface.uts';
|
||||
export default {
|
||||
data() {
|
||||
return {}
|
||||
},
|
||||
methods: {
|
||||
openScan(){
|
||||
openCamera({
|
||||
cameraType:"FRONT",//开启前置摄像头,不设置默认使用后置摄像头,当设备只有一个摄像头,该设置无效,会自动取可用列表的摄像头
|
||||
continuous:true,//设为true即可开启连续扫码,默认不开启
|
||||
continuousDelay:2000,//连续扫码间隔时间
|
||||
autoZoom:true,//开启相机自动缩放,默认不开启,只限非连续扫码模式下使用
|
||||
styleFollowIos:false, //页面样式是否跟随IOS端,默认false不跟随
|
||||
showLamplight:false,//隐藏灯光操作,默认显示
|
||||
showPhotoAlbum:false,//隐藏相册操作,默认显示
|
||||
scanBox:true, //中间区域扫码模式 (注意:如果开启此模式,styleFollowIos必须配置且为false)
|
||||
scanBoxTitle:'将码放入取景框,即可自动扫描',//中间区域扫码标题,只有scanBox为true生效
|
||||
scanBoxTitleColor:"#ff0000",//中间区域扫码标题颜色,只有scanBox为true生效
|
||||
scanBoxTitleSize:16,//中间区域扫码标题大小,只有scanBox为true生效
|
||||
scanBoxHeight:200, //中间区域扫码框的高度,只有scanBox为true生效
|
||||
formatsVal:'32,128,256', //扫码格式
|
||||
markeTitle:'', //扫码页底部提示文字
|
||||
showToast:false,//二维码识别成功显示toast(只针对连续扫码生效)
|
||||
showToastText:"自定义扫码成功提示",//连续扫码场景提示语
|
||||
customFailToatText:"自定义未识别到二维码信息", //未识别到二维码时提示内容
|
||||
lightOnText:'灯光打开',//自定义打开灯光文案
|
||||
lightOffText:'灯光关闭',//自定义关闭灯光文案
|
||||
photoText: "自定义相册文字",//相册底部文案
|
||||
moreQrCodeSelectText:"当前识别到多个二维码,请选择一个", //多个二维码选择提示文案
|
||||
moreQrCodeSelectTextColor:"#ff0000", //多个二维码选择提示文案颜色
|
||||
moreQrCodeSelectTextSize:18, //多个二维码选择提示文案大小
|
||||
outputAllCodeData:false, //开启后,直接返回扫码数据,获取返回值内容需要取optionArr字段,默认关闭(只针对全屏扫码且非连续扫码有效)
|
||||
success:(val:CallbackValType)=>{
|
||||
console.log('扫码结果回调===',val)
|
||||
//暂停扫码(针对连续扫码场景生效)
|
||||
// setContinuousScanStatus(true)
|
||||
// 返回参数增加scanCodeType 识别码类型 1- 二维码 2- 条形码 0- 未知
|
||||
// if(val.optionArr!=null&&val.optionArr!.length>0){
|
||||
// val.optionArr?.forEach(item=>{
|
||||
// result.value.push(item.textVal ?? '');
|
||||
// })
|
||||
// }else{
|
||||
// result.value.push(val.option.textVal ?? '');
|
||||
// }
|
||||
|
||||
// setTimeout(()=>{
|
||||
//接口识别后,继续扫码
|
||||
// setContinuousScanStatus(false)
|
||||
// },5000)
|
||||
},
|
||||
error:(val : ErrorCallbackValType) => {
|
||||
console.log('识别失败===', val);
|
||||
uni.showToast({
|
||||
title:"没有识别到二维码"
|
||||
})
|
||||
},
|
||||
cancel:()=>{
|
||||
console.log('取消扫码')
|
||||
}
|
||||
} as InitParamsType);
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
```
|
||||
|
||||
### IOS端UniappX项目中使用
|
||||
```html
|
||||
<template>
|
||||
<view>
|
||||
<button @click="openScan">打开扫码</button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { openCamera,closeCamera,setContinuousScanStatus} from '@/uni_modules/xwq-mlkit-scan-code';
|
||||
import { InitParamsType, CallbackValType,ErrorCallbackValType } from '@/uni_modules/xwq-mlkit-scan-code/utssdk/interface.uts';
|
||||
const openScan = () => {
|
||||
openCamera({
|
||||
continuous:true,//设为true即可开启连续扫码,默认不开启
|
||||
continuousDelay:2000,//连续扫码间隔时间
|
||||
autoZoom:true,//开启相机自动缩放,默认不开启,只限非连续扫码模式下使用
|
||||
styleFollowIos:false, //页面样式是否跟随IOS端,默认false不跟随
|
||||
showLamplight:false,//隐藏灯光操作,默认显示
|
||||
showPhotoAlbum:false,//隐藏相册操作,默认显示
|
||||
formatsVal:'32,128,256', //扫码格式
|
||||
scanBox:true, //中间区域扫码模式 (注意:如果开启此模式,styleFollowIos必须配置且为false)
|
||||
scanBoxTitle:'将码放入取景框,即可自动扫描',//中间区域扫码标题,只有scanBox为true生效
|
||||
scanBoxTitleColor:"#ff0000",//中间区域扫码标题颜色,只有scanBox为true生效
|
||||
scanBoxTitleSize:16,//中间区域扫码标题大小,只有scanBox为true生效
|
||||
scanBoxHeight:200, //中间区域扫码框的高度,只有scanBox为true生效
|
||||
markeTitle:'', //扫码页底部提示文字
|
||||
showToast:false,//二维码识别成功显示toast(只针对连续扫码生效)
|
||||
showToastText:"自定义扫码成功提示",//连续扫码场景提示语
|
||||
customFailToatText:"自定义未识别到二维码信息", //未识别到二维码时提示内容
|
||||
lightOnText:'灯光打开',//自定义打开灯光文案
|
||||
lightOffText:'灯光关闭',//自定义关闭灯光文案
|
||||
photoText: "自定义相册文字",//相册底部文案
|
||||
moreQrCodeSelectText:"当前识别到多个二维码,请选择一个", //多个二维码选择提示文案
|
||||
moreQrCodeSelectTextColor:"#ff0000", //多个二维码选择提示文案颜色
|
||||
moreQrCodeSelectTextSize:18, //多个二维码选择提示文案大小
|
||||
outputAllCodeData:false, //开启后,直接返回扫码数据,获取返回值内容需要取optionArr字段,默认关闭(只针对全屏扫码且非连续扫码有效)
|
||||
success: (val : CallbackValType) => {
|
||||
console.log('识别结果====', val)
|
||||
//暂停扫码(针对连续扫码场景生效)
|
||||
// setContinuousScanStatus(true)
|
||||
// 返回参数增加scanCodeType 识别码类型 1- 二维码 2- 条形码 0- 未知
|
||||
// if(val.optionArr!=null&&val.optionArr!.length>0){
|
||||
// val.optionArr?.forEach(item=>{
|
||||
// result.value.push(item.textVal ?? '');
|
||||
// })
|
||||
// }else{
|
||||
// result.value.push(val.option.textVal ?? '');
|
||||
// }
|
||||
|
||||
// setTimeout(()=>{
|
||||
//接口识别后,继续扫码
|
||||
// setContinuousScanStatus(false)
|
||||
// },5000)
|
||||
},
|
||||
error:(val : ErrorCallbackValType) => {
|
||||
console.log('识别失败===', val);
|
||||
uni.showToast({
|
||||
title:"没有识别到二维码"
|
||||
})
|
||||
},
|
||||
cancel:()=>{
|
||||
console.log('取消扫码')
|
||||
}
|
||||
} as InitParamsType);
|
||||
|
||||
};
|
||||
</script>
|
||||
|
||||
```
|
||||
|
||||
|
||||
### 在鸿蒙端使用用例(注意:鸿蒙使用的是官方默认扫码界面,不能自定义界面内容,只能单码识别,不支持连续扫码)
|
||||
```html
|
||||
<template>
|
||||
<view>
|
||||
<button @click="openScan">打开扫码</button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { openCamera } from '@/uni_modules/xwq-mlkit-scan-code';
|
||||
import { InitParamsType, CallbackValType,ErrorCallbackValType } from '@/uni_modules/xwq-mlkit-scan-code/utssdk/interface.uts';
|
||||
const openScan = () => {
|
||||
openCamera({
|
||||
showPhotoAlbum:true,//相册入口是否开启
|
||||
success: (val : CallbackValType) => {
|
||||
console.log('识别结果====', val)
|
||||
uni.showToast({
|
||||
title:'识别成功'
|
||||
})
|
||||
},
|
||||
error:(val : ErrorCallbackValType) => {
|
||||
console.log('识别失败===', val);
|
||||
uni.showToast({
|
||||
title:"没有识别到二维码"
|
||||
})
|
||||
},
|
||||
cancel:()=>{
|
||||
console.log('取消扫码')
|
||||
}
|
||||
} as InitParamsType);
|
||||
|
||||
};
|
||||
```
|
||||
|
||||
|
||||
### 其他插件预览
|
||||
|
||||
[(兼容IOS、安卓、鸿蒙)二维码、条码识别,mlkit扫码插件 毫秒级识别效率,支持多码识别,连续扫](https://ext.dcloud.net.cn/plugin?id=17575)
|
||||
[TTS(安卓、ios、鸿蒙、web)将文字转成语音播报](https://ext.dcloud.net.cn/plugin?id=21718)
|
||||
[(兼容安卓、IOS端)离线语音识别插件、支持离线语音](https://ext.dcloud.net.cn/plugin?id=23397)
|
||||
[(UNIAPPX原生播放器)仿抖音视频刷刷刷 刷视频 自动滑动视频,短剧刷视频必备神器](https://ext.dcloud.net.cn/plugin?id=24719)
|
||||
[(安卓、IOS) PDF预览插件](https://ext.dcloud.net.cn/plugin?id=25438)
|
||||
[(兼容安卓、鸿蒙端、iOS)onnx 大模型实时语音识别 wav音频文件转文本](https://ext.dcloud.net.cn/plugin?id=26641)
|
||||
[(兼容安卓、鸿蒙)录音插件,支持pcm实时回调,wav转换,后台录音](https://ext.dcloud.net.cn/plugin?id=26890)
|
||||
[(nvue)app端仿抖音短视频 丝滑切换视频效果,无限数据加载](https://ext.dcloud.net.cn/plugin?id=21073)
|
||||
[兼容安卓、IOS端支持全局消息弹窗插件](https://ext.dcloud.net.cn/plugin?id=20254)
|
||||
[(支持安卓和IOS端)原生UTS组件svg插件](https://ext.dcloud.net.cn/plugin?id=18803)
|
||||
[(兼容IOS和安卓Web三端)SVGA 动画组件 支持自定义文本、图片,图层隐藏功能](https://ext.dcloud.net.cn/plugin?id=16489)
|
||||
[系统权限验证、获取、跳转](https://ext.dcloud.net.cn/plugin?id=15673)
|
||||
[(兼容安卓、IOS、鸿蒙)二维码 qrcode 自定义logo图片 颜色可自定义](https://ext.dcloud.net.cn/plugin?id=15583)
|
||||
[仿抖音短视频微信小程序 丝滑切换视频效果,无限数据加载不卡顿,咨询进IM交流群](https://ext.dcloud.net.cn/plugin?id=13679)
|
||||
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"
|
||||
package="io.dcloud.uni_modules.xwq_mlkit_scan_code">
|
||||
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<!-- Don't require camera, as this requires a rear camera. This allows it to work on the Nexus 7 -->
|
||||
<uses-feature android:name="android.hardware.camera" android:required="false" />
|
||||
<uses-feature android:name="android.hardware.camera.front" android:required="false" />
|
||||
<!-- TODO replace above two with next line after Android 4.2 -->
|
||||
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
|
||||
<uses-feature android:name="android.hardware.camera.flash" android:required="false" />
|
||||
<uses-feature android:name="android.hardware.screen.landscape" android:required="false" />
|
||||
<uses-feature android:name="android.hardware.wifi" android:required="false" />
|
||||
|
||||
<application>
|
||||
<!-- android:theme="@style/Theme.AppCompat.Light.NoActionBar" -->
|
||||
<activity android:name="uts.sdk.modules.xwqMlkitScanCode.MyMlkitScanActivity"></activity>
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"minSdkVersion": "21",
|
||||
"dependencies": [
|
||||
"com.google.mlkit:barcode-scanning:17.3.0",
|
||||
"androidx.camera:camera-core:1.4.0",
|
||||
"androidx.camera:camera-camera2:1.4.0",
|
||||
"androidx.camera:camera-lifecycle:1.4.0",
|
||||
"androidx.camera:camera-view:1.4.0",
|
||||
"androidx.appcompat:appcompat:1.4.1"
|
||||
]
|
||||
}
|
||||
|
After Width: | Height: | Size: 254 B |
|
After Width: | Height: | Size: 7.8 KiB |
|
After Width: | Height: | Size: 736 B |
|
After Width: | Height: | Size: 634 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 9.0 KiB |
|
After Width: | Height: | Size: 7.1 KiB |
|
After Width: | Height: | Size: 788 B |
|
After Width: | Height: | Size: 7.7 KiB |
@@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical"
|
||||
android:layout_width="match_parent" android:background="#000000" android:layout_height="match_parent">
|
||||
|
||||
<!-- <SurfaceView android:id="@+id/camera_wrap" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" android:layout_gravity="center_vertical">
|
||||
</SurfaceView> -->
|
||||
<androidx.camera.view.PreviewView android:id="@+id/camera_preview" android:layout_width="match_parent" android:layout_height="match_parent" >
|
||||
</androidx.camera.view.PreviewView>
|
||||
|
||||
<ImageView android:id="@+id/ivPic" android:layout_width="match_parent" android:layout_height="wrap_content" ></ImageView>
|
||||
|
||||
<RelativeLayout android:orientation="vertical" android:id="@+id/senter_box" android:layout_width="match_parent"
|
||||
android:layout_height="0dp" android:layout_weight="1" >
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout android:orientation="vertical" android:id="@+id/relative_layout" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout android:layout_width="match_parent" android:layout_height="match_parent"
|
||||
android:layout_gravity="top|bottom" android:orientation="vertical">
|
||||
<LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1"
|
||||
android:gravity="top" android:orientation="horizontal">
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent" android:layout_height="60dp" android:paddingLeft="32dp"
|
||||
android:orientation="vertical" android:gravity="center_vertical"
|
||||
android:background="@android:color/transparent" android:id="@+id/top_content">
|
||||
<ImageView android:id="@+id/header_back" android:layout_width="30dp" android:layout_height="30dp" android:src="@drawable/close"></ImageView>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1"
|
||||
android:gravity="bottom" android:orientation="horizontal">
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent" android:layout_height="100dp"
|
||||
android:orientation="horizontal" android:background="#80000000" android:gravity="center_horizontal|top"
|
||||
android:id="@+id/bottom_content">
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content" android:layout_height="match_parent"
|
||||
android:orientation="vertical" android:gravity="center_vertical|center_horizontal"
|
||||
android:layout_marginTop="15dp" android:layout_marginLeft="28dp"
|
||||
android:id="@+id/asml_wrap">
|
||||
<ImageView android:id="@+id/footer_asml" android:layout_width="40dp" android:layout_height="40dp" android:src="@drawable/photo_open"></ImageView>
|
||||
<TextView android:paddingTop="20px" android:id="@+id/text_asml" android:layout_width="wrap_content" android:textAlignment="center" android:layout_height="wrap_content" android:gravity="center"
|
||||
android:textColor="#ffffff" android:text="相册" android:textSize="15dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView android:id="@+id/footer_recognition" android:textAlignment="center" android:layout_width="wrap_content" android:layout_weight="1" android:layout_height="wrap_content"
|
||||
android:paddingTop="60px" android:textColor="#fff" android:text="正在识别,请稍后..." android:textSize="14dp" />
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content" android:layout_height="match_parent"
|
||||
android:orientation="vertical" android:gravity="center_vertical|center_horizontal"
|
||||
android:layout_marginTop="15dp" android:layout_marginRight="28dp"
|
||||
android:id="@+id/flashlight_wrap">
|
||||
<ImageView android:id="@+id/flashlight" android:layout_width="40dp" android:layout_height="40dp" android:src="@drawable/light_close"></ImageView>
|
||||
<TextView android:paddingTop="20px" android:id="@+id/text_flashlight" android:textAlignment="center" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center"
|
||||
android:textColor="#ffffff" android:text="灯光" android:textSize="15dp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
<uts.sdk.modules.xwqMlkitScanCode.ScanOverlay android:id="@+id/overlay" android:layout_width="wrap_content" android:layout_height="wrap_content" >
|
||||
</uts.sdk.modules.xwqMlkitScanCode.ScanOverlay>
|
||||
</FrameLayout>
|
||||
@@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical"
|
||||
android:layout_width="match_parent" android:background="#000000" android:layout_height="match_parent">
|
||||
|
||||
<androidx.camera.view.PreviewView android:id="@+id/camera_preview" android:layout_width="match_parent" android:layout_height="match_parent" >
|
||||
</androidx.camera.view.PreviewView>
|
||||
|
||||
<ImageView android:id="@+id/ivPic" android:layout_width="match_parent" android:layout_height="wrap_content" ></ImageView>
|
||||
|
||||
<RelativeLayout android:orientation="vertical" android:id="@+id/senter_box" android:layout_width="match_parent"
|
||||
android:layout_height="0dp" android:layout_weight="1" >
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout android:orientation="vertical" android:id="@+id/relative_layout" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout android:layout_width="match_parent" android:layout_height="match_parent"
|
||||
android:layout_gravity="top|bottom" android:orientation="vertical">
|
||||
<LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1"
|
||||
android:gravity="top" android:orientation="horizontal" android:layout_marginTop="20dp">
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent" android:layout_height="60dp" android:paddingLeft="32dp"
|
||||
android:paddingRight="32dp"
|
||||
android:orientation="horizontal" android:gravity="center_vertical"
|
||||
android:background="@android:color/transparent" android:id="@+id/top_content">
|
||||
<ImageView android:id="@+id/header_back" android:layout_width="35dp" android:layout_height="35dp" android:src="@drawable/close"></ImageView>
|
||||
<View android:layout_width="0dp" android:layout_height="0dp" android:layout_weight="1" />
|
||||
<ImageView android:id="@+id/footer_asml" android:layout_width="35dp" android:layout_height="35dp" android:src="@drawable/photo_open"></ImageView>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1"
|
||||
android:gravity="bottom" android:orientation="horizontal" android:layout_centerHorizontal="true">
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent" android:layout_height="50dp"
|
||||
android:orientation="vertical" android:background="#80000000" android:gravity="center"
|
||||
android:id="@+id/bottom_content">
|
||||
<TextView android:id="@+id/footer_recognition" android:textAlignment="center" android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:textColor="#fff" android:text="正在识别,请稍后..." android:textSize="14dp" android:layout_gravity="center" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:id="@+id/flashlight_wrap"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginBottom="150dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/flashlight"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:src="@drawable/flashlight_off" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_flashlight"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:paddingTop="20px"
|
||||
android:text="轻触点亮"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#ffffff"
|
||||
android:textSize="15dp" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
<uts.sdk.modules.xwqMlkitScanCode.ScanOverlay android:id="@+id/overlay" android:layout_width="wrap_content" android:layout_height="wrap_content" >
|
||||
</uts.sdk.modules.xwqMlkitScanCode.ScanOverlay>
|
||||
</FrameLayout>
|
||||
@@ -0,0 +1,77 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical"
|
||||
android:layout_width="match_parent" android:background="#000000" android:layout_height="match_parent">
|
||||
|
||||
<androidx.camera.view.PreviewView android:id="@+id/camera_preview" android:layout_width="match_parent" android:layout_height="match_parent" >
|
||||
</androidx.camera.view.PreviewView>
|
||||
|
||||
<ImageView android:id="@+id/ivPic" android:layout_width="match_parent" android:layout_height="wrap_content" ></ImageView>
|
||||
|
||||
<RelativeLayout android:orientation="vertical" android:id="@+id/senter_box" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent" android:layout_height="match_parent"
|
||||
android:orientation="vertical" android:gravity="center_vertical"
|
||||
android:background="#50000000" android:id="@+id/senter_box_bg">
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout android:orientation="vertical" android:id="@+id/relative_layout" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout android:layout_width="match_parent" android:layout_height="match_parent"
|
||||
android:layout_gravity="top|bottom" android:orientation="vertical">
|
||||
<LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1"
|
||||
android:gravity="top" android:orientation="horizontal" android:layout_marginTop="20dp">
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent" android:layout_height="60dp" android:paddingLeft="32dp"
|
||||
android:paddingRight="32dp"
|
||||
android:orientation="horizontal" android:gravity="center_vertical"
|
||||
android:background="@android:color/transparent" android:id="@+id/top_content">
|
||||
<ImageView android:id="@+id/header_back" android:layout_width="35dp" android:layout_height="35dp" android:src="@drawable/close"></ImageView>
|
||||
<View android:layout_width="0dp" android:layout_height="0dp" android:layout_weight="1" />
|
||||
<ImageView android:id="@+id/footer_asml" android:layout_width="35dp" android:layout_height="35dp" android:src="@drawable/photo_open"></ImageView>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1"
|
||||
android:gravity="bottom" android:orientation="horizontal" android:layout_centerHorizontal="true">
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent" android:layout_height="50dp"
|
||||
android:orientation="vertical" android:background="#80000000" android:gravity="center"
|
||||
android:id="@+id/bottom_content">
|
||||
<TextView android:id="@+id/footer_recognition" android:textAlignment="center" android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:textColor="#fff" android:text="正在识别,请稍后..." android:textSize="14dp" android:layout_gravity="center" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:id="@+id/flashlight_wrap"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginBottom="150dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/flashlight"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:src="@drawable/flashlight_off" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_flashlight"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:paddingTop="20px"
|
||||
android:text="轻触点亮"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#ffffff"
|
||||
android:textSize="15dp" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
<uts.sdk.modules.xwqMlkitScanCode.BoxView android:id="@+id/scan_box_wrap" android:layout_width="wrap_content" android:layout_height="wrap_content" >
|
||||
</uts.sdk.modules.xwqMlkitScanCode.BoxView>
|
||||
</FrameLayout>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#6200EE</color>
|
||||
<color name="colorPrimaryDark">#3700B3</color>
|
||||
<color name="colorAccent">#03DAC5</color>
|
||||
<color name="colorHeader">#83818D</color>
|
||||
<color name="colorWhite">#ffffff</color>
|
||||
<color name="colorBlack">#000000</color>
|
||||
</resources>
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"dependencies": {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"module": {
|
||||
"requestPermissions": [
|
||||
{
|
||||
"name": "ohos.permission.CAMERA",
|
||||
"reason": "$string:camera_reason"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"string": [
|
||||
{
|
||||
"name":"camera_reason",
|
||||
"value": "为了能正常使用相机扫码识别功能",
|
||||
"usedScene": {
|
||||
"abilities": ["EntryAbility"],
|
||||
"when": "inuse"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>NSPhotoLibraryUsageDescription</key>
|
||||
<string>我们需要您的同意来访问相册,以便您可以选择图片。</string>
|
||||
<key>NSCameraUsageDescription</key>
|
||||
<string>我们需要您的同意来使用相机扫描图像</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
After Width: | Height: | Size: 254 B |
|
After Width: | Height: | Size: 7.8 KiB |
|
After Width: | Height: | Size: 736 B |
|
After Width: | Height: | Size: 634 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 9.0 KiB |
|
After Width: | Height: | Size: 7.1 KiB |
|
After Width: | Height: | Size: 788 B |
|
After Width: | Height: | Size: 7.7 KiB |
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"deploymentTarget": "15.5",
|
||||
"dependencies-pods": [{
|
||||
"name": "GoogleMLKit",
|
||||
"version": "7.0.0"
|
||||
},
|
||||
{
|
||||
"name": "MLKitBarcodeScanning",
|
||||
"version": "6.0.0"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -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>
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
|
||||
|
||||
export function openCamera(paramas) {
|
||||
console.log('******************插件不支持WEB平台!********************')
|
||||
}
|
||||