Commit 55eea5b0 authored by 沈翠玲's avatar 沈翠玲

测试蓝牙打印

parent e06cf83d
......@@ -134,49 +134,21 @@ module.exports = {
this.$u.toast('请绑定打印机');
return;
}
await CTPL.init();
await CTPL.discovery( (res) => {
if (res.name === 'CT-428D') {
this.device = res
console.log(this.device)
}
});
const $this = this
setTimeout(()=>{
CTPL.connect(
$this.device,
function success(res1) {
console.log('扫描到的打印机',res1)
CTPL.setSize($this.pageObj.width, $this.pageObj.height)
CTPL.clearCache()
$this.getImageData((response)=>{
console.log('response', response)
const imageRes = response
// CTPL.drawBitMap(
// 0,
// 0,
// imageRes.width,
// imageRes.height,
// 0,
// response.data
// )
// CTPL.setPrintCopies(1, 1)
// CTPL.execute((res) => {
// console.log('res', res)
// })
})
},
function fail(e) {
console.log('报错',e)
if (this.vuex_printConnect) {
this.$u.api.getPrintDown(params).then((res) => {
if (res.code === 200) {
getApp().globalData.printSocket.emit('news', {
client: null,
printer: this.vuex_printerInfo.printerName,
type: 'url_pdf',
// pdf_path: 'http://192.168.3.91:8082/static/123.pdf',
pdf_path: res.fileUrl,
});
}
)
uni.onBLEConnectionStateChange(function (res) {
console.log('sadsada', res)
})
}, 6000)
return
});
} else {
this.$u.toast('打印机连接失败');
}
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment