cdk
2025-03-24 06e6cf5719a7de9d7919cee2f6fcc3cfc6f9eb9d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
var barcode = require('./barcode');
var qrcode = require('./qrcode');
 
function convert_length(length) {
    return Math.round(wx.getSystemInfoSync().windowWidth * length / 750);
}
 
function barc(id, code, width, height) {
    barcode.code128(wx.createCanvasContext(id), code, convert_length(width), convert_length(height))
}
 
function qrc(id, code, width, height) {
    qrcode.api.draw(code, {
        ctx: wx.createCanvasContext(id),
        width: convert_length(width),
        height: convert_length(height)
    })
}
 
module.exports = {
    barcode: barc,
    qrcode: qrc
}