ios 拍照完成

This commit is contained in:
xsl
2026-03-11 10:46:45 +08:00
parent eeebb2070e
commit 8249992bd3
62 changed files with 98 additions and 1947 deletions
+14
View File
@@ -0,0 +1,14 @@
{
"version" : "1.0",
"configurations" : [
{
"playground" : "standard",
"type" : "uni-app:app-ios_simulator"
},
{
"customPlaygroundType" : "device",
"playground" : "standard",
"type" : "uni-app:app-ios"
}
]
}
+84 -52
View File
@@ -1,52 +1,84 @@
<template> <template>
<view> <view class="container">
<image class="logo" :src="img"></image> <text class="title">UniApp X 拍照测试</text>
</view> <image v-if="imageUrl" :src="imageUrl" mode="aspectFit" class="preview-image"></image>
</template>
<button @click="takePhoto" type="primary">打开摄像头拍照</button>
<script>
import {QrOpt,getQrData} from "@/uni_modules/xtf-qrcode" <text v-if="errorMsg" class="error-text">{{ errorMsg }}</text>
export default { </view>
data() { </template>
return {
title: 'Hello', <script lang="uts">
img:"", export default {
} data() {
}, return {
onLoad() { imageUrl: '' as string,
console.log("QrOpt") errorMsg: '' as string
var that=this; }
getQrData({ },
content:"xtf", methods: {
logo:"/static/logo.png", takePhoto() {
logoW:80, uni.chooseImage({
logoH:80, count: 1,
qrSize:300, sizeType: ['compressed'],
callback:function(data:string){ sourceType: ['camera'], // 只从相机选择
that.img=data; success: (res) => {
} console.log('拍照成功:', res);
if (res.tempFilePaths && res.tempFilePaths.length > 0) {
} as QrOpt); this.imageUrl = res.tempFilePaths[0];
//console.log(this.img) this.errorMsg = '';
}
}, },
methods: { fail: (err) => {
console.error('拍照失败:', err);
} this.errorMsg = '拍照失败: ' + (err.errMsg || '未知错误');
}
</script> // 权限被拒绝时引导用户去设置
if (err.errMsg && err.errMsg.includes('permission')) {
<style> uni.showModal({
.logo { title: '权限提示',
height: 300px; content: '您已拒绝摄像头权限,请在设置中开启',
width: 300px; confirmText: '去设置',
margin: 100px auto 25px auto; success: (res) => {
} if (res.confirm) {
uni.openSetting();
.title { }
font-size: 18px; }
color: #8f8f94; });
text-align: center; }
} }
</style> });
}
}
}
</script>
<style>
.container {
display: flex;
flex-direction: column;
align-items: center;
padding: 40px 20px;
}
.title {
font-size: 36px;
font-weight: bold;
margin-bottom: 40px;
}
.preview-image {
width: 500px;
height: 500px;
margin: 20px 0;
border: 2px solid #ddd;
border-radius: 10px;
}
.error-text {
color: #ff0000;
margin-top: 20px;
}
</style>
Binary file not shown.
-6
View File
@@ -1,6 +0,0 @@
## 1.0.22025-03-04
优化
## 1.0.12025-02-10
初始化
## 1.0.02025-02-10
初始化
-91
View File
@@ -1,91 +0,0 @@
{
"id": "xtf-qrcode",
"displayName": "二维码生成 qrcode uts ",
"version": "1.0.2",
"description": "android/ios/web 通过平台sdk 生成二维码返回base64格式数据,可自行设置显示,动态二维码",
"keywords": [
"二维码",
"生成二维码",
"动态二维码",
"二维码生成",
"qrcode"
],
"repository": "",
"engines": {
"HBuilderX": "^3.6.8"
},
"dcloudext": {
"type": "uts",
"sale": {
"regular": {
"price": "1.99"
},
"sourcecode": {
"price": "10.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "无",
"data": "无",
"permissions": "无"
},
"npmurl": ""
},
"uni_modules": {
"dependencies": [],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "y",
"aliyun": "y",
"alipay": "y"
},
"client": {
"Vue": {
"vue2": "y",
"vue3": "y"
},
"App": {
"app-android": "y",
"app-ios": "y",
"app-harmony": "n"
},
"H5-mobile": {
"Safari": "y",
"Android Browser": "y",
"微信浏览器(Android)": "y",
"QQ浏览器(Android)": "y"
},
"H5-pc": {
"Chrome": "y",
"IE": "y",
"Edge": "y",
"Firefox": "y",
"Safari": "y"
},
"小程序": {
"微信": "n",
"阿里": "u",
"百度": "u",
"字节跳动": "u",
"QQ": "u",
"钉钉": "u",
"快手": "u",
"飞书": "u",
"京东": "u"
},
"快应用": {
"华为": "u",
"联盟": "u"
}
}
}
},
"dependencies": {
"qrcode": "^1.5.4",
"weapp-qrcode": "^1.0.0"
}
}
-43
View File
@@ -1,43 +0,0 @@
# xtf-qrcode
#### 若web 端报错,可用解压插件目录web.zip覆盖web文件夹文件
### uniappx
```
import {QrOpt,getQrData} from "@/uni_modules/xtf-qrcode"
getQrData({
content:"xtf",
logo:"/static/logo.png",
logoW:80,
logoH:80,
qrSize:300,
callback:function(data:string){
// that.img=data;
//data 为base64图片
}
} as QrOpt);
```
### uniapp
```
import {getQrData} from "@/uni_modules/xtf-qrcode"
getQrData({
content:"xtf",
logo:"/static/logo.png",
logoW:80,
logoH:80,
qrSize:300,
callback:function(data:string){
// that.img=data;
//data 为base64图片
}
});
```
二维码logo 宽高 建议为二维码大小的1/5 左右
### 开发文档
[UTS 语法](https://uniapp.dcloud.net.cn/tutorial/syntax-uts.html)
[UTS API插件](https://uniapp.dcloud.net.cn/plugin/uts-plugin.html)
[UTS uni-app兼容模式组件](https://uniapp.dcloud.net.cn/plugin/uts-component.html)
[UTS 标准模式组件](https://doc.dcloud.net.cn/uni-app-x/plugin/uts-vue-component.html)
[Hello UTS](https://gitcode.net/dcloud/hello-uts)
Binary file not shown.
@@ -1,171 +0,0 @@
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.pdf.PdfRenderer;
import android.os.ParcelFileDescriptor;
import android.text.TextUtils;
import android.util.Log;
import android.util.Base64;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.BinaryBitmap;
import com.google.zxing.ChecksumException;
import com.google.zxing.EncodeHintType;
import com.google.zxing.FormatException;
import com.google.zxing.MultiFormatWriter;
import com.google.zxing.NotFoundException;
import com.google.zxing.RGBLuminanceSource;
import com.google.zxing.Result;
import com.google.zxing.WriterException;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.common.CharacterSetECI;
import com.google.zxing.common.HybridBinarizer;
import com.google.zxing.pdf417.PDF417Writer;
import com.google.zxing.pdf417.encoder.Compaction;
import com.google.zxing.pdf417.encoder.Dimensions;
import com.google.zxing.pdf417.encoder.PDF417;
import com.google.zxing.qrcode.QRCodeReader;
import com.google.zxing.qrcode.QRCodeWriter;
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;
/**
* 二维码生成工具类
*/
public class QRCodeGenerator {
private static final String TAG = "ZxingUtil";
/**
* 在二维码中间添加Logo图案
*/
private static Bitmap addLogo(Bitmap src,int logoW,int logoH, Bitmap logo) {
if (src == null) {
return null;
}
if (logo == null) {
return src;
}
logo=resizeBitmap(logo,logoW,logoH);
// 获取图片的宽高
int srcWidth = src.getWidth();
int srcHeight = src.getHeight();
int logoWidth = logo.getWidth();
int logoHeight = logo.getHeight();
if (srcWidth == 0 || srcHeight == 0) {
return null;
}
if (logoWidth == 0 || logoHeight == 0) {
return src;
}
// logo大小为二维码整体大小的1/5
// float scaleFactor = srcWidth * 1.0f / 5 / logoWidth;
Bitmap bitmap = Bitmap.createBitmap(srcWidth, srcHeight,
Bitmap.Config.ARGB_8888);
try {
Canvas canvas = new Canvas(bitmap);
canvas.drawBitmap(src, 0, 0, null);
// canvas.scale(scaleFactor, scaleFactor, srcWidth / 2, srcHeight / 2);
canvas.drawBitmap(logo, (srcWidth - logoWidth) / 2,
(srcHeight - logoHeight) / 2, null);
canvas.save();
canvas.restore();
} catch (Exception e) {
bitmap = null;
e.getStackTrace();
}
return bitmap;
}
public static Bitmap generateQRCodeWithLogo(String content, int widthPix,
int heightPix,int logoW,int logoH, Bitmap logoBm) {
if (content == null || "".equals(content)) {
return null;
}
Bitmap bitmap = null;
// 配置参数
Map<EncodeHintType, Object> hints = new HashMap<EncodeHintType, Object>();
hints.put(EncodeHintType.CHARACTER_SET, "utf-8");
// 容错级别
hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);
// 设置空白边距的宽度
hints.put(EncodeHintType.MARGIN, 0); //default is 4
// 图像数据转换,使用了矩阵转换
BitMatrix bitMatrix;
try {
bitMatrix = new QRCodeWriter().encode(content,
BarcodeFormat.QR_CODE, widthPix, heightPix, hints);
int[] pixels = new int[widthPix * heightPix];
// 下面这里按照二维码的算法,逐个生成二维码的图片,
// 两个for循环是图片横列扫描的结果
for (int y = 0; y < heightPix; y++) {
for (int x = 0; x < widthPix; x++) {
if (bitMatrix.get(x, y)) {
pixels[y * widthPix + x] = 0xff000000;
} else {
pixels[y * widthPix + x] = 0xffffffff;
}
}
}
// 生成二维码图片的格式,使用ARGB_8888
bitmap = Bitmap.createBitmap(widthPix, heightPix,
Bitmap.Config.ARGB_8888);
bitmap.setPixels(pixels, 0, widthPix, 0, 0, widthPix, heightPix);
if (logoBm != null) {
bitmap = addLogo(bitmap, logoW,logoH,logoBm);
}
// if(!TextUtils.isEmpty(filePath)){
// bitmap.compress(Bitmap.CompressFormat.JPEG, 100,
// new FileOutputStream(filePath));}
} catch (WriterException e) {
//
e.printStackTrace();
}
return bitmap;
}
public static Bitmap resizeBitmap(Bitmap originalBitmap, int newWidth, int newHeight) {
// 创建一个新的Bitmap对象,指定缩放后的宽度、高度和配置(这里使用与原Bitmap相同的配置)
Bitmap resizedBitmap = Bitmap.createScaledBitmap(originalBitmap, newWidth, newHeight, true);
return resizedBitmap;
}
public static String convert(Bitmap bitmap) {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
// 压缩Bitmap到字节数组中,格式为PNG,质量为100%
bitmap.compress(Bitmap.CompressFormat.PNG, 100, byteArrayOutputStream);
byte[] byteArray = byteArrayOutputStream.toByteArray();
// 将字节数组编码为Base64字符串
String encoded = Base64.encodeToString(byteArray, Base64.DEFAULT);
return encoded;
}
}
@@ -1,7 +0,0 @@
public class Test{
public static String test(){
return "xtf";
}
}
@@ -1,7 +0,0 @@
{
"minSdkVersion": "19",
"dependencies": [
"com.google.zxing:core:3.4.1",
"com.journeyapps:zxing-android-embedded:4.3.0"
]
}
@@ -1,45 +0,0 @@
import BitmapFactory from 'android.graphics.BitmapFactory';
export type QrOpt = {
content:string,
logo?:string,
qrSize?:number,
logoW?:number,
logoH?:number,
marign?:number,
callback:(data:string)=>void
}
export function getQrData (opt:QrOpt):void{
if(opt.qrSize==null){
opt.qrSize=300;
}
console.log("--------------")
if(opt.logo==null){
opt.callback("data:image/jpg;base64,"+QRCodeGenerator.convert(QRCodeGenerator.generateQRCodeWithLogo(opt.content,opt.qrSize!.toInt(),opt.qrSize!.toInt(),(0).toInt(),(0).toInt(),null)));
}else{
try{
var logo= UTSAndroid.getResourcePath(opt.logo!);
if(opt.logoW==null){
opt.logoW=50;
}
if(opt.logoH==null){
opt.logoW=50;
}
var bitmap= BitmapFactory.decodeFile(logo);
opt.callback("data:image/jpg;base64,"+QRCodeGenerator.convert(QRCodeGenerator.generateQRCodeWithLogo(opt.content,opt.qrSize!.toInt(),opt.qrSize!.toInt(),opt.logoW!.toInt(),opt.logoH!.toInt(),bitmap)));
}catch(e:Exception){
opt.callback("data:image/jpg;base64,"+QRCodeGenerator.convert(QRCodeGenerator.generateQRCodeWithLogo(opt.content,opt.qrSize!.toInt(),opt.qrSize!.toInt(),(0).toInt(),(0).toInt(),null)));
}
}
}
@@ -1,7 +0,0 @@
{
"deploymentTarget": "12"
// implementation 'com.google.zxing:core:3.4.1'
// implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
}
@@ -1,40 +0,0 @@
export type QrOpt = {
content:string,
logo?:string,
qrSize?:number,
logoW?:number,
logoH?:number,
marign?:number,
callback:(data:string)=>void
}
export function getQrData (opt:QrOpt):void{
console.log(opt.content)
if(opt.qrSize==null){
opt.qrSize=300;
}
if(opt.logo==null){
var b=QR.createQrCode(opt.content,opt.qrSize!.toInt());
console.log(b);
opt.callback("data:image/jpg;base64,"+b)
//return "data:image/jpg;base64,"+b;
}else{
var l=UTSiOS.getResourcePath(opt.logo!)
if(opt.logoW==null){
opt.logoW=50;
}
if(opt.logoH==null){
opt.logoH=50;
}
var b=QR.createQrCodeWithLogo(opt.content,opt.qrSize!.toInt(),l,opt.logoW!.toInt(),opt.logoH!.toInt());
console.log(b);
opt.callback("data:image/jpg;base64,"+b)
}
}
@@ -1,92 +0,0 @@
import CoreImage
import UIKit
import Foundation
import SwiftUICore
public class QR{
static func imageToBase64(_ image: UIImage) -> String {
if let imageData = image.jpegData(compressionQuality: 1.0) {
// 使imageData
let base64String = imageData.base64EncodedString(options: [])
return base64String
}
return "";
}
static func createQrCode(_ data:String,_ size:Int)->String{
// 使
var b:CGFloat=CGFloat(size);
guard let qrCodeImage = QR.generateQRCode(with:data, qrSize: b)
else{
return "";
}
let q = QR.imageToBase64(qrCodeImage)
return q
}
static func createQrCodeWithLogo(_ data:String,_ size:Int,_ logo: String,_ logoW:Int,_ logoH:Int)->String{
// 使
var b:CGFloat=CGFloat(size);
var w:CGFloat=CGFloat(logoW);
var h:CGFloat=CGFloat(logoH);
var logoSize:CGSize=CGSize(width: w, height: h)
guard let qrCodeImage = QR.generateQRCode(with:data,logoName:logo, logoSize:logoSize, qrSize: b)
else{
return "";
}
let q = QR.imageToBase64(qrCodeImage)
return q
}
// logo
static func generateQRCode(with content: String, logoName: String? = nil, logoSize: CGSize = CGSize(width: 50, height: 50), qrSize: CGFloat = 200) -> UIImage? {
// 1.
guard let qrFilter = CIFilter(name: "CIQRCodeGenerator") else { return nil }
let data = content.data(using: .utf8)
qrFilter.setValue(data, forKey: "inputMessage")
qrFilter.setValue("H", forKey: "inputCorrectionLevel") //
guard let qrImage = qrFilter.outputImage else { return nil }
// 2.
let scaleTransform = CGAffineTransform(scaleX: qrSize / qrImage.extent.size.width, y: qrSize / qrImage.extent.size.height)
let scaledQrImage = qrImage.transformed(by: scaleTransform)
// 3. UIImage
guard let qrUIImage:UIImage? = UIImage(ciImage: scaledQrImage) else { return nil }
// if let image: UIImage? = someFunctionThatReturnsUIImage() {
// // image
// } else {
// // imagenil
// }
// 4. logo
if let logoName = logoName, let logoImage = UIImage(named: logoName) {
let logoFrame = CGRect(x: (qrUIImage!.size.width - logoSize.width) / 2,
y: (qrUIImage!.size.height - logoSize.height) / 2,
width: logoSize.width,
height: logoSize.height)
UIGraphicsBeginImageContextWithOptions(qrUIImage!.size, false, 0.0)
qrUIImage?.draw(in: CGRect(origin: .zero, size: qrUIImage!.size))
logoImage.draw(in: logoFrame)
let finalImage = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return finalImage
}
// logo
return qrUIImage
}
}
@@ -1,47 +0,0 @@
/**
* interface.uts
* uts插件接口定义文件,按规范定义接口文件可以在HBuilderX中更好的做到语法提示
*/
/**
* myApi 异步函数的参数,在type里定义函数需要的参数以及api成功、失败的相关回调函数。
*/
export type MyApiOptions = {
paramA : boolean
success ?: (res : MyApiResult) => void
fail ?: (res : MyApiFail) => void
complete ?: (res : any) => void
}
/**
* 函数返回结果
* 可以是void, 基本数据类型,自定义type, 或者其他类型。
* [可选实现]
*/
export type MyApiResult = {
fieldA : number,
fieldB : boolean,
fieldC : string
}
/**
* 错误码
* 根据uni错误码规范要求,建议错误码以90开头,以下是错误码示例:
* - 9010001 错误信息1
* - 9010002 错误信息2
*/
export type MyApiErrorCode = 9010001 | 9010002;
/**
* myApi 的错误回调参数
*/
export interface MyApiFail extends IUniError {
errCode : MyApiErrorCode
};
/* 异步函数定义 */
export type MyApi = (options : MyApiOptions) => void
/* 同步函数定义 */
export type MyApiSync = (paramA : boolean) => MyApiResult
@@ -1,39 +0,0 @@
/* 此规范为 uni 规范,可以按照自己的需要选择是否实现 */
import { MyApiErrorCode, MyApiFail } from "./interface.uts"
/**
* 错误主题
* 注意:错误主题一般为插件名称,每个组件不同,需要使用时请更改。
* [可选实现]
*/
export const UniErrorSubject = 'uts-api';
/**
* 错误信息
* @UniError
* [可选实现]
*/
export const MyAPIErrors : Map<MyApiErrorCode, string> = new Map([
/**
* 错误码及对应的错误信息
*/
[9010001, 'custom error mseeage1'],
[9010002, 'custom error mseeage2'],
]);
/**
* 错误对象实现
*/
export class MyApiFailImpl extends UniError implements MyApiFail {
/**
* 错误对象构造函数
*/
constructor(errCode : MyApiErrorCode) {
super();
this.errSubject = UniErrorSubject;
this.errCode = errCode;
this.errMsg = MyAPIErrors.get(errCode) ?? "";
}
}
Binary file not shown.
@@ -1,97 +0,0 @@
import { QRCode } from './qrcode.min.js';
export type QrOpt = {
content:string,
logo?:string,
qrSize?:number,
logoW?:number,
logoH?:number,
marign?:number,
callback:(data:string)=>void
}
export const getQrData = async function (opt:QrOpt){
console.log(opt.content)
if(opt.qrSize==null){
opt.qrSize=300;
}
if(opt.marign==null){
opt.marign=1;
}
// 要生成的二维码内容
// var qrContent = "https://www.example.com";
//使用QRCode.toDataURL()方法生成base64字符串
// QRCode.toDataURL(opt.content, {
// //errorCorrectionLevel: QRCode.CorrectLevel.H, // 容错级别
// margin: 1, // 边距
// width: opt.qrSize!, // 二维码宽度
// height: opt.qrSize!, // 二维码高度
// color: {
// dark: "#000000", // 前景色(二维码颜色)
// light: "#ffffff" // 背景色(空白区域颜色)
// }
// }).then(function(base64) {
// // 在这里,base64是包含二维码图片的base64字符串
// // console.log(base64);
// opt.callback(base64);
// // return base64;
// // 你可以将base64字符串设置为img元素的src属性来显示二维码
// // var img = document.createElement('img');
// // img.src = base64;
// // document.body.appendChild(img);
// // 你也可以将base64字符串用于其他目的,比如下载或传输
// }).catch(function(error) {
// console.error("生成二维码时出错:", error);
// });
//return "";
const qrcodeCanvas = document.createElement('canvas');
qrcodeCanvas.width = opt.qrSize!;
qrcodeCanvas.height = opt.qrSize!;
// 使用QRCode对象生成二维码
await QRCode.toCanvas(qrcodeCanvas, opt.content, { width: opt.qrSize!,height: opt.qrSize!,margin: opt.marign!}, (error) => {
if (error) console.error(error);
});
if(opt.logo==null){
opt.callback(qrcodeCanvas.toDataURL('image/png'))
return;
}
// 获取logo图片
const logoImage = new Image();
logoImage.src = opt.logo!; // 替换为你的logo图片路径
logoImage.onload = () => {
// 创建一个用于合成带有logo的二维码的canvas元素
const logoQRCodeCanvas = document.createElement('canvas');
logoQRCodeCanvas.width = qrcodeCanvas.width;
logoQRCodeCanvas.height = qrcodeCanvas.height;
const ctx = logoQRCodeCanvas.getContext('2d');
// 将基本的二维码绘制到新的canvas上
ctx.drawImage(qrcodeCanvas, 0, 0);
// 计算logo的大小和位置
const logoSize = opt.logoW!; // logo的显示大小
const logoX = (logoQRCodeCanvas.width - opt.logoW!) / 2;
const logoY = (logoQRCodeCanvas.height - opt.logoH!) / 2;
// 在二维码上绘制logo
ctx.drawImage(logoImage, logoX, logoY, logoSize, opt.logoH);
// 将带有logo的二维码canvas转换为base64图片
const base64Image = logoQRCodeCanvas.toDataURL('image/png');
// 将base64图片存储到组件的数据中
// this.qrcodeWithLogo = base64Image;
opt.callback(base64Image)
};
}
File diff suppressed because one or more lines are too long
@@ -1,252 +0,0 @@
## 1.15.02026-03-08
补充文档说明
## 1.14.92026-01-27
* 识别结果回调参数增加识别码类型字段scanCodeType返回
## 1.14.82026-01-21
* 更新安卓端部分依赖版本到1.4,解决上架Google商店要求16k导致上架失败的问题
## 1.14.72026-01-13
* 优化IOS端关闭扫码页逻辑
## 1.14.62026-01-12
* iOS端识别不到二维码Toast弹窗支持根据内容自适应
## 1.14.52026-01-12
* 相册图片识别-增加自定义未识别到二维码提示内容
## 1.14.42026-01-04
* IOS端支持配置直接返回数据(包括多个码结果)
## 1.14.32025-12-31
* 安卓端支持配置直接返回数据(包括多个码结果)
## 1.14.22025-12-30
* IOS端调整对焦模式为优先自动对焦
* 已知问题优化
## 1.14.12025-12-22
* 修复uniapp项目云打包报错的问题
## 1.14.02025-12-21
### 重要更新
* 将参数中的扫码格式设置类型由number调整为string,为了更灵活的配置多种格式扫码
* 连续扫码场景支持间隔时间动态控制,参照用例
* 连续扫码场景增加暂停扫码控制,适配更多的业务场景
* 安卓端修复在连续扫码中可能出现回调两次的问题
## 1.13.12025-12-19
* 消除控制台报解析器已关闭的错误
* 补充文档说明
## 1.13.02025-12-18
* 苹果端针对iPhone15及以上机型,需要近距离扫码特定场景增加参数配置
## 1.12.92025-12-17
* 修复IOS端偶发性回调两次的问题
* IOS端增加对页面多次调用的拦截操作
## 1.12.82025-12-17
* 修复安卓端相册识别后数据类型转换错误的问题
## 1.12.72025-12-17
* IOS端补充product类型条码的返回字段,与安卓保持一致
## 1.12.62025-12-17
* 修复部分条码返回值不准确的问题
## 1.12.52025-12-15
* 移除安卓端的调试信息
## 1.12.42025-12-15
* 安卓端修复计算值丢失精度的问题
## 1.12.32025-12-15
* 适配小米澎湃系统识别多码时预览图不全屏问题
## 1.12.22025-12-15
* 针对安卓小米机型调试
## 1.12.12025-12-15
* 适配安卓小米澎湃系统某些机型识别到多个二维码,预览图没有覆盖屏幕的问题
## 1.12.02025-12-15
* 针对安卓小米澎湃系统调试
## 1.11.92025-12-15
* 增加调试信息
## 1.11.82025-12-15
* 安卓端针对小米机型调试
## 1.11.72025-12-14
* 增加调试log
## 1.11.62025-12-14
* 安卓端优化识别到多个二维码结果,预览图没有铺满屏幕的情况
* 增加识别到多个二维码结果,底部提示文案的内容、颜色、字号大小自定义配置
## 1.11.52025-12-10
* 针对iPhone15优化测试
## 1.11.42025-12-09
* 安卓端优化中间区域扫码模式,四拐角样式绘制适配屏幕大小
## 1.11.32025-12-09
* 修复IOS端云打包错误的问题
## 1.11.22025-12-09
* IOS端增加log打印测试
## 1.11.12025-12-08
* IOS端增加超广角对焦模式触发主动对焦处理
* 安卓端优化多码识别结果标记处理
## 1.11.02025-12-06
* 修改安卓端扫码模式默认为全屏模式
## 1.10.92025-12-04
* IOS端优化,解决某些机型识别成功后扫码页面未完全关闭的问题
## 1.10.82025-12-04
* 修复安卓端聚焦模糊的问题
* 优化安卓端条码的识别效率
## 1.10.72025-11-26
* 安卓端sdk支持最低版本改为默认为21
## 1.10.62025-11-26
* 安卓端增加多点自动对焦,提升识别效率
## 1.10.52025-11-24
* 优化安卓端单码识别速度
* IOS端新增侧滑关闭扫码页功能
## 1.10.42025-11-23
* 优化IOS端多码识别
## 1.10.32025-11-21
* 补充鸿蒙端字段声明
## 1.10.22025-11-18
* 优化iOS端近距离扫码
## 1.10.12025-11-18
* IOS端增加log信息打印
## 1.10.02025-11-17
* 修复安卓端相册二维码识别问题
## 1.9.92025-11-15
* 优化IOS端多码识别
## 1.9.82025-11-15
* 优化IOS端近距离无法识别条码的问题
* IOS端新增scanbox高度自定义配置
## 1.9.72025-11-13
* 安卓端支持设置scanbox模式扫码框的高度自定义配置
## 1.9.62025-11-12
* 完善IOS端scanbox模式扫码逻辑
## 1.9.52025-11-11
* 补充IOS端scanbox扫码模式UI
## 1.9.42025-11-11
* 优化入参处理逻辑
* 补充中间扫码模式文档说明
## 1.9.32025-11-08
* IOS端支持扫码格式设置
* IOS端细节优化
## 1.9.22025-11-08
* 细节优化
## 1.9.12025-10-26
* 兼容鸿蒙端扫码
* 注意:鸿蒙使用的是官方默认扫码界面,不能自定义界面内容,只能单码识别,不支持连续扫码
## 1.9.02025-10-25
* 增加连续扫码场景,toast提示内容自定义配置
## 1.8.92025-10-24
*升级安卓谷歌扫码依赖到17.3.0版本
*最低支持版本提到26
## 1.8.82025-09-24
IOS端补充主动关闭扫码页面的方法
## 1.8.72025-09-23
修复uniapp项目打包失败的问题
## 1.8.62025-09-22
优化主动关闭扫码页方法判断,兼容uniapp端V2项目
## 1.8.52025-09-19
安卓端增加主动关闭扫码页的方法
## 1.8.42025-09-19
移除无用代码
## 1.8.32025-09-18
调整web目录文件后缀
## 1.8.22025-09-18
新增web平台目录
## 1.8.12025-08-06
更新安卓端依赖到最新版本
## 1.8.02025-05-24
安卓端
fix: 修复由1.7.9版本引起的识别多个二维码后,左上角叉不能关闭的bug
Feat-重要更新: 1. 安卓新增跟随IOS界面样式配置选项
2. 新增二维码识别中自动缩放相机功能配置
## 1.7.92025-05-22
修复安卓端灯光切换的需要点两次的bug
## 1.7.82025-05-22
重要:安卓端支持手动聚焦缩放功能
## 1.7.72025-05-21
调整灯光文案自定义字段,由原来的一个变为两个,可参考用例
## 1.7.62025-05-21
适配新的二维码制式
## 1.7.52025-05-13
移除无用代码
## 1.7.42025-05-10
feat(重要):IOS端增加手动对焦、自动曝光功能
## 1.7.32025-04-29
调整文案宽度自适应
## 1.7.22025-04-28
适配文案动态修改
## 1.7.12025-04-28
增加相册、手电筒文案自定义
## 1.7.02025-04-23
1.IOS端增加灯光功能
2.适配灯光功能动态配置
## 1.6.52025-04-22
修复关闭扫码页,顶部出现扫描线条的bug
## 1.6.42025-04-22
1.IOS端增加相册入口动态配置
2.IOS端在连续扫码情况下,增加toast提示配置
## 1.6.32025-04-21
1.修复IOS无法关闭页面的bug
2.IOS端增加底部文案动态配置
## 1.6.22025-04-21
修复IOS关闭扫码页失败的问题
## 1.6.12025-04-21
平板设备增加打印信息
## 1.6.02025-04-21
安卓 端增加测试log打印
## 1.5.92025-04-21
IOS端增加识别成功音效
## 1.5.82025-04-20
重要:IOS端增加多码识别
## 1.5.72025-04-13
1、增加用户取消扫码回调方法
2、移除平台目录下的类型声明,统一使用interface文件,升级后需注意调整代码
## 1.5.62025-04-10
IOS端修复草料二维码识别失败的问题
## 1.5.52025-03-22
iOS端启动扫码预览逻辑优化
## 1.5.42025-03-15
ios更新:增加相册二维码识别
## 1.5.32025-03-14
开启源码授权
## 1.5.22025-02-27
ios端增加连续扫码
## 1.5.12025-02-25
修复iOS扫码窗口关闭,返回按钮未移除的问题
## 1.5.02025-02-24
增加iOS端的支持
## 1.4.02025-02-19
增加连续扫码识别成功toast提示
## 1.3.92025-02-11
修复识别多个二维码成功后,摄像头预览未正常关闭的问题
## 1.3.82025-01-14
适配邮件二维码识别
## 1.3.72025-01-10
增加ISBN二维码识别
## 1.3.62024-12-30
开启摄像头信息打印
## 1.3.52024-12-18
细节优化
## 1.3.42024-12-17
增加相册、灯光显示动态控制
## 1.3.32024-12-17
针对不同机型优化摄像头打开模式
## 1.3.22024-12-16
增加前后摄像头切换功能
## 1.3.12024-12-16
解决开启连续扫码,回调函数只触发一次的问题
## 1.32024-12-14
增加连续扫码参数配置
## 1.2.52024-10-28
移除无用代码
## 1.2.42024-10-28
修复由工具4.31版本引起的颜色设置失效问题,注意:调整了多色的传值类型,可参照下列文档说明
## 1.2.32024-10-27
修复工具4.31引起的OptionType未引入的错误
## 1.2.22024-10-25
移除调试代码
## 1.2.12024-10-25
优化图像解析分辨率逻辑
## 1.2.02024-10-19
1.优化识别到二维码标记的UI样式
2.增加超时未识别到二维码回调error函数
3.二维码解析细节优化
## 1.1.12024-10-07
增加物料二维码内容正常读取返回
## 1.1.02024-09-29
适配uniapp项目扫码
## 1.0.32024-08-13
更新使用文档
## 1.0.22024-08-13
优化
## 1.0.12024-04-18
1.增加返回参数类型
2.修改返回值的格式
## 1.0.02024-04-10
初始化
-1
View File
@@ -1 +0,0 @@
¯^ ³<Ì¥ƒH1D@¥E^Ÿ*sÙ žèNˆû"T¸>üin%Ø%nz*Ÿ·À­íJe›”(¥JKÂÈ[Ôc%ù[xBZqϧ¹o[¶³¸Ko“>;É
@@ -1,120 +0,0 @@
{
"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": "-"
}
}
}
}
}
}
-373
View File
@@ -1,373 +0,0 @@
# 插件使用说明文档
<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)
@@ -1,20 +0,0 @@
<?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>
@@ -1,11 +0,0 @@
{
"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"
]
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 254 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 736 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 634 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 788 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

