This commit is contained in:
2025-04-29 13:26:19 +08:00
parent 6e1ae24845
commit bf88fcb395
73 changed files with 12939 additions and 4637 deletions

View File

@@ -1,5 +1,8 @@
// var app = getApp();
var encode = require("./encoding.js");
// var encode = require("./encoding.js");
// import encode from './encoding.js'
// const encode = import('./encoding.js')
import * as encode from './encoding.js'
var jpPrinter = {
createNew: function() {
var jpPrinter = {};
@@ -12,13 +15,16 @@ var jpPrinter = {
//将指令转成数组装起
jpPrinter.addCommand = function(content) {
var code = new encode.TextEncoder(
console.log('断点2.4',encode);
var code = new encode.default.TextEncoder(
'gb18030', {
NONSTANDARD_allowLegacyEncoding: true
}).encode(content)
console.log('断点2.5',code);
for (var i = 0; i < code.length; ++i) {
command.push(code[i])
}
console.log('断点2.6');
}
/**
@@ -27,8 +33,11 @@ var jpPrinter = {
* @param {int} pageHeight 标签纸高度单位mm
*/
jpPrinter.setSize = function(pageWidght, pageHeight) {
console.log('断点2.2');
data = "SIZE " + pageWidght.toString() + " mm" + "," + pageHeight.toString() + " mm" + "\r\n";
console.log('断点2.3');
jpPrinter.addCommand(data)
};
/**
@@ -370,4 +379,4 @@ var jpPrinter = {
}
};
module.exports.jpPrinter = jpPrinter;
export default jpPrinter;