去掉打印

This commit is contained in:
Wang Kejun 2023-02-19 22:06:17 +08:00
parent 4c836ba649
commit 3a00ccad61
2 changed files with 18 additions and 20 deletions

View File

@ -41,7 +41,6 @@ exports.default = OakComponent({
var userEntityGrant = _a.data;
var qrCodeUrl = (_b = userEntityGrant === null || userEntityGrant === void 0 ? void 0 : userEntityGrant.wechatQrCode$entity[0]) === null || _b === void 0 ? void 0 : _b.url;
var buffer = (_c = userEntityGrant === null || userEntityGrant === void 0 ? void 0 : userEntityGrant.wechatQrCode$entity[0]) === null || _c === void 0 ? void 0 : _c.buffer;
console.log(userEntityGrant);
if (buffer) {
var newBuffer = new ArrayBuffer(buffer.length * 2);
var newBufferToUint16 = new Uint16Array(newBuffer);
@ -53,15 +52,15 @@ exports.default = OakComponent({
qrCodeUrl = 'data:image/png;base64,' + base64Str;
}
else {
// let binary = '';
// const bytes = new Uint8Array(newBufferToUint16);
// const len = bytes.byteLength;
// for (let i = 0; i < len; i++) {
// binary += String.fromCharCode(bytes[i]);
// }
// const base64Str = window.btoa(binary);
var buffer2 = Buffer.from(newBufferToUint16, 'base64');
var base64Str = buffer2.toString('base64');
let binary = '';
const bytes = new Uint8Array(newBufferToUint16);
const len = bytes.byteLength;
for (let i = 0; i < len; i++) {
binary += String.fromCharCode(bytes[i]);
}
const base64Str = window.btoa(binary);
// var buffer2 = Buffer.from(newBufferToUint16, 'base64');
// var base64Str = buffer2.toString('base64');
qrCodeUrl = 'data:image/png;base64,' + base64Str;
}
}

View File

@ -38,7 +38,6 @@ export default OakComponent({
formData: ({ data: userEntityGrant }) => {
let qrCodeUrl = userEntityGrant?.wechatQrCode$entity![0]?.url;
const buffer = userEntityGrant?.wechatQrCode$entity![0]?.buffer;
console.log(userEntityGrant);
if (buffer) {
const newBuffer = new ArrayBuffer(buffer.length * 2);
const newBufferToUint16 = new Uint16Array(newBuffer);
@ -50,15 +49,15 @@ export default OakComponent({
const base64Str = wx.arrayBufferToBase64(newBufferToUint16);
qrCodeUrl = 'data:image/png;base64,' + base64Str;
} else {
// let binary = '';
// const bytes = new Uint8Array(newBufferToUint16);
// const len = bytes.byteLength;
// for (let i = 0; i < len; i++) {
// binary += String.fromCharCode(bytes[i]);
// }
// const base64Str = window.btoa(binary);
const buffer2 = Buffer.from(newBufferToUint16, 'base64');
const base64Str = buffer2.toString('base64');
let binary = '';
const bytes = new Uint8Array(newBufferToUint16);
const len = bytes.byteLength;
for (let i = 0; i < len; i++) {
binary += String.fromCharCode(bytes[i]);
}
const base64Str = window.btoa(binary);
// const buffer2 = Buffer.from(newBufferToUint16, 'base64');
// const base64Str = buffer2.toString('base64');
qrCodeUrl = 'data:image/png;base64,' + base64Str;
}