@@ -1,65 +0,0 @@
<?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>
@@ -1,73 +0,0 @@
<?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>
@@ -1,77 +0,0 @@
<?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>
@@ -1,9 +0,0 @@
<?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>
@@ -1,4 +0,0 @@
{
"dependencies": {
}
}
@@ -1,10 +0,0 @@
{
"module": {
"requestPermissions": [
{
"name": "ohos.permission.CAMERA",
"reason": "$string:camera_reason"
}
]
}
}
@@ -1,12 +0,0 @@
{
"string": [
{
"name":"camera_reason",
"value": "为了能正常使用相机扫码识别功能",
"usedScene": {
"abilities": ["EntryAbility"],
"when": "inuse"
}
}
]
}
@@ -1,10 +0,0 @@
<?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>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 254 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 736 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 634 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 788 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

@@ -1,12 +0,0 @@
{
"deploymentTarget": "15.5",
"dependencies-pods": [{
"name": "GoogleMLKit",
"version": "7.0.0"
},
{
"name": "MLKitBarcodeScanning",
"version": "6.0.0"
}
]
}
@@ -1,137 +0,0 @@
/**
* 扫码支持的类型
* 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>
}
@@ -1,6 +0,0 @@
export function openCamera(paramas) {
console.log('******************插件不支持WEB平台!********************')
}