You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
542 B
23 lines
542 B
1 year ago
|
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
|
||
|
}
|