Files
test/uni_modules/xtf-qrcode/utssdk/app-ios/index.uts
T
2026-03-11 09:44:18 +08:00

40 lines
785 B
Plaintext

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)
}
}